diff options
Diffstat (limited to 'core/conf/rc.d')
-rwxr-xr-x | core/conf/rc.d/distccd | 33 | ||||
-rw-r--r-- | core/conf/rc.d/iptables | 83 |
2 files changed, 86 insertions, 30 deletions
diff --git a/core/conf/rc.d/distccd b/core/conf/rc.d/distccd new file mode 100755 index 0000000..65a166d --- /dev/null +++ b/core/conf/rc.d/distccd @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# +# /etc/rc.d/distccd: start/stop distcc daemon +# + +. /etc/distcc.conf +if [ -z "$DISTCC_ALLOW" ]; then + echo "Please define a range of IPs allowed to connect to this distccd" + echo "host in DISTCC_ALLOW in /etc/rc.conf. More detailed information" + echo "can be found in the distcc's README package." + exit 1 +fi + +DISTCC_USER="${DISTCC_USER:=nobody}" +DISTCC_LOG_LEVEL="${DISTCC_LOG_LEVEL:=notice}" + +case $1 in +start) + /usr/sbin/distccd --daemon --user "$DISTCC_USER" --allow "$DISTCC_ALLOW" --log-level "$DISTCC_LOG_LEVEL" + ;; +stop) + killall -q /usr/sbin/distccd + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/core/conf/rc.d/iptables b/core/conf/rc.d/iptables index 9471f99..cc7c765 100644 --- a/core/conf/rc.d/iptables +++ b/core/conf/rc.d/iptables @@ -1,39 +1,62 @@ -source /etc/iptables/ipt-conf.sh -source /etc/iptables/ipt-firewall.sh +IPT="/usr/sbin/iptables" +TYPE=bridge +#TYPE=server +#TYPE=open + +echo "clear all iptables tables" + +${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 + +# Set Default Rules +${IPT} -P INPUT DROP +${IPT} -P FORWARD DROP +${IPT} -P OUTPUT DROP + +${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 case $1 in start) - ipt_clear - ipt_tables - case $TYPE in - bridge) - source /etc/iptables/ipt-bridge.sh - - ## log everything else and drop - ipt_log - - iptables-save > /etc/iptables/bridge.v4 - ;; - server) - source /etc/iptables/iptables-conf.sh - - ## log everything else and drop - ipt_log - - iptables-save > /etc/iptables/net.v4 - ;; - esac - ;; - stop) + case $TYPE in + bridge) + + echo "setting bridge network..." + echo 1 > /proc/sys/net/ipv4/ip_forward + + ## load bridge configuration + iptables-restore /etc/iptables/bridge.v4 + + ;; + server) + + echo "setting server network..." + ## load server configuration + iptables-restore /etc/iptables/server.v4 - ipt_clear ;; - restart) - $0 stop - $0 start + open) + + echo "setting client network..." + ## load client configuration + iptables-restore /etc/iptables/open.v4 + ;; + esac + ;; + stop) + + ;; *) - echo "Usage: $0 [start|stop|restart]" - ;; + echo "Usage: $0 [start|stop]" + ;; esac |