Changeset eda4507 in freewrt


Ignore:
Timestamp:
Sep 18, 2006, 11:13:33 PM (19 years ago)
Author:
Waldemar Brodkorb <wbx@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
7afec77
Parents:
202f73c4
Message:

add a normal init script for openvpn, use and install a specific script (openvpn-webif.init) for webif usage

git-svn-id: svn://www.freewrt.org/trunk/freewrt@638 afb5a338-a214-0410-bd46-81f09a774fd1

Location:
package/openvpn
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • package/openvpn/Makefile

    r202f73c4 reda4507  
    8989                  $(ENABLE_SMALL) \
    9090        );
    91         touch $(WRKBUILD)/.configured
     91        touch $@
    9292
    9393$(WRKBUILD)/.built:
     
    116116
    117117$(IPKG_OPENVPN_WEBIF):
     118        install -d -m0755 $(IDIR_OPENVPN)/etc/init.d
    118119        install -d -m0755 $(IDIR_OPENVPN_WEBIF)/www/cgi-bin/webif
     120        $(CP) ./files/openvpn-webif.init \
     121                $(IDIR_OPENVPN)/etc/init.d/S$(PKG_INIT)openvpn
    119122        $(CP) ./files/openvpn.sh $(IDIR_OPENVPN_WEBIF)/www/cgi-bin/webif
    120123        $(IPKG_BUILD) $(IDIR_OPENVPN_WEBIF) $(PACKAGE_DIR)
  • package/openvpn/files/openvpn.init

    r202f73c4 reda4507  
    11#!/bin/sh
    22
    3 case "$(nvram get openvpn_cli)" in
    4         on|enabled|1)
    5                 continue
    6         ;;
    7         off|disabled|0)
    8                 exit 0
    9         ;;
    10 esac
     3. /etc/rc.conf
    114
    125case "$1" in
     
    169                ;;
    1710        start)
    18                 SERVER=$(nvram get openvpn_cli_server)
    19                 PROTO=$(nvram get openvpn_cli_proto)
    20                 PORT=$(nvram get openvpn_cli_port)
    21 
    22                 [ "$SERVER" ] || {
    23                         logger "$0: remote server not configured!"
    24                         exit
    25                 }
    26                 case "$(nvram get openvpn_cli_auth)" in
    27                         cert)
    28                                 AUTH_OPTION="--ns-cert-type server --pkcs12"
    29                                 AUTH_FILE="/etc/openvpn/certificate.p12"
    30                                 PKCS12PASS="$(nvram get openvpn_cli_pkcs12pass)"
    31                                 [ "$PKCS12PASS" ] && {
    32                                         echo -n "$PKCS12PASS" > /etc/openvpn/pkcs12pass.tmp
    33                                         chmod 600 /etc/openvpn/pkcs12pass.tmp
    34                                         AUTH_OPTION="--askpass /etc/openvpn/pkcs12pass.tmp $AUTH_OPTION"
    35                                 }
    36                         ;;
    37                         psk)
    38                                 AUTH_OPTION="--secret"
    39                                 AUTH_FILE="/etc/openvpn/shared.key"
    40                         ;;
    41                         *)
    42                                 logger "$0: unknown authentication type, aborting!"
    43                                 exit
    44                         ;;
    45                 esac
    46                 [ -f "$AUTH_FILE" ] || {
    47                         logger "$0: no certificat/keyfile found!"
    48                         exit
    49                 }
    50                 openvpn --client                                \
    51                         --proto  "${PROTO:-udp}"                \
    52                         --port   "${PORT:-1194}"                \
    53                         --remote "$SERVER"                      \
    54                         --dev tun                               \
    55                         --nobind                                \
    56                         $AUTH_OPTION "$AUTH_FILE"               \
    57                         --comp-lzo                              \
    58                         --daemon                                \
    59                         --status /tmp/openvpn-status.log        \
    60                         --verb 3
     11                [ -f /etc/openvpn/openvpn.conf ] || exit
     12                openvpn --daemon --config openvpn.conf --cd /etc/openvpn
     13        ;;
     14        stop)
     15                killall openvpn
    6116        ;;
    6217        restart)
     
    6520                $0 start
    6621        ;;
    67         reload)
    68                 killall -SIGHUP openvpn
    69         ;;
    70         stop)
    71                 killall openvpn
    72         ;;
    7322esac
     23exit $?
Note: See TracChangeset for help on using the changeset viewer.