summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README7
-rw-r--r--etc/uanytun/client1/config6
-rw-r--r--etc/uanytun/client2/config6
-rw-r--r--etc/uanytun/client3/config6
-rw-r--r--etc/uanytun/p2p-a/config6
-rw-r--r--etc/uanytun/p2p-b/config6
-rw-r--r--src/Makefile40
-rwxr-xr-xsrc/configure24
8 files changed, 67 insertions, 34 deletions
diff --git a/README b/README
index e2ba6ed..9e4cdf4 100644
--- a/README
+++ b/README
@@ -69,7 +69,9 @@ Installing
# sudo make install
-This will install anytun under the $PREFIX defined with configure
+This will install anytun under the --prefix defined with configure.
+It also creates a user with name --username with home --userhome
+which can be changed by configure as well.
Uninstalling
------------
@@ -80,4 +82,5 @@ This removes everytthing except for the config files
# sudo make purge
-This also removes config files
+This also removes the config files and deletes the user and it's
+home directory.
diff --git a/etc/uanytun/client1/config b/etc/uanytun/client1/config
index a7d4f52..9fa8edd 100644
--- a/etc/uanytun/client1/config
+++ b/etc/uanytun/client1/config
@@ -48,10 +48,10 @@ remote-port 4444
log syslog:3,uanytun-client1,daemon
## change user and group after init
-username nobody
-groupname nogroup
+username uanytun
+groupname uanytun
-## chroot to /var/run/uanytun
+## chroot to users home directory
#chroot /var/run/uanytun
## key derivation pseudo random function
diff --git a/etc/uanytun/client2/config b/etc/uanytun/client2/config
index 04ec3cf..f5283d8 100644
--- a/etc/uanytun/client2/config
+++ b/etc/uanytun/client2/config
@@ -48,10 +48,10 @@ remote-port 4444
log syslog:3,uanytun-client2,daemon
## change user and group after init
-username nobody
-groupname nogroup
+username uanytun
+groupname uanytun
-## chroot to /var/run/uanytun
+## chroot to users home directory
#chroot /var/run/uanytun
## key derivation pseudo random function
diff --git a/etc/uanytun/client3/config b/etc/uanytun/client3/config
index 7de1694..23c722b 100644
--- a/etc/uanytun/client3/config
+++ b/etc/uanytun/client3/config
@@ -48,10 +48,10 @@ remote-port 4444
log syslog:3,uanytun-client3,daemon
## change user and group after init
-username nobody
-groupname nogroup
+username uanytun
+groupname uanytun
-## chroot to /var/run/uanytun
+## chroot to users home directory
#chroot /var/run/uanytun
## key derivation pseudo random function
diff --git a/etc/uanytun/p2p-a/config b/etc/uanytun/p2p-a/config
index 42caa9c..e5e561f 100644
--- a/etc/uanytun/p2p-a/config
+++ b/etc/uanytun/p2p-a/config
@@ -56,10 +56,10 @@ remote-port 4444
log syslog:3,uanytun-p2p-a,daemon
## change user and group after init
-username nobody
-groupname nogroup
+username uanytun
+groupname uanytun
-## chroot to /var/run/uanytun
+## chroot to users home directory
#chroot /var/run/uanytun
## key derivation pseudo random function
diff --git a/etc/uanytun/p2p-b/config b/etc/uanytun/p2p-b/config
index 32dcc87..4d9d417 100644
--- a/etc/uanytun/p2p-b/config
+++ b/etc/uanytun/p2p-b/config
@@ -56,10 +56,10 @@ remote-port 4444
log syslog:3,uanytun-p2p-b,daemon
## change user and group after init
-username nobody
-groupname nogroup
+username uanytun
+groupname uanytun
-## chroot to /var/run/uanytun
+## chroot to users home directory
#chroot /var/run/uanytun
## key derivation pseudo random function
diff --git a/src/Makefile b/src/Makefile
index fff8ee2..9b95da3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -91,7 +91,7 @@ clean:
manpage:
$(MAKE) --directory="../doc/" manpage
-install: install-bin install-etc install-man
+install: install-bin install-etc install-man add-user
install-bin: $(EXECUTABLE)
mkdir -p $(DESTDIR)$(SBINDIR)
@@ -101,19 +101,22 @@ install-bin: $(EXECUTABLE)
install-etc:
mkdir -p $(DESTDIR)$(ETCDIR)/uanytun
install -m 644 ../etc/uanytun/autostart $(DESTDIR)$(ETCDIR)/uanytun/autostart
- @( cd '../etc/uanytun/' ; \
- for dir in `ls`; do \
- if [ -d $$dir ]; then \
- echo "install $$dir configuration" ; \
- cd $$dir ; \
- mkdir -p $(DESTDIR)$(ETCDIR)/uanytun/$$dir ; \
- install -m 600 config $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
- if [ -e 'post-up.sh' ]; then \
- install -m 755 post-up.sh $(DESTDIR)$(ETCDIR)/uanytun/$$dir/post-up.sh ; \
- fi ; \
- cd .. ; \
- fi ; \
- done \
+ @( cd '../etc/uanytun/' ; \
+ for dir in `ls`; do \
+ if [ -d $$dir ]; then \
+ echo "install $$dir configuration" ; \
+ cd $$dir ; \
+ mkdir -p $(DESTDIR)$(ETCDIR)/uanytun/$$dir ; \
+ install -m 600 config $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ sed -i 's#username uanytun#username $(USERNAME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ sed -i 's#groupname uanytun#groupname $(USERNAME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ sed -i 's#chroot /var/run/uanytun#chroot $(USERHOME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ if [ -e 'post-up.sh' ]; then \
+ install -m 755 post-up.sh $(DESTDIR)$(ETCDIR)/uanytun/$$dir/post-up.sh ; \
+ fi ; \
+ cd .. ; \
+ fi ; \
+ done \
)
mkdir -p $(DESTDIR)$(ETCDIR)/init.d
install -m 755 ../etc/init.d/uanytun $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
@@ -125,10 +128,17 @@ install-man: manpage
cp ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
gzip $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
+add-user:
+ @ adduser --system --group --home $(USERHOME) $(USERNAME)
+
+remove-user:
+ @ deluser $(USERNAME)
+ @ rm -rf $(USERHOME)
+
remove:
rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8.gz
rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
-purge: remove
+purge: remove remove-user
rm -rf $(DESTDIR)$(ETCDIR)/uanytun/
diff --git a/src/configure b/src/configure
index d112494..a5c8173 100755
--- a/src/configure
+++ b/src/configure
@@ -43,16 +43,22 @@ PASSPHRASE=1
V4_MAPPED=1
PREFIX='/usr/local'
+USERNAME='uanytun'
+USERHOME='/var/run/uanytun'
print_usage() {
echo "configure --help print this"
echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
+ echo " --username=<USERNAME> create this user when installing (default: uanytun)"
+ echo " --userhome=<PATH> the home directory of the user to be created (default: /var/run/uanytun)"
echo " --use-ssl-crypto use ssl crypto library instead of libgcrypt"
- echo " --disable-crypto disable crypto at all (only NULL cipher)"
+ echo " --no-crypto disable crypto at all (only NULL cipher)"
echo " --disable-passphrase disable master key and salt passphrase"
+ echo " --enable-passphrase enable master key and salt passphrase"
echo " --disable-v4-mapped disable V4-Mapped addresses (this means to disable"
echo " simultanious use of IPv4 and IPv6)"
+ echo " --enable-v4-mapped enable V4-Mapped addresses"
}
for arg
@@ -64,18 +70,30 @@ do
--prefix=*)
PREFIX=${arg#--prefix=}
;;
+ --username=*)
+ USERNAME=${arg#--username=}
+ ;;
+ --userhome=*)
+ USERHOME=${arg#--userhome=}
+ ;;
--use-ssl-crypto)
CRYPTO_LIB='ssl'
;;
- --disable-crypto)
+ --no-crypto)
CRYPTO_LIB='none'
;;
--disable-passphrase)
PASSPHRASE=0
;;
+ --enable-passphrase)
+ PASSPHRASE=1
+ ;;
--disable-v4-mapped)
V4_MAPPED=0
;;
+ --enable-v4-mapped)
+ V4_MAPPED=1
+ ;;
--help)
print_usage
exit 0
@@ -159,6 +177,8 @@ LDFLAGS := $LDFLAGS
SBINDIR := $PREFIX/sbin
MANDIR := $PREFIX/share/man
ETCDIR := $ETCDIR
+USERNAME := $USERNAME
+USERHOME := $USERHOME
EOF
exit 0