Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: vpnc: devel

scripts help

 

 

vpnc devel RSS feed   Index | Next | Previous | View Threaded


paulf at free

Nov 26, 2007, 2:09 PM

Post #1 of 7 (969 views)
Permalink
scripts help

Hi

I've just been having a go at getting vpnc 0.5.1 to work. This is on
Solaris Express Developer Edition 09/07 with Sun Studio 12. It compiled
quite easily (though with a few warnings). I had to twiddle the Makefile
to get it to use ginstall rather than install.

When I ran vpnc, it looks like the connection is being made, but I had
problems with vpnc-script and vpnc-disconnect.

The most glaring thing is that these are bash scripts (maybe ksh as
well, I didn't test) but they claim via #!/bin/sh to be Bourne shells.

Here is the end of the output (IP addresses substituted for XXX etc):
ifconfig: setifflags: SIOCSLIFFLAGS: tun0: no such interface
add host XXX: gateway YYY: entry exists
route: gateway required for add or delete command
add net default: gateway ZZZ: Network is unreachable
VPNC started in background (pid: 1313)...

/etc/resolv.conf didn't look good:
#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
domain OLD NEW
nameserver AAA

nameserver BBB

Hmm, two domains, not one?
AAA and BBB look reasonable.

It looks to me as though the ifconfig and route parts are failing.

Has anyone had similar problems?

A+
Paul

_______________________________________________
vpnc-devel mailing list
vpnc-devel[at]unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/


jmvpnc at loplof

Nov 28, 2007, 8:50 AM

Post #2 of 7 (937 views)
Permalink
Re: scripts help [In reply to]

On Mon, Nov 26, 2007 at 11:09:49PM +0100, Paul Floyd wrote:
> The most glaring thing is that these are bash scripts (maybe ksh as
> well, I didn't test) but they claim via #!/bin/sh to be Bourne shells.

So which bash'isms are used?

> ifconfig: setifflags: SIOCSLIFFLAGS: tun0: no such interface

Well, without the tun interface exverything else will break.

> /etc/resolv.conf didn't look good:
> #@VPNC_GENERATED@ -- this file is generated by vpnc
> # and will be overwritten by vpnc
> # as long as the above mark is intact
> domain OLD NEW

> Hmm, two domains, not one?

Will need to have a look at the script - I don't think that I have that
problem at my system. Can you please add "set -x" near the top of the
script and have a look at the output (or mail it)?

Thanks
Joerg
--
Joerg Mayer <jmayer[at]loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
_______________________________________________
vpnc-devel mailing list
vpnc-devel[at]unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/


jmvpnc at loplof

Nov 28, 2007, 11:17 AM

Post #3 of 7 (934 views)
Permalink
Re: scripts help [In reply to]

OK, 2nd attempt - after some investigations.

On Mon, Nov 26, 2007 at 11:09:49PM +0100, Paul Floyd wrote:
>
> I've just been having a go at getting vpnc 0.5.1 to work. This is on
> Solaris Express Developer Edition 09/07 with Sun Studio 12. It compiled
> quite easily (though with a few warnings). I had to twiddle the Makefile
> to get it to use ginstall rather than install.

Why is that? What's wrong with install?

> problems with vpnc-script and vpnc-disconnect.
>
> The most glaring thing is that these are bash scripts (maybe ksh as
> well, I didn't test) but they claim via #!/bin/sh to be Bourne shells.

I need to know which things are bash'isms. Do you have an idea how to
fix the problem?

> ifconfig: setifflags: SIOCSLIFFLAGS: tun0: no such interface

The reason why tun0 doesn't work has to be figured out - something
seems to go wrong when setting up the tun0 interface.

> add host XXX: gateway YYY: entry exists
> route: gateway required for add or delete command
> add net default: gateway ZZZ: Network is unreachable

Results of tun0 missing.

> domain OLD NEW
...
> Hmm, two domains, not one?

Please test the attached patch and let me know about the result.

Thanks for your feedback!

Ciao
Joerg
--
Joerg Mayer <jmayer[at]loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
Attachments: vpnc-double-domain.diff (0.54 KB)


paulf at free

Nov 28, 2007, 1:02 PM

Post #4 of 7 (935 views)
Permalink
Re: scripts help [In reply to]

Hi

Thabks for the reply.

Joerg Mayer wrote:
> On Mon, Nov 26, 2007 at 11:09:49PM +0100, Paul Floyd wrote:
>
>>The most glaring thing is that these are bash scripts (maybe ksh as
>>well, I didn't test) but they claim via #!/bin/sh to be Bourne shells.
>
>
> So which bash'isms are used?

I'm not sure. I simply changed #!/bin/sh to #!/bin/bash

>>ifconfig: setifflags: SIOCSLIFFLAGS: tun0: no such interface
>
>
> Well, without the tun interface exverything else will break.

tun is OK, I get as far as seeing the welcome message from the IPSec
gateway.

>>/etc/resolv.conf didn't look good:
>>#@VPNC_GENERATED@ -- this file is generated by vpnc
>># and will be overwritten by vpnc
>># as long as the above mark is intact
>>domain OLD NEW
>
>
>>Hmm, two domains, not one?
>
>
> Will need to have a look at the script - I don't think that I have that
> problem at my system. Can you please add "set -x" near the top of the
> script and have a look at the output (or mail it)?

I made the following diff:

The output below came with this diff:
238c237
< LINE="domain $CISCO_DEF_DOMAIN"
---
> LINE="$LINE $CISCO_DEF_DOMAIN"

Otherwise it seems to just append $CISCO_DEF_DOMAIN to the existing
domain line in /etc/resolv.conf, hence the two domains.

The other error message seems to come from
route delete default

ifconfig -a shows, (in addition to rtls0)

tun0:
flags=10010008d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4,FIXEDMTU>
mtu 1412 index 4
inet AAA --> AAA netmask ffffffff

netstat -rn shows
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ---------- ---------
default AAA UG 1 0
CCC 192.168.0.254 UGH 1 1
AAA AAA UH 1 0 tun0
192.168.0.0 192.168.0.1 U 1 3 rtls0

I think that CCC corresponds to the IPSec gateway that I'm connecting to.

One more little thing. If I connect with the Cisco VPN client, it seems
to set an mtu of 1356 rather than 1412. Not sure if that means anything.

Here is the -x output of vpnc-script:

Enter password for user[at]site: +
PATH=/sbin:/usr/sbin:/usr/ccs/bin:/usr/xpg4/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/local/bin:/usr/dt/bin:/export/home/paulf/qt-x11-free-3.3.8/bin:/opt/sfw/bin:/usr/sfw/bin:/bin:/usr/sbin:/usr/lang:/export/home/paulf/bin:/opt/SUNWspro/bin:/usr/ucb:/opt/schily/bin:/opt/tcl/bin:/export/home/paulf/p4
++ uname -s
+ OS=SunOS
+ VPNC_WIN_SCRIPT=/etc/vpnc/vpnc-script-win
+ case "$OS" in
+ DEFAULT_ROUTE_FILE=/var/run/vpnc/defaultroute
+ RESOLV_CONF_BACKUP=/var/run/vpnc/resolv.conf-backup
+ FULL_SCRIPTNAME=/usr/local/sbin/vpnc
++ basename /usr/local/sbin/vpnc
+ SCRIPTNAME=vpnc
+ '[' -d /var/run/vpnc ']'
+ mkdir -p /var/run/vpnc
++ which ip
++ grep '^/'
+ IPROUTE=
+ '[' SunOS = Linux ']'
+ ifconfig_syntax_ptp=
+ route_syntax_gw=
+ route_syntax_del=delete
+ route_syntax_netmask=-netmask
+ '[' -x /sbin/resolvconf ']'
+ '[' -x /sbin/modify_resolvconf ']'
+ MODIFYRESOLVCONF=modify_resolvconf_generic
+ RESTORERESOLVCONF=restore_resolvconf_generic
+ '[' -n '' ']'
+ '[' -z pre-init ']'
+ case "$reason" in
+ do_pre_init
+ '[' SunOS = Linux ']'
+ '[' SunOS = FreeBSD ']'
+ '[' SunOS = GNU/kFreeBSD ']'
+ '[' SunOS = NetBSD ']'
+ '[' SunOS = OpenBSD ']'
+ '[' SunOS = SunOS ']'
+ :
+ exit 0
+
PATH=/sbin:/usr/sbin:/usr/ccs/bin:/usr/xpg4/bin:/usr/bin:/etc:/usr/openwin/bin:/usr/local/bin:/usr/dt/bin:/export/home/paulf/qt-x11-free-3.3.8/bin:/opt/sfw/bin:/usr/sfw/bin:/bin:/usr/sbin:/usr/lang:/export/home/paulf/bin:/opt/SUNWspro/bin:/usr/ucb:/opt/schily/bin:/opt/tcl/bin:/export/home/paulf/p4
++ uname -s
+ OS=SunOS
+ VPNC_WIN_SCRIPT=/etc/vpnc/vpnc-script-win
+ case "$OS" in
+ DEFAULT_ROUTE_FILE=/var/run/vpnc/defaultroute
+ RESOLV_CONF_BACKUP=/var/run/vpnc/resolv.conf-backup
+ FULL_SCRIPTNAME=/usr/local/sbin/vpnc
++ basename /usr/local/sbin/vpnc
+ SCRIPTNAME=vpnc
+ '[' -d /var/run/vpnc ']'
++ which ip
++ grep '^/'
+ IPROUTE=
+ '[' SunOS = Linux ']'
+ ifconfig_syntax_ptp=
+ route_syntax_gw=
+ route_syntax_del=delete
+ route_syntax_netmask=-netmask
+ '[' -x /sbin/resolvconf ']'
+ '[' -x /sbin/modify_resolvconf ']'
+ MODIFYRESOLVCONF=modify_resolvconf_generic
+ RESTORERESOLVCONF=restore_resolvconf_generic
+ '[' -n '' ']'
+ '[' -z connect ']'
+ case "$reason" in
+ do_connect
+ '[' -n 'welcome message' ']'
+ echo 'Connect Banner:'
Connect Banner:
+ echo 'welcome message'
+ read LINE
+ echo '|' 'welcome message
+ read LINE
+ echo '|' $'\r'
|
+ read LINE
+ echo '|' 'welcome message '
| wlcome message
+ read LINE
+ echo '|' $'\r'
|
+ read LINE
+ echo '|' 'welcome message'
| welcome message
+ read LINE
+ echo

+ do_ifconfig
+ ifconfig tun0 inet AAA AAA netmask 255.255.255.255 mtu 1412 up
+ set_vpngateway_route
++ get_default_gw
++ awk '{print $2}'
++ grep '^0.0.0.0'
++ sed 's/^.*:.*$//'
++ sed s/default/0.0.0.0/
++ netstat -r -n
+ route add -host CCC 192.168.0.254
add host CCC: gateway 192.168.0.254
+ '[' -n '' ']'
+ set_default_route
++ get_default_gw
++ awk '{print $2}'
++ grep '^0.0.0.0'
++ sed 's/^.*:.*$//'
++ sed s/default/0.0.0.0/
++ netstat -r -n
+ DEFAULTGW=192.168.0.254
+ echo 192.168.0.254
+ route delete default
route: gateway required for add or delete command
+ route add default AAA
add net default: gateway AAA
+ '[' -n 'BBB BBB' ']'
+ modify_resolvconf_generic
+ grep '^#@VPNC_GENERATED@' /etc/resolv.conf
+ cp -- /etc/resolv.conf /var/run/vpnc/resolv.conf-backup
+ NEW_RESOLVCONF='#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact'
+ CISCO_DEF_DOMAIN_ORIG=DDD
+ INTERNAL_IP4_DNS_TEMP='BBB EEE'
+ exec
+ read LINE
+ case "$LINE" in
+ '[' -n DDD ']'
+ LINE='domain DDD'
+ CISCO_DEF_DOMAIN=
+ NEW_RESOLVCONF='#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
domain DDD'
+ read LINE
+ case "$LINE" in
+ '[' -n 'BBB EEE' ']'
+ read ONE_NAMESERVER INTERNAL_IP4_DNS_TEMP
+ LINE='nameserver BBB'
+ NEW_RESOLVCONF='#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
domain DDD
nameserver BBB'
+ read LINE
+ case "$LINE" in
+ NEW_RESOLVCONF='#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
domain DDD
nameserver BBB
'
+ read LINE
+ exec
+ for i in '$INTERNAL_IP4_DNS_TEMP'
+ NEW_RESOLVCONF='#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
domain DDD
nameserver BBB

nameserver EEE'
+ '[' -n '' ']'
+ echo '#@VPNC_GENERATED@ -- this file is generated by vpnc
# and will be overwritten by vpnc
# as long as the above mark is intact
domain DDD
nameserver BBB

nameserver EEE'
+ '[' SunOS = Darwin ']'
+ exit 0
VPNC started in background (pid: 999)...


_______________________________________________
vpnc-devel mailing list
vpnc-devel[at]unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/


paulf at free

Nov 29, 2007, 12:26 PM

Post #5 of 7 (939 views)
Permalink
Re: scripts help [In reply to]

Joerg Mayer wrote:
> OK, 2nd attempt - after some investigations.
>
> On Mon, Nov 26, 2007 at 11:09:49PM +0100, Paul Floyd wrote:
>
>>I've just been having a go at getting vpnc 0.5.1 to work. This is on
>>Solaris Express Developer Edition 09/07 with Sun Studio 12. It compiled
>>quite easily (though with a few warnings). I had to twiddle the Makefile
>>to get it to use ginstall rather than install.
>
>
> Why is that? What's wrong with install?

Solaris install has a different syntax to GNU install. Something like
install -f /dest/dir -m 700 file
ginstall gets installed with a full installation (at least with Solaris
Express).

>>problems with vpnc-script and vpnc-disconnect.
>>
>>The most glaring thing is that these are bash scripts (maybe ksh as
>>well, I didn't test) but they claim via #!/bin/sh to be Bourne shells.
>
>
> I need to know which things are bash'isms. Do you have an idea how to
> fix the problem?

Running the script produces
/etc/vpnc/vpnc-script: !: not found
/etc/vpnc/vpnc-script: !: not found

and with -x

+ ! [ -d /var/run/vpnc ]
/etc/vpnc/vpnc-script: !: not found

A+
Paul








_______________________________________________
vpnc-devel mailing list
vpnc-devel[at]unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/


paulf at free

Nov 29, 2007, 1:50 PM

Post #6 of 7 (936 views)
Permalink
Re: scripts help [In reply to]

Hi

>>ifconfig: setifflags: SIOCSLIFFLAGS: tun0: no such interface
>
>
> The reason why tun0 doesn't work has to be figured out - something
> seems to go wrong when setting up the tun0 interface.

I don't understand why I'm seeing this message when ifconfig -a shows tun0.

A+
Paul

_______________________________________________
vpnc-devel mailing list
vpnc-devel[at]unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/


jmvpnc at loplof

Nov 30, 2007, 9:24 AM

Post #7 of 7 (936 views)
Permalink
Re: scripts help [In reply to]

On Thu, Nov 29, 2007 at 09:26:00PM +0100, Paul Floyd wrote:
> > Why is that? What's wrong with install?
>
> Solaris install has a different syntax to GNU install. Something like
> install -f /dest/dir -m 700 file
> ginstall gets installed with a full installation (at least with Solaris
> Express).

Needs more research on how to work around this from my side.

> + ! [ -d /var/run/vpnc ]
> /etc/vpnc/vpnc-script: !: not found

Please test the attached patch.

Thanks

Joerg
--
Joerg Mayer <jmayer[at]loplof.de>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
Attachments: bashism.diff (0.37 KB)

vpnc devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.