Skip to content

Commit 621d326

Browse files
authored
docs: restructure certs docs (#1373)
These changes aim to address the following issues in relation to the certificate auto-enrollment docs: * Separate mixed-purpose content: the current explanation page for certs combines explanatory content with instructions. The instructions should be extracted into relevant how-to guides. * Improve searchability/discoverability: two pages exist that are called "Certificate auto-enrollment" and "Using certificates auto-enrollment". These are difficult to distinguish in external or internal search. * Make titles explicit and differentiated: a guide on using certificate auto-enrollment for VPN and virtual networks should have "VPN" in the title for those interested in that use-case * Provide external resources in one place: we occasionally get requests for troubleshooting tools that are mentioned in the documentation but that we do not maintain. We should add an external resources page and link it prominently where relevant. * Present coherent organization of certs docs: with more granular certs docs now being presented, we can surface them cleanly in the homepage and sidenav Other minor changes: * Added metadata * Updated links and redirects UDENG-8751
2 parents 777a01d + ee332ae commit 621d326

14 files changed

Lines changed: 349 additions & 190 deletions

File tree

docs/.custom_wordlist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ backends
2424
boolean
2525
CAs
2626
CEP
27+
cepces
2728
certmonger
2829
CES
2930
changelog
@@ -88,6 +89,7 @@ lockscreen
8889
LTS
8990
MacOS
9091
macOS
92+
manpage
9193
manpages
9294
multiline
9395
multiText

docs/conf.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,12 @@
231231
# the sphinx_reredirects extension will be disabled.
232232

233233
redirects = {
234-
"tutorial/certificates-auto-enrolment": "../../how-to/certificates-auto-enrollment",
235-
"tutorial/certificates-auto-enrollment": "../../how-to/certificates-auto-enrollment",
236-
"tutorials/certificates-auto-enrolment": "../../how-to/certificates-auto-enrollment",
237-
"tutorials/certificates-auto-enrollment": "../../how-to/certificates-auto-enrollment",
238-
"how-to/certificates-auto-enrolment": "../../how-to/certificates-auto-enrollment",
234+
"tutorial/certificates-auto-enrolment": "../../how-to/certificates",
235+
"tutorial/certificates-auto-enrollment": "../../how-to/certificates",
236+
"tutorials/certificates-auto-enrolment": "../../how-to/certificates",
237+
"tutorials/certificates-auto-enrollment": "../../how-to/certificates",
238+
"how-to/certificates-auto-enrolment": "../../how-to/certificates",
239+
"how-to/certificates-auto-enrollment": "../../how-to/certificates",
239240
}
240241

241242

@@ -250,7 +251,7 @@
250251
linkcheck_ignore = [
251252
"http://127.0.0.1:8000",
252253
"https://leonelson.com/2011/08/15/how-to-increase-your-csr-key-size-on-microsoft-iis-without-removing-the-production-certificate/",
253-
"https://manpages.ubuntu.com/manpages/man8/*",
254+
"https://manpages.ubuntu.com/manpages/*",
254255
"https://www.samba.org/*", # giving erroneous link failures as of June 16th 2025
255256
"https://wiki.samba.org/*", # giving erroneous link failures as of June 16th 2025
256257
]

docs/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
// Dir is the embedded directory containing documentation.
99
// Only embed structured documentation.
1010
//
11-
//go:embed index.md tutorial/*.md how-to/*.md explanation/*.md reference/*.md
11+
//go:embed index.md tutorial/*.md how-to/*.md how-to/certificates/*.md explanation/*.md reference/*.md
1212
var Dir embed.FS
1313

1414
// RTDRootURL is the root url of ReadTheDoc adsys documentation.

docs/explanation/certificates.md

Lines changed: 10 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,184 +1,27 @@
11
---
22
myst:
33
html_meta:
4-
description: "Configure certificate auto-enrollment for Ubuntu clients using Active Directory Certificate Services with certmonger and cepces integration."
4+
description: "Explanation of how certificate auto-enrollment is implemented and applied with ADSys."
55
---
66

7-
# Certificate auto-enrollment
7+
# Details of certificate auto-enrollment implementation
88

99
```{include} ../pro_content_notice.txt
1010
:start-after: <!-- Include start pro -->
1111
:end-before: <!-- Include end pro -->
1212
```
1313

14-
The certificate policy manager allows clients to enroll for certificates from **Active Directory Certificate Services**. Certificates are then continuously monitored and refreshed by the [`certmonger`](https://www.freeipa.org/page/Certmonger) daemon. Currently, only machine certificates are supported.
15-
16-
Unlike the other ADSys policy managers which are configured in the special Ubuntu section provided by the ADMX files (Administrative Templates), settings for certificate auto-enrollment are configured in the Microsoft GPO tree:
17-
18-
* `Computer Configuration > Policies > Windows Settings > Security Settings > Public Key Policies > Certificate Services Client - Auto-Enrollment`
19-
20-
![Certificate GPO tree view](../images/explanation/certificates/certificate-settings.png)
21-
22-
## Required packages
23-
24-
The following packages must be installed on the client in order for auto-enrollment to work:
25-
26-
* [`certmonger`](https://www.freeipa.org/page/Certmonger) — daemon that monitors and updates certificates
27-
* [`cepces`](https://github.com/openSUSE/cepces)`certmonger` extension that can communicate with **Active Directory Certificate Services**
28-
29-
On Ubuntu systems, run the following to install them:
30-
31-
```bash
32-
sudo apt install certmonger python3-cepces
33-
```
34-
35-
On the Windows side, the following roles must be installed and configured:
36-
37-
* `Certification Authority`
38-
* `Certificate Enrollment Policy Web Service`
39-
* `Certificate Enrollment Web Service`
40-
41-
## Rules precedence
42-
43-
Auto-enrollment configuration will override any settings referenced higher in the GPO hierarchy.
44-
45-
## Policy configuration
46-
47-
Certificate auto-enrollment is configured by setting the **Configuration Model** to **Enabled** and ticking the following checkbox: **Update certificates that use certificate templates**.
48-
49-
![Certificate GPO properties](../images/explanation/certificates/certificate-gpo.png)
50-
51-
The policy can be disabled by performing _any_ of the following:
52-
53-
* unticking the **Update certificates that use certificate templates** checkbox
54-
* setting the **Configuration Model** to **Disabled** or **Not configured**
55-
56-
The other settings in this GPO entry do not affect ADSys in any way.
57-
58-
For more advanced configuration, a list of policy servers can be specified in the following GPO entry:
59-
60-
* `Computer Configuration > Policies > Windows Settings > Security Settings > Public Key Policies > Certificate Services Client - Certificate Enrollment Policy`
61-
62-
![Certificate advanced configuration](../images/explanation/certificates/advanced-configuration.png)
63-
64-
## Applying the policy
65-
66-
On the client system, a successful auto-enrollment will place certificate data in the following paths:
67-
68-
* `/var/lib/adsys/certs` - certificate data
69-
* `/var/lib/adsys/private/certs` - private key data
70-
* `/usr/local/share/ca-certificates` - root certificate data (symbolic link pointing to `/var/lib/adsys/certs`)
71-
72-
For detailed information on the tracked certificates, `certmonger` can be directly interacted with:
73-
74-
```output
75-
# Query monitored certificates
76-
> getcert list
77-
Number of certificates and requests being tracked: 1.
78-
Request ID 'galacticcafe-CA.Machine':
79-
status: MONITORING
80-
stuck: no
81-
key pair storage: type=FILE,location='/var/lib/adsys/private/certs/galacticcafe-CA.Machine.key'
82-
certificate: type=FILE,location='/var/lib/adsys/certs/galacticcafe-CA.Machine.crt'
83-
CA: galacticcafe-CA
84-
issuer: CN=galacticcafe-CA,DC=galacticcafe,DC=com
85-
subject: CN=keypress.galacticcafe.com
86-
issued: 2023-08-18 18:44:27 EEST
87-
expires: 2024-08-17 18:44:27 EEST
88-
dns: keypress.galacticcafe.com
89-
key usage: digitalSignature,keyEncipherment
90-
eku: id-kp-clientAuth,id-kp-serverAuth
91-
certificate template/profile: Machine
92-
profile: Machine
93-
pre-save command:
94-
post-save command:
95-
track: yes
96-
auto-renew: yes
97-
98-
# Query known CAs
99-
> getcert list-cas
100-
(...)
101-
CA 'galacticcafe-CA':
102-
is-default: no
103-
ca-type: EXTERNAL
104-
helper-location: /usr/libexec/certmonger/cepces-submit --server=win-mk85nrq26nu.galacticcafe.com --auth=Kerberos
105-
```
106-
10714
## Policy implementation
10815

109-
With the exception of policy parsing, ADSys leverages the Samba implementation of certificate auto-enrollment. As this feature is only available in newer versions of Samba, we have taken the liberty of vendoring the required Samba files to allow this policy to work on Ubuntu versions that ship an older Samba version. These files are shipped in `/usr/share/adsys/python/vendor_samba`.
16+
With the exception of policy parsing, ADSys leverages the Samba implementation of certificate auto-enrollment. As this feature is only available in newer versions of Samba, we have vendored the required Samba files to allow this policy to work on Ubuntu versions that ship an older Samba version. These files are shipped in `/usr/share/adsys/python/vendor_samba`.
11017

111-
To ensure idempotency when applying the policy, we set up a Samba [TDB cache file](https://wiki.samba.org/index.php/TDB) at `/var/lib/adsys/samba/cert_gpo_state_$(hostname).tdb` which contains various information pertaining to the enrolled certificate(s).
18+
To ensure idempotency when applying the policy, we set up a Samba [TDB cache file](https://wiki.samba.org/index.php/TDB) at `/var/lib/adsys/samba/cert_gpo_state_$(hostname).tdb` which contains information pertaining to the enrolled certificate(s).
11219

113-
Here is an overview of what happens during policy application:
114-
115-
* GPO parsing (ADSys)
116-
* execute Python helper script (ADSys)
117-
* fetch root CA and policy servers (Samba)
118-
* start monitoring certificate using `certmonger` and `cepces` (Samba)
119-
120-
## Troubleshooting
121-
122-
### Some dependencies are not available in the client Ubuntu installation
123-
124-
While `certmonger` has been available for a while in Ubuntu, `python3-cepces` is a new package, available starting with Ubuntu 23.10. If unavailable on the client version, it can also be manually installed from the [source repository](https://github.com/openSUSE/cepces). The certificate policy manager only checks for the existence of the `cepces-submit` and `getcert` binaries, not their respective packages, in order to allow some wiggle room for this.
125-
126-
### Manipulating certificates with `getcert`
127-
128-
While not encouraged, certificates can be manipulated with the same tool. This could be helpful for debugging purposes.
129-
130-
```output
131-
# Regenerate a certificate
132-
> getcert rekey -i galacticcafe-CA.Machine
133-
Resubmitting "galacticcafe-CA.Machine" to "galacticcafe-CA".
20+
### Policy application sequence
13421

135-
# Unmonitor a certificate
136-
> getcert stop-tracking -i galacticcafe-CA.Machine
137-
Request "galacticcafe-CA.Machine" removed.
138-
139-
# Remove CA
140-
> getcert remove-ca -c galacticcafe-CA
141-
CA "galacticcafe-CA" removed.
142-
```
143-
144-
Note that tampering with certificate data outside of ADSys (e.g. manually unmonitoring using `getcert`) will render the GPO cache obsolete as it will cause a drift between the actual state and the "known" cached state. In this case, it's best to remove the cache file at `/var/lib/adsys/samba/*.tdb` together with any enrolled certificates and CAs to ensure a clean slate.
145-
146-
### Debugging `auto-enroll` script
147-
148-
While certificate parsing happens in ADSys itself, enrollment is done via an embedded Python helper script. For debugging purposes, it can be dumped to the current directory and made executable by executing the following commands:
149-
150-
```output
151-
> adsysctl policy debug cert-autoenroll-script
152-
> chmod +x ./cert-autoenroll
153-
```
154-
155-
Before executing the script manually, the following environment variables have to be set:
156-
157-
```sh
158-
export PYTHONPATH=/usr/share/adsys/python
159-
export KRB5CCNAME=/var/run/adsys/krb5cc/$(hostname)
160-
```
161-
162-
Then, run the script passing the required arguments (the argument list is also printed in the ADSys debug logs during policy application):
163-
164-
```output
165-
# Un-enroll machine
166-
> ./cert-autoenroll unenroll keypress galacticcafe.com --state_dir /var/lib/adsys --debug
167-
```
168-
169-
### Errors communicating with the CEP/CES servers
170-
171-
If ADSys successfully applies the policy but `getcert list` does not list the certificates or they are in an unexpected state, check the `certmonger` logs for details (`journalctl -u certmonger`). Additionally, debug logging for `cepces` can be enabled by editing the logging configuration at `/etc/cepces/logging.conf`.
172-
173-
The `cepces` configuration itself is batteries-included, meaning it should work out of the box for most setups. All configuration options are documented and configurable at `/etc/cepces/cepces.conf`.
174-
175-
## Additional information
176-
177-
While configuring Active Directory Certificate Services is outside the scope of the policy manager documentation, we have found the following resources to be useful:
178-
179-
* [How to setup Microsoft Active Directory Certificate Services](https://www.virtuallyboring.com/setup-microsoft-active-directory-certificate-services-ad-cs/)
180-
* [How to increase your CSR key size on Microsoft IIS without removing the production certificate?](https://leonelson.com/2011/08/15/how-to-increase-your-csr-key-size-on-microsoft-iis-without-removing-the-production-certificate/)
181-
182-
## Acknowledgements
22+
Here is an overview of what happens during policy application:
18323

184-
We would like to thank the Samba team for making great strides in the research and implementation of certificate auto-enrollment via Active Directory Certificate Services.
24+
* Parse GPO (ADSys)
25+
* Execute Python helper script (ADSys)
26+
* Fetch root CA and policy servers (Samba)
27+
* Start monitoring certificate using `certmonger` and `cepces` (Samba)
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
myst:
3+
html_meta:
4+
description: "Steps to configure certificate auto-enrollment with ADSys."
5+
---
6+
7+
(howto::certificates-configure)=
8+
# Configure certificate auto-enrollment
9+
10+
```{include} ../../pro_content_notice.txt
11+
:start-after: <!-- Include start pro -->
12+
:end-before: <!-- Include end pro -->
13+
```
14+
15+
Certificate auto-enrollment is a key component of Ubuntu’s Active Directory GPO support.
16+
This feature enables clients to seamlessly enroll for certificates from Active Directory Certificate Services.
17+
18+
## Rules precedence
19+
20+
Auto-enrollment configuration will override any settings referenced higher in the GPO hierarchy.
21+
22+
## Policy configuration
23+
24+
Certificate auto-enrollment is configured by setting the **Configuration Model** to **Enabled** and ticking the following checkbox: **Update certificates that use certificate templates**.
25+
26+
![Certificate GPO properties](../../images/explanation/certificates/certificate-gpo.png)
27+
28+
The policy can be disabled by performing _any_ of the following:
29+
30+
* unticking the **Update certificates that use certificate templates** checkbox
31+
* setting the **Configuration Model** to **Disabled** or **Not configured**
32+
33+
The other settings in this GPO entry do not affect ADSys in any way.
34+
35+
For more advanced configuration, a list of policy servers can be specified in the following GPO entry:
36+
37+
* `Computer Configuration > Policies > Windows Settings > Security Settings > Public Key Policies > Certificate Services Client - Certificate Enrollment Policy`
38+
39+
![Certificate advanced configuration](../../images/explanation/certificates/advanced-configuration.png)
40+
41+
## Applying the policy
42+
43+
On the client system, a successful auto-enrollment will place certificate data in the following paths:
44+
45+
* `/var/lib/adsys/certs` - certificate data
46+
* `/var/lib/adsys/private/certs` - private key data
47+
* `/usr/local/share/ca-certificates` - root certificate data (symbolic link pointing to `/var/lib/adsys/certs`)
48+
49+
For detailed information on the tracked certificates, `certmonger` can be directly interacted with:
50+
51+
```output
52+
# Query monitored certificates
53+
> getcert list
54+
Number of certificates and requests being tracked: 1.
55+
Request ID 'galacticcafe-CA.Machine':
56+
status: MONITORING
57+
stuck: no
58+
key pair storage: type=FILE,location='/var/lib/adsys/private/certs/galacticcafe-CA.Machine.key'
59+
certificate: type=FILE,location='/var/lib/adsys/certs/galacticcafe-CA.Machine.crt'
60+
CA: galacticcafe-CA
61+
issuer: CN=galacticcafe-CA,DC=galacticcafe,DC=com
62+
subject: CN=keypress.galacticcafe.com
63+
issued: 2023-08-18 18:44:27 EEST
64+
expires: 2024-08-17 18:44:27 EEST
65+
dns: keypress.galacticcafe.com
66+
key usage: digitalSignature,keyEncipherment
67+
eku: id-kp-clientAuth,id-kp-serverAuth
68+
certificate template/profile: Machine
69+
profile: Machine
70+
pre-save command:
71+
post-save command:
72+
track: yes
73+
auto-renew: yes
74+
75+
# Query known CAs
76+
> getcert list-cas
77+
(...)
78+
CA 'galacticcafe-CA':
79+
is-default: no
80+
ca-type: EXTERNAL
81+
helper-location: /usr/libexec/certmonger/cepces-submit --server=win-mk85nrq26nu.galacticcafe.com --auth=Kerberos
82+
```

docs/how-to/certificates/index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
myst:
3+
html_meta:
4+
description: "Guides on certificate auto-enrollment with ADSys."
5+
---
6+
7+
(howto::certificates-index)=
8+
# Certificate auto-enrollment
9+
10+
Dedicated guides on using ADSys for certificate auto-enrollment.
11+
12+
```{toctree}
13+
:titlesonly:
14+
Setting up certificate auto-enrollment <setup>
15+
Configuring certificate auto-enrollment <configure>
16+
Troubleshooting certificate auto-enrollment <troubleshoot>
17+
Using a VPN with certificate auto-enrollment <vpn>
18+
```
19+
20+
## External resources
21+
22+
ADSys and its certificate auto-enrollment feature depend on tools, including
23+
[certmonger](ref::certmonger-links) and
24+
[cepces](ref::cepces-links).
25+
26+
To support you in troubleshooting these tools, we provide a list of relevant
27+
[external resources](ref::external).

0 commit comments

Comments
 (0)