- import of strongswan-2.7.0

- applied patch for charon
This commit is contained in:
Martin Willi
2006-04-28 07:14:48 +00:00
parent 52923c9acb
commit 997358a6c4
2043 changed files with 346842 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
HOSTNAME=alice
+11
View File
@@ -0,0 +1,11 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_ALICE broadcast 10.1.255.255 netmask 255.255.0.0"
# For setting the default gateway
#
gateway="eth0/PH_IP1_MOON"
+74
View File
@@ -0,0 +1,74 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow IKE
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow NAT-T
iptables -A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+25
View File
@@ -0,0 +1,25 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
nat_traversal=yes
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn nat-t
left=%defaultroute
leftcert=aliceCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_SUN
[email protected]
rightsubnet=10.2.0.0/16
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMDE0NVoXDTE0MDkwODExMDE0NVowRTELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xGzAZBgNVBAMTEnN0cm9u
Z1N3YW4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL/y
X2LqPVZuWLPIeknK86xhz6ljd3NNhC2z+P1uoCP3sBMuZiZQEjFzhnKcbXxCeo2f
FnvhOOjrrisSuVkzuu82oxXD3fIkzuS7m9V4E10EZzgmKWIf+WuNRfbgAuUINmLc
4YGAXBQLPyzpP4Ou48hhz/YQo58Bics6PHy5v34qCVROIXDvqhj91P8g+pS+F21/
7P+CH2jRcVIEHZtG8M/PweTPQ95dPzpYd2Ov6SZ/U7EWmbMmT8VcUYn1aChxFmy5
gweVBWlkH6MP+1DeE0/tL5c87xo5KCeGK8Tdqpe7sBRC4pPEEHDQciTUvkeuJ1Pr
K+1LwdqRxo7HgMRiDw8CAwEAAaOBrzCBrDAPBgNVHRMBAf8EBTADAQH/MAsGA1Ud
DwQEAwIBBjAdBgNVHQ4EFgQUXafdcAZRMn7ntm2zteXgYOouTe8wbQYDVR0jBGYw
ZIAUXafdcAZRMn7ntm2zteXgY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9DcEEc1M5lKlEgrwohT8/fQNsMB2edxacvApO
u3S/yPmPFaTAXio2e2gicP0CgYEAp3PjM02PDu14RUypdTjAL7YxjErwcPdSXpc0
H8pOm9mKOlyrPLbGJ3IiJnhyETW5iBovS4iWIXNoStSTaxfN2vI72rt6sz0WzJdD
idD7X3oezzboXwjaIANDqkV6LhGwuLXa898/yCLjErRzZ0kzptiRCnT3w9pjrK3w
/rN7v2sCgYAEwfgrwjb7+JUaSSaf6TlbM9/ZuTRBVN0OTQz2JVhokeAePeFjHzXt
nzJI2ETYlIu6e1VaFzHb6dp84PzWfLV7Kk8hZqJeCQN4RmQ04oNBllWoOZPbN7oa
8pAMk/DCsBxcM/GvnDQJlDVLQRyY64zJU8EI0rF1t+zosIyGtXom/A==
-----END RSA PRIVATE KEY-----
+9
View File
@@ -0,0 +1,9 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA aliceKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+1
View File
@@ -0,0 +1 @@
HOSTNAME=bob
+10
View File
@@ -0,0 +1,10 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_BOB broadcast 10.2.255.255 netmask 255.255.0.0"
# For setting the default gateway
#
gateway="eth0/PH_IP1_SUN"
+74
View File
@@ -0,0 +1,74 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow IKE
iptables -A INPUT -i eth0 -p udp --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --sport 500 -j ACCEPT
# allow NAT-T
iptables -A INPUT -i eth0 -p udp --dport 4500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+24
View File
@@ -0,0 +1,24 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
nat_traversal=yes
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn nat-t
left=%defaultroute
leftcert=bobCert.pem
[email protected]
leftfirewall=yes
right=%any
rightsubnetwithin=10.1.0.0/16
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMDE0NVoXDTE0MDkwODExMDE0NVowRTELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xGzAZBgNVBAMTEnN0cm9u
Z1N3YW4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL/y
X2LqPVZuWLPIeknK86xhz6ljd3NNhC2z+P1uoCP3sBMuZiZQEjFzhnKcbXxCeo2f
FnvhOOjrrisSuVkzuu82oxXD3fIkzuS7m9V4E10EZzgmKWIf+WuNRfbgAuUINmLc
4YGAXBQLPyzpP4Ou48hhz/YQo58Bics6PHy5v34qCVROIXDvqhj91P8g+pS+F21/
7P+CH2jRcVIEHZtG8M/PweTPQ95dPzpYd2Ov6SZ/U7EWmbMmT8VcUYn1aChxFmy5
gweVBWlkH6MP+1DeE0/tL5c87xo5KCeGK8Tdqpe7sBRC4pPEEHDQciTUvkeuJ1Pr
K+1LwdqRxo7HgMRiDw8CAwEAAaOBrzCBrDAPBgNVHRMBAf8EBTADAQH/MAsGA1Ud
DwQEAwIBBjAdBgNVHQ4EFgQUXafdcAZRMn7ntm2zteXgYOouTe8wbQYDVR0jBGYw
ZIAUXafdcAZRMn7ntm2zteXgYOouTe+hSaRHMEUxCzAJ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Dt3/l/Uwhk8Zwz2vHx2lKhMei+rpuXbLl
EaoEh5yPHZ87F9Dr4Tbw7AUCgYAjtFpmE2AlWdPtsofdypUwkjmStvUuh7ptWcbk
N5fv/7EDdE1NKDAg4Y3uZSMVmy27PVXqUY1QdZaYl356DaqP1dRuEAJ/UDE/fUQj
DlIWT/Re0pFRwQxwaUAY+oOStZHUsL8G9SliB43a1FO0jm/h8LIoZBBCX+ItUGfY
RBZ+UwKBgCToB2oPwDfrfCkScNozV7GPfcmHTR5bvvpYgRMGyuE1hAwLIWW9V4u9
1Bp1vCR/C4kiUSBpYsGXLRqJ1GURueQoEbREE4ZvkmNV+t40uX3Fd8/OchAGi934
0jYmd3dvN4MtF7O02YwpBzuH/wAwdxK0iDbdv+KEZb7TLdL37IN1
-----END RSA PRIVATE KEY-----
+8
View File
@@ -0,0 +1,8 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA bobKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+1
View File
@@ -0,0 +1 @@
HOSTNAME=carol
+10
View File
@@ -0,0 +1,10 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_CAROL broadcast 192.168.0.255 netmask 255.255.255.0"
# For setting the default gateway
#
gateway="eth0/192.168.0.254"
+73
View File
@@ -0,0 +1,73 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow esp
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
# allow IKE
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+29
View File
@@ -0,0 +1,29 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn home
left=PH_IP_CAROL
leftnexthop=%direct
leftcert=carolCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMDE0NVoXDTE0MDkwODExMDE0NVowRTELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xGzAZBgNVBAMTEnN0cm9u
Z1N3YW4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL/y
X2LqPVZuWLPIeknK86xhz6ljd3NNhC2z+P1uoCP3sBMuZiZQEjFzhnKcbXxCeo2f
FnvhOOjrrisSuVkzuu82oxXD3fIkzuS7m9V4E10EZzgmKWIf+WuNRfbgAuUINmLc
4YGAXBQLPyzpP4Ou48hhz/YQo58Bics6PHy5v34qCVROIXDvqhj91P8g+pS+F21/
7P+CH2jRcVIEHZtG8M/PweTPQ95dPzpYd2Ov6SZ/U7EWmbMmT8VcUYn1aChxFmy5
gweVBWlkH6MP+1DeE0/tL5c87xo5KCeGK8Tdqpe7sBRC4pPEEHDQciTUvkeuJ1Pr
K+1LwdqRxo7HgMRiDw8CAwEAAaOBrzCBrDAPBgNVHRMBAf8EBTADAQH/MAsGA1Ud
DwQEAwIBBjAdBgNVHQ4EFgQUXafdcAZRMn7ntm2zteXgYOouTe8wbQYDVR0jBGYw
ZIAUXafdcAZRMn7ntm2zteXgYOouTe+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xSEGuInJScfo6vVCC3hNf3cpy
d/Zg0FBH9a5zBIv7fM9t63ECgYAosrSt5I68cNDcA1IWJOGgmS47cYJqxGLbtA1K
3UMMwx08592qGXsktIs3dIuuOBs2MAbYZg9+3Btg3/fS8KS576CEEpBpTHCIrWky
fvSBZ+EXngyQi2J4qyYOXijdNpBvbNrLOeEPSNv4di39D05DLITbLJgoUBnwy3Fj
ZWNR+QKBgEKn19f5QWs/O1DPWBXfvCSc01cuSUx20a6Z3B6Lxj+7MuXBjVxPkGge
kEaZnNzwgm+QQ1C51nIn9gY4LZx7OxMy0idEss76aRq4Lb7I6XakBrCQLQ9IiTkv
gNOeJYGsQv7tkIWWRlBIXjSBGwT6HzTEfN5cvdHSDzARGFGjwYfK
-----END RSA PRIVATE KEY-----
+7
View File
@@ -0,0 +1,7 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA carolKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+1
View File
@@ -0,0 +1 @@
HOSTNAME=dave
+10
View File
@@ -0,0 +1,10 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_DAVE broadcast 192.168.0.255 netmask 255.255.255.0"
# For setting the default gateway
#
gateway="eth0/192.168.0.254"
+73
View File
@@ -0,0 +1,73 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow esp
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
# allow IKE
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+24
View File
@@ -0,0 +1,24 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn home
left=PH_IP_DAVE
leftcert=daveCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMDE0NVoXDTE0MDkwODExMDE0NVowRTELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xGzAZBgNVBAMTEnN0cm9u
Z1N3YW4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL/y
X2LqPVZuWLPIeknK86xhz6ljd3NNhC2z+P1uoCP3sBMuZiZQEjFzhnKcbXxCeo2f
FnvhOOjrrisSuVkzuu82oxXD3fIkzuS7m9V4E10EZzgmKWIf+WuNRfbgAuUINmLc
4YGAXBQLPyzpP4Ou48hhz/YQo58Bics6PHy5v34qCVROIXDvqhj91P8g+pS+F21/
7P+CH2jRcVIEHZtG8M/PweTPQ95dPzpYd2Ov6SZ/U7EWmbMmT8VcUYn1aChxFmy5
gweVBWlkH6MP+1DeE0/tL5c87xo5KCeGK8Tdqpe7sBRC4pPEEHDQciTUvkeuJ1Pr
K+1LwdqRxo7HgMRiDw8CAwEAAaOBrzCBrDAPBgNVHRMBAf8EBTADAQH/MAsGA1Ud
DwQEAwIBBjAdBgNVHQ4EFgQUXafdcAZRMn7ntm2zteXgYOouTe8wbQYDVR0jBGYw
ZIAUXafdcAZRMn7ntm2zteXgYOouTe+hSaRHMEUxCzAJBgNVBAYTAkNIMRk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wc62tf7Bp9qx
t5WOeGQkCCqMVC8D6n6uwDixAoGABV4jErfdzgLWnT01p98xVPTkqPIDitRFOeBF
QZc4O1d5+quy4ZziNjeMs2G9w86aSIp0GDFo2NRdVLtRnpande+U/m5UShnN42C7
AoAtz8NWlG5mvFxExFaRjX9QcEXlu/KnECkbE3Qs/wewNEXkk3f+VywSfkAJ3f/P
6bVvot0CgYBA1B9SXYhclR3KNZJPRuTn9OQ/TqLmcCMN62dIhPW4WZo2ixZH3YdS
PE/bYmYfZUPt7MnOSNSnuLKineIf1Dipz0gjuSyFGAs5DE+N+8GWYo00n+0e3TLL
pcBj4nOdIVPTZ31IFeVbi06dCYmzLPAGDeLe1M1Z7fakNky1Wv+Sdg==
-----END RSA PRIVATE KEY-----
+7
View File
@@ -0,0 +1,7 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA daveKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+34
View File
@@ -0,0 +1,34 @@
# /etc/hosts: This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server. Just add the names, addresses
# and any aliases to this file...
#
127.0.0.1 localhost
192.168.0.254 uml0.strongswan.org uml0
10.1.0.254 uml1.strongswan.org uml1
10.2.0.254 uml1.strongswan.org uml2
PH_IP_ALICE alice.strongswan.org alice
PH_IP_VENUS venus.strongswan.org venus
PH_IP1_MOON moon1.strongswan.org moon1
PH_IP_MOON moon.strongswan.org moon
PH_IP_CAROL carol.strongswan.org carol
PH_IP1_CAROL carol1.strongswan.org carol1
PH_IP_WINNETOU winnetou.strongswan.org winnetou crl.strongswan.org ocsp.strongswan.org ldap.strongswan.org
PH_IP_DAVE dave.strongswan.org dave
PH_IP1_DAVE dave1.strongswan.org dave1
PH_IP_SUN sun.strongswan.org sun
PH_IP1_SUN sun1.strongswan.org sun1
PH_IP_BOB bob.strongswan.org bob
# IPV6 versions of localhost and co
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
+1
View File
@@ -0,0 +1 @@
HOSTNAME=moon
+11
View File
@@ -0,0 +1,11 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_MOON broadcast 192.168.0.255 netmask 255.255.255.0"
iface_eth1="PH_IP1_MOON broadcast 10.1.255.255 netmask 255.255.0.0"
# For setting the default gateway
#
gateway="eth0/192.168.0.254"
+76
View File
@@ -0,0 +1,76 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow esp
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
# allow IKE
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+36
View File
@@ -0,0 +1,36 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
left=192.168.0.1
leftnexthop=%direct
leftcert=moonCert.pem
[email protected]
leftfirewall=yes
conn net-net
leftsubnet=10.1.0.0/16
right=192.168.0.2
rightsubnet=10.2.0.0/16
[email protected]
auto=add
conn host-host
right=192.168.0.2
[email protected]
auto=add
conn rw
leftsubnet=10.1.0.0/16
right=%any
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMDE0NVoXDTE0MDkwODExMDE0NVowRTELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xGzAZBgNVBAMTEnN0cm9u
Z1N3YW4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL/y
X2LqPVZuWLPIeknK86xhz6ljd3NNhC2z+P1uoCP3sBMuZiZQEjFzhnKcbXxCeo2f
FnvhOOjrrisSuVkz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2171aDJQOWdNV3WQtexUKEhC4Ewn
yXEDoVGAXJtiCj34QYHjoMEHUqfabKyWKUcaK8hbMsOhYPOorfLXg9MCgYEAwpaP
W68NJGu5Zxsdz62rOiPNb58cuoxLDZsJ1sMKJO7BdPIqTZ0oGNdgt5phyc3ROBSH
cjqZdzpim1gXGm4ocGvwg3APNQN6DLBknJNZmHzPd7RLSz2UxhTHRTfHAltQPcmW
cJVBHsrsS0QnvDndXfzLuLq12S6UZasR5eBdcxkCgYEAizBuOI6DdGG4nceG8lbH
mRwY8xtq3h66d7skLMBxp9ByaVS76bYsrCZVn6Fl0EtlNuMUb52uRzPIO3F9FwUA
MFHoHpC1YibKwYdAwKcAm07T7950x/eVDm+NLB2VHDBHfruLQogiubEF4/VKSaA2
Xm1/iVaD9bJzAZw7vWY9/BkCgYB/Xe9uErGmgkB0BaLIuiNWxfKFOn+id4v01uNk
yHtOW10TgCNCdDi3sdpjs1CIuAhXDdDuav7itLuwdMOCkFI16+EdF29Mwv7TaW4h
sq01i5R9BO03zZIg6Z7ZZr4Dg+OM3fNzs65RSn/KcE0V/kYwa/So8MVw5/VIauYn
MmnYmQKBgDEFWQPyPH242olRqtE0yDp8qVHEjJp7mU822YFbyCyAUnttqOS+/5/u
Z7H95QZHGaQESL1tcNnaiRASJAKDWjKOdM/TTotWjCn65v+DHvgk/IJeYJVHoGBS
pBE+wJ8AZJu3t9GVp3PxFxHIjxUrEKG0rli7bYv8F245+Wx8DeXI
-----END RSA PRIVATE KEY-----
+7
View File
@@ -0,0 +1,7 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA moonKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+1
View File
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAsxKfTm05po6leGD8C+M0eAR5EE4s1pQXc0D/dVlqrmfZ65h5BFQY9lnwpCvapV6OVqKWx8ICmeIH3OhaPxPPNKlU81f3d0xgh8BRJpWh459DYkRVa5f7ax5eeFE1lelj9s1d0seUl/IZolpJ8Wmt9TN1hwJ0mrkwN4670rb3urc=
+1
View File
@@ -0,0 +1 @@
HOSTNAME=sun
+13
View File
@@ -0,0 +1,13 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_SUN broadcast 192.168.0.255 netmask 255.255.255.0"
iface_eth1="PH_IP1_SUN broadcast 10.2.255.255 netmask 255.255.0.0"
# For setting the default gateway
#
gateway="eth0/192.168.0.254"
+80
View File
@@ -0,0 +1,80 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow esp
iptables -A INPUT -i eth0 -p 50 -j ACCEPT
iptables -A OUTPUT -o eth0 -p 50 -j ACCEPT
# allow IKE
iptables -A INPUT -i eth0 -p udp --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --sport 500 -j ACCEPT
# allow NAT-T
iptables -A INPUT -i eth0 -p udp --dport 4500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --sport 4500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+37
View File
@@ -0,0 +1,37 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
nat_traversal=yes
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
left=PH_IP_SUN
leftcert=sunCert.pem
[email protected]
leftfirewall=yes
conn net-net
leftsubnet=10.2.0.0/16
right=PH_IP_MOON
rightsubnet=10.1.0.0/16
[email protected]
auto=add
conn host-host
right=PH_IP_MOON
[email protected]
auto=add
conn nat-t
leftsubnet=10.2.0.0/16
right=%any
rightsubnetwithin=10.1.0.0/16
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMDE0NVoXDTE0MDkwODExMDE0NVowRTELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xGzAZBgNVBAMTEnN0cm9u
Z1N3YW4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL/y
X2LqPVZuWLPIeknK86xhz6ljd3NNhC2z+P1uoCP3sBMuZiZQEjFzhnKcbXxCeo2f
FnvhOOjrrisSuVkzuu82oxXD3fIkzuS7m9V4E10EZzgmKWIf+WuNRfbgAuUINmLc
4YGAXBQLPyzpP4Ou48hhz/YQo58Bics6PHy5v34qCVROIXDvqhj91P8g+pS+F21/
7P+CH2jRcVIEHZtG8M/PweTPQ95dPzpYd2Ov6SZ/U7EWmbMmT8VcUYn1aChxFmy5
gweVBWlkH6MP+1DeE0/tL5c87xo5KCeGK8Tdqpe7sBRC4pPEEHDQciTUvkeuJ1Pr
K+1LwdqRxo7HgMRiDw8CAwEAAaOBrzCBrDAPBgNVHRMBAf8EBTADAQH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mpo0FH6L
Pq69CqZ4QPkELaYSNhi7It7/BpAVhbfRyAWPxrwhUMy5beDlkNv4ToXv+yK4A3yp
6+HR0rlXAtCQKTt5yLoUMz3iM531n2UwjZAUhf0IOP1CZpWRP9ZlrfdUi/C4eo4k
ECOlPeBryN5brGTY4w58IwKBgQC0ukRF2I+qoP/mNg4Yu2KtfM4jlG4072G+P9eF
PhSO9p+pCkhKbFD8RWDWUsslJmL09OXIkmkP4zIYmvieLOLFEjLHZi2YGER/SuMg
9B74EQsKW5sK5hF9AXOsIaQI04Hu0lFAlHbC11euAiMShOdNiMG4d3ArSVVK+bb+
hsAP0QKBgHcJuTJ6dv77evW3MFZPRjFH25pike40PWmSLgCt5PV25DRL2UG0pOut
uybN9biQK5v377/3GD7eOL+acxHODjWmmfeEFW0YlJ1oUb/P8NlqsSnHvUoIqa24
JmTXS/XzjgxQFFfzo0c1/1JLdG6r5CLTWxHq1EhIOJsowTlrCzX/
-----END RSA PRIVATE KEY-----
+8
View File
@@ -0,0 +1,8 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA sunKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+1
View File
@@ -0,0 +1 @@
HOSTNAME=venus
+11
View File
@@ -0,0 +1,11 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_VENUS broadcast 10.1.255.255 netmask 255.255.0.0"
# For setting the default gateway
#
gateway="eth0/PH_IP1_MOON"
+74
View File
@@ -0,0 +1,74 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="start stop reload"
depend() {
before net
need logger
}
start() {
ebegin "Starting firewall"
# default policy is DROP
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT DROP
/sbin/iptables -P FORWARD DROP
# allow IKE
iptables -A INPUT -i eth0 -p udp --sport 500 --dport 500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 500 --sport 500 -j ACCEPT
# allow NAT-T
iptables -A INPUT -i eth0 -p udp --sport 4500 --dport 4500 -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 4500 --sport 4500 -j ACCEPT
# allow crl fetch from winnetou
iptables -A INPUT -i eth0 -p tcp --sport 80 -s PH_IP_WINNETOU -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -d PH_IP_WINNETOU -j ACCEPT
# allow ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
eend $?
}
stop() {
ebegin "Stopping firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
if [ $a == nat ]; then
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
elif [ $a == mangle ]; then
/sbin/iptables -t mangle -P PREROUTING ACCEPT
/sbin/iptables -t mangle -P INPUT ACCEPT
/sbin/iptables -t mangle -P FORWARD ACCEPT
/sbin/iptables -t mangle -P OUTPUT ACCEPT
/sbin/iptables -t mangle -P POSTROUTING ACCEPT
elif [ $a == filter ]; then
/sbin/iptables -t filter -P INPUT ACCEPT
/sbin/iptables -t filter -P FORWARD ACCEPT
/sbin/iptables -t filter -P OUTPUT ACCEPT
fi
done
eend $?
}
reload() {
ebegin "Flushing firewall"
for a in `cat /proc/net/ip_tables_names`; do
/sbin/iptables -F -t $a
/sbin/iptables -X -t $a
done;
eend $?
start
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+25
View File
@@ -0,0 +1,25 @@
# /etc/ipsec.conf - strongSwan IPsec configuration file
version 2.0 # conforms to second version of ipsec.conf specification
config setup
plutodebug=control
crlcheckinterval=180
strictcrlpolicy=no
nat_traversal=yes
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
conn nat-t
left=%defaultroute
leftcert=venusCert.pem
[email protected]
leftfirewall=yes
right=PH_IP_SUN
[email protected]
rightsubnet=10.2.0.0/16
auto=add
@@ -0,0 +1,22 @@
-----BEGIN CERTI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5FlY5kbmZcs
6wlSBkAzzKb7WbPNgbGLMAYP+EXKODe+f1nzP+oojmJlCdTLfrudREFA2ZGGOKDX
0o2EhnGL7VB4Upuw5ddMs7s1v6pqUKQXrZQUb24AX8w/1n+0PEM=
-----END RSA PRIVATE KEY-----
+8
View File
@@ -0,0 +1,8 @@
# /etc/ipsec.secrets - strongSwan IPsec secrets file
: RSA venusKey.pem
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtTCCAp2gAwIBAgIBADANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3d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oMEn3qUPSrh3CdBfi3KTQAQn2Mlk7bGHh9ICWi3vA==
-----END RSA PRIVATE KEY-----
+52
View File
@@ -0,0 +1,52 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/strongswan/testing/hosts/winnetou/etc/conf.d/apache2,v 1.2 2006/01/06 12:21:21 as Exp $
# Config file for /etc/init.d/apache2
# An example from /etc/apache2/conf/modules.d/40_mod_ssl.conf:
#
# <IfDefine SSL>
# <IfModule !mod_ssl.c>
# LoadModule ssl_module extramodules/mod_ssl.so
# </IfModule>
# </IfDefine>
#
# This means that the mod_ssl.so DSO module is only loaded
# into the server when you pass "-D SSL" at startup. To
# enable WebDAV, add "-D DAV -D DAV_FS". If you installed
# mod_php then add "-D PHP4". For more options, please
# read the files in the /etc/apache2/conf/modules.d directory.
APACHE2_OPTS="-D SSL -D DEFAULT_VHOST"
# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.
# ServerRoot setting
#SERVERROOT=/etc/apache2
# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
#CONFIGFILE=conf/apache2.conf
# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"
# PID file location
# Note that this MUST match the setting in your configuration file!
PIDFILE=/var/run/apache2.pid
# Restart style
# see http://httpd.apache.org/docs-2.0/stopping.html for more details
# the default is 'graceful', the other possible value is 'restart'
# If you use 'graceful', completion of the command does NOT imply that the system
# has finished restarting. Restart is finished only when all child processes
# have finished serving their current request sets. Read the URL for details.
#RESTARTSTYLE="restart"
RESTARTSTYLE="graceful"
@@ -0,0 +1 @@
HOSTNAME=winnetou
+10
View File
@@ -0,0 +1,10 @@
# /etc/conf.d/net:
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_lo="127.0.0.1 netmask 255.0.0.0"
iface_eth0="PH_IP_WINNETOU broadcast 192.168.0.255 netmask 255.255.255.0"
# For setting the default gateway
#
gateway="eth0/192.168.0.254"
+8
View File
@@ -0,0 +1,8 @@
# conf.d file for the openldap-2.1 series
#
# To enable both the standard unciphered server and the ssl encrypted
# one uncomment this line or set any other server starting options
# you may desire.
#
# OPTS="-h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
OPTS="-4"
+1
View File
@@ -0,0 +1 @@
winnetou
+78
View File
@@ -0,0 +1,78 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="${opts} reload"
[ "x${SERVERROOT}" != "x" ] && APACHE2_OPTS="${APACHE2_OPTS} -d ${SERVERROOT}"
[ "x${CONFIGFILE}" != "x" ] && APACHE2_OPTS="${APACHE2_OPTS} -f ${CONFIGFILE}"
[ "x${STARTUPERRORLOG}" != "x" ] && APACHE2_OPTS="${APACHE2_OPTS} -E ${STARTUPERRORLOG}"
# set a default for PIDFILE/RESTARTSTYLE for those that FAILED to follow
# instructiosn and update the conf.d/apache2 file.
# (bug #38787)
[ -z "${PIDFILE}" ] && PIDFILE=/var/run/apache2.pid
[ -z "${RESTARTSTYLE}" ] && RESTARTSTYLE="graceful"
checkconfig() {
local myconf="/etc/apache2/conf/apache2.conf"
if [ "x${CONFIGFILE}" != "x" ]; then
if [ ${CONFIGFILE:0:1} = "/" ]; then
myconf="${CONFIGFILE}"
else
myconf="${SERVERROOT:-/usr/lib/apache2}/${CONFIGFILE}"
fi
fi
if [ ! -r "${myconf}" ]; then
eerror "Unable to read configuration file: ${myconf}"
return 1
fi
if [ -z "${PIDFILE}" ]; then
eerror "\$PIDFILE is not set!"
eerror "Did you etc-update /etc/conf.d/apache2?"
return 1
fi
if [ -z "${RESTARTSTYLE}" ]; then
eerror "\$RESTARTSTYLE is not set!"
eerror "Did you etc-update /etc/conf.d/apache2?"
return 1
fi
/usr/sbin/apache2 -t ${APACHE2_OPTS} 1>/dev/null 2>&1
ret=$?
if [ $ret -ne 0 ]; then
eerror "Apache2 has detected a syntax error in your configuration files:"
/usr/sbin/apache2 -t ${APACHE2_OPTS}
fi
return $ret
}
depend() {
need net
use mysql dns logger netmount postgres
after sshd
}
start() {
checkconfig || return 1
ebegin "Starting apache2"
[ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
[ -f /usr/lib/apache2/build/envvars ] && . /usr/lib/apache2/build/envvars
env -i PATH=$PATH /sbin/start-stop-daemon --quiet \
--start --startas /usr/sbin/apache2 \
--pidfile ${PIDFILE} -- -k start ${APACHE2_OPTS}
eend $?
}
stop() {
ebegin "Stopping apache2"
/usr/sbin/apache2ctl stop >/dev/null
start-stop-daemon -o --quiet --stop --pidfile ${PIDFILE}
eend $?
}
reload() {
# restarting apache2 is much easier than apache1. The server handles most of the work for us.
# see http://httpd.apache.org/docs-2.0/stopping.html for more details
ebegin "Restarting apache2"
/usr/sbin/apache2 ${APACHE2_OPTS} -k ${RESTARTSTYLE}
eend $?
}
+314
View File
@@ -0,0 +1,314 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
#NB: Config is in /etc/conf.d/net
if [[ -n $NET_DEBUG ]]; then
set -x
devnull=/dev/stderr
else
devnull=/dev/null
fi
# For pcmcia users. note that pcmcia must be added to the same
# runlevel as the net.* script that needs it.
depend() {
use hotplug pcmcia
}
checkconfig() {
if [[ -z "${ifconfig_IFACE}" ]]; then
eerror "Please make sure that /etc/conf.d/net has \$ifconfig_$IFACE set"
eerror "(or \$iface_$IFACE for old-style configuration)"
return 1
fi
if [[ -n "${vlans_IFACE}" && ! -x /sbin/vconfig ]]; then
eerror "For VLAN (802.1q) support, emerge net-misc/vconfig"
return 1
fi
}
# Fix bug 50039 (init.d/net.eth0 localization)
# Some other commands in this script might need to be wrapped, but
# we'll get them one-by-one. Note that LC_ALL trumps LC_anything_else
# according to locale(7)
ifconfig() {
LC_ALL=C /sbin/ifconfig "$@"
}
# setup_vars: setup variables based on $1 and content of /etc/conf.d/net
# The following variables are set, which should be declared local by
# the calling routine.
# status_IFACE (up or '')
# vlans_IFACE (space-separated list)
# ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE)
# dhcpcd_IFACE (command-line args for dhcpcd)
# routes_IFACE (array of route lines)
# inet6_IFACE (array of inet6 lines)
# ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails)
setup_vars() {
local i iface="${1//\./_}"
status_IFACE="$(ifconfig ${1} 2>${devnull} | gawk '$1 == "UP" {print "up"}')"
eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\"
eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" )
eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\"
eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" )
eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" )
eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" )
# BACKWARD COMPATIBILITY: populate the ifconfig_IFACE array
# if iface_IFACE is set (fex. iface_eth0 instead of ifconfig_eth0)
eval local iface_IFACE=\"\$\{iface_$iface\}\"
if [[ -n ${iface_IFACE} && -z ${ifconfig_IFACE} ]]; then
# Make sure these get evaluated as arrays
local -a aliases broadcasts netmasks
# Start with the primary interface
ifconfig_IFACE=( "${iface_IFACE}" )
# ..then add aliases
eval aliases=( \$\{alias_$iface\} )
eval broadcasts=( \$\{broadcast_$iface\} )
eval netmasks=( \$\{netmask_$iface\} )
for ((i = 0; i < ${#aliases[@]}; i = i + 1)); do
ifconfig_IFACE[i+1]="${aliases[i]} ${broadcasts[i]:+broadcast ${broadcasts[i]}} ${netmasks[i]:+netmask ${netmasks[i]}}"
done
fi
# BACKWARD COMPATIBILITY: check for space-separated inet6 addresses
if [[ ${#inet6_IFACE[@]} == 1 && ${inet6_IFACE} == *' '* ]]; then
inet6_IFACE=( ${inet6_IFACE} )
fi
}
iface_start() {
local IFACE=${1} i x retval
checkconfig || return 1
if [[ ${ifconfig_IFACE} != dhcp ]]; then
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Bringing ${IFACE} up (${i})"
else
ebegin "Bringing ${IFACE} up"
fi
# ifconfig does not always return failure ..
ifconfig ${IFACE} ${ifconfig_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
# Check that eth0 was not brought up by the kernel ...
if [[ ${status_IFACE} == up ]]; then
einfo "Keeping kernel configuration for ${IFACE}"
else
ebegin "Bringing ${IFACE} up via DHCP"
/sbin/dhcpcd ${dhcpcd_IFACE} ${IFACE}
retval=$?
eend $retval
if [[ $retval == 0 ]]; then
# DHCP succeeded, show address retrieved
i=$(ifconfig ${IFACE} | grep -m1 -o 'inet addr:[^ ]*' |
cut -d: -f2)
[[ -n ${i} ]] && einfo " ${IFACE} received address ${i}"
elif [[ -n "${ifconfig_fallback_IFACE}" ]]; then
# DHCP failed, try fallback.
# Show the address, but catch if this interface will be inet6 only
i=${ifconfig_fallback_IFACE%% *}
if [[ ${i} == *.*.*.* ]]; then
ebegin "Using fallback configuration (${i}) for ${IFACE}"
else
ebegin "Using fallback configuration for ${IFACE}"
fi
ifconfig ${IFACE} ${ifconfig_fallback_IFACE} >${devnull} && \
ifconfig ${IFACE} up &>${devnull}
eend $? || return $?
else
return $retval
fi
fi
fi
if [[ ${#ifconfig_IFACE[@]} -gt 1 ]]; then
einfo " Adding aliases"
for ((i = 1; i < ${#ifconfig_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE}:${i} (${ifconfig_IFACE[i]%% *})"
ifconfig ${IFACE}:${i} ${ifconfig_IFACE[i]}
eend $?
done
fi
if [[ -n ${inet6_IFACE} ]]; then
einfo " Adding inet6 addresses"
for ((i = 0; i < ${#inet6_IFACE[@]}; i = i + 1)); do
ebegin " ${IFACE} inet6 add ${inet6_IFACE[i]}"
ifconfig ${IFACE} inet6 add ${inet6_IFACE[i]} >${devnull}
eend $?
done
fi
# Set static routes
if [[ -n ${routes_IFACE} ]]; then
einfo " Adding routes"
for ((i = 0; i < ${#routes_IFACE[@]}; i = i + 1)); do
ebegin " ${routes_IFACE[i]}"
/sbin/route add ${routes_IFACE[i]}
eend $?
done
fi
# Set default route if applicable to this interface
if [[ ${gateway} == ${IFACE}/* ]]; then
local ogw=$(/bin/netstat -rn | awk '$1 == "0.0.0.0" {print $2}')
local gw=${gateway#*/}
if [[ ${ogw} != ${gw} ]]; then
ebegin " Setting default gateway ($gw)"
# First delete any existing route if it was setup by kernel...
/sbin/route del default dev ${IFACE} &>${devnull}
# Second delete old gateway if it was set...
/sbin/route del default gw ${ogw} &>${devnull}
# Third add our new default gateway
/sbin/route add default gw ${gw} >${devnull}
eend $? || {
true # need to have some command in here
# Note: This originally called stop, which is obviously
# wrong since it's calling with a local version of IFACE.
# The below code works correctly to abort configuration of
# the interface, but is commented because we're assuming
# that default route failure should not cause the interface
# to be unconfigured.
#local error=$?
#ewarn "Aborting configuration of ${IFACE}"
#iface_stop ${IFACE}
#return ${error}
}
fi
fi
# Enabling rp_filter causes wacky packets to be auto-dropped by
# the kernel. Note that we only do this if it is not set via
# /etc/sysctl.conf ...
if [[ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter && \
-z "$(grep -s '^[^#]*rp_filter' /etc/sysctl.conf)" ]]; then
echo -n 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
fi
}
# iface_stop: bring down an interface. Don't trust information in
# /etc/conf.d/net since the configuration might have changed since
# iface_start ran. Instead query for current configuration and bring
# down the interface.
iface_stop() {
local IFACE=${1} i x aliases inet6 count
# Try to do a simple down (no aliases, no inet6, no dhcp)
aliases="$(ifconfig | grep -o "^$IFACE:[0-9]*" | tac)"
inet6="$(ifconfig ${IFACE} | awk '$1 == "inet6" {print $2}')"
if [[ -z ${aliases} && -z ${inet6} && ! -e /var/run/dhcpcd-${IFACE}.pid ]]; then
ebegin "Bringing ${IFACE} down"
ifconfig ${IFACE} down &>/dev/null
eend 0
return 0
fi
einfo "Bringing ${IFACE} down"
# Stop aliases before primary interface.
# Note this must be done in reverse order, since ifconfig eth0:1
# will remove eth0:2, etc. It might be sufficient to simply remove
# the base interface but we're being safe here.
for i in ${aliases} ${IFACE}; do
# Delete all the inet6 addresses for this interface
inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')"
if [[ -n ${inet6} ]]; then
einfo " Removing inet6 addresses"
for x in ${inet6}; do
ebegin " ${IFACE} inet6 del ${x}"
ifconfig ${i} inet6 del ${x}
eend $?
done
fi
# Stop DHCP (should be N/A for aliases)
# Don't trust current configuration... investigate ourselves
if /sbin/dhcpcd -z ${i} &>${devnull}; then
ebegin " Releasing DHCP lease for ${IFACE}"
for ((count = 0; count < 9; count = count + 1)); do
/sbin/dhcpcd -z ${i} &>${devnull} || break
sleep 1
done
[[ ${count} -lt 9 ]]
eend $? "Timed out"
fi
ebegin " Stopping ${i}"
ifconfig ${i} down &>${devnull}
eend 0
done
return 0
}
start() {
# These variables are set by setup_vars
local status_IFACE vlans_IFACE dhcpcd_IFACE
local -a ifconfig_IFACE routes_IFACE inet6_IFACE
# Call user-defined preup function if it exists
if [[ $(type -t preup) == function ]]; then
einfo "Running preup function"
preup ${IFACE} || {
eerror "preup ${IFACE} failed"
return 1
}
fi
# Start the primary interface and aliases
setup_vars ${IFACE}
iface_start ${IFACE} || return 1
# Start vlans
local vlan
for vlan in ${vlans_IFACE}; do
/sbin/vconfig add ${IFACE} ${vlan} >${devnull}
setup_vars ${IFACE}.${vlan}
iface_start ${IFACE}.${vlan}
done
# Call user-defined postup function if it exists
if [[ $(type -t postup) == function ]]; then
einfo "Running postup function"
postup ${IFACE}
fi
}
stop() {
# Call user-defined predown function if it exists
if [[ $(type -t predown) == function ]]; then
einfo "Running predown function"
predown ${IFACE}
fi
# Don't depend on setup_vars since configuration might have changed.
# Investigate current configuration instead.
local vlan
for vlan in $(ifconfig | grep -o "^${IFACE}\.[^ ]*"); do
iface_stop ${vlan}
/sbin/vconfig rem ${vlan} >${devnull}
done
iface_stop ${IFACE} || return 1 # always succeeds, btw
# Call user-defined postdown function if it exists
if [[ $(type -t postdown) == function ]]; then
einfo "Running postdown function"
postdown ${IFACE}
fi
}
# vim:ts=4
+25
View File
@@ -0,0 +1,25 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/strongswan/testing/hosts/winnetou/etc/init.d/slapd,v 1.2 2005/05/31 14:04:43 as Exp $
depend() {
need net
}
start() {
ebegin "Starting ldap-server"
eval start-stop-daemon --start --quiet --pidfile /var/run/openldap/slapd.pid --exec /usr/lib/openldap/slapd -- -u ldap -g ldap "${OPTS}"
eend $?
if [ ! -e /var/lib/openldap-data/objectClass.bdb ]
then
sleep 5
ldapadd -x -D "cn=Manager, o=Linux strongSwan, c=CH" -w tuxmux -f /etc/openldap/ldif.txt
fi
}
stop() {
ebegin "Stopping ldap-server"
start-stop-daemon --stop --signal 2 --quiet --pidfile /var/run/openldap/slapd.pid
eend $?
}
@@ -0,0 +1,40 @@
dn: o=Linux strongSwan, c=CH
objectclass: organization
o: Linux strongSwan
dn: cn=Manager,o=Linux strongSwan, c=CH
objectclass: organizationalRole
cn: Manager
dn: cn=strongSwan Root CA, o=Linux strongSwan, c=CH
objectClass: organizationalRole
cn: strongSwan Root CA
objectClass: certificationAuthority
authorityRevocationList;binary:< file:///etc/openssl/strongswan.crl
certificateRevocationList;binary:< file:///etc/openssl/strongswan.crl
cACertificate;binary:< file:///etc/openssl/strongswanCert.der
dn: ou=Research, o=Linux strongSwan, c=CH
objectclass: organizationalUnit
ou: Research
dn: cn=Research CA, ou=Research, o=Linux strongSwan, c=CH
objectClass: organizationalRole
cn: Research CA
objectClass: certificationAuthority
authorityRevocationList;binary:< file:///etc/openssl/research/research.crl
certificateRevocationList;binary:< file:///etc/openssl/research/research.crl
cACertificate;binary:< file:///etc/openssl/research/researchCert.der
dn: ou=Sales, o=Linux strongSwan, c=CH
objectclass: organizationalUnit
ou: Sales
dn: cn=Sales CA, ou=Sales, o=Linux strongSwan, c=CH
objectClass: organizationalRole
cn: Sales CA
objectClass: certificationAuthority
authorityRevocationList;binary:< file:///etc/openssl/sales/sales.crl
certificateRevocationList;binary:< file:///etc/openssl/sales/sales.crl
cACertificate;binary:< file:///etc/openssl/sales/salesCert.der
@@ -0,0 +1,68 @@
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/schema/core.schema
# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
# Load dynamic backend modules:
# modulepath /usr/lib/openldap/openldap
# moduleload back_bdb.la
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!
#######################################################################
# BDB database definitions
#######################################################################
database bdb
checkpoint 32 30 # <kbyte> <min>
suffix "o=Linux strongSwan,c=CH"
rootdn "cn=Manager,o=Linux strongSwan,c=CH"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw tuxmux
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory /var/lib/openldap-data
# Indices to maintain
index objectClass eq
+35
View File
@@ -0,0 +1,35 @@
#! /bin/sh
# generate a certificate revocation list (CRL) for the strongswan CA.
#
# Copyright (C) 2004 Andreas Steffen
# Zuercher Hochschule Winterthur
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# RCSID $Id: generate-crl,v 1.2 2005/03/24 11:19:38 as Exp $
export COMMON_NAME=strongSwan
cd /etc/openssl
openssl ca -config /etc/openssl/openssl.cnf -gencrl -out crl.pem
openssl crl -in crl.pem -outform der -out strongswan.crl
cp strongswan.crl /var/www/localhost/htdocs/
cp strongswanCert.pem /var/www/localhost/htdocs/
cp index.html /var/www/localhost/htdocs/
cd /etc/openssl/research
openssl ca -config /etc/openssl/research/openssl.cnf -gencrl -out crl.pem
openssl crl -in crl.pem -outform der -out research.crl
cp research.crl /var/www/localhost/htdocs/
cd /etc/openssl/sales
openssl ca -config /etc/openssl/sales/openssl.cnf -gencrl -out crl.pem
openssl crl -in crl.pem -outform der -out sales.crl
cp sales.crl /var/www/localhost/htdocs/
@@ -0,0 +1,36 @@
<html>
<head>
<title>strongSwan Web Services</title>
<base target="_self">
</head>
<body bgcolor="#FFFFFF">
<table border=0 cellpadding=0 cellspacing=0 width=600>
<tr><td>
<h2>strongSwan Certification Authority</h2>
<ul>
<li>
<a href="strongswanCert.pem">Root CA Certificate</a>
</li>
</ul>
<ul>
<li>
<a href="strongswan.crl">Certificate Revocation List (CRL)</a>
</li>
</ul>
<h2>strongSwan UML Testing Environment</h2>
<ul>
<li>
<a href="testresults/">UML Test Results</a>
</li>
</ul>
<a href="images/umlArchitecture_large.png" target="_blank">
<img src="images/umlArchitecture_small.png" border="0">
</a>
<hr>
<address>Linux strongSwan (<a href="http://www.strongswan.org">www.strongswan.org</a>)</address>
</td></tr>
</table>
</body>
@@ -0,0 +1,15 @@
V 090909111334Z 01 unknown /C=CH/O=Linux strongSwan/CN=mars.strongswan.org
V 090909111553Z 02 unknown /C=CH/O=Linux strongSwan/CN=sun.strongswan.org
V 090909111725Z 03 unknown /C=CH/O=Linux strongSwan/CN=moon.strongswan.org
V 090909111826Z 04 unknown /C=CH/O=Linux strongSwan/CN=venus.strongswan.org
V 090909112439Z 05 unknown /C=CH/O=Linux strongSwan/OU=Sales/[email protected]
V 090909112534Z 06 unknown /C=CH/O=Linux strongSwan/OU=Research/[email protected]
R 090909112548Z 041226135423Z 07 unknown /C=CH/O=Linux strongSwan/OU=Research/[email protected]
V 090909112651Z 08 unknown /C=CH/O=Linux strongSwan/OU=Accounting/[email protected]
V 091118162928Z 09 unknown /C=CH/O=Linux strongSwan/OU=OCSP Signing Authority/CN=ocsp.strongswan.org
V 091231214318Z 0A unknown /C=CH/O=Linux strongSwan/OU=Research/[email protected]
V 100216084430Z 0B unknown /C=CH/O=Linux strongSwan/OU=Authorization Authority/[email protected]
R 140321062536Z 050621195214Z 0C unknown /C=CH/O=Linux strongSwan/OU=Research/CN=Research CA
V 140321062916Z 0D unknown /C=CH/O=Linux strongSwan/OU=Sales/CN=Sales CA
V 100607191714Z 0E unknown /C=CH/O=Linux strongSwan/CN=winnetou.strongswan.org
V 100620195806Z 0F unknown /C=CH/O=Linux strongSwan/OU=Research/CN=Research CA
@@ -0,0 +1 @@
unique_subject = yes
@@ -0,0 +1 @@
unique_subject = yes
@@ -0,0 +1,14 @@
V 090909111334Z 01 unknown /C=CH/O=Linux strongSwan/CN=mars.strongswan.org
V 090909111553Z 02 unknown /C=CH/O=Linux strongSwan/CN=sun.strongswan.org
V 090909111725Z 03 unknown /C=CH/O=Linux strongSwan/CN=moon.strongswan.org
V 090909111826Z 04 unknown /C=CH/O=Linux strongSwan/CN=venus.strongswan.org
V 090909112439Z 05 unknown /C=CH/O=Linux strongSwan/OU=Sales/[email protected]
V 090909112534Z 06 unknown /C=CH/O=Linux strongSwan/OU=Research/[email protected]
R 090909112548Z 041226135423Z 07 unknown /C=CH/O=Linux strongSwan/OU=Research/[email protected]
V 090909112651Z 08 unknown /C=CH/O=Linux strongSwan/OU=Accounting/[email protected]
V 091118162928Z 09 unknown /C=CH/O=Linux strongSwan/OU=OCSP Signing Authority/CN=ocsp.strongswan.org
V 091231214318Z 0A unknown /C=CH/O=Linux strongSwan/OU=Research/[email protected]
V 100216084430Z 0B unknown /C=CH/O=Linux strongSwan/OU=Authorization Authority/[email protected]
R 140321062536Z 050621195214Z 0C unknown /C=CH/O=Linux strongSwan/OU=Research/CN=Research CA
V 140321062916Z 0D unknown /C=CH/O=Linux strongSwan/OU=Sales/CN=Sales CA
V 100607191714Z 0E unknown /C=CH/O=Linux strongSwan/CN=winnetou.strongswan.org
@@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIIEDTCCAvWgAwIBAgIBATANBgkqhkiG9w0BAQQFADBFMQswCQYDVQQGEwJDSDEZ
MBcGA1UEChMQTGludXggc3Ryb25nU3dhbjEbMBkGA1UEAxMSc3Ryb25nU3dhbiBS
b290IENBMB4XDTA0MDkxMDExMTMzNFoXDTA5MDkwOTExMTMzNFowRjELMAkGA1UE
BhMCQ0gxGTAXBgNVBAoTEExpbnV4IHN0cm9uZ1N3YW4xHDAaBgNVBAMTE21hcnMu
c3Ryb25nc3dhbi5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDA
zRlshdPlLggS7bpAlovamLpk9pxYUv3c8J4W0kV4knMPbSJywfctpce95iPZfU6V
ICV0fVOn/0utJG+0lMTYwcf5zvyIDPDccfsTT3WI+/PcaUpU6E5aaPAZxDG4na6w
UVUKiR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YW4ub3Jn
L3N0cm9uZ3N3YW4uY3JsMA0GCSqGSIb3DQEBBAUAA4IBAQADdQIlJkFtmHEjtuyo
2aIcrsUx98FtvVgB7RpQB8JZlly7UEjvX0CIIvW/7Al5/8h9s1rhrRffX7nXQKAQ
AmPnvD2Pp47obDnHqm/L109S1fcL5BiPN1AlgsseUBwzdqBpyRncPXZoAuBh/BU5
D/1Dip0hXgB/X6+QymSzRJoSKfpeXVICj1kYH1nIkn0YXthYF3BTrCheCzBlKn0S
CixbCUYsUjtSqld0nG76jyGb/gnWntNettH+RXWe1gm6qREJwfEFdeYviTqx2Uxi
6sBKG/XjNAcMArXb7V6w0YAwCyjwCl49B+mLZaFH+9izzBJ7NyVqhH8ToB1gt0re
JGhV
-----END CERTIFICATE-----

Some files were not shown because too many files have changed in this diff Show More