# VPN config based on SSID

**URL:** <https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350>\
**Category:** Router\
**Created:** [April 18, 2018, 11:23am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350 "2018-04-18T11:23:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![forester](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/f/d78d45/32.png) [@forester](https://forum.gl-inet.com/u/forester)\
**Post date:** [April 18, 2018, 11:23am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/1 "2018-04-18T11:23:45Z")

</div>

Hi,

So I have a couple of SSID’s which are behind firewalls which means it can only reach my VPN’s on particular ports.

I therefore would like to use a particular VPN profile based on the SSID name.

I am quite comfortable on the shell so can always invoke openvpn with the appropriate configuration file - but then the WebGUI does not reflect the “true state”.

Is there a particular way I can change this in a manner that will reflect in the gl-inet WebGUI?

Things I have tried:

- Merely killing openvpn and pointing to the new ovpn file - WebGUI still reflects the previous choice in the webGUI
- curl script to login (this works) and then call openvpn\_cgi with the ovpn-filename, struggling to get this to work, probably because I do not know how to handle the CSRF token header
- Call the openvpn\_cgi directly - this is a binary though and wants me to authenticate so no idea how

Any tips welcome!

---

<div class="post-metadata">

**Author:** ![alzhao](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@alzhao](https://forum.gl-inet.com/u/alzhao)\
**Post date:** [April 20, 2018, 10:16am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/2 "2018-04-20T10:16:11Z")

</div>

Check /etc/config/glconfig and find the current ovpn file under use.

---

<div class="post-metadata">

**Author:** ![forester](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/f/d78d45/32.png) [@forester](https://forum.gl-inet.com/u/forester)\
**Post date:** [April 20, 2018, 10:32am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/3 "2018-04-20T10:32:30Z")

</div>

Thanks @alzhao however ‘ps’ can tell me the same - is there a way to change the running config and ensure the WebUI reflects the change though?

---

<div class="post-metadata">

**Author:** ![alzhao](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@alzhao](https://forum.gl-inet.com/u/alzhao)\
**Post date:** [April 20, 2018, 10:45am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/4 "2018-04-20T10:45:10Z")

</div>

I am afraid that it is that smart to do that.

---

<div class="post-metadata">

**Author:** ![forester](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/f/d78d45/32.png) [@forester](https://forum.gl-inet.com/u/forester)\
**Post date:** [April 20, 2018, 11:40am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/5 "2018-04-20T11:40:40Z")

</div>

Ok, figured it out -  
$ uci get glconfig.openvpn.ovpn # shows current one  
$ uci set glconfig.openvpn.ovpn='/etc/openvpn/example.ovpn # sets to the new one

The GUI reflects the above

Unsure how to hit the ‘apply’ (it is not ‘uci commit’) but stopping and starting openvpn from the same script does it for me for now.

---

<div class="post-metadata">

**Author:** ![kyson-lok](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/kyson-lok/32/185_2.png) [@kyson-lok](https://forum.gl-inet.com/u/kyson-lok)\
**Post date:** [April 20, 2018, 1:35pm UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/6 "2018-04-20T13:35:03Z")

</div>

@forester To apply it. Try to do this.

```shell
# uci commit glconfig
# /etc/init.d/startvpn restart

```

---

<div class="post-metadata">

**Author:** ![forester](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/f/d78d45/32.png) [@forester](https://forum.gl-inet.com/u/forester)\
**Post date:** [April 20, 2018, 2:17pm UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/7 "2018-04-20T14:17:46Z")

</div>

> [@kyson-lok](#):
>
> /etc/init.d/startvpn restart

@kyson-lok - thanks a ton, works well and much cleaner

---

<div class="post-metadata">

**Author:** ![bruce](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/bruce/32/35649_2.png) [@bruce](https://forum.gl-inet.com/u/bruce)\
**Post date:** [October 29, 2025, 2:56am UTC](https://forum.gl-inet.com/t/vpn-config-based-on-ssid/3350/8 "2025-10-29T02:56:04Z")

</div>


