From 24d425d27f6e250ef4bb82cec8bc518dfbb2c80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuncay=20=C3=87OLAK?= Date: Tue, 7 Sep 2021 13:00:32 +0300 Subject: [PATCH] change module for linux_distro as distro and added dynamic_dns_update param to ad_login --- src/base/command/command_runner.py | 2 +- src/base/system/system.py | 11 +++++++---- src/plugins/ldap-login/execute_ad_login.py | 7 ++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/base/command/command_runner.py b/src/base/command/command_runner.py index 833bb5f..6339db4 100644 --- a/src/base/command/command_runner.py +++ b/src/base/command/command_runner.py @@ -73,7 +73,7 @@ class CommandRunner(object): if str(json_data['event']) == 'login' and self.check_last_login(): username = json_data['username'] - if username != "Debian-gdm": + if username != "Debian-gdm" or username != "gdm": display = json_data['display'] desktop = json_data['desktop'] diff --git a/src/base/system/system.py b/src/base/system/system.py index 2655fa3..1518a02 100644 --- a/src/base/system/system.py +++ b/src/base/system/system.py @@ -12,7 +12,7 @@ import socket import struct import netifaces from uuid import getnode as get_mac - +import distro import cpuinfo import psutil @@ -337,15 +337,18 @@ class System: @staticmethod def distribution_name(): - return platform.linux_distribution()[0] + #return platform.linux_distribution()[0] + return distro.linux_distribution()[0] @staticmethod def distribution_version(): - return platform.linux_distribution()[1] + # return platform.linux_distribution()[1] + return distro.linux_distribution()[1] @staticmethod def distribution_id(): - return platform.linux_distribution()[2] + # return platform.linux_distribution()[2] + return distro.linux_distribution()[2] @staticmethod def version(): diff --git a/src/plugins/ldap-login/execute_ad_login.py b/src/plugins/ldap-login/execute_ad_login.py index 842ac88..3a42d3d 100644 --- a/src/plugins/ldap-login/execute_ad_login.py +++ b/src/plugins/ldap-login/execute_ad_login.py @@ -30,8 +30,9 @@ class ADLogin(AbstractPlugin): ad_username = self.data['ad_username'] admin_password = self.data['admin_password'] ad_port = self.data['ad_port'] + dynamic_dns_update = self.data['dynamic_dns_update'] - execution_result = self.ad_authentication.authenticate(domain_name, hostname, ip_address, admin_password, ad_username) + execution_result = self.ad_authentication.authenticate(domain_name, hostname, ip_address, admin_password, ad_username, dynamic_dns_update) if execution_result is False: self.context.create_response(code=self.message_code.TASK_ERROR.value, message='Active Directory kullanıcısı ile oturum açma ayarlanırken hata oluştu.: Gerekli Paketleri indirilemedi.', @@ -46,21 +47,17 @@ class ADLogin(AbstractPlugin): 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ı ve istemci yeniden başlatılıyor.', content_type=self.get_content_type().APPLICATION_JSON.value) - except Exception as e: self.logger.error(str(e)) self.context.create_response(code=self.message_code.TASK_ERROR.value,