-
Notifications
You must be signed in to change notification settings - Fork 24
feat: certificate trust #341
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
Open
Klaas-
wants to merge
6
commits into
linux-system-roles:main
Choose a base branch
from
Klaas-:feature/certificate_trust
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
22881bc
Add certificate_trust option for trusting CA certificates
Klaas- e77e3db
Only install certmonger when needed
Klaas- d42042b
Address comments from ai/richm
Klaas- db3b6fd
Update tests/tests_trust.yml
Klaas- c1d3b90
Update tests/tests_trust.yml
Klaas- a6e923e
Address feedback of Sergei, rename command -> cli and shorten test by…
Klaas- File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| ca-certificates | ||
| certmonger |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # SPDX-License-Identifier: MIT | ||
| --- | ||
| - name: Validate certificate_trust items | ||
| assert: | ||
| that: | ||
| - item.name is defined | ||
| - item.state | d('present') in ['present', 'absent'] | ||
| - >- | ||
| item.state | d('present') == 'absent' or | ||
| [item.content is defined, item.src is defined, item.url is defined] | | ||
| select | list | length == 1 | ||
| fail_msg: >- | ||
| Each certificate_trust item must have a name, state must be 'present' | ||
| or 'absent', and exactly one of content, src, or url must be given | ||
| when state is 'present' | ||
| loop: "{{ certificate_trust }}" | ||
| loop_control: | ||
| label: "{{ item.name | d('unnamed') }}" | ||
|
|
||
| - name: Ensure trust store packages are installed | ||
| package: | ||
| name: "{{ __certificate_trust_packages }}" | ||
| state: present | ||
| use: "{{ (__certificate_is_ostree | d(false)) | | ||
| ternary('ansible.posix.rhel_rpm_ostree', omit) }}" | ||
|
|
||
| - name: Install trust certificates | ||
| copy: | ||
| content: "{{ item.content | default(omit) }}" | ||
| src: "{{ item.src | default(omit) }}" | ||
| remote_src: "{{ item.remote_src | default(omit) }}" | ||
| dest: "{{ __certificate_trust_dir }}/{{ item.name }}.crt" | ||
| owner: root | ||
| group: root | ||
| mode: "0644" | ||
| loop: "{{ certificate_trust }}" | ||
| loop_control: | ||
| label: "{{ item.name }}" | ||
| when: | ||
| - item.state | d('present') == 'present' | ||
| - item.content is defined or item.src is defined | ||
| register: __certificate_trust_copied | ||
|
|
||
| - name: Install trust certificates from URL | ||
| get_url: | ||
| url: "{{ item.url }}" | ||
| dest: "{{ __certificate_trust_dir }}/{{ item.name }}.crt" | ||
| owner: root | ||
| group: root | ||
| mode: "0644" | ||
| loop: "{{ certificate_trust }}" | ||
| loop_control: | ||
| label: "{{ item.name }}" | ||
| when: | ||
| - item.state | d('present') == 'present' | ||
| - item.url is defined | ||
| register: __certificate_trust_downloaded | ||
|
coderabbitai[bot] marked this conversation as resolved.
Klaas- marked this conversation as resolved.
|
||
|
|
||
| - name: Remove trust certificates | ||
| file: | ||
| path: "{{ __certificate_trust_dir }}/{{ item.name }}.crt" | ||
| state: absent | ||
| loop: "{{ certificate_trust }}" | ||
| loop_control: | ||
| label: "{{ item.name }}" | ||
| when: item.state | d('present') == 'absent' | ||
| register: __certificate_trust_removed | ||
|
|
||
| - name: Update system trust store | ||
| command: "{{ __certificate_update_trust_cli }}" | ||
| changed_when: true | ||
| when: __certificate_trust_copied is changed | ||
| or __certificate_trust_downloaded is changed | ||
| or __certificate_trust_removed is changed | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.