Compare commits

..

5 Commits

Author SHA1 Message Date
Adrien Gallouët
ff83707581 Update autotools and add missing files
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
2017-11-27 20:59:33 +00:00
Adrien Gallouët
a02839712e Force restart systemd-networkd
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
2017-11-27 11:52:05 +00:00
Adrien Gallouët
495138ffe4 Try to guess pref in glorytun-run
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
2017-11-27 11:12:48 +00:00
Adrien Gallouët
e26ecf37a3 Cleanup glorytun-setup
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
2017-11-26 20:52:36 +00:00
Adrien Gallouët
827876647f Fix typo
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
2017-11-26 17:20:35 +00:00
6 changed files with 43 additions and 31 deletions

View File

@@ -17,9 +17,7 @@ glorytun_SOURCES = \
src/iface.c \ src/iface.c \
src/iface.h \ src/iface.h \
src/db.c \ src/db.c \
src/db.h src/db.h \
glorytun_SOURCES += \
mud/mud.h \ mud/mud.h \
mud/mud.c mud/mud.c
@@ -27,5 +25,13 @@ EXTRA_DIST = \
LICENSE \ LICENSE \
README.md \ README.md \
VERSION \ VERSION \
systemd/glorytun-client.network \
systemd/glorytun-run \
systemd/glorytun-setup \
systemd/glorytun.network \
systemd/glorytun@.service.in \
mud/LICENSE \
mud/README.md \
meson.build \
autogen.sh \ autogen.sh \
version.sh version.sh

View File

@@ -26,7 +26,7 @@ The more classical autotools suite is also available.
Just call `glorytun-setup` and follow the instructions. Just call `glorytun-setup` and follow the instructions.
Fist, setup the server: First, setup the server:
$ sudo glorytun-setup $ sudo glorytun-setup
Config filename (tun0): Config filename (tun0):

View File

@@ -8,7 +8,7 @@ AC_DEFINE_UNQUOTED([VERSION_MAJOR], [m4_esyscmd([./version.sh major])])
AC_CONFIG_SRCDIR([src/common.h]) AC_CONFIG_SRCDIR([src/common.h])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 -Wall -Werror foreign tar-ustar subdir-objects]) AM_INIT_AUTOMAKE([1.12 -Wall -Werror foreign tar-ustar subdir-objects])
AM_DEP_TRACK AM_DEP_TRACK
AM_SILENT_RULES([yes]) AM_SILENT_RULES([yes])
AM_PROG_CC_C_O AM_PROG_CC_C_O

View File

@@ -1,6 +1,6 @@
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
dnl serial 11 (pkg-config-0.29) # serial 12 (pkg-config-0.29.2)
dnl
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl dnl
@@ -41,7 +41,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require. dnl of the macros you require.
m4_defun([PKG_PREREQ], m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29]) [m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ ])dnl PKG_PREREQ
@@ -142,7 +142,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no pkg_failed=no
AC_MSG_CHECKING([for $1]) AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2])

View File

@@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -e
if [ ! -f "$1" ]; then if [ ! -f "$1" ]; then
echo "usage: $(basename "$0") FILE" echo "usage: $(basename "$0") FILE"
exit 1 exit 1
@@ -11,10 +13,16 @@ DEV="gt${HOST:+c}-$(basename "$1")"
# Setting BIND is like going to 'expert mode' # Setting BIND is like going to 'expert mode'
# This helper is pretty stupid and still needs some work # This helper is pretty stupid and still needs some work
if [ -n "$HOST" ] && [ -z "$BIND" ]; then if [ -n "$HOST" ]; then
if [ -z "$PREF" ]; then
PREF=$(ip rule | awk '/from all lookup main/{print $1; exit}' | tr -d :)
PREF=$((PREF-1))
fi
if [ -z "$BIND" ]; then
BIND=$(ip route get "$HOST" | awk '/src/{getline;print $0}' RS=' ') BIND=$(ip route get "$HOST" | awk '/src/{getline;print $0}' RS=' ')
ip rule add from "$BIND" table main pref 32000 ip rule add from "$BIND" table main pref "$((PREF-1))"
ip rule add from all table 200 pref 32001 fi
ip rule add from all table 200 pref "$PREF"
fi fi
exec glorytun \ exec glorytun \

View File

@@ -7,9 +7,8 @@ _ask() {
read -r "$2" read -r "$2"
} }
_NAME=tun0 _ask "Config filename (tun0)" NAME
_ask "Config filename ($_NAME)" NAME NAME=${NAME:-tun0}
NAME=${NAME:-$_NAME}
if [ -f /etc/glorytun/"$NAME" ]; then if [ -f /etc/glorytun/"$NAME" ]; then
echo "This config already exit!" echo "This config already exit!"
@@ -20,23 +19,22 @@ _ask "Server ip (enter for server conf)" HOST
_ask "Server key (enter to generate a new one)" KEY _ask "Server key (enter to generate a new one)" KEY
if [ -z "$KEY" ]; then if [ -z "$KEY" ]; then
KEY=$(glorytun keygen) || exit KEY=$(glorytun keygen)
echo "Your new key: $KEY" echo "Your new key: $KEY"
fi fi
# install files
mkdir -p /etc/glorytun mkdir -p /etc/glorytun
FILE="/etc/glorytun/$NAME"
echo "${HOST:+HOST=$HOST}" > "$FILE" cat > /etc/glorytun/"$NAME" <<EOF
${HOST:+HOST="$HOST"}
EOF
touch "$FILE.key" ( umask 077; echo "$KEY" > /etc/glorytun/"$NAME".key )
chmod 600 "$FILE.key"
echo "$KEY" > "$FILE.key"
# start services
_ask "Start glorytun now ? (enter to skip)" START _ask "Start glorytun now ? (enter to skip)" START
case "$START" in case "$START" in y*|Y*)
y*|Y*)
systemctl restart systemd-networkd systemctl restart systemd-networkd
systemctl start glorytun@"$NAME" systemctl start glorytun@"$NAME" ;;
;;
esac esac