diff options
Diffstat (limited to 'core/conf/rc.d')
-rwxr-xr-x | core/conf/rc.d/fcgiwrap | 41 | ||||
-rwxr-xr-x | core/conf/rc.d/git-daemon | 43 | ||||
-rw-r--r-- | core/conf/rc.d/iptables | 90 | ||||
-rwxr-xr-x | core/conf/rc.d/net | 22 | ||||
-rwxr-xr-x | core/conf/rc.d/postgresql | 16 | ||||
-rwxr-xr-x | core/conf/rc.d/wlan | 45 |
6 files changed, 126 insertions, 131 deletions
diff --git a/core/conf/rc.d/fcgiwrap b/core/conf/rc.d/fcgiwrap new file mode 100755 index 0000000..2059848 --- /dev/null +++ b/core/conf/rc.d/fcgiwrap @@ -0,0 +1,41 @@ +#!/bin/sh +# +# /etc/rc.d/bird: start/stop fcgiwrapper +# + +SSD=/sbin/start-stop-daemon +NAME=fcgiwrap +PROG=/usr/bin/spawn-fcgi +USER=www +GROUP=gitolite +PIDFILE=/var/run/spawn_${NAME}.pid +SOCKET=/var/run/fcgiwrap.sock +OPTS="-u $USER -g $GROUP -P $PIDFILE -M 0660 -s $SOCKET -- /usr/sbin/${NAME}" + + +case $1 in + start) + echo "Starting ${NAME}..." + $SSD --background --user $USER --quiet --start --pidfile $PIDFILE --exec $PROG -- $OPTS + ;; +stop) + echo "Stopping ${NAME}..." + $SSD --stop --remove-pidfile --retry 10 --pidfile $PIDFILE + ;; +restart) + echo "Restarting ${NAME}..." + $0 stop + $0 start + ;; +status) + $SSD --status --pidfile $PIDFILE + case $? in + 0) echo "$PROG is running with pid $(cat $PIDFILE )" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac diff --git a/core/conf/rc.d/git-daemon b/core/conf/rc.d/git-daemon new file mode 100755 index 0000000..41793eb --- /dev/null +++ b/core/conf/rc.d/git-daemon @@ -0,0 +1,43 @@ +#!/bin/sh + +SSD=/sbin/start-stop-daemon +NAME=git-daemon +PROG=$(git --exec-path)/${NAME} +USER=gitolite +GROUP=gitolite +PIDFILE=/var/run/git-daemon.pid +REPOS=/srv/gitolite/repositories +OPTS="--verbose --reuseaddr --base-path=${REPOS}" + +case $1 in + start) + echo "Starting ${NAME}..." + $SSD --start \ + --pidfile ${PIDFILE} \ + --exec ${PROG} -- ${OPTS} \ + --detach --pid-file=${PIDFILE} \ + --user=${USER} --group=${GROUP} + + ;; + stop) + echo "Stopping ${NAME}..." + $SSD --stop --quiet --name git-daemon \ + --pidfile ${PIDFILE} + ;; + restart) + echo "Restarting ${NAME}..." + $0 stop + $0 start + ;; + status) + $SSD --status --pidfile $PIDFILE + case $? in + 0) echo "$PROG is running with pid $(cat $PIDFILE )" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; + *) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac diff --git a/core/conf/rc.d/iptables b/core/conf/rc.d/iptables index f8b7881..44f6bb2 100644 --- a/core/conf/rc.d/iptables +++ b/core/conf/rc.d/iptables @@ -1,96 +1,20 @@ #!/bin/bash -IPT="/usr/sbin/iptables" -#TYPE=bridge -#TYPE=server -TYPE=open -#TYPE=client - -clear_ipt() { - - ${IPT} -F - ${IPT} -X - ${IPT} -t nat -F - ${IPT} -t nat -X - ${IPT} -t mangle -F - ${IPT} -t mangle -X - ${IPT} -t raw -F - ${IPT} -t raw -X - ${IPT} -t security -F - ${IPT} -t security -X - -} - case $1 in start) - case $TYPE in - bridge) - clear_ipt - echo "setting bridge network..." - echo 1 > /proc/sys/net/ipv4/ip_forward - - ## load bridge configuration - iptables-restore /etc/iptables/bridge.v4 - - ;; - server) - clear_ipt - echo "setting server network..." - ## load server configuration - iptables-restore /etc/iptables/server.v4 - - ;; - client) - clear_ipt - echo "setting client network..." - ## load client configuration - iptables-restore /etc/iptables/client.v4 - ;; - open) - clear_ipt - echo "setting open network..." - ## load client configuration - - ${IPT} -P INPUT DROP - ${IPT} -P FORWARD DROP - ${IPT} -P OUTPUT ACCEPT - - ${IPT} -A INPUT -i lo -s 127.0.0.0/8 -d 127.0.0.0/8 -j ACCEPT - ${IPT} -A OUTPUT -o lo -s 127.0.0.0/8 -d 127.0.0.0/8 -j ACCEPT - - ${IPT} -A INPUT -p tcp --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT - ${IPT} -A INPUT -p udp --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT - - ${IPT} -A OUTPUT -j ACCEPT - - ${IPT} -A FORWARD -j LOG --log-level 7 --log-prefix "iptables: FORWARD: " - ${IPT} -A INPUT -j LOG --log-level 7 --log-prefix "iptables: INPUT: " - #${IPT} -A OUTPUT -j LOG --log-level 7 --log-prefix "iptables: OUTPUT: " - - - ;; - esac + echo "clear all iptables tables" + #nohup bash /etc/iptables/ipt-start.sh & + nohup bash /etc/iptables/ipt-start.sh & ;; stop) - echo "clear all iptables tables" - clear_ipt - # Set Default Rules - ${IPT} -P INPUT DROP - ${IPT} -P FORWARD DROP - ${IPT} -P OUTPUT DROP - - ${IPT} -A FORWARD -j LOG --log-level 7 --log-prefix "iptables: FORWARD: " - ${IPT} -A INPUT -j LOG --log-level 7 --log-prefix "iptables: INPUT: " - ${IPT} -A OUTPUT -j LOG --log-level 7 --log-prefix "iptables: OUTPUT: " - - + echo "clear all iptables tables" + nohup bash /etc/iptables/ipt-stop.sh & ;; restart) - clear_ipt - $0 start + $0 start ;; status) - ${IPT} -v + /usr/sbin/iptables -L -n -v ;; *) echo "Usage: $0 [start|stop]" diff --git a/core/conf/rc.d/net b/core/conf/rc.d/net index 07c46a5..a4c566a 100755 --- a/core/conf/rc.d/net +++ b/core/conf/rc.d/net @@ -8,15 +8,20 @@ TYPE="DHCP" # For "static" connections, specify your settings here: # To see your available devices run "ip link". -DEV=enp11s0 +DEV=ens3 ADDR=192.168.1.100 MASK=24 GW=192.168.1.1 # Optional settings: -#DHCPOPTS="-h $(/bin/hostname) -C resolv.conf $DEV" DHCPOPTS="-t 10" +/sbin/ifconfig dummy down > /dev/null 2>&1 +/sbin/ifconfig dummy0 down > /dev/null 2>&1 +/sbin/ifconfig ifb0 down > /dev/null 2>&1 +/sbin/ifconfig ifb1 down > /dev/null 2>&1 +/sbin/ifconfig bond0 down > /dev/null 2>&1 + case $1 in start) if [ "${TYPE}" = "DHCP" ]; then @@ -31,15 +36,9 @@ case $1 in if [ "${TYPE}" = "DHCP" ]; then /sbin/dhcpcd -x else - #/sbin/ip route del default - #/sbin/ip link set ${DEV} down - #/sbin/ip addr del ${ADDR}/${MASK} dev ${DEV} - - /sbin/ip route del default dev ${DEV} - /sbin/ip route flush dev ${DEV} - /sbin/ip link set ${DEV} down - /sbin/ip addr flush dev ${DEV} - + /sbin/ip route del default + /sbin/ip link set ${DEV} down + /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV} fi ;; restart) @@ -52,3 +51,4 @@ case $1 in esac # End of file + diff --git a/core/conf/rc.d/postgresql b/core/conf/rc.d/postgresql new file mode 100755 index 0000000..5f0762a --- /dev/null +++ b/core/conf/rc.d/postgresql @@ -0,0 +1,16 @@ +# +# /etc/rc.d/postgresql: start, stop or restart PostgreSQL server postmaster +# + +PG_DATA=/srv/pgsql/data + +case "$1" in + start|stop|status|restart|reload) + sudo -u postgres pg_ctl -D "$PG_DATA" -l /var/log/postgresql "$1" + ;; + *) + echo "usage: $0 start|stop|restart|reload|status" + ;; +esac + +# End of file diff --git a/core/conf/rc.d/wlan b/core/conf/rc.d/wlan index c9c60ec..9a2f935 100755 --- a/core/conf/rc.d/wlan +++ b/core/conf/rc.d/wlan @@ -3,11 +3,8 @@ # /etc/rc.d/wlan: start/stop wireless interface # -# Connection type: "DHCP" or "static" -#TYPE="DHCP" -TYPE="static" +DEV=wlp3s0 -DEV=wlp7s0 SSD=/sbin/start-stop-daemon PROG_DHCP=/sbin/dhcpcd @@ -18,10 +15,6 @@ PID_WIFI=/var/run/wpa_supplicant.pid OPTS_DHCP="--waitip -h $(/bin/hostname) -z $DEV" OPTS_WIFI="-B -P $PID_WIFI -D nl80211,wext -c /etc/wpa_supplicant.conf -i $DEV" -ADDR=192.168.1.67 -MASK=24 -GW=192.168.1.254 - print_status() { $SSD --status --pidfile $2 @@ -35,37 +28,14 @@ print_status() { case $1 in start) - - if [ "${TYPE}" = "DHCP" ]; then - $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \ - $SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP - RETVAL=$? - else - - /sbin/ip link set ${DEV} up - - $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI - - RETVAL=$? - - /sbin/ip addr add ${ADDR}/${MASK} dev ${DEV} broadcast + - /sbin/ip route add default via ${GW} - fi + $SSD --start --pidfile $PID_WIFI --exec $PROG_WIFI -- $OPTS_WIFI && \ + $SSD --start --pidfile $PID_DHCP --exec $PROG_DHCP -- $OPTS_DHCP + RETVAL=$? ;; stop) - - if [ "${TYPE}" = "DHCP" ]; then - ( $SSD --stop --retry 10 --pidfile $PID_DHCP - $SSD --stop --retry 10 --pidfile $PID_WIFI ) - RETVAL=$? - else - $SSD --stop --retry 10 --pidfile $PID_WIFI - RETVAL=$? - - /sbin/ip link set ${DEV} down - /sbin/ip route del default - /sbin/ip addr del ${ADDR}/${MASK} dev ${DEV} - fi + ( $SSD --stop --retry 10 --pidfile $PID_DHCP + $SSD --stop --retry 10 --pidfile $PID_WIFI ) + RETVAL=$? ;; restart) $0 stop @@ -83,3 +53,4 @@ esac exit $RETVAL # End of file + |