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 | 80 | ||||
-rwxr-xr-x | core/conf/rc.d/postgresql | 16 |
4 files changed, 129 insertions, 51 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..893b087 100644 --- a/core/conf/rc.d/iptables +++ b/core/conf/rc.d/iptables @@ -1,55 +1,46 @@ #!/bin/bash -IPT="/usr/sbin/iptables" -#TYPE=bridge +. /etc/iptables/ipt-conf.sh +. /etc/iptables/ipt-firewall.sh + +TYPE=bridge #TYPE=server -TYPE=open +#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 + #ipt_clear + echo "setting bridge network..." + echo 1 > /proc/sys/net/ipv4/ip_forward - ## load bridge configuration - iptables-restore /etc/iptables/bridge.v4 + ## load bridge configuration + #iptables-restore /etc/iptables/bridge.v4 + #iptables-restore /etc/iptables/bridge.v6 + bash /etc/iptables/ipt-bridge.sh ;; server) - clear_ipt - echo "setting server network..." - ## load server configuration - iptables-restore /etc/iptables/server.v4 - + #ipt_clear + echo "setting server network..." + ## load server configuration + #iptables-restore /etc/iptables/server.v4 + #iptables-restore /etc/iptables/server.v6 + bash /etc/iptables/ipt-server.sh ;; client) - clear_ipt - echo "setting client network..." - ## load client configuration - iptables-restore /etc/iptables/client.v4 + #ipt_clear + echo "setting client network..." + ## load client configuration + #iptables-restore /etc/iptables/client.v4 + bash /etc/iptables/ipt-client.sh ;; open) - clear_ipt - echo "setting open network..." - ## load client configuration + ipt_clear + echo "setting open network..." + ## load client configuration ${IPT} -P INPUT DROP ${IPT} -P FORWARD DROP @@ -65,29 +56,16 @@ case $1 in ${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 ;; 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: " - - + ipt_clear + ipt_tables ;; restart) - clear_ipt - $0 start + $0 start ;; status) ${IPT} -v 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 |