+
+
+class Installer(LoginManagerInstaller):
+
+ def __init__(self, *pargs):
+ super(Installer, self).__init__()
+ self.name = 'pam'
+ self.pargs = pargs
+
+ def install_args(self, group):
+ group.add_argument('--pam', choices=['yes', 'no'], default='no',
+ help='Configure PAM authentication')
+ group.add_argument('--pam-service', action='store', default='remote',
+ help='PAM service name to use for authentication')
+
+ def configure(self, opts, changes):
+ if opts['pam'] != 'yes':
+ return
+
+ # Add configuration data to database
+ po = PluginObject(*self.pargs)
+ po.name = 'pam'
+ po.wipe_data()
+ po.wipe_config_values()
+ config = {'service name': opts['pam_service']}
+ po.save_plugin_config(config)
+
+ # Update global config to add login plugin
+ po.is_enabled = True
+ po.save_enabled_state()
+
+ # for selinux enabled platforms, ignore if it fails just report
+ try:
+ subprocess.call(['/usr/sbin/setsebool', '-P',
+ 'httpd_mod_auth_pam=on',
+ 'httpd_tmp_exec=on'])
+ except Exception: # pylint: disable=broad-except
+ pass