📄 _plutoload.in
字号:
#!/bin/sh# Pluto database-loading script# Copyright (C) 1998, 1999, 2001 Henry Spencer.# # This program is free software; you can redistribute it and/or modify it# under the terms of the GNU General Public License as published by the# Free Software Foundation; either version 2 of the License, or (at your# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.# # This program is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License# for more details.## RCSID $Id: _plutoload.in,v 1.4 2002/09/15 22:45:14 dhr Exp $## exit status is 13 for protocol violation, that of Pluto otherwiseme='ipsec _plutoload' # for messagesfor dummydo case "$1" in --load) plutoload="$2" ; shift ;; --start) plutostart="$2" ; shift ;; --wait) plutowait="$2" ; shift ;; --post) postpluto="$2" ; shift ;; --) shift ; break ;; -*) echo "$me: unknown option \`$1'" >&2 ; exit 2 ;; *) break ;; esac shiftdone# searches, if needed# the way the searches were done ensures plutoload >= plutoroute >= plutostart# search for things to "ipsec auto --add": auto in "add" "route" "start"eval `ipsec _confread --varprefix PLUTO --search auto add route start`if test " $PLUTO_confreadstatus" != " "then echo "auto=add/route/start search: $PLUTO_confreadstatus" echo "unable to determine what conns to add -- adding none" plutoload=else plutoload="$PLUTO_confreadnames"fi# search for things to "ipsec auto --route": auto in "route" "start"eval `ipsec _confread --varprefix PLUTO --search auto route start`if test " $PLUTO_confreadstatus" != " "then echo "auto=route/start search: $PLUTO_confreadstatus" echo "unable to determine what conns to route -- routing none" plutoroute=else plutoroute="$PLUTO_confreadnames"fi# search for things to "ipsec auto --up": auto in "start"eval `ipsec _confread --varprefix PLUTO --search auto start`if test " $PLUTO_confreadstatus" != " "then echo "auto=start search: $PLUTO_confreadstatus" echo "unable to determine what conns to start -- starting none" plutostart=else plutostart="$PLUTO_confreadnames"fi# await Pluto's readiness (not likely to be an issue, but...)eofed=ywhile read sayingdo case "$saying" in 'Pluto initialized') eofed= ; break ;; # NOTE BREAK OUT *) echo "pluto unexpectedly said \`$saying'" ;; esacdoneif test "$eofed"then echo "pluto died unexpectedly!?!" exit 13fi# database loadfor tu in $plutoloaddo ipsec auto --add $tu || echo "...could not add conn \"$tu\""done# enable listeningipsec auto --ready# execute any post-startup cleanupif test " $postpluto" != " "then $postpluto st=$? if test " $st" -ne 0 then echo "...postpluto command exited with status $st" fifi# quickly establish routingfor tu in $plutoroutedo ipsec auto --route $tu || echo "...could not route conn \"$tu\""done# tunnel initiation, which may take a whileasync=if test " $plutowait" = " no"then async="--asynchronous"fifor tu in $plutostartdo ipsec auto --up $async $tu || echo "...could not start conn \"$tu\""done# report any further utterances, and watch for exit statuseofed=ywhile read sayingdo case "$saying" in exit) eofed= ; break ;; # NOTE BREAK OUT *) echo "pluto unexpectedly says \`$saying'" ;; esacdoneif test "$eofed"then echo "pluto died without exit status!?!" exit 13fiif read statusthen exit $statuselse echo "pluto yielded no exit status!?!" exit 13fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -