mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-13 03:23:42 +03:00
if disabled-local True set disabled_user true in ahenk.conf
This commit is contained in:
parent
f329f63ba7
commit
d61f10469b
4 changed files with 26 additions and 21 deletions
|
@ -245,8 +245,8 @@ class AhenkDaemon(BaseDaemon):
|
|||
self.register_user_name=username
|
||||
self.register_user_password=password
|
||||
|
||||
# if user_disabled is when ahenk service restarted TRUE disabled local users
|
||||
def disable_local_users(self):
|
||||
|
||||
self.logger.info('Local users disable action start..')
|
||||
conf_manager = Scope.get_instance().get_configuration_manager()
|
||||
|
||||
|
|
|
@ -32,22 +32,7 @@ class ADLogin(AbstractPlugin):
|
|||
ad_port = self.data['ad_port']
|
||||
disabled_local_user = self.data['disableLocalUser']
|
||||
|
||||
self.config.read(self.ahenk_conf_path)
|
||||
if disabled_local_user is True:
|
||||
self.registration.disable_local_users()
|
||||
config = configparser.ConfigParser()
|
||||
config.read(self.ahenk_conf_path)
|
||||
config.set('MACHINE', 'user_disabled', 'disabled')
|
||||
|
||||
with open(self.ahenk_conf_path, 'w') as configfile:
|
||||
self.logger.info('Opening config file ')
|
||||
config.write(configfile)
|
||||
configfile.close()
|
||||
|
||||
self.logger.info('User disabled value Disabled')
|
||||
|
||||
else:
|
||||
self.logger.info("local users will not be disabled because local_user parameter is FALSE")
|
||||
|
||||
execution_result = self.ad_authentication.authenticate(domain_name, hostname, ip_address, admin_password, ad_username)
|
||||
if execution_result is False:
|
||||
|
@ -55,8 +40,26 @@ class ADLogin(AbstractPlugin):
|
|||
message='Active Directory kullanıcısı ile oturum açma ayarlanırken hata oluştu.: Gerekli Paketleri indirilemedi.',
|
||||
content_type=self.get_content_type().APPLICATION_JSON.value)
|
||||
else:
|
||||
# if get disabled_local_user TRUE set user_disabled in ahenk.conf. disabled local users then client reboot
|
||||
self.config.read(self.ahenk_conf_path)
|
||||
if disabled_local_user is True:
|
||||
# self.registration.disable_local_users()
|
||||
config = configparser.ConfigParser()
|
||||
config.read(self.ahenk_conf_path)
|
||||
config.set('MACHINE', 'user_disabled', 'true')
|
||||
|
||||
with open(self.ahenk_conf_path, 'w') as configfile:
|
||||
self.logger.info('Opening config file ')
|
||||
config.write(configfile)
|
||||
configfile.close()
|
||||
self.logger.info('User disabled value Disabled')
|
||||
|
||||
else:
|
||||
self.logger.info("local users will not be disabled because local_user parameter is FALSE")
|
||||
self.shutdown()
|
||||
|
||||
self.context.create_response(code=self.message_code.TASK_PROCESSED.value,
|
||||
message='Active Directory kullanıcısı ile oturum açma başarı ile sağlandı.',
|
||||
message='Active Directory kullanıcısı ile oturum açma başarı ile sağlandı ve istemci yeniden başlatılıyor.',
|
||||
content_type=self.get_content_type().APPLICATION_JSON.value)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -37,12 +37,13 @@ class LDAPLogin(AbstractPlugin):
|
|||
message='LDAP kullanıcısı ile oturum açma ayarlanırken hata oluştu.: SSSD Paketleri indirilemedi.',
|
||||
content_type=self.get_content_type().APPLICATION_JSON.value)
|
||||
else:
|
||||
# if get disabled_local_user TRUE set user_disabled in ahenk.conf. disabled local users then client reboot
|
||||
self.config.read(self.ahenk_conf_path)
|
||||
if disabled_local_user is True:
|
||||
self.registration.disable_local_users()
|
||||
# self.registration.disable_local_users()
|
||||
config = configparser.ConfigParser()
|
||||
config.read(self.ahenk_conf_path)
|
||||
config.set('MACHINE', 'user_disabled', 'disabled')
|
||||
config.set('MACHINE', 'user_disabled', 'true')
|
||||
|
||||
with open(self.ahenk_conf_path, 'w') as configfile:
|
||||
self.logger.info('Opening config file ')
|
||||
|
@ -53,8 +54,9 @@ class LDAPLogin(AbstractPlugin):
|
|||
else:
|
||||
self.logger.info("local users will not be disabled because local_user parameter is FALSE")
|
||||
self.shutdown()
|
||||
|
||||
self.context.create_response(code=self.message_code.TASK_PROCESSED.value,
|
||||
message='LDAP kullanıcısı ile oturum açma başarı ile sağlandı.',
|
||||
message='LDAP kullanıcısı ile oturum açma başarı ile sağlandı ve istemci yeniden başlatılıyor.',
|
||||
content_type=self.get_content_type().APPLICATION_JSON.value)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -22,7 +22,7 @@ class InstalledPackages(AbstractPlugin):
|
|||
try:
|
||||
self.logger.debug('Executing command for package list.')
|
||||
self.execute(
|
||||
'dpkg-query -f=\'${{Status}},${{binary:Package}},${{Version}}\n\' -W \'*\' | grep \'install ok installed\' | sed \'s/install ok installed/i/\' | sed \'s/unknown ok not-installed/u/\' | sed \'s/deinstall ok config-files/u/\' | grep -v ahenk > {0}'.format(
|
||||
'dpkg-query -f=\'${{Status}},${{binary:Package}},${{Version}}\n\' -W \'*\' | grep \'install ok installed\' | sed \'s/install ok installed/i/\' | sed \'s/unknown ok not-installed/u/\' | sed \'s/deinstall ok config-files/u/\' > {0}'.format(
|
||||
self.file_path))
|
||||
self.logger.debug('Command executed.')
|
||||
|
||||
|
|
Loading…
Reference in a new issue