Skip to content

Commit c8b8f97

Browse files
pablomhclaude
andcommitted
Convert Podman Quadlet deployment from rootful to rootless
Converts Foreman deployment to rootless Podman containers with dedicated service user and proper namespace isolation. Key changes: - Auto-allocate matching UID/GID for foreman service user - Map container volumes to proper UIDs (PostgreSQL:26, Redis:1001, Pulp:700) - Move certificates from /root to /var/lib/foreman with correct ownership - Add migration playbook for converting existing rootful deployments - Move Quadlet files to user scope (~/.config/containers/systemd) - Enable loginctl linger and configure unprivileged ports New components: - rootless_user role: Service user creation with auto-allocation - migrate-to-rootless playbook: Automated rootful-to-rootless migration Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 60b55aa commit c8b8f97

File tree

33 files changed

+1750
-880
lines changed

33 files changed

+1750
-880
lines changed

docs/certificates.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ foremanctl deploy --certificate-source=installer
4242
After deployment, certificates are available at:
4343

4444
**Default Source:**
45-
- CA Certificate: `/root/certificates/certs/ca.crt`
46-
- Server Certificate: `/root/certificates/certs/<hostname>.crt`
47-
- Client Certificate: `/root/certificates/certs/<hostname>-client.crt`
45+
- CA Certificate: `/var/lib/foreman/certificates/certs/ca.crt`
46+
- Server Certificate: `/var/lib/foreman/certificates/certs/<hostname>.crt`
47+
- Client Certificate: `/var/lib/foreman/certificates/certs/<hostname>-client.crt`
4848

4949
**Installer Source:**
50-
- CA Certificate: `/root/ssl-build/katello-default-ca.crt`
51-
- Server Certificate: `/root/ssl-build/<hostname>/<hostname>-apache.crt`
52-
- Client Certificate: `/root/ssl-build/<hostname>/<hostname>-foreman-client.crt`
50+
- CA Certificate: `/var/lib/foreman/ssl-build/katello-default-ca.crt`
51+
- Server Certificate: `/var/lib/foreman/ssl-build/<hostname>/<hostname>-apache.crt`
52+
- Client Certificate: `/var/lib/foreman/ssl-build/<hostname>/<hostname>-foreman-client.crt`
53+
54+
**Note for Rootless Deployments:**
55+
- All certificates are owned by `foreman:foreman` user and group
56+
- If migrating from a rootful deployment with installer certificates, copy them from `/root/ssl-build/` to `/var/lib/foreman/ssl-build/` and ensure proper ownership (`chown -R foreman:foreman /var/lib/foreman/ssl-build/`)
5357

5458
### Current Limitations
5559

@@ -99,16 +103,18 @@ Certificate paths are defined in source-specific variable files:
99103

100104
**Default Source (`src/vars/default_certificates.yml`):**
101105
```yaml
106+
certificates_ca_directory: /var/lib/foreman/certificates
102107
ca_certificate: "{{ certificates_ca_directory }}/certs/ca.crt"
103108
server_certificate: "{{ certificates_ca_directory }}/certs/{{ ansible_facts['fqdn'] }}.crt"
104109
client_certificate: "{{ certificates_ca_directory }}/certs/{{ ansible_facts['fqdn'] }}-client.crt"
105110
```
106111
107112
**Installer Source (`src/vars/installer_certificates.yml`):**
108113
```yaml
109-
ca_certificate: "/root/ssl-build/katello-default-ca.crt"
110-
server_certificate: "/root/ssl-build/{{ ansible_facts['fqdn'] }}/{{ ansible_facts['fqdn'] }}-apache.crt"
111-
client_certificate: "/root/ssl-build/{{ ansible_facts['fqdn'] }}/{{ ansible_facts['fqdn'] }}-foreman-client.crt"
114+
certificates_ca_directory: /var/lib/foreman/ssl-build
115+
ca_certificate: "{{ certificates_ca_directory }}/katello-default-ca.crt"
116+
server_certificate: "{{ certificates_ca_directory }}/{{ ansible_facts['fqdn'] }}/{{ ansible_facts['fqdn'] }}-apache.crt"
117+
client_certificate: "{{ certificates_ca_directory }}/{{ ansible_facts['fqdn'] }}/{{ ansible_facts['fqdn'] }}-foreman-client.crt"
112118
```
113119

114120
#### Integration with Deployment
@@ -138,12 +144,14 @@ The `certificate_checks` role uses `foreman-certificate-check` binary to validat
138144

139145
**Directory Structure:**
140146
```
141-
/root/certificates/
147+
/var/lib/foreman/certificates/
142148
├── certs/ # Public certificates
143149
├── private/ # Private keys and passwords
144150
└── requests/ # Certificate signing requests
145151
```
146152
153+
All certificate files and directories are owned by `foreman:foreman` to support rootless Podman deployments.
154+
147155
**OpenSSL Configuration:**
148156
- Custom configuration template supports SAN extensions
149157
- Single DNS entry per certificate: `subjectAltName = DNS:{{ certificates_hostname }}`

src/playbooks/deploy/deploy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- "../../vars/base.yaml"
1515
roles:
1616
- role: pre_install
17+
- role: rootless_user
1718
- role: checks
1819
- role: certificates
1920
when: "certificate_source == 'default'"

0 commit comments

Comments
 (0)