Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
fastd [12.12.2015 07:44] – havelock | fastd [16.07.2017 19:32] (aktuell) – havelock | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== fastd ====== | ====== fastd ====== | ||
- | In Bearbeitung! | + | TODO In Bearbeitung! |
- | Dokumentation: | + | Dokumentation: |
+ | |||
+ | Ab Debian Stretch (9) ist fastd und die dazugehörigen Abhängigkeiten vorhanden. | ||
+ | Es sind also keine externen Repositories mehr notwendig. | ||
Bei der manuellen Übersetzung von fastd müssen das Init-Script und die manpages | Bei der manuellen Übersetzung von fastd müssen das Init-Script und die manpages | ||
Zeile 9: | Zeile 12: | ||
Vorarbeiten | Vorarbeiten | ||
+ | < | ||
+ | aptitude install build-essential pkg-config cmake doxygen bison libsodium-dev libjson-c-dev libcap-dev | ||
+ | </ | ||
- | aptitude install build-essential pkg-config cmake doxygen | + | Voraussetzung ist [[libuecc]], dieses muß vorab gebaut und installiert werden. |
- | + | ||
- | Voraussetzung ist '' | + | |
+ | Compilieren von fastd | ||
+ | < | ||
+ | cd / | ||
+ | git clone git:// | ||
+ | cd fastd | ||
+ | git checkout v18 | ||
+ | cd .. | ||
+ | mkdir fastd-build | ||
+ | cd fastd-build | ||
+ | cmake ../fastd | ||
+ | make | ||
+ | make install | ||
+ | </ | ||
<file conf / | <file conf / | ||
Zeile 26: | Zeile 42: | ||
AUTOSTART=" | AUTOSTART=" | ||
</ | </ | ||
+ | |||
+ | Hinweis: Wenn fastd selbst kompiliert wurde, ist die Installation normalerweise | ||
+ | nach ''/ | ||
+ | angepaßt werden ('' | ||
+ | |||
+ | Hinweis: Das Script ist auch Bestandteil der [[FFPI-Tools]]. | ||
++++ Init-Script für fastd | | ++++ Init-Script für fastd | | ||
- | < | + | < |
#!/bin/sh -e | #!/bin/sh -e | ||
Zeile 40: | Zeile 62: | ||
# Default-Stop: | # Default-Stop: | ||
# Short-Description: | # Short-Description: | ||
- | # Description: | + | # Description: |
- | # in / | + | # in / |
### END INIT INFO | ### END INIT INFO | ||
Zeile 50: | Zeile 72: | ||
# Modified for restarting / starting / stopping single tunnels by Richard Mueller < | # Modified for restarting / starting / stopping single tunnels by Richard Mueller < | ||
# Modified for fastd by Nils Schneider < | # Modified for fastd by Nils Schneider < | ||
+ | # Beautified by Thomas Hooge < | ||
. / | . / | ||
Zeile 55: | Zeile 78: | ||
test $DEBIAN_SCRIPT_DEBUG && set -v -x | test $DEBIAN_SCRIPT_DEBUG && set -v -x | ||
- | DAEMON=/ | ||
DESC=" | DESC=" | ||
+ | NAME=fastd | ||
+ | DAEMON=/ | ||
CONFIG_DIR=/ | CONFIG_DIR=/ | ||
- | test -x $DAEMON || exit 0 | + | SCRIPTNAME=/ |
- | test -d $CONFIG_DIR || exit 0 | + | |
+ | # Exit if the package is not installed | ||
+ | [ -x "$DAEMON" ] || exit 0 | ||
+ | |||
+ | # Exit if the configuration directory is not existent | ||
+ | [ -d $CONFIG_DIR | ||
# Source defaults file; edit that file to configure this script. | # Source defaults file; edit that file to configure this script. | ||
AUTOSTART=" | AUTOSTART=" | ||
- | if test -e / | + | if test -e / |
- | . / | + | . / |
+ | fi | ||
+ | |||
+ | if [ ! -d / | ||
+ | mkdir / | ||
+ | chown fastd. /var/run/fastd | ||
fi | fi | ||
start_vpn () { | start_vpn () { | ||
- | | + | STATUS=0 |
- | start-stop-daemon --start --quiet --oknodo \ | + | start-stop-daemon --start --quiet --oknodo \ |
- | --pidfile / | + | --pidfile / |
- | --make-pidfile \ | + | --make-pidfile \ |
- | --background \ | + | --background \ |
- | --exec $DAEMON -- \ | + | --exec $DAEMON -- \ |
- | --syslog-level info \ | + | --syslog-level info \ |
- | --config $CONFIG_DIR/ | + | --config $CONFIG_DIR/ |
- | || STATUS=1 | + | || STATUS=1 |
} | } | ||
stop_vpn () { | stop_vpn () { | ||
- | | + | kill `cat $PIDFILE` || true |
- | rm -f $PIDFILE | + | rm -f $PIDFILE |
- | log_end_msg 0 | + | log_end_msg 0 |
} | } | ||
- | case " | + | case " |
- | start) | + | start) |
- | | + | log_action_begin_msg " |
- | | + | # autostart fastds |
- | if test -z " | + | if test -z " |
- | # check if automatic startup is disabled by AUTOSTART=none | + | # check if automatic startup is disabled by AUTOSTART=none |
- | if test " | + | if test " |
- | log_warning_msg " | + | log_warning_msg " |
- | exit 0 | + | exit 0 |
- | fi | + | fi |
- | if test -z " | + | if test -z " |
- | # all fastds shall be started automatically | + | # all fastds shall be started automatically |
- | for CONFIG in `cd $CONFIG_DIR; | + | for CONFIG in `cd $CONFIG_DIR; |
- | NAME=${CONFIG%%/ | + | INSTANCE=${CONFIG%%/ |
- | log_daemon_msg " | + | log_daemon_msg " |
- | start_vpn | + | start_vpn |
- | done | + | done |
- | else | + | else |
- | # start only specified fastds | + | # start only specified fastds |
- | for NAME in $AUTOSTART ; do | + | for INSTANCE |
- | if test -e $CONFIG_DIR/ | + | if test -e $CONFIG_DIR/ |
- | log_daemon_msg " | + | log_daemon_msg " |
- | start_vpn | + | start_vpn |
- | else | + | else |
- | log_failure_msg " | + | log_failure_msg " |
- | STATUS=1 | + | STATUS=1 |
- | fi | + | fi |
- | done | + | done |
- | fi | + | fi |
- | #start fastds from command line | + | #start fastds from command line |
- | else | + | else |
- | while shift ; do | + | while shift ; do |
- | [ -z " | + | [ -z " |
- | NAME=$1 | + | INSTANCE=$1 |
- | if test -e $CONFIG_DIR/ | + | if test -e $CONFIG_DIR/ |
- | log_daemon_msg " | + | log_daemon_msg " |
- | start_vpn | + | start_vpn |
- | else | + | else |
- | log_failure_msg " | + | log_failure_msg " |
- | | + | STATUS=1 |
- | fi | + | fi |
- | done | + | done |
- | fi | + | fi |
- | log_end_msg ${STATUS: | + | log_end_msg ${STATUS: |
- | ;; | + | ;; |
- | stop) | + | stop) |
- | log_action_begin_msg " | + | log_action_begin_msg " |
- | if test -z " | + | if test -z " |
- | PIDFILE= | + | PIDFILE= |
- | for PIDFILE in `ls / | + | for PIDFILE in `ls / |
- | NAME=`echo $PIDFILE | cut -c16-` | + | INSTANCE=`echo $PIDFILE | cut -c16-` |
- | NAME=${NAME%%.pid} | + | INSTANCE=${INSTANCE%%.pid} |
- | log_daemon_msg " | + | log_daemon_msg " |
- | stop_vpn | + | stop_vpn |
- | done | + | done |
- | if test -z " | + | if test -z " |
- | log_warning_msg " | + | log_warning_msg " |
- | fi | + | fi |
- | else | + | else |
- | while shift ; do | + | while shift ; do |
- | [ -z " | + | [ -z " |
- | if test -e / | + | if test -e / |
- | log_daemon_msg " | + | log_daemon_msg " |
- | PIDFILE=`ls / | + | PIDFILE=`ls / |
- | NAME=`echo $PIDFILE | cut -c16-` | + | INSTANCE=`echo $PIDFILE | cut -c16-` |
- | NAME=${NAME%%.pid} | + | INSTANCE=${INSTANCE%%.pid} |
- | stop_vpn | + | stop_vpn |
- | else | + | else |
- | log_failure_msg " | + | log_failure_msg " |
- | fi | + | fi |
- | done | + | done |
- | fi | + | fi |
- | ;; | + | ;; |
- | restart) | + | restart) |
- | shift | + | shift |
- | $0 stop ${@} | + | $0 stop ${@} |
- | sleep 1 | + | sleep 1 |
- | $0 start ${@} | + | $0 start ${@} |
- | ;; | + | ;; |
- | status) | + | status) |
- | GLOBAL_STATUS=0 | + | GLOBAL_STATUS=0 |
- | if test -z " | + | if test -z " |
- | # We want status for all defined fastd. | + | # We want status for all defined fastd. |
- | # Returns success if all autostarted fastds are defined and running | + | # Returns success if all autostarted fastds are defined and running |
- | if test " | + | if test " |
- | # Consider it a failure if AUTOSTART=none | + | # Consider it a failure if AUTOSTART=none |
- | log_warning_msg "No fastds autostarted" | + | log_warning_msg "No fastds autostarted" |
- | GLOBAL_STATUS=1 | + | GLOBAL_STATUS=1 |
- | else | + | else |
- | if ! test -z " | + | if ! test -z " |
- | # Consider it a failure if one of the autostarted fastd is not defined | + | # Consider it a failure if one of the autostarted fastd is not defined |
- | for VPN in $AUTOSTART ; do | + | for VPN in $AUTOSTART ; do |
- | if ! test -f $CONFIG_DIR/ | + | if ! test -f $CONFIG_DIR/ |
- | log_warning_msg "fastd ' | + | log_warning_msg "fastd ' |
- | GLOBAL_STATUS=1 | + | GLOBAL_STATUS=1 |
- | fi | + | fi |
- | done | + | done |
- | fi | + | fi |
- | fi | + | fi |
- | for CONFIG in `cd $CONFIG_DIR; | + | for CONFIG in `cd $CONFIG_DIR; |
- | NAME=${CONFIG%%/ | + | INSTANCE=${CONFIG%%/ |
- | # Is it an autostarted fastd? | + | # Is it an autostarted fastd? |
- | if test -z " | + | if test -z " |
- | AUTOVPN=1 | + | AUTOVPN=1 |
- | else | + | else |
- | if test " | + | if test " |
- | AUTOVPN=0 | + | AUTOVPN=0 |
- | else | + | else |
- | AUTOVPN=0 | + | AUTOVPN=0 |
- | for VPN in $AUTOSTART; do | + | for VPN in $AUTOSTART; do |
- | if test " | + | if test " |
- | AUTOVPN=1 | + | AUTOVPN=1 |
- | fi | + | fi |
- | done | + | done |
- | fi | + | fi |
- | fi | + | fi |
- | if test " | + | if test " |
- | # If it is autostarted, | + | # If it is autostarted, |
- | status_of_proc -p / | + | status_of_proc -p / |
- | else | + | else |
- | status_of_proc -p / | + | status_of_proc -p / |
- | fi | + | fi |
- | done | + | done |
- | else | + | else |
- | # We just want status for specified fastd. | + | # We just want status for specified fastd. |
- | # Returns success if all specified fastds are defined and running | + | # Returns success if all specified fastds are defined and running |
- | while shift ; do | + | while shift ; do |
- | [ -z " | + | [ -z " |
- | NAME=$1 | + | INSTANCE=$1 |
- | if test -e $CONFIG_DIR/ | + | if test -e $CONFIG_DIR/ |
- | # Config exists | + | # Config exists |
- | status_of_proc -p / | + | status_of_proc -p / |
- | else | + | else |
- | # Config does not exist | + | # Config does not exist |
- | log_warning_msg "fastd '$NAME': | + | log_warning_msg " |
- | GLOBAL_STATUS=1 | + | GLOBAL_STATUS=1 |
- | fi | + | fi |
- | done | + | done |
- | fi | + | fi |
- | exit $GLOBAL_STATUS | + | exit $GLOBAL_STATUS |
- | ;; | + | ;; |
- | *) | + | *) |
- | echo " | + | echo " |
- | exit 1 | + | exit 1 |
- | ;; | + | ;; |
esac | esac | ||
exit 0 | exit 0 | ||
- | |||
- | # vim:set ai sts=2 sw=2 tw=0: | ||
</ | </ | ||
++++ | ++++ |