multiple fixes

This commit is contained in:
Jörg Thalheim 2015-03-12 23:36:20 +01:00
parent 9e43529e92
commit 1117500044
5 changed files with 30 additions and 33 deletions

View File

@ -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 <url>
user> cd /etc/tinc/evenet
user> tinc -c . generate-keys
user> tinc -c . join <url>
# 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

2
resolvers/dn42 Normal file
View File

@ -0,0 +1,2 @@
nameserver 172.23.75.8
nameserver 172.23.75.9

View File

@ -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

View File

@ -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

11
tinc-up
View File

@ -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"