-
Notifications
You must be signed in to change notification settings - Fork 43
transfer oauth creds as part of certificate bundle #698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
55358e9
97d2aa1
f10a973
41fc3c8
584f8ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| --- | ||
| help: | | ||
| Fetch a certificate bundle | ||
| Fetch an auth bundle | ||
|
|
||
| variables: | ||
| hostname: | ||
| parameter: hostname | ||
| help: Hostname to fetch the certificate bundle for. | ||
| help: Hostname to fetch the auth bundle for. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,7 @@ After deployment, certificates are available at: | |
| - Certificates from `foreman-installer` are normalized into the same paths as the Default Source above | ||
| - Original directory is backed up to `/root/ssl-build.bak/` | ||
|
|
||
| **Proxy/Secondary System Certificates (from certificate-bundle):** | ||
| **Proxy/Secondary System Certificates (from auth-bundle):** | ||
| - Generated in per-host subdirectories: `/var/lib/foremanctl/certs/hosts/<hostname>/` | ||
| - Packaged tarball: `/var/lib/foremanctl/certs/bundles/<hostname>.tar.gz` | ||
|
|
||
|
|
@@ -138,20 +138,20 @@ foremanctl deploy --certificate-ca-renew | |
|
|
||
| Both flags are **not persisted** in foremanctl’s answers file (one-shot). | ||
|
|
||
| ### Certificate Bundle for Secondary Systems | ||
| ### Auth Bundle for Secondary Systems | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the parameters.md, we still show
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch, in which section should we add droped parameters which existed on foreman-installer but not in foremanctl? or just remove them from undetermined
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #532 I used "unmapped" to explicitly call them out. how about that?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perfect, thanks |
||
|
|
||
| The `certificate-bundle` command generates a certificate tarball for a secondary system such as a foreman-proxy host. This is the foremanctl equivalent of `foreman-proxy-certs-generate`. | ||
| The `auth-bundle` command generates a certificate and OAuth credential tarball for a secondary system such as a foreman-proxy host. This is the foremanctl equivalent of `foreman-proxy-certs-generate`. | ||
|
|
||
| The internal CA must already exist from a prior `foremanctl deploy`. | ||
|
|
||
| #### Usage | ||
|
|
||
| ```bash | ||
| # Generate a certificate bundle using the internal CA | ||
| foremanctl certificate-bundle proxy.example.com | ||
| # Generate an auth bundle using the internal CA | ||
| foremanctl auth-bundle proxy.example.com | ||
|
|
||
| # Generate a certificate bundle with custom server certificates for the proxy | ||
| foremanctl certificate-bundle \ | ||
| # Generate an auth bundle with custom server certificates for the proxy | ||
| foremanctl auth-bundle \ | ||
| --certificate-server-certificate /path/to/proxy.example.com.crt \ | ||
| --certificate-server-key /path/to/proxy.example.com.key \ | ||
| proxy.example.com | ||
|
|
@@ -165,7 +165,7 @@ If the Foreman server was deployed with custom server certificates, each proxy m | |
|
|
||
| #### Tarball Contents | ||
|
|
||
| The tarball uses the same directory structure as `/var/lib/foremanctl/certs/`: | ||
| The tarball mirrors the on-disk layout under `/var/lib/foremanctl/`: | ||
|
|
||
| ``` | ||
| certs/ | ||
|
|
@@ -176,8 +176,13 @@ certs/ | |
| private/ | ||
| ├── <hostname>.key # Server private key | ||
| └── <hostname>-client.key # Client private key | ||
| oauth/ | ||
| ├── foreman-oauth-consumer-key # OAuth consumer key for Foreman API auth | ||
| └── foreman-oauth-consumer-secret # OAuth consumer secret for Foreman API auth | ||
| ``` | ||
|
|
||
| On extract, `certs/` and `private/` are installed under `/var/lib/foremanctl/certs/`, and `oauth/` is installed under `/var/lib/foremanctl/oauth/`. | ||
|
|
||
| When using the internal CA only, `server-ca.crt` and `ca.crt` are identical. When custom server certificates are provided, `server-ca.crt` contains the custom CA and `ca.crt` contains the internal CA. | ||
|
|
||
| ### Current Limitations | ||
|
|
@@ -203,7 +208,7 @@ src/roles/certificates/ | |
| │ └── custom.yml # Applies user-provided custom server certs | ||
| └── defaults/main.yml # Default configuration variables | ||
|
|
||
| src/roles/certificate_bundle/ | ||
| src/roles/auth_bundle/ | ||
| ├── tasks/main.yml # Packages certificates into a tarball | ||
| └── defaults/main.yml # Output directory configuration | ||
| ``` | ||
|
|
@@ -230,11 +235,11 @@ For `certificate_source: custom_server`: | |
| 2. **Custom Server Certificates**: Copy the custom server cert, key, and CA bundle from user-provided paths to `/var/lib/foremanctl/certs/` (only when certificate paths are provided) | ||
| 3. **Host Certificate Issuance**: Generate client certificate and localhost certificate signed by the internal CA (server cert for FQDN is skipped) | ||
|
|
||
| #### Certificate Bundle Generation | ||
| #### Auth Bundle Generation | ||
|
|
||
| The `certificate-bundle` playbook reuses the `certificates` role to generate proxy certificates in a per-host subdirectory (`certificates_ca_directory/hosts/<hostname>/`). It overrides `certificates_ca_directory_certs`, `certificates_ca_directory_keys`, and `certificates_ca_directory_requests` to point to the subdirectory while keeping `certificates_ca_directory` unchanged so the CA can still be found for signing. It sets `certificates_ca: false` (the CA already exists from a prior deploy) and passes the proxy hostname via `certificates_hostnames`. The `certificate_bundle` role then packages the generated certificates along with the CA into a tarball under `certificates_ca_directory/bundles/`. | ||
| The `auth-bundle` playbook reuses the `certificates` role to generate proxy certificates in a per-host subdirectory (`certificates_ca_directory/hosts/<hostname>/`). It overrides `certificates_ca_directory_certs`, `certificates_ca_directory_keys`, and `certificates_ca_directory_requests` to point to the subdirectory while keeping `certificates_ca_directory` unchanged so the CA can still be found for signing. It sets `certificates_ca: false` (the CA already exists from a prior deploy) and passes the proxy hostname via `certificates_hostnames`. The `auth_bundle` role then packages the generated certificates along with the CA into a tarball under `certificates_ca_directory/bundles/`. | ||
|
|
||
| When custom server certificates are provided for the proxy, `certificates_source` is set to `custom_server` so only client certificates are generated by the internal CA. The custom server certificate, key, and CA are validated by the `certificate_checks` role and then packaged directly into the tarball by the `certificate_bundle` role. | ||
| When custom server certificates are provided for the proxy, `certificates_source` is set to `custom_server` so only client certificates are generated by the internal CA. The custom server certificate, key, and CA are validated by the `certificate_checks` role and then packaged directly into the tarball by the `auth_bundle` role. | ||
|
|
||
| #### Migration from foreman-installer | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| - name: Generate an auth bundle for a hostname | ||
| hosts: | ||
| - quadlet | ||
| become: true | ||
| vars_files: | ||
| - "../../vars/base.yaml" | ||
| - "../../vars/certificates.yml" | ||
| - "../../vars/foreman.yml" | ||
| roles: | ||
| - role: certificate_checks | ||
| when: certificates_source == 'custom_server' | ||
| vars: | ||
| certificate_checks_certificate: "{{ certificates_custom_server_certificate }}" | ||
| certificate_checks_key: "{{ certificates_custom_server_key }}" | ||
| certificate_checks_ca: "{{ server_ca_certificate }}" | ||
| - role: certificates | ||
| vars: | ||
| certificates_ca: false | ||
| certificates_output_directory: "{{ certificates_ca_directory }}/hosts/{{ hostname }}" | ||
| certificates_hostnames: | ||
| - "{{ hostname }}" | ||
| - role: auth_bundle | ||
| vars: | ||
| auth_bundle_hostname: "{{ hostname }}" | ||
| auth_bundle_ca_bundle: "{{ ca_bundle }}" | ||
| auth_bundle_ca_certificate: "{{ ca_certificate }}" | ||
| auth_bundle_server_ca_certificate: "{{ server_ca_certificate }}" | ||
| auth_bundle_server_certificate: "{{ certificates_ca_directory }}/hosts/{{ hostname }}/certs/{{ hostname }}.crt" | ||
| auth_bundle_server_key: "{{ certificates_ca_directory }}/hosts/{{ hostname }}/private/{{ hostname }}.key" | ||
| auth_bundle_client_certificate: "{{ certificates_ca_directory }}/hosts/{{ hostname }}/certs/{{ hostname }}-client.crt" | ||
| auth_bundle_client_key: "{{ certificates_ca_directory }}/hosts/{{ hostname }}/private/{{ hostname }}-client.key" | ||
| auth_bundle_oauth_consumer_key_file: "{{ foreman_oauth_consumer_key_file }}" | ||
| auth_bundle_oauth_consumer_secret_file: "{{ foreman_oauth_consumer_secret_file }}" |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| --- | ||
| auth_bundle_output_directory: "{{ certificates_ca_directory }}/bundles" | ||
| auth_bundle_server_ca_certificate: "{{ auth_bundle_ca_certificate }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require updates to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SatelliteQE/robottelo#22277
for doc PR, i hope to get this PR in before that 😄