Skip to content

Commit 22bdf64

Browse files
committed
Add pam package conditional for UBTU-20-010065
1 parent 96f31d7 commit 22bdf64

File tree

1 file changed

+38
-2
lines changed
  • linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_configure_cert_checking/ansible

1 file changed

+38
-2
lines changed

linux_os/guide/system/accounts/accounts-physical/screen_locking/smart_card_login/smartcard_configure_cert_checking/ansible/shared.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,52 @@
77
- name: Package facts
88
package_facts:
99

10+
- name: Check if cert_policy entry exists in /etc/pam_pkcs11/pam_pkcs11.conf
11+
shell: grep "cert_policy" /etc/pam_pkcs11/pam_pkcs11.conf | wc -l
12+
register: cert_policy_count
13+
changed_when: false
14+
when:
15+
{{% if 'sle' in product %}}
16+
- "'pam_pkcs11' in ansible_facts.packages"
17+
{{% else %}}
18+
- "'libpam-pkcs11' in ansible_facts.packages"
19+
{{% endif %}}
20+
21+
- name: Add cert_policy entry if none exist in /etc/pam_pkcs11/pam_pkcs11.conf
22+
lineinfile:
23+
path: /etc/pam_pkcs11/pam_pkcs11.conf
24+
line: 'cert_policy = ca,signature,ocsp_on;'
25+
create: true
26+
when:
27+
- (cert_policy_count.stdout | int) == 0
28+
{{% if 'sle' in product %}}
29+
- "'pam_pkcs11' in ansible_facts.packages"
30+
{{% else %}}
31+
- "'libpam-pkcs11' in ansible_facts.packages"
32+
{{% endif %}}
33+
1034
- name: Replace 'none' from cert_policy
1135
replace:
1236
path: /etc/pam_pkcs11/pam_pkcs11.conf
1337
regexp: (^\s*cert_policy\s*=\s*)none\s*;(\s*$)
1438
replace: \g<1>ocsp_on,ca,signature;\g<2>
15-
when: "'pam_pkcs11' in ansible_facts.packages"
39+
when:
40+
{{% if 'sle' in product %}}
41+
- "'pam_pkcs11' in ansible_facts.packages"
42+
{{% else %}}
43+
- "'libpam-pkcs11' in ansible_facts.packages"
44+
{{% endif %}}
45+
1646

1747
- name: Add 'ocsp_on' parameter for cert_policy in /etc/pam_pkcs11/pam_pkcs11.conf
1848
replace:
1949
path: /etc/pam_pkcs11/pam_pkcs11.conf
2050
regexp: (^\s*cert_policy\s*=\s*)(?!.*ocsp_on)(.*)
2151
replace: \g<1>ocsp_on,\g<2>
22-
when: "'pam_pkcs11' in ansible_facts.packages"
52+
when:
53+
{{% if 'sle' in product %}}
54+
- "'pam_pkcs11' in ansible_facts.packages"
55+
{{% else %}}
56+
- "'libpam-pkcs11' in ansible_facts.packages"
57+
{{% endif %}}
58+

0 commit comments

Comments
 (0)