2022-11-24 19:01:40 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-03-20 11:04:12 +00:00
|
|
|
. /lib/tiny-cloud/common
|
|
|
|
|
2022-11-24 19:01:40 +00:00
|
|
|
# Enable SSH keepalive
|
|
|
|
sed -i -e 's/^[\s#]*TCPKeepAlive\s.*/TCPKeepAlive yes/' -e 's/^[\s#]*ClientAliveInterval\s.*/ClientAliveInterval 60/' /etc/ssh/sshd_config
|
|
|
|
echo 'enabled SSH keep alives'
|
|
|
|
|
2022-12-03 17:04:13 +00:00
|
|
|
# openRC
|
2022-11-24 19:01:40 +00:00
|
|
|
sed -i -e 's/^[\s#]*rc_cgroup_mode=.*/rc_cgroup_mode="unified"/' /etc/rc.conf
|
2022-12-03 17:04:13 +00:00
|
|
|
sed -i -e 's/^[\s#]*rc_logger=.*/rc_logger="YES"/' /etc/rc.conf
|
|
|
|
echo 'enabled cgroupv2, openRC logging'
|
|
|
|
|
2024-03-20 11:04:12 +00:00
|
|
|
# speed up dhcpcd and chronyd
|
|
|
|
add_once /etc/dhcpcd.conf noarp >/dev/null
|
|
|
|
sed -i -e 's/^[\s#]*FAST_STARTUP=.*/FAST_STARTUP=yes/' /etc/conf.d/chronyd
|
|
|
|
|
2022-12-03 17:04:13 +00:00
|
|
|
# OpenRC parallel - causes too much chaos
|
|
|
|
#sed -i -e 's/^[\s#]*rc_parallel=.*/rc_parallel="YES"/' /etc/rc.conf
|
|
|
|
#echo 'enable parallel openRC'
|
2022-11-24 19:01:40 +00:00
|
|
|
|
2023-04-26 17:22:52 +00:00
|
|
|
# Setup syslog-ng json logging and apparmor tweaks
|
2022-11-24 19:01:40 +00:00
|
|
|
cp /lib/zdt/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
|
|
|
|
cp /lib/zdt/syslog-ng.logrotate.conf /etc/logrotate.d/syslog-ng
|
2023-04-26 17:22:52 +00:00
|
|
|
cp /lib/zdt/syslog-ng.apparmor /etc/apparmor.d/local/sbin.syslog-ng
|
2022-11-24 19:01:40 +00:00
|
|
|
|
2023-08-18 15:17:00 +00:00
|
|
|
[ -f /etc/periodic/daily/logrotate ] && mv /etc/periodic/daily/logrotate /etc/periodic/hourly/
|
2022-11-24 19:01:40 +00:00
|
|
|
echo 'syslog-ng: all to /var/log/messages as json, rotate hourly'
|
|
|
|
|
|
|
|
# use init to spawn monit
|
2024-03-20 11:04:12 +00:00
|
|
|
add_once /etc/inittab ":2345:respawn:/usr/bin/monit -Ic /etc/monitrc.zdt" >/dev/null
|
2022-11-24 19:01:40 +00:00
|
|
|
echo 'Enable monit via inittab'
|
|
|
|
|
2023-10-05 16:46:40 +00:00
|
|
|
# QoL - color prompt even for doas bash
|
|
|
|
[ -f /etc/profile.d/color_prompt.sh.disabled ] && mv /etc/profile.d/color_prompt.sh.disabled /etc/profile.d/color_prompt.sh
|
|
|
|
ln -sf /etc/profile.d/color_prompt.sh /etc/bash/color_prompt.sh
|
|
|
|
|
2024-07-18 18:58:33 +00:00
|
|
|
cat <<EOF > /etc/profile.d/zdt-alias.sh
|
|
|
|
alias rs='doas bash'
|
|
|
|
alias sudo='doas'
|
|
|
|
alias cu='doas cat /var/log/user-data.log'
|
|
|
|
alias cl="doas cat /var/log/messages | jq -r '\"\(.time): \(.message)\"'"
|
|
|
|
alias tl="doas tail -f /var/log/messages | jq -r '\"\(.time): \(.message)\"'"
|
|
|
|
EOF
|