|
| 1 | +# lint:ignore:140chars |
1 | 2 | # @summary This resource manages an individual rule that applies to the file defined in target. |
2 | 3 | # |
3 | 4 | # @param type Sets the type of rule. |
|
10 | 11 | # @param order Sets an order for placing the rule in pg_hba.conf. This can be either a string or an integer. If it is an integer, it will be converted to a string by zero-padding it to three digits. E.g. 42 will be zero-padded to the string '042'. The pg_hba_rule fragments are sorted using the alpha sorting order. Default value: 150. |
11 | 12 | # @param target Provides the target for the rule, and is generally an internal only property. Use with caution. |
12 | 13 | # @param postgresql_version Manages pg_hba.conf without managing the entire PostgreSQL instance. |
| 14 | +# lint:endignore:140chars |
13 | 15 | define postgresql::server::pg_hba_rule ( |
14 | 16 | Postgresql::Pg_hba_rule_type $type, |
15 | | - String $database, |
16 | | - String $user, |
17 | | - String $auth_method, |
| 17 | + String[1] $database, |
| 18 | + String[1] $user, |
| 19 | + String[1] $auth_method, |
18 | 20 | Optional[Postgresql::Pg_hba_rule_address] $address = undef, |
19 | | - String $description = 'none', |
| 21 | + String[1] $description = 'none', |
20 | 22 | Optional[String] $auth_option = undef, |
21 | 23 | Variant[String, Integer] $order = 150, |
22 | 24 |
|
|
34 | 36 | } |
35 | 37 |
|
36 | 38 | if $manage_pg_hba_conf == false { |
37 | | - fail('postgresql::server::manage_pg_hba_conf has been disabled, so this resource is now unused and redundant, either enable that option or remove this resource from your manifests') |
| 39 | + fail('postgresql::server::manage_pg_hba_conf has been disabled, so this resource is now unused and redundant, either enable that option or remove this resource from your manifests') # lint:ignore:140chars |
38 | 40 | } else { |
39 | 41 | if($type =~ /^host/ and $address == undef) { |
40 | 42 | fail('You must specify an address property when type is host based') |
|
48 | 50 | } |
49 | 51 |
|
50 | 52 | $allowed_auth_methods = $postgresql_version ? { |
51 | | - '10' => ['trust', 'reject', 'scram-sha-256', 'md5', 'password', 'gss', 'sspi', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam', 'bsd'], |
| 53 | + '10' => ['trust', 'reject', 'scram-sha-256', 'md5', 'password', 'gss', 'sspi', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam', 'bsd'], # lint:ignore:140chars |
52 | 54 | '9.6' => ['trust', 'reject', 'md5', 'password', 'gss', 'sspi', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam', 'bsd'], |
53 | 55 | '9.5' => ['trust', 'reject', 'md5', 'password', 'gss', 'sspi', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam'], |
54 | 56 | '9.4' => ['trust', 'reject', 'md5', 'password', 'gss', 'sspi', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam'], |
|
60 | 62 | '8.3' => ['trust', 'reject', 'md5', 'crypt', 'password', 'gss', 'sspi', 'krb5', 'ident', 'ldap', 'pam'], |
61 | 63 | '8.2' => ['trust', 'reject', 'md5', 'crypt', 'password', 'krb5', 'ident', 'ldap', 'pam'], |
62 | 64 | '8.1' => ['trust', 'reject', 'md5', 'crypt', 'password', 'krb5', 'ident', 'pam'], |
63 | | - default => ['trust', 'reject', 'scram-sha-256', 'md5', 'password', 'gss', 'sspi', 'krb5', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam', 'crypt', 'bsd'] |
| 65 | + default => ['trust', 'reject', 'scram-sha-256', 'md5', 'password', 'gss', 'sspi', 'krb5', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam', 'crypt', 'bsd'] # lint:ignore:140chars |
64 | 66 | } |
65 | 67 |
|
66 | 68 | assert_type(Enum[$allowed_auth_methods], $auth_method) |
|
69 | 71 | $fragname = "pg_hba_rule_${name}" |
70 | 72 | concat::fragment { $fragname: |
71 | 73 | target => $target, |
72 | | - content => template('postgresql/pg_hba_rule.conf'), |
| 74 | + content => epp('postgresql/pg_hba_rule.conf.epp', { |
| 75 | + name => $name, |
| 76 | + description => $description, |
| 77 | + order => $order, |
| 78 | + type => $type, |
| 79 | + database => $database, |
| 80 | + user => $user, |
| 81 | + address => $address, |
| 82 | + auth_method => $auth_method, |
| 83 | + auth_option => $auth_option, |
| 84 | + } |
| 85 | + ), |
73 | 86 | order => $_order, |
74 | 87 | } |
75 | 88 | } |
|
0 commit comments