From d5ec6785ed351e8083cb394011bbc631cd46a438 Mon Sep 17 00:00:00 2001 From: Frederic Lepied Date: Wed, 20 Feb 2002 21:50:00 +0000 Subject: added enable_password --- share/libmsec.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/share/libmsec.py b/share/libmsec.py index ef07195..068867a 100644 --- a/share/libmsec.py +++ b/share/libmsec.py @@ -71,6 +71,7 @@ STARTX = '/usr/X11R6/bin/startx ' SU = '/etc/pam.d/su' SYSCTLCONF = '/etc/sysctl.conf' SYSLOGCONF = '/etc/syslog.conf' +SYSTEM_AUTH = '/etc/pam.d/system-auth' XDM = '/etc/pam.d/xdm' XSERVERS = '/etc/X11/xdm/Xservers' @@ -490,6 +491,18 @@ def password_length(length, ndigits=0, nupper=0): passwd.replace_line_matching('^password\s+required\s+/lib/security/pam_cracklib.so.*', '@0 ucredit=%s ' % nupper)) +def enable_password(arg): + ''' Use password to authenticate users.''' + system_auth = ConfigFile.get_config_file(SYSTEM_AUTH) + + if arg: + _interactive and log(_('Using password to authenticate users')) + system_auth.remove_line_matching('^\s*auth\s+sufficient\s+/lib/security/pam_permit.so') + else: + _interactive and log(_('Don\'t use password to authenticate users')) + system_auth.replace_line_matching('^\s*auth\s+sufficient\s+/lib/security/pam_permit.so', 'auth sufficient /lib/security/pam_permit.so') or \ + system_auth.insert_before('auth\s+sufficient', 'auth sufficient /lib/security/pam_permit.so') + def enable_sulogin(arg): ''' Enable/Disable sulogin(8) in single user level.''' inittab = ConfigFile.get_config_file(INITTAB) -- cgit v1.2.1