summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-04-20 15:41:22 +0200
committerChristian Poessinger <christian@poessinger.com>2019-04-20 15:41:22 +0200
commiteb8943a0fe2d37bb981573361e56b28511844503 (patch)
treeaddc8ba228bcb82498752b192b04c816dd61ff7f /src
parentfc354d633d6dc64472cc54acef21b80934e0065c (diff)
downloadvyos-1x-eb8943a0fe2d37bb981573361e56b28511844503.tar.gz
vyos-1x-eb8943a0fe2d37bb981573361e56b28511844503.zip
[hostname] T1336: sanitize FQDN before passing to hostnamectl
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/host_name.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 030735215..32ae4526f 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -98,7 +98,8 @@ def generate(config):
def apply(config):
"""Apply configuration"""
- os.system("hostnamectl set-hostname --static {0}".format(config["fqdn"]))
+ fqdn = config["fqdn"]
+ os.system("hostnamectl set-hostname --static {0}".format(fqdn.rstrip('.')))
# Restart services that use the hostname
os.system("systemctl restart rsyslog.service")