aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2016-10-23 11:48:23 +0200
committerPapoteur <papoteur@mageialinux-online.org>2016-10-23 11:48:23 +0200
commitbca8d16114f6c20744962b38879f5e8ba81816fa (patch)
tree2028f5f87d420006c35a58a64967f7cc9dd6de0e /src
parentbc4f07275b9a86a08b3b2cf55d406907978a9309 (diff)
downloadmsec-bca8d16114f6c20744962b38879f5e8ba81816fa.tar
msec-bca8d16114f6c20744962b38879f5e8ba81816fa.tar.gz
msec-bca8d16114f6c20744962b38879f5e8ba81816fa.tar.bz2
msec-bca8d16114f6c20744962b38879f5e8ba81816fa.tar.xz
msec-bca8d16114f6c20744962b38879f5e8ba81816fa.zip
manage allow_xserver_to_listen also for sddm.conf (mga#19612)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/msec/plugins/msec.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/msec/plugins/msec.py b/src/msec/plugins/msec.py
index 05ab4db..36f8b21 100755
--- a/src/msec/plugins/msec.py
+++ b/src/msec/plugins/msec.py
@@ -75,6 +75,7 @@ STARTX_REGEXP = '(\s*serverargs=".*) -nolisten tcp(.*")'
XSERVERS_REGEXP = '(\s*[^#]+/usr/bin/X .*) -nolisten tcp(.*)'
GDMCONF_REGEXP = '(\s*command=.*/X.*?) -nolisten tcp(.*)$'
KDMRC_REGEXP = re.compile('(.*?)-nolisten tcp(.*)$')
+SDDMCONF_REGEXP = re.compile('(.*?)-listen tcp(.*)$')
# ctrl-alt-del
CTRALTDEL_REGEXP = '^ca::ctrlaltdel:/sbin/shutdown.*'
# ssh PermitRootLogin
@@ -211,6 +212,7 @@ class msec:
xservers = self.configfiles.get_config_file(XSERVERS)
gdmconf = self.configfiles.get_config_file(GDMCONF)
kdmrc = self.configfiles.get_config_file(KDMRC)
+ sddmconf = self.configfiles.get_config_file(SDDMCONF)
val_startx = startx.get_match(STARTX_REGEXP)
val_xservers = xservers.get_match(XSERVERS_REGEXP)
@@ -220,6 +222,12 @@ class msec:
val_kdmrc = KDMRC_REGEXP.search(str)
else:
val_kdmrc = None
+ str = sddmconf.get_shell_variable('ServerArguments', 'X11', '^\s*$')
+ if str:
+ val_sddmconf = SDDMCONF_REGEXP.search(str)
+ else:
+ val_sddmconf = None
+ self.log.debug("Valeur SDDM {}".format(val_sddmconf))
# TODO: better check for file existance
@@ -234,8 +242,10 @@ class msec:
gdmconf.set_shell_variable('DisallowTCP', 'false', '\[security\]', '^\s*$')
if kdmrc.exists():
kdmrc.replace_line_matching('^(ServerArgsLocal=.*?)-nolisten tcp(.*)$', '@1@2', 0, 0, 'X-\*-Core', '^\s*$')
+ if sddmconf.exists() and not val_sddmconf:
+ sddmconf.replace_line_matching('^(ServerArguments=.*)$', '@1 -listen tcp', 'ServerArguments=-listen tcp', 0, 'X11', '^\s*$')
else:
- if not val_startx or not val_xservers or not val_kdmrc or val_gdmconf != 'true':
+ if not val_startx or not val_xservers or not val_kdmrc or val_gdmconf != 'true' or not val_sddmconf:
self.log.info(_('Forbidding the X server to listen to tcp connection'))
if not val_startx:
startx.exists() and startx.replace_line_matching('serverargs="(.*?)( -nolisten tcp)?"', 'serverargs="@1 -nolisten tcp"')
@@ -245,6 +255,8 @@ class msec:
gdmconf.exists() and gdmconf.set_shell_variable('DisallowTCP', 'true', '\[security\]', '^\s*$')
if not val_kdmrc:
kdmrc.exists() and kdmrc.replace_line_matching('^(ServerArgsLocal=.*)$', '@1 -nolisten tcp', 'ServerArgsLocal=-nolisten tcp', 0, 'X-\*-Core', '^\s*$')
+ if sddmconf.exists():
+ sddmconf.replace_line_matching('^(ServerArguments=.*?)-listen tcp(.*)$', '@1@2', 0, 0, 'X11', '^\s*$')
def set_shell_timeout(self, val):
''' Set the shell timeout. A value of zero means no timeout.'''