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
Allow custom validity dates over new X509 certificates #53149
Merged
Merged
Changes from 19 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
bd37b41
Ported unit test for fix to new Salt master branch.
jeduardo 869dba3
Ported fixes to allow not_before and not_after to master branch.
jeduardo f2c381d
Removed CSR tests as they are not available in master.
jeduardo f280978
Fixed test to ensure a string is passed to the write method.
jeduardo af84ea9
Lint fixes.
jeduardo f7e56cc
Merge branch 'master' into x509-specify-date-range
jeduardo 38b590a
Merge branch 'master' into x509-specify-date-range
jeduardo ea80c18
Merge branch 'master' into x509-specify-date-range
jeduardo aa08e1b
Merge branch 'master' into x509-specify-date-range
jeduardo cddba82
Merge branch 'master' into x509-specify-date-range
jeduardo 8d8d549
Merge branch 'master' into x509-specify-date-range
jeduardo f123bc9
Changed salt version.
jeduardo 704811e
Merge branch 'master' into x509-specify-date-range
jeduardo a0ffdbd
Removed unused variable detected by lint
jeduardo 1237d19
Merge branch 'master' into x509-specify-date-range
jeduardo 56a7d4a
Code formatting changes.
jeduardo 99c2ce4
Merge branch 'master' into x509-specify-date-range
jeduardo 0391afa
Added integration tests for x509 state covering new functionality.
jeduardo 7f884ac
Merge branch 'master' into x509-specify-date-range
jeduardo c164814
Merge branch 'master' into x509-specify-date-range
jeduardo 4a2cb48
Removed deprecated options from documentation.
jeduardo 0bfd52c
Merge branch 'master' into x509-specify-date-range
jeduardo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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,66 @@ | ||
{% set tmp_dir = pillar['tmp_dir'] %} | ||
|
||
{{ tmp_dir }}/pki: | ||
file.directory | ||
|
||
{{ tmp_dir }}/pki/issued_certs: | ||
file.directory | ||
|
||
{{ tmp_dir }}/pki/ca.key: | ||
x509.private_key_managed: | ||
- bits: 4096 | ||
- require: | ||
- file: {{ tmp_dir }}/pki | ||
|
||
{{ tmp_dir }}/pki/ca.crt: | ||
x509.certificate_managed: | ||
- signing_private_key: {{ tmp_dir }}/pki/ca.key | ||
- CN: ca.example.com | ||
- C: US | ||
- ST: Utah | ||
- L: Salt Lake City | ||
- basicConstraints: "critical CA:true" | ||
- keyUsage: "critical cRLSign, keyCertSign" | ||
- subjectKeyIdentifier: hash | ||
- authorityKeyIdentifier: keyid,issuer:always | ||
- days_valid: 3650 | ||
- days_remaining: 0 | ||
- backup: True | ||
- managed_private_key: | ||
name: {{ tmp_dir }}/pki/ca.key | ||
bits: 4096 | ||
backup: True | ||
- require: | ||
- file: {{ tmp_dir }}/pki | ||
- {{ tmp_dir }}/pki/ca.key | ||
|
||
mine.send: | ||
module.run: | ||
- func: x509.get_pem_entries | ||
- kwargs: | ||
glob_path: {{ tmp_dir }}/pki/ca.crt | ||
- onchanges: | ||
- x509: {{ tmp_dir }}/pki/ca.crt | ||
|
||
{{ tmp_dir }}/pki/test.key: | ||
x509.private_key_managed: | ||
- bits: 4096 | ||
- backup: True | ||
|
||
test_crt: | ||
x509.certificate_managed: | ||
- name: {{ tmp_dir }}/pki/test.crt | ||
- ca_server: minion | ||
- signing_policy: ca_policy | ||
- public_key: {{ tmp_dir }}/pki/test.key | ||
- CN: minion | ||
- days_remaining: 30 | ||
- not_after: 2020-05-05 14:30:00 | ||
- backup: True | ||
- managed_private_key: | ||
name: {{ tmp_dir }}/pki/test.key | ||
bits: 4096 | ||
backup: True | ||
- require: | ||
- {{ tmp_dir }}/pki/ca.crt | ||
- {{ tmp_dir }}/pki/test.key |
66 changes: 66 additions & 0 deletions
66
tests/integration/files/file/base/test_cert_not_before.sls
This file contains 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,66 @@ | ||
{% set tmp_dir = pillar['tmp_dir'] %} | ||
|
||
{{ tmp_dir }}/pki: | ||
file.directory | ||
|
||
{{ tmp_dir }}/pki/issued_certs: | ||
file.directory | ||
|
||
{{ tmp_dir }}/pki/ca.key: | ||
x509.private_key_managed: | ||
- bits: 4096 | ||
- require: | ||
- file: {{ tmp_dir }}/pki | ||
|
||
{{ tmp_dir }}/pki/ca.crt: | ||
x509.certificate_managed: | ||
- signing_private_key: {{ tmp_dir }}/pki/ca.key | ||
- CN: ca.example.com | ||
- C: US | ||
- ST: Utah | ||
- L: Salt Lake City | ||
- basicConstraints: "critical CA:true" | ||
- keyUsage: "critical cRLSign, keyCertSign" | ||
- subjectKeyIdentifier: hash | ||
- authorityKeyIdentifier: keyid,issuer:always | ||
- days_valid: 3650 | ||
- days_remaining: 0 | ||
- backup: True | ||
- managed_private_key: | ||
name: {{ tmp_dir }}/pki/ca.key | ||
bits: 4096 | ||
backup: True | ||
- require: | ||
- file: {{ tmp_dir }}/pki | ||
- {{ tmp_dir }}/pki/ca.key | ||
|
||
mine.send: | ||
module.run: | ||
- func: x509.get_pem_entries | ||
- kwargs: | ||
glob_path: {{ tmp_dir }}/pki/ca.crt | ||
- onchanges: | ||
- x509: {{ tmp_dir }}/pki/ca.crt | ||
|
||
{{ tmp_dir }}/pki/test.key: | ||
x509.private_key_managed: | ||
- bits: 4096 | ||
- backup: True | ||
|
||
test_crt: | ||
x509.certificate_managed: | ||
- name: {{ tmp_dir }}/pki/test.crt | ||
- ca_server: minion | ||
- signing_policy: ca_policy | ||
- public_key: {{ tmp_dir }}/pki/test.key | ||
- CN: minion | ||
- days_remaining: 30 | ||
- not_before: 2019-05-05 00:00:00 | ||
- backup: True | ||
- managed_private_key: | ||
name: {{ tmp_dir }}/pki/test.key | ||
bits: 4096 | ||
backup: True | ||
- require: | ||
- {{ tmp_dir }}/pki/ca.crt | ||
- {{ tmp_dir }}/pki/test.key |
67 changes: 67 additions & 0 deletions
67
tests/integration/files/file/base/test_cert_not_before_not_after.sls
This file contains 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,67 @@ | ||
{% set tmp_dir = pillar['tmp_dir'] %} | ||
|
||
{{ tmp_dir }}/pki: | ||
file.directory | ||
|
||
{{ tmp_dir }}/pki/issued_certs: | ||
file.directory | ||
|
||
{{ tmp_dir }}/pki/ca.key: | ||
x509.private_key_managed: | ||
- bits: 4096 | ||
- require: | ||
- file: {{ tmp_dir }}/pki | ||
|
||
{{ tmp_dir }}/pki/ca.crt: | ||
x509.certificate_managed: | ||
- signing_private_key: {{ tmp_dir }}/pki/ca.key | ||
- CN: ca.example.com | ||
- C: US | ||
- ST: Utah | ||
- L: Salt Lake City | ||
- basicConstraints: "critical CA:true" | ||
- keyUsage: "critical cRLSign, keyCertSign" | ||
- subjectKeyIdentifier: hash | ||
- authorityKeyIdentifier: keyid,issuer:always | ||
- days_valid: 3650 | ||
- days_remaining: 0 | ||
- backup: True | ||
- managed_private_key: | ||
name: {{ tmp_dir }}/pki/ca.key | ||
bits: 4096 | ||
backup: True | ||
- require: | ||
- file: {{ tmp_dir }}/pki | ||
- {{ tmp_dir }}/pki/ca.key | ||
|
||
mine.send: | ||
module.run: | ||
- func: x509.get_pem_entries | ||
- kwargs: | ||
glob_path: {{ tmp_dir }}/pki/ca.crt | ||
- onchanges: | ||
- x509: {{ tmp_dir }}/pki/ca.crt | ||
|
||
{{ tmp_dir }}/pki/test.key: | ||
x509.private_key_managed: | ||
- bits: 4096 | ||
- backup: True | ||
|
||
test_crt: | ||
x509.certificate_managed: | ||
- name: {{ tmp_dir }}/pki/test.crt | ||
- ca_server: minion | ||
- signing_policy: ca_policy | ||
- public_key: {{ tmp_dir }}/pki/test.key | ||
- CN: minion | ||
- days_remaining: 30 | ||
- not_before: 2019-05-05 00:00:00 | ||
- not_after: 2020-05-05 14:30:00 | ||
- backup: True | ||
- managed_private_key: | ||
name: {{ tmp_dir }}/pki/test.key | ||
bits: 4096 | ||
backup: True | ||
- require: | ||
- {{ tmp_dir }}/pki/ca.crt | ||
- {{ tmp_dir }}/pki/test.key |
This file contains 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.
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.
managed_private_key
was removed on purpose here: https://github.com/saltstack/salt/pull/52935/files#diff-5499a295a50d60a761c34f4080e4014bL80 in favor of using the separatex509.private_key_managed
state. Can you remove the reference here and on line 175.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.
Hey @Ch3LL, good catch. I remember seeing the change in the code but forgot to look for it in the docs. Just removed it, thanks!