summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-12-13 08:23:27 -0600
committerGitHub <noreply@github.com>2024-12-13 08:23:27 -0600
commit6a7766ec1fbb73edff908db9a7845941a7bf0391 (patch)
tree50644b0dd3a888683b451c9f833b67a7075ce66d /src
parent4221687fc7a0482b13a79358f9b0d085ec0835f6 (diff)
parent6999f85b2fc1c6e2421242e30e3810bd19250f3e (diff)
downloadvyos-1x-6a7766ec1fbb73edff908db9a7845941a7bf0391.tar.gz
vyos-1x-6a7766ec1fbb73edff908db9a7845941a7bf0391.zip
Merge pull request #4176 from jestabro/vyconf-minimal
T6718: use the vyconf daemon for validation of set commands
Diffstat (limited to 'src')
-rwxr-xr-xsrc/init/vyos-router14
-rw-r--r--src/systemd/vyconfd.service21
2 files changed, 35 insertions, 0 deletions
diff --git a/src/init/vyos-router b/src/init/vyos-router
index f8cc87507..e2e964656 100755
--- a/src/init/vyos-router
+++ b/src/init/vyos-router
@@ -24,6 +24,8 @@ declare action=$1; shift
declare -x BOOTFILE=$vyatta_sysconfdir/config/config.boot
declare -x DEFAULT_BOOTFILE=$vyatta_sysconfdir/config.boot.default
+declare -x VYCONF_CONFIG_DIR=/usr/libexec/vyos/vyconf/config
+
# If vyos-config= boot option is present, use that file instead
for x in $(cat /proc/cmdline); do
[[ $x = vyos-config=* ]] || continue
@@ -146,6 +148,10 @@ init_bootfile () {
chgrp ${GROUP} $BOOTFILE
chmod 660 $BOOTFILE
fi
+ if [ -d $VYCONF_CONFIG_DIR ] ; then
+ cp -f $BOOTFILE $VYCONF_CONFIG_DIR/config.boot
+ cp -f $DEFAULT_BOOTFILE $VYCONF_CONFIG_DIR/config.failsafe
+ fi
}
# if necessary, migrate initial config
@@ -154,6 +160,10 @@ migrate_bootfile ()
if [ -x $vyos_libexec_dir/run-config-migration.py ]; then
log_progress_msg migrate
sg ${GROUP} -c "$vyos_libexec_dir/run-config-migration.py $BOOTFILE"
+ # update vyconf copy after migration
+ if [ -d $VYCONF_CONFIG_DIR ] ; then
+ cp -f $BOOTFILE $VYCONF_CONFIG_DIR/config.boot
+ fi
fi
}
@@ -518,6 +528,8 @@ start ()
disabled system_config || system_config
+ systemctl start vyconfd.service
+
for s in ${subinit[@]} ; do
if ! disabled $s; then
log_progress_msg $s
@@ -560,6 +572,8 @@ stop()
umount ${vyatta_configdir}
log_action_end_msg $?
+ systemctl stop vyconfd.service
+
systemctl stop frr.service
unmount_encrypted_config
diff --git a/src/systemd/vyconfd.service b/src/systemd/vyconfd.service
new file mode 100644
index 000000000..ab2280263
--- /dev/null
+++ b/src/systemd/vyconfd.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=VyOS vyconf daemon
+
+# Without this option, lots of default dependencies are added,
+# among them network.target, which creates a dependency cycle
+DefaultDependencies=no
+
+After=systemd-remount-fs.service
+
+[Service]
+ExecStart=/usr/libexec/vyos/vyconf/vyconfd --log-file /var/run/log/vyconfd.log
+Type=exec
+SyslogIdentifier=vyconfd
+SyslogFacility=daemon
+Restart=on-failure
+
+User=root
+Group=vyattacfg
+
+[Install]
+WantedBy=vyos.target