Browse Source

distro/systemd: add man page ref and set config file permissions

* redhat/*.service: Add "Documentation=man:..." lines.  Chmod and chown the
  config files as appropriate.
* redhat/quagga.sysconfig: Make configure generated, to substitute in the
  configured user/groups to an Env var, for use in the service files.

Note: This is partial and edited version of Scott's patch, by Paul Jakma.
Stupid mistakes will be mine.

Note2: Would be good to move distro agnostic files, like systemd service files,
to a neutral dirctory.
Scott Leggett 1 year ago
parent
commit
9d035625fe

+ 1 - 1
configure.ac

@@ -1657,7 +1657,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
 	  redhat/Makefile
 	  pkgsrc/Makefile
 	  fpm/Makefile
-	  redhat/quagga.spec 
+	  redhat/quagga.spec redhat/quagga.sysconfig
 	  lib/version.h
 	  isisd/topology/Makefile
 	  pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh

+ 3 - 0
redhat/bgpd.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/bgpd.conf
+Documentation=man:bgpd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/bgpd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/bgpd.conf
 ExecStart=/usr/sbin/bgpd -d $BGPD_OPTS -f /etc/quagga/bgpd.conf
 Restart=on-abort
 

+ 3 - 0
redhat/isisd.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/isisd.conf
+Documentation=man:isisd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/isisd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/isisd.conf
 ExecStart=/usr/sbin/isisd -d $ISISD_OPTS -f /etc/quagga/isisd.conf
 Restart=on-abort
 

+ 3 - 0
redhat/nhrpd.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/nhrpd.conf
+Documentation=man:nhrpd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/nhrpd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/nhrpd.conf
 ExecStart=/usr/sbin/nhrpd -d $NHRPD_OPTS -f /etc/quagga/nhrpdd.conf
 Restart=on-abort
 

+ 3 - 0
redhat/ospf6d.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/ospf6d.conf
+Documentation=man:ospf6d
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/ospf6d.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/ospf6d.conf
 ExecStart=/usr/sbin/ospf6d -d $OSPF6D_OPTS -f /etc/quagga/ospf6d.conf
 Restart=on-abort
 

+ 3 - 0
redhat/ospfd.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/ospfd.conf
+Documentation=man:ospfd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/ospfd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/ospfd.conf
 ExecStart=/usr/sbin/ospfd -d $OSPFD_OPTS -f /etc/quagga/ospfd.conf
 Restart=on-abort
 

+ 3 - 0
redhat/pimd.service

@@ -3,10 +3,13 @@ Description=PIM multicast routing engine
 BindTo=zebra.service
 After=syslog.target network.target zebra.service
 ConditionPathExists=/etc/quagga/pimd.conf
+Documentation=man:pimd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/pimd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/pimd.conf
 ExecStart=/usr/sbin/pimd -d $PIMD_OPTS -f /etc/quagga/pimd.conf
 Restart=on-abort
 

+ 6 - 0
redhat/quagga.sysconfig

@@ -11,6 +11,12 @@ RIPNGD_OPTS="-A ::1"
 ZEBRA_OPTS="-A 127.0.0.1"
 PIMD_OPTS="-A 127.0.0.1"
 
+# Default: The compiled in default user and group(s), useful to
+# system startup to chmod config files.
+QUAGGA_USER=quagga
+QUAGGA_GROUP=quagga
+VTY_GROUP=
+
 # Watchquagga configuration for LSB initscripts
 #
 # (Not needed with systemd: the service files are configured to automatically

+ 31 - 0
redhat/quagga.sysconfig.in

@@ -0,0 +1,31 @@
+#
+# Default: Bind all daemon vtys to the loopback(s) only
+#
+BABELD_OPTS="-A 127.0.0.1"
+BGPD_OPTS="-A 127.0.0.1"
+ISISD_OPTS="-A ::1"
+OSPF6D_OPTS="-A ::1"
+OSPFD_OPTS="-A 127.0.0.1"
+RIPD_OPTS="-A 127.0.0.1"
+RIPNGD_OPTS="-A ::1"
+ZEBRA_OPTS="-A 127.0.0.1"
+PIMD_OPTS="-A 127.0.0.1"
+
+# Default: The compiled in default user and group(s), useful to
+# system startup to chmod config files.
+QUAGGA_USER=@enable_user@
+QUAGGA_GROUP=@enable_group@
+VTY_GROUP=@enable_vty_group@
+
+# Watchquagga configuration for LSB initscripts
+#
+# (Not needed with systemd: the service files are configured to automatically
+# restart any daemon on failure. If zebra fails, all running daemons will be
+# stopped; zebra will be started again; and then the previously running daemons
+# will be started again.)
+#
+# Uncomment and edit this line to reflect the daemons you are actually using:
+#WATCH_DAEMONS="zebra bgpd ospfd ospf6d ripd ripngd"
+#
+# Timer values can be adjusting by editing this line:
+WATCH_OPTS="-Az -b_ -r/sbin/service_%s_restart -s/sbin/service_%s_start -k/sbin/service_%s_stop"

+ 3 - 0
redhat/ripd.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/ripd.conf
+Documentation=man:ripd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/ripd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/ripd.conf
 ExecStart=/usr/sbin/ripd -d $RIPD_OPTS -f /etc/quagga/ripd.conf
 Restart=on-abort
 

+ 3 - 0
redhat/ripngd.service

@@ -5,10 +5,13 @@ Wants=network.target
 After=zebra.service network-pre.target
 Before=network.target
 ConditionPathExists=/etc/quagga/ripngd.conf
+Documentation=man:ripngd
 
 [Service]
 Type=forking
 EnvironmentFile=/etc/sysconfig/quagga
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/ripngd.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /etc/quagga/ripngd.conf
 ExecStart=/usr/sbin/ripngd -d $RIPNGD_OPTS -f /etc/quagga/ripngd.conf
 Restart=on-abort
 

+ 4 - 0
redhat/zebra.service

@@ -4,11 +4,15 @@ Wants=network.target
 Before=network.target
 After=network-pre.target
 ConditionPathExists=/etc/quagga/zebra.conf
+Documentation=man:zebra
 
 [Service]
 Type=forking
 EnvironmentFile=-/etc/sysconfig/quagga
 ExecStartPre=/sbin/ip route flush proto zebra
+ExecStartPre=-/bin/chmod -f 640 /etc/quagga/vtysh.conf /etc/quagga/zebra.conf
+ExecStartPre=-/bin/chown -f $QUAGGA_USER:$QUAGGA_GROUP /run/quagga /etc/quagga/zebra.conf
+ExecStartPre=-/bin/chown -f ${QUAGGA_USER}${VTY_GROUP:+":$VTY_GROUP"} quaggavty /etc/quagga/vtysh.conf
 ExecStart=/usr/sbin/zebra -d $ZEBRA_OPTS -f /etc/quagga/zebra.conf
 Restart=on-abort