|
14 | 14 |
|
15 | 15 | ## `cert_info` module |
16 | 16 |
|
17 | | -The netways.elasticstack.cert_info module gathers information about pkcs12 certificates generated by the Elastic stack cert util. |
| 17 | +The netways.elasticstack.cert_info module gathers information about pkcs12 certificates generated by the Elasticstack cert util. |
18 | 18 |
|
19 | 19 | ### Dependencies |
20 | 20 | - python-cryptography >= 2.5.0 on the remote node |
@@ -71,9 +71,11 @@ Currently, the information of the following extensions and values will be return |
71 | 71 | `path`: |
72 | 72 | Absolute path to certificate. (**Default:** undefined, required) |
73 | 73 |
|
74 | | -`password`: |
75 | | -The password of the pkcs12 certificate. (**Default:** No default, optional) |
| 74 | +`passphrase`: |
| 75 | +The passphrase of the pkcs12 certificate. (**Default:** No default, optional) |
76 | 76 |
|
| 77 | +`passphrase_check`: |
| 78 | +This will only check the passphrase and returns a bool in the results. If enabled it won't return any certificate information, only the passphrase_check result. (**Default:** False, optional) |
77 | 79 |
|
78 | 80 | ### Returns |
79 | 81 | All keys and values that will be returned with the results variable of the module: |
@@ -101,12 +103,15 @@ The serial number of the certificate as **str** which represents an integer. |
101 | 103 | - `critical`: The value of critical as **str** which represents a bool. |
102 | 104 | - `values`: The keys and their values of the extension as **str**. (See: Supported extensions) |
103 | 105 |
|
| 106 | +`passphrase_check`: |
| 107 | +A **bool** that will be `True` if the passphrase check was positive and `False`, if not. It's also possible that it returns `False` if the certificate is corrupted, since Python can't differentiate it and handles exceptions like this as a "VauleError". |
| 108 | + |
104 | 109 | ### Example |
105 | 110 | ``` |
106 | 111 | - name: Test |
107 | 112 | cert_info: |
108 | 113 | path: /opt/es-ca/elasticsearch-ca.pkcs12 |
109 | | - password: PleaseChangeMe |
| 114 | + passphrase: PleaseChangeMe |
110 | 115 | register: test |
111 | 116 |
|
112 | 117 | - name: Debug |
@@ -156,3 +161,39 @@ ok: [localhost] => { |
156 | 161 | } |
157 | 162 | } |
158 | 163 | ``` |
| 164 | + |
| 165 | +### Example of passphrase_check |
| 166 | +``` |
| 167 | +- name: Test correct passphrase wit passphrase_check parameter |
| 168 | + cert_info: |
| 169 | + path: /opt/es-ca/elasticsearch-ca.pkcs12 |
| 170 | + passphrase: PleaseChangeMe |
| 171 | + passphrase_check: True |
| 172 | + register: test |
| 173 | +
|
| 174 | +- name: Debug |
| 175 | + debug: |
| 176 | + msg: "{{ test }}" |
| 177 | +``` |
| 178 | + |
| 179 | +**Output**: |
| 180 | +``` |
| 181 | +TASK [Test correct passphrase wit passphrase_check parameter] ****************** |
| 182 | +ok: [localhost] |
| 183 | +
|
| 184 | +TASK [Debug] ******************************************************************* |
| 185 | +ok: [localhost] => { |
| 186 | + "msg": { |
| 187 | + "changed": false, |
| 188 | + "extensions": {}, |
| 189 | + "failed": false, |
| 190 | + "issuer": "", |
| 191 | + "not_valid_after": "", |
| 192 | + "not_valid_before": "", |
| 193 | + "passphrase_check": true, |
| 194 | + "serial_number": "", |
| 195 | + "subject": "", |
| 196 | + "version": "" |
| 197 | + } |
| 198 | +} |
| 199 | +``` |
0 commit comments