From 1117500044411be6a23533169f0e64fdf85bbe7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 12 Mar 2015 23:36:20 +0100 Subject: [PATCH] multiple fixes --- README => README.txt | 27 +++++++++++++++------------ resolvers/dn42 | 2 ++ tinc-debug | 15 +++++++-------- tinc-generate-mac | 8 ++++++-- tinc-up | 11 ----------- 5 files changed, 30 insertions(+), 33 deletions(-) rename README => README.txt (56%) create mode 100644 resolvers/dn42 diff --git a/README b/README.txt similarity index 56% rename from README rename to README.txt index 1246abe..1b877dc 100644 --- a/README +++ b/README.txt @@ -8,32 +8,35 @@ Freebsd: - dhcpcd or dhclient (dhcpcd recommend) Mac OS X: - Get homebrew + - $ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" + - $ brew install tuntap # WICHTIG: Befehle, welche das Programm am Ende + # ausspuckt befolgen und Rechner neustarten (ja, wirklich neustarten!) - brew install --devel tinc + - brew install bash - Replace /etc with /usr/local/etc in the following walk-through Windows: - TODO 2. Clone hosts - root> mkdir /etc/tinc/evenet + root> mkdir /etc/tinc/evenet # /usr/local/etc/tinc/evenet on MacOS X root> chown $USER /etc/tinc/evenet user> git clone gitlab@git.higgsboson.tk:Mic92/evenet.git /etc/tinc/evenet 3. Request invite url (generated by `tinc -c . invite`) 4. Join tinc url - user> tinc -c /etc/tinc/evenet join + user> cd /etc/tinc/evenet + user> tinc -c . generate-keys + user> tinc -c . join # Optional (set public address) user> tinc -c /etc/tinc/evenet tinc> set Address domain.tld # optional, wenn eine öffentliche Addresse verfügbar ist tinc> set Port 666 # optional, wenn anderer Port gewünscht tinc> exit -5. Test with tinc-debug - /etc/tinc/evenet +5. Generate MAC-Adresse + $ ./tinc-generate-mac +6. Test with tinc-debug + $ ./tinc-debug +7. Recommend: Add dn42-domain (on MacOS X) + $ ln -s /usr/local/etc/tinc/evenet/resolver/dn42 /etc/resolver/dn42 -Linux iproute2 -$ ip addr add address/prefixlength dev interface - -Linux/Freebsd/OpenBSD/NetBSD/Solaris/MacOS X -$ ifconfig interface address netmask netmask - -Windows -$ netsh interface ip set address interface static address netmask +Static IP-Adresses diff --git a/resolvers/dn42 b/resolvers/dn42 new file mode 100644 index 0000000..7272641 --- /dev/null +++ b/resolvers/dn42 @@ -0,0 +1,2 @@ +nameserver 172.23.75.8 +nameserver 172.23.75.9 diff --git a/tinc-debug b/tinc-debug index fb861ed..e07c82e 100755 --- a/tinc-debug +++ b/tinc-debug @@ -7,6 +7,9 @@ fi set -eu +SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +source "$SCRIPT_DIR/lib/core.bash" + die() { echo $1 &>2 exit 1 @@ -15,27 +18,23 @@ warn() { echo $1 &>2 } -DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) - -if [ ! -f "$DIR/ed25519_key.priv" ]; then +if [ ! -f "$SCRIPT_DIR/ed25519_key.priv" ]; then warn "No ed25519_key.priv found!" fi -if [ ! -f "$DIR/rsa_key.priv" ]; then +if [ ! -f "$SCRIPT_DIR/rsa_key.priv" ]; then warn "No rsa_key.priv found!" fi - - if [[ $EUID -ne 0 ]]; then if has sudo; then echo "Start tinc. Cancel with Ctrl+C ..." - sudo TINC_DEBUG=1 tincd -c "$DIR" -D -d + sudo TINC_DEBUG=1 tincd -c "$SCRIPT_DIR" -D -d else die "run this script as root" fi else echo "Start tinc. Cancel with Ctrl+C ..." export TINC_DEBUG=1 - tincd -c "$DIR" -D -d + tincd -c "$SCRIPT_DIR" -D -d fi diff --git a/tinc-generate-mac b/tinc-generate-mac index 99cba95..768f54a 100755 --- a/tinc-generate-mac +++ b/tinc-generate-mac @@ -6,9 +6,13 @@ DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" TINCRC="$DIR/tincrc" MAC_ADDRESS="" -source "$TINCRC" || true +if [ -f "$TINCRC" ]; then + source "$TINCRC" +else + export MAC_ADDRESS="" +fi -if [ -n "$MAC_ADDRESS" ]; then +if [[ -n "$MAC_ADDRESS" ]]; then echo "Skip generating MAC: MAC_ADDRESS with value '$MAC_ADDRESS' already defined in '$TINCRC'." exit 1 else diff --git a/tinc-up b/tinc-up index 70de383..66ed8c0 100755 --- a/tinc-up +++ b/tinc-up @@ -14,17 +14,6 @@ source "$SCRIPT_DIR/lib/ip.bash" source "$SCRIPT_DIR/lib/mac.bash" source "$SCRIPT_DIR/lib/route.bash" -#disable_ipv6_privacy() { -# local interface=$1 -# if [[ "$OSTYPE" == "linux-gnu" ]]; then -# sysctl -w "net.ipv6.conf.${interface}.use_tempaddr=0" -# elif [[ "$OSTYPE" == "openbsd"* ]]; then -# ifconfig "${interface}" -autoconfprivacy -# elif has sysctl; then -# sysctl -w net.inet6.ip6.use_tempaddr=0 -# fi -#} - [ -z "${INTERFACE:-}" ] && die "no INTERFACE environment variable set" MAC_ADDRESS_FILE="${SCRIPT_DIR}/tinc-macaddr"