summaryrefslogtreecommitdiffstats
path: root/retiolum
diff options
context:
space:
mode:
authorroot <root@krebs>2011-09-09 18:20:34 +0200
committerroot <root@krebs>2011-09-09 18:20:34 +0200
commit176c9ac08ad9c2ddc430b2d1a194f6be41115f5b (patch)
tree82ea214ff1d45799099576e4ff007c34a6b7c990 /retiolum
parentdac9eb2553987778500e0bc7e54ad2a28124969d (diff)
parent150ce5757d2982da740bd9ce2b44b57b6d2831c6 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum')
-rwxr-xr-xretiolum/bin/hosts4
-rwxr-xr-xretiolum/bin/ipv62
-rwxr-xr-xretiolum/bin/update_tinc_hosts6
-rw-r--r--retiolum/hosts/sir_krebs_a_lot11
-rwxr-xr-xretiolum/scripts/tinc_setup/tinc-up6
5 files changed, 23 insertions, 6 deletions
diff --git a/retiolum/bin/hosts b/retiolum/bin/hosts
index 6939f52c..bd0c77dc 100755
--- a/retiolum/bin/hosts
+++ b/retiolum/bin/hosts
@@ -6,6 +6,8 @@ netname=${1-retiolum}
cd /etc/tinc/$netname/hosts
for i in `ls`; do
- sed -rn 's|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1\t'$i' '$i'.'$netname'|p' $i
+ sed -n '
+ s|^ *Subnet *= *\([^ /]*\)\(/[0-9]*\)\? *$|\1\t'$i' '$i'.'$netname'|p
+ ' $i
done | sort
diff --git a/retiolum/bin/ipv6 b/retiolum/bin/ipv6
index 65a1eaa1..34c6de71 100755
--- a/retiolum/bin/ipv6
+++ b/retiolum/bin/ipv6
@@ -13,7 +13,7 @@ if test `id -u` != 0; then
fi
file=/etc/tinc/retiolum/hosts/`hostname`
-addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file`
+addr=`sed -n 's|^Subnet *= *\(42:[0-9A-Fa-f:]*/128\)|\1|p' $file`
route=42::/16
start() {
diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts
index fe0785e3..86a28992 100755
--- a/retiolum/bin/update_tinc_hosts
+++ b/retiolum/bin/update_tinc_hosts
@@ -29,9 +29,13 @@ case "${*-I am made of stupid}" in
;;
('create magic')
$0 has magic || $0 print magic >> $hosts < /dev/null
+ $0 start
;;
('destroy magic')
- $0 has magic && sed -ie "/^$bs$/,/^$es$/d" $hosts
+ if $0 has magic; then
+ cache="`cat $hosts`"
+ echo "$cache" | sed "/^$bs$/,/^$es$/d" > $hosts
+ fi
;;
('has magic')
grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts
diff --git a/retiolum/hosts/sir_krebs_a_lot b/retiolum/hosts/sir_krebs_a_lot
new file mode 100644
index 00000000..14e9d242
--- /dev/null
+++ b/retiolum/hosts/sir_krebs_a_lot
@@ -0,0 +1,11 @@
+Address = 84.23.79.81
+Subnet = 10.7.7.100
+Subnet = 42:48bd:f4cd:b2f1:ff6b:865c:d041:def6/128
+-----BEGIN RSA PUBLIC KEY-----
+MIIBCgKCAQEAzkVF0BSWUEqzdUidLTa6qL4wlNSb8gaxyZperzoAj65d5l25SCqc
+jjqvREcE6p+jM4t1STXoohnNvexubNXW3PVo5Zpew+BsaGjVvow0LkqCJ9k96Rrk
+JzU5lAVH6om3/QYws/Ot0zq1Z/+Xw/0+9JpVKhEipMWLpLgjAvWdvzSW6aBIHVN1
+3E85fkTE5f0azct+XNSNzUebdyIy8wu/EexGmFI9bN+ewIvqjZJdvxP+Ank55MsE
+8P7K9TKwVXw440MGqqoQaOhdaT75TL+2nsAfWYcrNnE3YehMOmCMp9oY+RAvsIkK
+iAYyF5l7ZTi/7KGHNsG7rr0cbytiz2nS6wIDAQAB
+-----END RSA PUBLIC KEY-----
diff --git a/retiolum/scripts/tinc_setup/tinc-up b/retiolum/scripts/tinc_setup/tinc-up
index ae7c68e6..9a557787 100755
--- a/retiolum/scripts/tinc_setup/tinc-up
+++ b/retiolum/scripts/tinc_setup/tinc-up
@@ -4,15 +4,15 @@ dirname="`dirname "$0"`"
conf=$dirname/tinc.conf
-name=`sed -rn 's|^ *Name *= *([^ ]*) *$|\1|p' $conf`
+name=`sed -n 's|^ *Name *= *\([^ ]*\) *$|\1|p' $conf`
host=$dirname/hosts/$name
route4=10.7.7.0/24
-addr4=`sed -rn 's|^ *Subnet *= *(10\.[^ ]*) *$|\1|p' $host`
+addr4=`sed -n 's|^ *Subnet *= *\(10\.[^ ]*\) *$|\1|p' $host`
route6=42::/16
-addr6=`sed -rn 's|^ *Subnet *= *(42:[^ ]*) *$|\1|p' $host`
+addr6=`sed -n 's|^ *Subnet *= *\(42:[^ ]*\) *$|\1|p' $host`
ifconfig $INTERFACE up $addr4
route add -net $route4 dev $INTERFACE