summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-04-18 19:49:48 +0200
committerChristian Breunig <christian@breunig.cc>2025-04-18 19:54:12 +0200
commit50d1e137a5fdad0c253fe9882f86030b7abc6b2b (patch)
tree3567c3ecbe3c8d17098011c3a0e6ad9e1d65e219
parent9e47c2153be7cc0e5ed21ca8a976336d4bf872d8 (diff)
downloadvyos-1x-50d1e137a5fdad0c253fe9882f86030b7abc6b2b.tar.gz
vyos-1x-50d1e137a5fdad0c253fe9882f86030b7abc6b2b.zip
syslog: T7367: ensure rsyslog is registered as default systemd syslog service
Systemd states: The default syslog implementation should make syslog.service a symlink to itself, so that this socket activates the right actual syslog service.
-rw-r--r--debian/vyos-1x.links1
-rwxr-xr-xsmoketest/scripts/cli/test_system_syslog.py6
-rwxr-xr-xsrc/init/vyos-router8
3 files changed, 14 insertions, 1 deletions
diff --git a/debian/vyos-1x.links b/debian/vyos-1x.links
index 7e21f294c..402c91306 100644
--- a/debian/vyos-1x.links
+++ b/debian/vyos-1x.links
@@ -1,3 +1,2 @@
/etc/netplug/linkup.d/vyos-python-helper /etc/netplug/linkdown.d/vyos-python-helper
/usr/libexec/vyos/system/standalone_root_pw_reset /opt/vyatta/sbin/standalone_root_pw_reset
-/lib/systemd/system/rsyslog.service /etc/systemd/system/syslog.service
diff --git a/smoketest/scripts/cli/test_system_syslog.py b/smoketest/scripts/cli/test_system_syslog.py
index 6eae3f19d..f3e1f65ea 100755
--- a/smoketest/scripts/cli/test_system_syslog.py
+++ b/smoketest/scripts/cli/test_system_syslog.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
import unittest
from base_vyostest_shim import VyOSUnitTestSHIM
@@ -59,6 +60,11 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase):
self.cli_delete(base_path)
self.cli_commit()
+ # The default syslog implementation should make syslog.service a
+ # symlink to itself
+ self.assertEqual(os.readlink('/etc/systemd/system/syslog.service'),
+ '/lib/systemd/system/rsyslog.service')
+
# Check for running process
self.assertFalse(process_named_running(PROCESS_NAME))
diff --git a/src/init/vyos-router b/src/init/vyos-router
index 081adf214..8584234b3 100755
--- a/src/init/vyos-router
+++ b/src/init/vyos-router
@@ -460,6 +460,14 @@ start ()
nfct helper add tns inet6 tcp
nft --file /usr/share/vyos/vyos-firewall-init.conf || log_failure_msg "could not initiate firewall rules"
+ # Ensure rsyslog is the default syslog daemon
+ SYSTEMD_SYSLOG="/etc/systemd/system/syslog.service"
+ SYSTEMD_RSYSLOG="/lib/systemd/system/rsyslog.service"
+ if [ ! -L ${SYSTEMD_SYSLOG} ] || [ "$(readlink -f ${SYSTEMD_SYSLOG})" != "${SYSTEMD_RSYSLOG}" ]; then
+ ln -sf ${SYSTEMD_RSYSLOG} ${SYSTEMD_SYSLOG}
+ systemctl daemon-reload
+ fi
+
# As VyOS does not execute commands that are not present in the CLI we call
# the script by hand to have a single source for the login banner and MOTD
${vyos_conf_scripts_dir}/system_syslog.py || log_failure_msg "could not reset syslog"