aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-11-05 15:28:18 +0100
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-11-05 16:11:47 +0100
commit021fa432447bd7b447ca39738040698db39d751b (patch)
tree66c0e46dfd952ce6de6043916f3eb9e2d92e62e2 /services
Initial commitv1
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'services')
-rw-r--r--services/Makemodule.am23
-rw-r--r--services/agetty6
-rw-r--r--services/consolefont6
-rw-r--r--services/devfs.in6
-rw-r--r--services/dhcpcd7
-rw-r--r--services/dhcpcdmaster10
-rw-r--r--services/dnsmasq6
-rw-r--r--services/gcrond5
-rw-r--r--services/hostapd.in7
-rw-r--r--services/hostname6
-rw-r--r--services/hwclock6
-rw-r--r--services/ifcfg.in7
-rw-r--r--services/ifdown.in7
-rw-r--r--services/ifrename.in7
-rw-r--r--services/klogd6
-rw-r--r--services/loopback10
-rw-r--r--services/modules.in7
-rw-r--r--services/mountusr.in5
-rw-r--r--services/network4
-rw-r--r--services/nft.in7
-rw-r--r--services/nginx6
-rw-r--r--services/ntpsetdate.gcron.in7
-rw-r--r--services/procfs.in9
-rw-r--r--services/sigkill.in6
-rw-r--r--services/sigterm.in9
-rw-r--r--services/sshd.in5
-rw-r--r--services/sshd_keygen.in14
-rw-r--r--services/swclock.in6
-rw-r--r--services/swclocksave.gcron.in3
-rw-r--r--services/swclocksave.in7
-rw-r--r--services/sync6
-rwxr-xr-xservices/sysctl7
-rw-r--r--services/sysfs.in13
-rw-r--r--services/sysinit5
-rw-r--r--services/tmpfs5
-rw-r--r--services/tmpfsrun11
-rw-r--r--services/tmpfsvar.in16
-rw-r--r--services/unbound6
-rw-r--r--services/usyslogd6
-rw-r--r--services/vfs4
40 files changed, 299 insertions, 0 deletions
diff --git a/services/Makemodule.am b/services/Makemodule.am
new file mode 100644
index 0000000..e39e200
--- /dev/null
+++ b/services/Makemodule.am
@@ -0,0 +1,23 @@
+initdir = @TEMPLATEDIR@
+init_DATA = services/agetty services/hostname services/loopback
+init_DATA += services/sysctl services/hwclock services/sysinit
+init_DATA += services/sigterm services/sync services/devfs
+init_DATA += services/sysfs services/procfs services/tmpfs
+init_DATA += services/vfs services/ifrename services/ifcfg
+init_DATA += services/dhcpcd services/dhcpcdmaster services/unbound
+init_DATA += services/dnsmasq services/ifdown services/modules
+init_DATA += services/network services/hostapd services/swclock
+init_DATA += services/swclocksave services/nft services/sigkill
+init_DATA += services/sshd services/sshd_keygen services/consolefont
+init_DATA += services/nginx services/usyslogd services/klogd
+init_DATA += services/swclocksave.gcron services/gcrond
+init_DATA += services/mountusr services/ntpsetdate.gcron
+init_DATA += services/tmpfsrun services/tmpfsvar
+
+EXTRA_DIST += services/sysinit services/vfs services/agetty services/hostname
+EXTRA_DIST += services/hwclock services/loopback services/klogd
+EXTRA_DIST += services/sync services/sysctl services/tmpfs
+EXTRA_DIST += services/dhcpcd services/dhcpcdmaster services/unbound
+EXTRA_DIST += services/usyslogd services/dnsmasq services/network
+EXTRA_DIST += services/consolefont services/gcrond services/nginx
+EXTRA_DIST += services/tmpfsrun
diff --git a/services/agetty b/services/agetty
new file mode 100644
index 0000000..6c8945b
--- /dev/null
+++ b/services/agetty
@@ -0,0 +1,6 @@
+description agetty on %0
+exec agetty %0 linux
+type respawn
+target boot
+after network
+tty "/dev/%0"
diff --git a/services/consolefont b/services/consolefont
new file mode 100644
index 0000000..1584db9
--- /dev/null
+++ b/services/consolefont
@@ -0,0 +1,6 @@
+description set console font
+type once
+target boot
+before sysinit
+after vfs
+exec setfont %0
diff --git a/services/devfs.in b/services/devfs.in
new file mode 100644
index 0000000..271eae7
--- /dev/null
+++ b/services/devfs.in
@@ -0,0 +1,6 @@
+description "mount /dev"
+type wait
+target boot
+after procfs sysfs
+before vfs
+exec "@SCRIPTDIR@/devfs.sh"
diff --git a/services/dhcpcd b/services/dhcpcd
new file mode 100644
index 0000000..184a843
--- /dev/null
+++ b/services/dhcpcd
@@ -0,0 +1,7 @@
+description "DHCP client on %0"
+type once
+target boot
+after dhcpcdmaster network
+
+tty /dev/null
+exec dhcpcd -n %0
diff --git a/services/dhcpcdmaster b/services/dhcpcdmaster
new file mode 100644
index 0000000..879497a
--- /dev/null
+++ b/services/dhcpcdmaster
@@ -0,0 +1,10 @@
+description "DHCP client - master service"
+type wait
+target boot
+after network
+tty /dev/null
+
+exec {
+ mkdir -p /var/db/dhcpcd
+ dhcpcd --inactive
+}
diff --git a/services/dnsmasq b/services/dnsmasq
new file mode 100644
index 0000000..4045824
--- /dev/null
+++ b/services/dnsmasq
@@ -0,0 +1,6 @@
+description "dnsmasq DNS & DHCP server"
+type respawn limit 5
+target boot
+after network unbound
+
+exec dnsmasq -k
diff --git a/services/gcrond b/services/gcrond
new file mode 100644
index 0000000..0ee1ee5
--- /dev/null
+++ b/services/gcrond
@@ -0,0 +1,5 @@
+description start gcron daemon
+exec gcrond
+type respawn
+target boot
+after network
diff --git a/services/hostapd.in b/services/hostapd.in
new file mode 100644
index 0000000..172aa6f
--- /dev/null
+++ b/services/hostapd.in
@@ -0,0 +1,7 @@
+description "WIFI access point daemon"
+type respawn limit 10
+target boot
+after sysinit ifrename
+before network ifcfg
+
+exec hostapd "@ETCPATH@/hostapd.conf"
diff --git a/services/hostname b/services/hostname
new file mode 100644
index 0000000..d0daa23
--- /dev/null
+++ b/services/hostname
@@ -0,0 +1,6 @@
+description reload hostname
+exec hostname --file /etc/hostname
+type wait
+target boot
+before sysinit
+after hwclock vfs
diff --git a/services/hwclock b/services/hwclock
new file mode 100644
index 0000000..7eac1da
--- /dev/null
+++ b/services/hwclock
@@ -0,0 +1,6 @@
+description restore time from RTC
+exec hwclock --hctosys --utc
+type wait
+target boot
+before sysinit
+after vfs modules
diff --git a/services/ifcfg.in b/services/ifcfg.in
new file mode 100644
index 0000000..c2b4127
--- /dev/null
+++ b/services/ifcfg.in
@@ -0,0 +1,7 @@
+description "static network configuration"
+type wait
+target boot
+after sysinit ifrename
+before network
+
+exec "@SCRIPTDIR@/ifcfg.sh" \ No newline at end of file
diff --git a/services/ifdown.in b/services/ifdown.in
new file mode 100644
index 0000000..1310098
--- /dev/null
+++ b/services/ifdown.in
@@ -0,0 +1,7 @@
+description "stop all network interfaces"
+type wait
+target %0
+after sigkill sigterm
+before sync
+
+exec "@SCRIPTDIR@/ifdown.sh" \ No newline at end of file
diff --git a/services/ifrename.in b/services/ifrename.in
new file mode 100644
index 0000000..efb00de
--- /dev/null
+++ b/services/ifrename.in
@@ -0,0 +1,7 @@
+description "rename network interfaces"
+type wait
+target boot
+after sysinit
+before network
+
+exec "@SCRIPTDIR@/ifrename.sh" \ No newline at end of file
diff --git a/services/klogd b/services/klogd
new file mode 100644
index 0000000..aaca59a
--- /dev/null
+++ b/services/klogd
@@ -0,0 +1,6 @@
+description "starting uklogd"
+exec klogd
+type respawn limit 5
+target boot
+after usyslogd
+before sysinit
diff --git a/services/loopback b/services/loopback
new file mode 100644
index 0000000..53118b5
--- /dev/null
+++ b/services/loopback
@@ -0,0 +1,10 @@
+description configure network loopback device
+type wait
+target boot
+before sysinit
+after hostname vfs
+
+exec {
+ ip addr add 127.0.0.1/8 dev lo brd +
+ ip link set lo up
+}
diff --git a/services/modules.in b/services/modules.in
new file mode 100644
index 0000000..e8c1863
--- /dev/null
+++ b/services/modules.in
@@ -0,0 +1,7 @@
+description "load kernel modules"
+type wait
+target boot
+after vfs usyslogd
+before sysinit
+
+exec "@SCRIPTDIR@/modules_load.sh" \ No newline at end of file
diff --git a/services/mountusr.in b/services/mountusr.in
new file mode 100644
index 0000000..14b1e8f
--- /dev/null
+++ b/services/mountusr.in
@@ -0,0 +1,5 @@
+description "mount /usr"
+type wait
+target boot
+before vfs
+exec "@SCRIPTDIR@/overlay.sh" usr /usr
diff --git a/services/network b/services/network
new file mode 100644
index 0000000..5ba505c
--- /dev/null
+++ b/services/network
@@ -0,0 +1,4 @@
+description "static network configuration completed"
+type wait
+target boot
+after sysinit \ No newline at end of file
diff --git a/services/nft.in b/services/nft.in
new file mode 100644
index 0000000..21caab0
--- /dev/null
+++ b/services/nft.in
@@ -0,0 +1,7 @@
+description "restore netfilter rule set"
+type wait
+target boot
+after sysinit ifrename
+before network ifcfg
+
+exec nft -f "@ETCPATH@/nftables.rules"
diff --git a/services/nginx b/services/nginx
new file mode 100644
index 0000000..6a36af9
--- /dev/null
+++ b/services/nginx
@@ -0,0 +1,6 @@
+description "start nginx web server"
+type once
+target boot
+after network
+tty /dev/null
+exec nginx
diff --git a/services/ntpsetdate.gcron.in b/services/ntpsetdate.gcron.in
new file mode 100644
index 0000000..6f86bd5
--- /dev/null
+++ b/services/ntpsetdate.gcron.in
@@ -0,0 +1,7 @@
+hour */4
+minute 5
+dayofmonth *
+dayofweek *
+month *
+tty /dev/null
+exec "@SCRIPTDIR@/setntpdate.sh"
diff --git a/services/procfs.in b/services/procfs.in
new file mode 100644
index 0000000..8c0743b
--- /dev/null
+++ b/services/procfs.in
@@ -0,0 +1,9 @@
+description "mount /proc"
+type wait
+target boot
+before vfs
+
+exec {
+ mount -t proc proc /proc
+ "@SCRIPTDIR@/trymount.sh" /proc/sys/fs/binfmt_misc binfmt_misc nodev,noexec,nosuid
+}
diff --git a/services/sigkill.in b/services/sigkill.in
new file mode 100644
index 0000000..cddd49d
--- /dev/null
+++ b/services/sigkill.in
@@ -0,0 +1,6 @@
+description send SIGKILL to remaining processes
+exec "@SCRIPTDIR@/killall5" 9
+type wait
+target %0
+after sigterm
+before sync shutdown reboot
diff --git a/services/sigterm.in b/services/sigterm.in
new file mode 100644
index 0000000..7e77fba
--- /dev/null
+++ b/services/sigterm.in
@@ -0,0 +1,9 @@
+description send SIGTERM to all processes
+type wait
+target %0
+before sigkill sync reboot shutdown
+
+exec {
+ "@SCRIPTDIR@/killall5" 15
+ sleep 5
+}
diff --git a/services/sshd.in b/services/sshd.in
new file mode 100644
index 0000000..a6292bc
--- /dev/null
+++ b/services/sshd.in
@@ -0,0 +1,5 @@
+description "OpenSSH server"
+type respawn limit 5
+target boot
+after network sshd_keygen
+exec "@SBINPATH@/sshd" -D
diff --git a/services/sshd_keygen.in b/services/sshd_keygen.in
new file mode 100644
index 0000000..6425e63
--- /dev/null
+++ b/services/sshd_keygen.in
@@ -0,0 +1,14 @@
+description "OpenSSH server - generate host keys"
+type wait
+target boot
+after network
+tty /dev/null
+exec {
+ mkdir -p "@ETCPATH@/ssh/"
+
+ ssh-keygen -f "@ETCPATH@/ssh/host_rsa_key" -N "" -t rsa
+ ssh-keygen -f "@ETCPATH@/ssh/host_ecdsa_key" -N "" -t ecdsa
+ ssh-keygen -f "@ETCPATH@/ssh/host_ed25519_key" -N "" -t ed25519
+
+ service disable sshd_keygen
+}
diff --git a/services/swclock.in b/services/swclock.in
new file mode 100644
index 0000000..02c4c27
--- /dev/null
+++ b/services/swclock.in
@@ -0,0 +1,6 @@
+description restore saved time from last shutdown
+type wait
+target boot
+before sysinit
+after vfs modules
+exec xargs -a @STATEFILESPATH@/swclock date --utc
diff --git a/services/swclocksave.gcron.in b/services/swclocksave.gcron.in
new file mode 100644
index 0000000..24e162b
--- /dev/null
+++ b/services/swclocksave.gcron.in
@@ -0,0 +1,3 @@
+interval hourly
+tty truncate @STATEFILESPATH@/swclock
+exec date --utc +%%m%%d%%H%%M%%Y.%%S
diff --git a/services/swclocksave.in b/services/swclocksave.in
new file mode 100644
index 0000000..683ded7
--- /dev/null
+++ b/services/swclocksave.in
@@ -0,0 +1,7 @@
+description write current time to backup file
+type wait
+target %0
+after sigkill
+before sync
+tty truncate @STATEFILESPATH@/swclock
+exec date --utc +%%m%%d%%H%%M%%Y.%%S
diff --git a/services/sync b/services/sync
new file mode 100644
index 0000000..d7217f9
--- /dev/null
+++ b/services/sync
@@ -0,0 +1,6 @@
+description sync
+exec sync
+type wait
+target %0
+after sigkill sigterm
+before reboot shutdown
diff --git a/services/sysctl b/services/sysctl
new file mode 100755
index 0000000..6664297
--- /dev/null
+++ b/services/sysctl
@@ -0,0 +1,7 @@
+description configure kernel paramters
+tty /dev/null
+exec sysctl --system
+type wait
+target boot
+before sysinit
+after vfs loopback
diff --git a/services/sysfs.in b/services/sysfs.in
new file mode 100644
index 0000000..8eebd0a
--- /dev/null
+++ b/services/sysfs.in
@@ -0,0 +1,13 @@
+description "mount /sys"
+type wait
+target boot
+after procfs
+before vfs
+
+exec {
+ mount -t sysfs sysfs /sys
+ "@SCRIPTDIR@/trymount.sh" /sys/kernel/security securityfs nodev,noexec,nosuid
+ "@SCRIPTDIR@/trymount.sh" /sys/kernel/config configfs nodev,noexec,nosuid
+ "@SCRIPTDIR@/trymount.sh" /sys/fs/fuse/connections fusectl nodev,noexec,nosuid
+ "@SCRIPTDIR@/trymount.sh" /sys/firmware/efi/efivars efivarfs ro
+}
diff --git a/services/sysinit b/services/sysinit
new file mode 100644
index 0000000..801ac97
--- /dev/null
+++ b/services/sysinit
@@ -0,0 +1,5 @@
+description basic system initialization
+type wait
+target boot
+after vfs
+before network \ No newline at end of file
diff --git a/services/tmpfs b/services/tmpfs
new file mode 100644
index 0000000..411a42b
--- /dev/null
+++ b/services/tmpfs
@@ -0,0 +1,5 @@
+description "mount /tmp"
+type wait
+target boot
+before vfs
+exec mount -t tmpfs none /tmp
diff --git a/services/tmpfsrun b/services/tmpfsrun
new file mode 100644
index 0000000..07dbd0a
--- /dev/null
+++ b/services/tmpfsrun
@@ -0,0 +1,11 @@
+description "mount /run"
+type wait
+target boot
+before vfs
+after tmpfsvar
+exec {
+ mount -t tmpfs none /run
+ mkdir /run/lock -m 0755
+ ln -s /run /var/run
+ ln -s /run/lock /var/lock
+}
diff --git a/services/tmpfsvar.in b/services/tmpfsvar.in
new file mode 100644
index 0000000..2c3c808
--- /dev/null
+++ b/services/tmpfsvar.in
@@ -0,0 +1,16 @@
+description "mount /var"
+type wait
+target boot
+before vfs
+exec {
+ mount -t tmpfs none /var
+ mkdir /var/log -m 0755
+ mkdir /var/spool -m 0755
+ mkdir /var/lib -m 0755
+ mkdir /var/tmp -m 0755
+ mkdir /var/nginx -m 0755
+ touch /var/log/lastlog
+ touch /var/log/faillog
+ touch /var/log/sulog
+ "@SCRIPTDIR@/overlay.sh" var_lib /var/lib
+}
diff --git a/services/unbound b/services/unbound
new file mode 100644
index 0000000..e9980ab
--- /dev/null
+++ b/services/unbound
@@ -0,0 +1,6 @@
+description "Unbound resolver"
+type respawn limit 5
+target boot
+after network
+
+exec unbound -d
diff --git a/services/usyslogd b/services/usyslogd
new file mode 100644
index 0000000..6b378d9
--- /dev/null
+++ b/services/usyslogd
@@ -0,0 +1,6 @@
+description "starting usyslogd"
+exec usyslogd --chroot --rotate-replace --max-size 8192
+type respawn limit 5
+target boot
+after vfs
+before sysinit \ No newline at end of file
diff --git a/services/vfs b/services/vfs
new file mode 100644
index 0000000..b699976
--- /dev/null
+++ b/services/vfs
@@ -0,0 +1,4 @@
+description VFS setup done
+type wait
+target boot
+before sysinit \ No newline at end of file