forked from duosecurity/puppet-duo_unix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpam.pp
62 lines (58 loc) · 1.93 KB
/
pam.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# == Class: duo_unix::pam
#
# Provides duo_unix functionality for SSH via PAM
#
# === Authors
#
# Mark Stanislav <[email protected]>
#
class duo_unix::pam inherits duo_unix {
$aug_pam_path = "/files${duo_unix::pam_file}"
$aug_match = "${aug_pam_path}/*/module[. = '${duo_unix::pam_module}']"
file { '/etc/duo/pam_duo.conf':
ensure => present,
owner => 'root',
group => 'root',
mode => '0600',
content => template('duo_unix/duo.conf.erb'),
require => Package[$duo_unix::duo_package];
}
if $duo_unix::manage_ssh {
augeas { 'Duo Security SSH Configuration' :
changes => [
'set /files/etc/ssh/sshd_config/UsePAM yes',
'set /files/etc/ssh/sshd_config/UseDNS no',
'set /files/etc/ssh/sshd_config/ChallengeResponseAuthentication yes'
],
require => Package[$duo_unix::duo_package],
notify => Service[$duo_unix::ssh_service];
}
}
if $duo_unix::manage_pam {
if $::osfamily == 'RedHat' {
augeas { 'PAM Configuration':
changes => [
"set ${aug_pam_path}/2/control ${duo_unix::pam_unix_control}",
"ins 100 after ${aug_pam_path}/2",
"set ${aug_pam_path}/100/type auth",
"set ${aug_pam_path}/100/control sufficient",
"set ${aug_pam_path}/100/module ${duo_unix::pam_module}"
],
require => Package[$duo_unix::duo_package],
onlyif => "match ${aug_match} size == 0";
}
} else {
augeas { 'PAM Configuration':
changes => [
"set ${aug_pam_path}/1/control ${duo_unix::pam_unix_control}",
"ins 100 after ${aug_pam_path}/1",
"set ${aug_pam_path}/100/type auth",
"set ${aug_pam_path}/100/control '[success=1 default=ignore]'",
"set ${aug_pam_path}/100/module ${duo_unix::pam_module}"
],
require => Package[$duo_unix::duo_package],
onlyif => "match ${aug_match} size == 0";
}
}
}
}