<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: Re: multiple cipes again
From: Florian Friesdorf <42ff,AT,gmx,DOT,net>
Date: Thu, 11 Jan 2001 03:24:43 +0100
In-reply-to: <3A5B1CF7.6CC4D62A@gcs-mbh.de>

On Tue, Jan 09, 2001 at 03:15:19PM +0100, Manuela Guandalini wrote:
> hi, hier i am again.
> 
> cipe1 and cipe2 work both now (very happy manu!!!!), but i would like
> cipe to use both files 'options.1' and 'options.2' at reboot. Now is the
> only optionfile choosen the one with name /etc/cipe/options.
> i must start the second one manually by typing
> /usr/sbin/cipe-cb -o /etc/cipe/options.2
> 
> i read in the manual, that i could write in ip-up
> options="options.1 options.2"
> 
> but it doesn't work. perhaps it's an older variable name, that doesn't
> exist any more. anyway, rccipe just take the default options file
> (/etc/cipe/options).
> which is the right file and which the right option to start more than
> one cipe at the time?

Well, I don't know how your cipes are started during init, but you need
some init script in /etc/init.d/ or /etc/rc.d/init.d/ depending on your
distribution which is invoked by init on system startup.
According to your X-Mailer entry your are running mandrake, so it should
be /etc/rc.d/init.d.

In this initscript two cipe daemons must be started:

/usr/sbin/cipe-cb -o /etc/cipe/options.1
/usr/sbin/cipe-cb -o /etc/cipe/options.2

I have attached a script cipe-ctrl which let you start cipe daemons for
different configs in /etc/cipe/peers/. It's work in progress, but does
what I want.
I'm running debian with ciped-cb in /usr/local/sbin, so, perhaps, you'll
have to adapt some things.

With cipe-ctrl you can say something like this in your initscript:

case "$1" in
        start)
                /usr/local/sbin/cipe-ctrl start all
                # or you can pick single configs
                /usr/local/sbin/cipe-ctrl start tunnel1
                /usr/local/sbin/cipe-ctrl start tunnel4
        ;;
        stop)
                /usr/local/sbin/cipe-ctrl stop all
        ;;
esac
                
provided that you have a /etc/cipe/peers/tunnel1 and ...4

I hope, I could help.
Suggestions are welcome.

-ff

-- 
     Florian Friesdorf <42ff,AT,gmx,DOT,net>
OpenPGP key available on public key servers

------> Save the future of Open Source <------
-> Online-Petition against Software Patents <-
------> http://petition.eurolinux.org <-------


#!/bin/sh
#
# file:    cipe-ctrl
# date:    2000-09-23
# version: 0.1
# desc:    control multiple cipe connections
# author:  based on /etc/init.d/cipe from Tommi Virtanen 
<tv,AT,debian,DOT,org>
#          written by Florian Friesdorf <42ff,AT,gmx,DOT,net>

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/ciped-cb
NAME=ciped
DESC="encrypted tunnel"

# Sanity checks
test -x $DAEMON || exit 0
test -d /etc/cipe/peers || exit 0
if [ "x$(ls /etc/cipe/peers)" = "x" ]; then
        echo CIPE is not configured yet, stopping.
        exit 0
fi

set -e

function Usage () {
        echo "Usage: `basename $0` start|stop|restart|force-reload 
all|<config_name>"
        exit 1
}

function startif () {
        for i in $CONF; do
                echo -n "$(basename $i) "
#               start-stop-daemon --start --exec $DAEMON \
#                       --name ${DAEMON}-$(basename $i) \
#                       -- -o "$i" "arg=$(basename $i)"
                $DAEMON -o $i "arg=$(basename $i)"
        done
}

function stopif () {
#    for a in $(/sbin/ifconfig|grep ^cip|sed 's/ .*//g'); do
#       echo -n "$a "
#    done
        for i in $CONF; do
                echo -n "$(basename $i) "
                start-stop-daemon --quiet --stop --pidfile 
/var/run/ciped.$(basename $i).pid \
                    --oknodo
    done
}

case $2 in 
all)
        CONF="/etc/cipe/peers/*"
        ;;
'')
        Usage
        ;;
*)
        CONF="/etc/cipe/peers/$2"
        ;;
esac

case "$1" in 
  start)
        echo -n "Starting ${DESC}: "
        startif
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping ${DESC}: "
        stopif
        sleep 3
        modprobe -r -q cipcb
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting ${DESC}: "
        stopif
        sleep 1
        startif
        echo "$NAME."
        ;;
  *)
        Usage
        ;;
esac

exit 0

Attachment: pgp00000.pgp
Description: "PGP signature"


<< | Thread Index | >> ]    [ << | Date Index | >> ]