Wiki - Freifunk Pinneberg

Freies WLAN im Kreis Pinneberg

Benutzer-Werkzeuge

Webseiten-Werkzeuge


fastd

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Letzte ÜberarbeitungBeide Seiten der Revision
fastd [06.12.2015 05:37] havelockfastd [21.11.2016 18:16] havelock
Zeile 1: Zeile 1:
 ====== fastd ====== ====== fastd ======
  
-In Bearbeitung!+TODO In Bearbeitung!
  
-Dokumentation: http://fastd.readthedocs.org/en/v17/. +Dokumentation: http://fastd.readthedocs.org/en/v18/. 
  
 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 9:
  
 Vorarbeiten  Vorarbeiten 
 +<code>
 +aptitude install build-essential pkg-config cmake doxygen bison libsodium-dev libjson-c-dev libcap-dev
 +</code>
  
-  aptitude install build-essential pkg-config cmake doxygen+Voraussetzung ist [[libuecc]], dieses muß vorab gebaut und installiert werden.
  
 +Compilieren von fastd
 +<code>
 +cd /usr/local/src
 +git clone git://git.universe-factory.net/fastd
 +cd fastd
 +git checkout v18
 +cd ..
 +mkdir fastd-build
 +cd fastd-build
 +cmake ../fastd
 +make
 +make install
 +</code>
  
 +<file conf /etc/default/fastd>
 +# This is the configuration file for /etc/init.d/fastd
 +
 +#
 +# Start only these VPNs automatically via init script.
 +# Allowed values are "all", "none" or space separated list of
 +# names of the VPNs. If empty, "all" is assumed.
 +#
 +AUTOSTART="all"
 +</file>
 +
 +Hinweis: Wenn fastd selbst kompiliert wurde, ist die Installation normalerweise
 +nach ''/usr/local'' erfolgt. Das folgende Init-Script muß dann entsprechend 
 +angepaßt werden (''DAEMON=/usr/local/bin/$NAME'').
 +
 +Hinweis: Das Script ist auch Bestandteil der [[FFPI-Tools]].
 +
 +++++ Init-Script für fastd |
 +<file bash /etc/init.d/fastd>
 +#!/bin/sh -e
 +
 +### BEGIN INIT INFO
 +# Provides:          fastd
 +# Required-Start:    $network $remote_fs $syslog
 +# Required-Stop:     $network $remote_fs $syslog
 +# Should-Start:      network-manager
 +# Should-Stop:       network-manager
 +# Default-Start:     2 3 4 5
 +# Default-Stop:      0 1 6
 +# Short-Description: Fast and Secure Tunneling Daemon
 +# Description:       This script will start fastd tunnels as specified
 +#                    in /etc/default/fastd and /etc/fastd/*/fastd.conf
 +### END INIT INFO
 +
 +# Derived from the OpenVPN init script
 +# Original version by Robert Leslie
 +# <rob@mars.org>, edited by iwj and cs
 +# Modified for openvpn by Alberto Gonzalez Iniesta <agi@inittab.org>
 +# Modified for restarting / starting / stopping single tunnels by Richard Mueller <mueller@teamix.net>
 +# Modified for fastd by Nils Schneider <nils@nilsschneider.net>
 +# Beautified by Thomas Hooge <pirat@hoogi.de>
 +
 +. /lib/lsb/init-functions
 +
 +test $DEBIAN_SCRIPT_DEBUG && set -v -x
 +
 +DESC="Fast and Secure Tunneling Daemon"
 +NAME=fastd
 +DAEMON=/usr/bin/$NAME
 +CONFIG_DIR=/etc/fastd
 +SCRIPTNAME=/etc/init.d/$NAME
 +
 +# Exit if the package is not installed
 +[ -x "$DAEMON" ] || exit 0
 +
 +# Exit if the configuration directory is not existent
 +[ -d $CONFIG_DIR ] || exit 0
 +
 +# Source defaults file; edit that file to configure this script.
 +AUTOSTART="all"
 +if test -e /etc/default/$NAME ; then
 + . /etc/default/$NAME
 +fi
 +
 +if [ ! -d /var/run/fastd ]; then
 + mkdir /var/run/fastd/
 + chown fastd. /var/run/fastd
 +fi
 +
 +start_vpn () {
 + STATUS=0  
 + start-stop-daemon --start --quiet --oknodo \
 + --pidfile /var/run/fastd/$INSTANCE.pid \
 + --make-pidfile \
 + --background \
 + --exec $DAEMON -- \
 + --syslog-level info \
 + --config $CONFIG_DIR/$INSTANCE/fastd.conf \
 + || STATUS=1
 +}
 +
 +stop_vpn () {
 + kill `cat $PIDFILE` || true
 + rm -f $PIDFILE
 + log_end_msg 0 
 +}
 +
 +case "$1" in 
 +  start)  
 + log_action_begin_msg "Starting $DESC"
 +
 + # autostart fastds
 + if test -z "$2" ; then
 + # check if automatic startup is disabled by AUTOSTART=none
 + if test "x$AUTOSTART" = "xnone" -o -z "$AUTOSTART" ; then
 + log_warning_msg "  Autostart disabled, no $NAME will be started."
 + exit 0
 + fi
 + if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
 + # all fastds shall be started automatically
 + for CONFIG in `cd $CONFIG_DIR; ls */fastd.conf 2> /dev/null`; do
 + INSTANCE=${CONFIG%%/fastd.conf}
 + log_daemon_msg "  Autostarting $NAME '$INSTANCE'"
 + start_vpn
 + done
 + else
 + # start only specified fastds
 + for INSTANCE in $AUTOSTART ; do
 + if test -e $CONFIG_DIR/$INSTANCE/fastd.conf ; then 
 + log_daemon_msg "  Autostarting $NAME '$INSTANCE'"
 + start_vpn
 + else
 + log_failure_msg "  Autostarting $NAME '$INSTANCE': missing $CONFIG_DIR/$INSTANCE/fastd.conf file!"
 + STATUS=1
 + fi
 + done
 + fi
 + #start fastds from command line
 + else
 + while shift ; do
 + [ -z "$1" ] && break
 + INSTANCE=$1
 + if test -e $CONFIG_DIR/$INSTANCE/fastd.conf ; then
 + log_daemon_msg "  Starting $NAME '$INSTANCE'"   
 + start_vpn
 + else
 + log_failure_msg "  Starting $NAME '$INSTANCE': missing $CONFIG_DIR/$INSTANCE/fastd.conf file!"
 + STATUS=1
 + fi
 + done
 + fi
 + log_end_msg ${STATUS:-0}
 + ;;
 +  stop)
 + log_action_begin_msg "Stopping $DESC"
 + if test -z "$2" ; then
 + PIDFILE=
 + for PIDFILE in `ls /var/run/fastd/*.pid 2> /dev/null`; do
 + INSTANCE=`echo $PIDFILE | cut -c16-`
 + INSTANCE=${INSTANCE%%.pid}
 + log_daemon_msg "  Stopping $NAME '$INSTANCE'"
 + stop_vpn
 + done
 + if test -z "$PIDFILE" ; then
 + log_warning_msg "  No $NAME is running."
 + fi
 + else
 + while shift ; do
 + [ -z "$1" ] && break
 + if test -e /var/run/fastd/$1.pid ; then
 + log_daemon_msg "  Stopping $NAME '$1'"
 + PIDFILE=`ls /var/run/fastd/$1.pid 2> /dev/null`
 + INSTANCE=`echo $PIDFILE | cut -c16-`
 + INSTANCE=${INSTANCE%%.pid}
 + stop_vpn
 + else
 + log_failure_msg "  Stopping $NAME '$1': No such $NAME is running."
 + fi
 + done
 + fi
 + ;;
 +  restart)
 + shift 
 + $0 stop ${@}
 + sleep 1
 + $0 start ${@}
 + ;;
 +  status)
 + GLOBAL_STATUS=0
 + if test -z "$2" ; then
 + # We want status for all defined fastd.
 + # Returns success if all autostarted fastds are defined and running
 + if test "x$AUTOSTART" = "xnone" ; then
 + # Consider it a failure if AUTOSTART=none
 + log_warning_msg "No fastds autostarted"
 + GLOBAL_STATUS=1
 + else
 + if ! test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
 + # Consider it a failure if one of the autostarted fastd is not defined
 + for VPN in $AUTOSTART ; do
 + if ! test -f $CONFIG_DIR/$VPN/fastd.conf ; then
 + log_warning_msg "fastd '$VPN' is in AUTOSTART but is not defined"
 + GLOBAL_STATUS=1
 + fi
 + done
 + fi
 + fi
 + for CONFIG in `cd $CONFIG_DIR; ls */fastd.conf 2> /dev/null`; do
 + INSTANCE=${CONFIG%%/fastd.conf}
 + # Is it an autostarted fastd?
 + if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
 + AUTOVPN=1
 + else
 + if test "x$AUTOSTART" = "xnone" ; then
 + AUTOVPN=0
 + else
 + AUTOVPN=0
 + for VPN in $AUTOSTART; do
 + if test "x$VPN" = "x$NAME" ; then
 + AUTOVPN=1
 + fi
 + done
 + fi
 + fi  
 + if test "x$AUTOVPN" = "x1" ; then
 + # If it is autostarted, then it contributes to global status
 + status_of_proc -p /var/run/fastd/${INSTANCE}.pid $NAME "$NAME '${INSTANCE}'" || GLOBAL_STATUS=1
 + else
 + status_of_proc -p /var/run/fastd/${INSTANCE}.pid $NAME "$NAME '${INSTANCE}' (non autostarted)" || true
 + fi
 + done
 + else
 + # We just want status for specified fastd.
 + # Returns success if all specified fastds are defined and running
 + while shift ; do
 + [ -z "$1" ] && break
 + INSTANCE=$1
 + if test -e $CONFIG_DIR/$INSTANCE/fastd.conf ; then
 + # Config exists
 + status_of_proc -p /var/run/fastd/${INSTANCE}.pid $NAME "$NAME '${INSTANCE}'" || GLOBAL_STATUS=1
 + else
 + # Config does not exist
 + log_warning_msg "$NAME '$INSTANCE': missing $CONFIG_DIR/$INSTANCE/fastd.conf file!"
 + GLOBAL_STATUS=1
 + fi
 + done
 + fi
 + exit $GLOBAL_STATUS
 + ;;
 +  *)
 + echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
 + exit 1
 + ;;
 +esac
 +
 +exit 0
 +
 +</file>
 +++++
fastd.txt · Zuletzt geändert: 16.07.2017 19:32 von havelock