Skip to content

Commit 9df424a

Browse files
committed
security fix: CP-26: Manage Website – File Manager – Upload
1 parent a288a88 commit 9df424a

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

install/install.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,16 @@ def fixCyberPanelPermissions(self):
664664
command = 'mount -o remount,rw,hidepid=2 /proc'
665665
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
666666

667+
## symlink protection
668+
669+
writeToFile = open('/usr/lib/sysctl.d/50-default.conf', 'a')
670+
writeToFile.writelines('fs.protected_hardlinks = 1\n')
671+
writeToFile.writelines('fs.protected_symlinks = 1\n')
672+
writeToFile.close()
673+
674+
command = 'sysctl --system'
675+
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
676+
667677
###
668678

669679
def install_unzip(self):

plogical/upgrade.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,6 +2097,16 @@ def generate_pass(length=14):
20972097
command = 'chmod 750 /usr/local/lsws/logs'
20982098
Upgrade.executioner(command, 0)
20992099

2100+
## symlink protection
2101+
2102+
writeToFile = open('/usr/lib/sysctl.d/50-default.conf', 'a')
2103+
writeToFile.writelines('fs.protected_hardlinks = 1\n')
2104+
writeToFile.writelines('fs.protected_symlinks = 1\n')
2105+
writeToFile.close()
2106+
2107+
command = 'sysctl --system'
2108+
Upgrade.executioner(command, 0)
2109+
21002110
Upgrade.stdOut("Permissions updated.")
21012111

21022112
except BaseException as msg:

0 commit comments

Comments
 (0)