Created
January 28, 2013 22:00
-
-
Save ojacobson/4659555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ldapauth($ldap_uri, $search_base, $bind_dn, $bind_passwd, $enable_root = false, $root_dn = '', $root_passwd = '') { | |
package { 'libnss-ldap': | |
ensure => installed, | |
} | |
package { 'libpam-cracklib': | |
ensure => installed, | |
} | |
package { 'libpam-ldap': | |
ensure => installed, | |
} | |
file { '/etc/ldap.conf': | |
ensure => file, | |
owner => root, | |
group => root, | |
mode => 0444, | |
content => template('ldapauth/ldap_pam.conf.erb'), | |
require => [ | |
Package['libpam-ldap'], | |
Package['libnss-ldap'], | |
], | |
} | |
file { '/etc/ldap.secret': | |
ensure => $enable_root ? { | |
true => file, | |
default => absent, | |
}, | |
owner => root, | |
group => root, | |
mode => 0400, | |
content => $root_passwd, | |
require => [ | |
Package['libpam-ldap'], | |
Package['libnss-ldap'], | |
], | |
} | |
file { '/etc/nsswitch.conf': | |
ensure => file, | |
owner => root, | |
group => root, | |
mode => 0444, | |
source => 'puppet:///modules/ldapauth/nsswitch.conf', | |
require => Package['libnss-ldap'], | |
} | |
file { '/usr/share/pam-configs/mkhomedir': | |
ensure => file, | |
owner => root, | |
group => root, | |
mode => 0444, | |
source => 'puppet:///modules/ldapauth/mkhomedir', | |
} | |
exec { 'pam-auth-update --package (for ldapauth)': | |
command => 'pam-auth-update --package', | |
user => root, | |
path => '/usr/sbin:/sbin:/usr/bin:/bin', | |
refreshonly => true, | |
subscribe => [ | |
Package['libpam-ldap'], | |
Package['libpam-cracklib'], | |
File['/usr/share/pam-configs/mkhomedir'], | |
], | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name: Automatic Homedir Creation | |
Default: yes | |
Priority: 256 | |
Session-Type: Additional | |
Session-Final: | |
required pam_mkhomedir.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment