LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Make OpenVPN connect on Ubuntu startup and then when connected, run a script as su (https://www.linuxquestions.org/questions/linux-networking-3/make-openvpn-connect-on-ubuntu-startup-and-then-when-connected-run-a-script-as-su-4175430460/)

riahc3 10-04-2012 06:24 AM

Make OpenVPN connect on Ubuntu startup and then when connected, run a script as su
 
Hey (That title was a mouthful)

I want that OpenVPN makes a connection when Ubuntu starts up and when the connection is up and running, to run a small script as su(peruser) without any user intervention.

How can I acomplish this?

Thank you

nugat 10-04-2012 11:38 PM

Quote:

Originally Posted by riahc3 (Post 4796954)
I want that OpenVPN makes a connection when Ubuntu starts up and when the connection is up and running, to run a small script as su(peruser) without any user intervention.

Configure the openvpn daemon to autostart - how to do that varies from distro to distro, but it is usually a SysVInit symlink or upstart or systemd command.

Make sure that you've generated a pre-shared key that both sides of the vpn connection will use. configure the openvpn config file to use the keys and to use ip addresses to talk to each other.

to run a script w/superuser privileges, just run it as root. create a script in /etc/init.d/ and configure it to start after your openvpn connection is up.

riahc3 10-05-2012 01:57 AM

Quote:

Originally Posted by nugat (Post 4797723)
Configure the openvpn daemon to autostart - how to do that varies from distro to distro, but it is usually a SysVInit symlink or upstart or systemd command.

Make sure that you've generated a pre-shared key that both sides of the vpn connection will use. configure the openvpn config file to use the keys and to use ip addresses to talk to each other.

to run a script w/superuser privileges, just run it as root. create a script in /etc/init.d/ and configure it to start after your openvpn connection is up.

Im in a Ubuntu distro 12.04 and Im using the network-manager-openvpn to configure it all.

I dont use preshared keys; Im using certified based OpenVPN connections......

Yes I imagine thats the way to do it but how do I configure it to start after my OpenVPN connection is up??

nugat 10-05-2012 09:01 PM

Quote:

Originally Posted by riahc3 (Post 4797809)
Im in a Ubuntu distro 12.04 and Im using the network-manager-openvpn to configure it all.

i'm not familiar w/network-manager-openvpn... is it a start-up script, or a GUI tool, or what?

Quote:

I dont use preshared keys; Im using certified based OpenVPN connections......
okay, that part shouldn't matter, so long as it is file-based, and not something that requires user intervention.

Quote:

Yes I imagine thats the way to do it but how do I configure it to start after my OpenVPN connection is up??
that goes back to how openvpn starts when Ubuntu comes online, if it can be auto-started that is. i assume it can using Ubuntu's boot process - i thought it was upstart. perhaps the following thread will help:

http://ubuntuforums.org/showthread.php?t=1609579


All times are GMT -5. The time now is 03:15 PM.