Skip to content

Commit

Permalink
don't require two-factor for sudo
Browse files Browse the repository at this point in the history
- remove check for historical duo-unix package
- don't modify /etc/pam.d/sudo
- revert /etc/pam.d/sudo to default state on each supported disro
  - this should be removed after all hosts are reverted
  • Loading branch information
rrotter committed Jan 16, 2025
1 parent 5ac9a0e commit fa36a5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
22 changes: 5 additions & 17 deletions manifests/profile/duo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,11 @@
'libpam-duo'
])

package { 'duo-unix':
ensure => absent
}

['sudo'].each |$pamfile| {
file_line { "/etc/pam.d/${pamfile}: pam_duo":
path => "/etc/pam.d/${pamfile}",
line => 'auth required pam_duo.so',
after => '^@include common-auth',
require => Package['sudo', 'libpam-duo'],
}

file_line { "/etc/pam.d/${pamfile}: remove /lib64/security/pam_duo":
ensure => absent,
path => "/etc/pam.d/${pamfile}",
line => 'auth required /lib64/security/pam_duo.so'
}
# Replace default /etc/pam.d/sudo
# This is only here to eliminate previous customizations
# Remove after January 2025
file { '/etc/pam.d/sudo':
source => "puppet:///modules/nebula/default/${facts['os']['distro']['codename']}/etc/pam.d/sudo",
}

concat_fragment { '/etc/pam.d/sshd: pam_duo':
Expand Down
7 changes: 2 additions & 5 deletions spec/classes/profile/duo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ def contain_pam_duo
end

it do
expect(subject).to contain_file_line("/etc/pam.d/sudo: pam_duo")
.with_path("/etc/pam.d/sudo")
.with_line("auth required pam_duo.so")
.with_after("^@include common-auth")
.that_requires(["Package[sudo]", "Package[libpam-duo]"])
expect(subject).to contain_file("/etc/pam.d/sudo")
.with_source("puppet:///modules/nebula/default/#{facts[:os]["distro"]["codename"]}/etc/pam.d/sudo")
end

it do
Expand Down

0 comments on commit fa36a5f

Please sign in to comment.