|
8 | 8 | # $mode - optional - defaults to '0600'
|
9 | 9 | # $certdir_mode - optional - defaults to '0700'
|
10 | 10 | # $manage_certdir - optional - defaults to true
|
| 11 | +# $enable_fips - optional - defaults to false |
11 | 12 | #
|
12 | 13 | # Actions:
|
13 | 14 | # creates a new NSS database, consisting of 4 files:
|
|
25 | 26 | # group => 'root',
|
26 | 27 | # mode => '0600',
|
27 | 28 | # certdir_mode => '0700',
|
28 |
| -# manage_certdir => true |
| 29 | +# manage_certdir => true, |
| 30 | +# enable_fips => false, |
29 | 31 | # }
|
30 | 32 | #
|
31 | 33 | #
|
|
36 | 38 | $group = undef,
|
37 | 39 | $mode = '0600',
|
38 | 40 | $certdir_mode = '0700',
|
39 |
| - $manage_certdir = true |
| 41 | + $manage_certdir = true, |
| 42 | + $enable_fips = false, |
40 | 43 | ) {
|
41 | 44 | include nsstools
|
42 | 45 |
|
|
47 | 50 | validate_string($mode)
|
48 | 51 | validate_string($certdir_mode)
|
49 | 52 | validate_bool($manage_certdir)
|
| 53 | + validate_bool($enable_fips) |
50 | 54 |
|
51 | 55 | if $manage_certdir {
|
52 | 56 | file { $certdir:
|
|
62 | 66 | $require_certdir = undef
|
63 | 67 | }
|
64 | 68 |
|
65 |
| - file { "${certdir}/nss-password.txt": |
| 69 | + $_password_file = "${certdir}/nss-password.txt" |
| 70 | + file { $_password_file: |
66 | 71 | ensure => file,
|
67 | 72 | owner => $owner,
|
68 | 73 | group => $group,
|
|
81 | 86 | group => $group,
|
82 | 87 | mode => $mode,
|
83 | 88 | require => [
|
84 |
| - File["${certdir}/nss-password.txt"], |
| 89 | + File[$_password_file], |
85 | 90 | Exec["create_nss_db_${title}"],
|
86 | 91 | ],
|
87 | 92 | }
|
88 | 93 |
|
89 | 94 | exec { "create_nss_db_${title}":
|
90 |
| - command => "/usr/bin/certutil -N -d ${certdir} -f ${certdir}/nss-password.txt", |
| 95 | + command => "/usr/bin/certutil -N -d ${certdir} -f ${_password_file}", |
91 | 96 | creates => ["${certdir}/cert8.db", "${certdir}/key3.db", "${certdir}/secmod.db"],
|
92 | 97 | require => [
|
93 |
| - File["${certdir}/nss-password.txt"], |
| 98 | + File[$_password_file], |
94 | 99 | Class['nsstools'],
|
95 | 100 | ]
|
96 | 101 | }
|
| 102 | + |
| 103 | + if $enable_fips { |
| 104 | + # enable fips mode on the NSS DB after DB creation |
| 105 | + exec { "enable_fips_mode_${title}": |
| 106 | + command => "/usr/bin/modutil -fips true -dbdir ${certdir} -force", |
| 107 | + unless => "/usr/bin/modutil -chkfips true -dbdir ${certdir}", |
| 108 | + subscribe => [Exec["create_nss_db_${title}"],], |
| 109 | + refreshonly => true, |
| 110 | + } |
| 111 | + } |
97 | 112 | }
|
0 commit comments