How to start openvpn-service manually via ssh or terminal?

how can i start openvpn-service manually via ssh or terminal? need that for a script.

Learn more, read the entire thread inside the IGEL Community o Slack

Run as user: /config/sessions/openvpn0

thx, will try!

thanks, overall it seems to work. thanks.

any command to release the vpn connection?

ok, besides my last question, which is a nice-to-have feature for me, i have the issue, that the vpn connection is established and immediately removed again.

any idea, why?

when calling /config/sessions/openvpn0 manually on an igel client connected to the internet, we get the following output (have to type it manually, just got a screenshot):

`setup_cmd: Execute [/config/bin/openvpn-session-handler] as root`

`Verbindung >openvnp0< wurde erfolgreich deaktiviert (aktiver D-Bus NetworkManager/activeConnecton/41`

`openvpn0 d3acxxxxxxxxxxxxxx vpn`

`openvpn0 d3acxxxxxxxxxxxxxx vpn`

`openvpn0 d3acxxxxxxxxxxxxxx vpn`


connection is shortly established and immediately removed.

Session is apperently started twice. If one already running and then started a second time , the first one get’s stopped and then the second comes up. Only one VPN at a time.

Do you have eth0 and wlan0 at the same time?

no, we only have eth0 enabled.

i don’t think there is another session, because if you boot up the client vpn is not started automatically (you have to do it manually, we have a link on the desktop to start vpn for this).

I think to be able to debug this you have to post your script (at least in pseudo code) and/or share the journal log (maybe in redacted form for privacy).

this is the script:

if ifconfig eth0 | grep -i inet | sed -e ‘s/.inet addr://’ -e ‘s/Bcast.//’ | grep -vq “^10.100.” ; then ‘/config/sessions/openvpn0’ ; fi

And you put it where?

i tried it in all 4 network-command (always in one place at a time).

Well, started from network-custom-cmds you run the sessions script as root. This why my first reply was _start as user_. Technically, sessions (even though a vpn is not a session pre-se) are supposed to be run by the user (su user -c “_your-cmd_” does the trick). Not sure if this is the reason here, though. But it has the potential to ruin the course of action.

checked already with “su user -c”, but not at all possible locations.

where do you think i should place the script? i think as final network command would be ok?

It’s the session-starter _/config/sessions/openvpn0,_ which has to be run as user. And yes, the final network cmd seems about right. If I wasn’t in home office I’d tested that myself already, but now it’s not so easy to get a vpn playgroud.

no problem, i will test that (let that test 😉 ).

checked again, not working (before we used:

if ifconfig eth0 | grep -i inet | sed -e ‘s/.inet addr://’ -e ‘s/Bcast.//’ | grep -vq “10.2.” ; then su -s /bin/sh user -c ‘/config/sessions/openvpn0’ ; fi

=> /bin/sh was explicitely called. but uit behaves identically.

please ignore the network-differences in my statements – we have the correct IPs in the configuration, due to obfiscating i am using other ip-ranges here.

Continue reading and comment on the thread ‘How to start openvpn-service manually via ssh or terminal?’.  Not a member? Join Here!

Learn more, search the IGEL Knowledge Base

Ask a question or comment on the above message thread?

Join or log in to the IGEL Community to ask us anything and meet other IGEL customers, partners, and EUC enthusiasts.

Submit a question, or Join Today!

Popular Message Threads

Categories & Tags: