LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2016, 06:33 AM   #1
kurwen
LQ Newbie
 
Registered: Mar 2016
Distribution: CentOS 7, RHEL6, Xubuntu 14.04
Posts: 8

Rep: Reputation: Disabled
Scripting a VPN


Hello,

1st: I'm using RHEL6 with gnome 2.28.2

I'm working on a script to open all my work stuff on the computer startup.
The first think I have to start is the VPN to the client's network, so here is where I have the problem:

when I bring up the VPN...

nmcli con up uuid my_VPN_UUID

...the system prompt a X window with a 'connection' button.

Is there any way to bypass this window or auto-issue the button-down action?

thanks!

Last edited by kurwen; 03-23-2016 at 06:35 AM.
 
Old 03-23-2016, 02:53 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 162Reputation: 162
Try following command
nmcli con up id ConnectionName
 
Old 03-28-2016, 02:11 AM   #3
kurwen
LQ Newbie
 
Registered: Mar 2016
Distribution: CentOS 7, RHEL6, Xubuntu 14.04
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks nini09,

But I think that command is mainly the same, you just change the way to call the connection.

When I try to star the VPN via
Code:
nmcli
command I receive this output:

Code:
state: VPN connecting (need authentication) (2)
and the X window appear asking me for confirmation... I want to skip/bypass/auto-confirm that panel.


I appreciate your time anyway
 
Old 03-28-2016, 02:44 AM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,862

Rep: Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152
I wonder if you could 'automate' this by adding as a network manager dispatcher script, so that as soon as the regular network is up the VPN is activated.

http://magazine.redhat.com/2008/07/2...-road-warrior/
http://sysadminsjourney.com/content/...work-location/

I apologise in advance if I'm on the wrong track here. It isn't clear to me why the 'connection' prompt is arising as you've described.
 
Old 03-28-2016, 03:10 AM   #5
kurwen
LQ Newbie
 
Registered: Mar 2016
Distribution: CentOS 7, RHEL6, Xubuntu 14.04
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hello ferrari,

Maybe I've not explain myself properly:

my problem is that when I start the VPN from a script (or manually) this X window appear:

http://www.linuxquestions.org/questi...1&d=1459152330

I want to bypass this window (so I can start it from a ssh session) or bring UP the VPN automatically on boot. (the "automatically start connecting next time" is a known bug and does not work)
Attached Thumbnails
Click image for larger version

Name:	Screenshot.png
Views:	20
Size:	20.5 KB
ID:	21276  
 
Old 03-28-2016, 03:24 AM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,862

Rep: Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152Reputation: 1152
Yes, I'm aware of that bug. However AFAIU, a NM dispatcher script can be used so that as soon as the network connection is up (configured to start automatically, the VPN is then activated. That should be able to be achieved without any user prompting required.
 
Old 03-28-2016, 02:43 PM   #7
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 162Reputation: 162
The command, nmcli con up id ConnectionName, is different from yours. If failure, you can add password into dispatcher-scripts like following.

Quote:
[vpn]
....
password-flags=0

[vpn-secrets]
password=your_password
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Shell Scripting Part I: Getting started with bash scripting LXer Syndicated Linux News 0 04-29-2015 08:03 AM
[SOLVED] Windows7 VPN clients behind Debian Gateway can not connect to Draytek VPN neopandid Linux - Server 3 08-31-2012 11:34 PM
LXer: Scripting the Linux desktop, Part 2: Scripting Nautilus LXer Syndicated Linux News 0 02-17-2011 04:02 AM
vpn-vpn Bridge between two networks (1x Debian Server, 1x Cisco RVS4000) qawse Linux - Networking 2 01-14-2011 01:16 AM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 04:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration