From 516a68fe39dfc8c16413c9fc17ed0aaafdfc2ac7 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Fri, 10 Jun 2022 12:29:33 +0500 Subject: [PATCH] bug fix: subdomain creation on cent/alma --- install/install.py | 20 ++++++++++++++++++++ plogical/upgrade.py | 3 +++ 2 files changed, 23 insertions(+) diff --git a/install/install.py b/install/install.py index 48d6c197d..e109267a8 100755 --- a/install/install.py +++ b/install/install.py @@ -2031,6 +2031,25 @@ milter_default_action = accept logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [enableDisableEmail]") return 0 + @staticmethod + def fixSudoers(): + try: + distroPath = '/etc/lsb-release' + + if not os.path.exists(distroPath): + fileName = '/etc/sudoers' + data = open(fileName, 'r').readlines() + + writeDataToFile = open(fileName, 'w') + for line in data: + if line.find("root") > -1 and line.find("ALL=(ALL)") > -1 and line[0] != '#': + writeDataToFile.writelines('root ALL=(ALL:ALL) ALL\n') + else: + writeDataToFile.write(line) + writeDataToFile.close() + except IOError as err: + pass + @staticmethod def setUpFirstAccount(): try: @@ -2279,6 +2298,7 @@ def main(): checks.setupPHPAndComposer() checks.fix_selinux_issue() checks.install_psmisc() + checks.fixSudoers() if args.postfix is None: checks.install_postfix_dovecot() diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 581f2a61d..63e9e09ba 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -248,6 +248,9 @@ class Upgrade: else: writeToFile.writelines(items) + if items.find("root") > -1 and items.find("ALL=(ALL)") > -1 and items[0] != '#': + writeToFile.writelines('root ALL=(ALL:ALL) ALL\n') + writeToFile.close() except: pass