[SOLVED] Theme Change While VPN Connected?

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

[SOLVED] Theme Change While VPN Connected?

Post by DVScuba »

I've been searching for a while but no hits on this idea. I couldn't even get a response in the chat room...

I'm looking for a highly visible indication that my OpenVPN is connected. ie. A red coloured panel, different desktop background, alternate coloured browser frame, blinking network icon etc... or something like that. Just something to let me know my work VPN is still connected so I don't accidentally hit an NSFW site while on the VPN.

Is there anything readily available for this or will I need to write some custom code or something? I'm NOT a coder by any means. :mrgreen:

LM 19.1 Cinn 64-bit

Thanks,

DV
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

hi DV!

Since you mention being on Cinnamon I'll recommend VPN LookOut applet (available from Mint menu> Applets) and featured here:
https://cinnamon-spices.linuxmint.com/applets/view/305

It is not as extreme as changing color of panel or desktop background, however it is a pretty big icon sitting in systray with a nice big Green color ofr VPN up and Red for down. It can also be configured to do many things VPN related, like auto-reconnect, beep and flash when it goes down, start, stop, restart VPN related apps (customizing here may get you ways to work in desktop background changes, etc).

The other app I rely on is indicator-IP (from bovender PPA) which shows me my public IP address (where my internets exit) on the panel and left click it in systray to show all addresses on system network interfaces (Public, enp3s0, and TUN0 in my case).
https://github.com/bovender/indicator-ip

there may be other and better methods, like using OVPN GUI clients (provided by some providers) to automate a "kill switch" effect (all internet is cut off if VPN goes down), this can also be done using scripts and UFW/iptables (and is similar in function to things you can do with VPN LookOut applet).

There is also advanced settings in Network Manager (NM) to ensure reconnects are initiated immediately if disconnected using Ping interval and Ping-restart commands (also good for manual .ovpn config edits).

forum member phd21 and I had a good discussion about most all of this I mention above a couple months back you might find some useful info there:
[SOLVED] UFW script for VPN drop protection (kill switch)

Hope this helps!
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

Hey redlined,

Thanks for your fast reply. I'll definitely look into all of these options and post back. I appreciate the multiple options you have provided.

Many Thanks,

DV
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

DVScuba wrote: Mon Jan 21, 2019 8:29 am Hey redlined,

Thanks for your fast reply. I'll definitely look into all of these options and post back. I appreciate the multiple options you have provided.

Many Thanks,

DV
hi DV, you're welcome! a real cut to the quick for my above ramble is try that VPN OutLook applet first (see applet manager) I think you will find it nice to have and work with. Even the basic function alone is a good VPN up/down green/red indicator on systray and it is spot on fast if VPN drops, and can perform a number of actions predefined and user customized on startup, when VPN starts, drops, reconnects, etc... Dev has really made it a gem this past few months of updates.
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

Even the basic function alone is a good VPN up/down green/red indicator on systray
I must be doing something wrong. I really like the idea behind this applet, but it doesn't seem to work for me. I enable my OpenVPN connection to work and all is well. The applet icon recognizes tun0 is up and turns green. When I disconnect, it stays green and continues to report tun0 as connected.

Checking my public IP shows the correct IP when I'm connected and also when I'm not connected, so I know that the actual OpenVPN tunnel is working, but unfortunately, the VPN Out-Look applet is not reporting correctly. And that's a shame, 'cause I really thought it was going to be suitable for me.

I'm off to look through the comments at https://cinnamon-spices.linuxmint.com/applets/view/305 to see I I can spot anything similar.

DV

EDIT: Looks like I need to wait for Cinnamon 4.x support. No biggie. Thanks again for the help. - DV
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

DVScuba wrote: Mon Jan 21, 2019 7:43 pm
Even the basic function alone is a good VPN up/down green/red indicator on systray
I must be doing something wrong. I really like the idea behind this applet, but it doesn't seem to work for me. I enable my OpenVPN connection to work and all is well. The applet icon recognizes tun0 is up and turns green. When I disconnect, it stays green and continues to report tun0 as connected.

Checking my public IP shows the correct IP when I'm connected and also when I'm not connected, so I know that the actual OpenVPN tunnel is working, but unfortunately, the VPN Out-Look applet is not reporting correctly. And that's a shame, 'cause I really thought it was going to be suitable for me.

I'm off to look through the comments at https://cinnamon-spices.linuxmint.com/applets/view/305 to see I I can spot anything similar.

DV

EDIT: Looks like I need to wait for Cinnamon 4.x support. No biggie. Thanks again for the help. - DV
oh no, it is perfect in Cinnamon 4 (I'm on 4.0.9) it was infact broke for a couple months before he started updating it though :?

ok, let me look- have you enabled indicator support for system? something tingles to remind of that... brb with more if I find something else, but this works fine using NM to handle ovpn or custom client, like eddie from airvpn. it picks up the right tun, eth and public addys, immediate, every time...
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

real quick, confirm you did this:
For full facilities including notifications and audible alerts the zenity, sox, libsox-fmt-mp3 and xdg-utils libraries must be installed. They can be installed wih the Synaptic Package Manager or using the following terminal command:

LinuxMint: sudo apt update && sudo apt install zenity sox libsox-fmt-mp3 xdg-utils
then restart Cinnamon or logout and back in to see if it is working as expected. If nothing was installed from the above list (as in already on system/latest version response in terminal then :? i continue looking 8)
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

I really appreciate how much you are trying to help me figure this out. Really... :D
real quick, confirm you did this:

--snip--
LinuxMint: sudo apt update && sudo apt install zenity sox libsox-fmt-mp3 xdg-utils
I did it again, just to be certain I didn't miss any errors: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
have you enabled indicator support for system? something tingles to remind of that...
I checked and found indicator support off. Enabling has made no difference. I'm off for a reboot to see if it helps any after enabling indicator support.

Running - LM 19.1 Cinn 4.0.9 // LK 4.18.0-13-generic on Intel Core i7-2600K @ 3.40GHz x 4 w/ 8GiB
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

Indicator support continues to make no difference to my issues with VPN Look-Out Applet

Wait. What? - "Try to reconnect to VPN when it shuts down incidentally." - I had this off as I'm looking for manual control, but found this when I toggled it on: "Do not try to reconnect automatically if the VPN has been disconnected by the user." - Toggled this on too in hopes of getting lucky, but no dice. :?

I'm going to go sleep on this for a few hours...

Thanks again for all the suggestions, redlined.

DV
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

Ummm. I didn't do anything, but suddenly, everything is working as it should. I swear, the only difference is a bowl of cereal and a couple of sips of coffee. Many thanks, redlined. Your persistence must have done something through the sleep cosmos for my ailment.

Have an awesome day!!! :D :D :D :D :D

DV
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

(rofl)
Most excellent news that it is working!

a good night rest and a next morning cup of world's strongest coffee always helps here too :mrgreen:

very glad this got sorted, and you are very welcome.

please consider going back to your first post this thread, click edit (pencil icon, top right) then add <SOLVED> to the topic/subject, this is a forum norm and may help others in future who seek solutions to similar issues. Thanks!
(and you have an awesome day too 8)
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: [SOLVED] Theme Change While VPN Connected?

Post by DVScuba »

Done!
redlined

Re: [SOLVED] Theme Change While VPN Connected?

Post by redlined »

and... solved it is, you da man DV! :mrgreen:

ps. Welcome to the Mint forums! it's a great place to learn, get issues resolved and participate in a large community of experienced Linux users.
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: [SOLVED] Theme Change While VPN Connected?

Post by DVScuba »

redlined wrote: Tue Jan 22, 2019 6:27 pm and... solved it is, you da man DV! :mrgreen:

ps. Welcome to the Mint forums! it's a great place to learn, get issues resolved and participate in a large community of experienced Linux users.
Sorta solved... I'm still seeing some weird behaviour that changes up frequently but I'm unable to replicate at will. If I find out what it is, I'll report back, but essentially it seems if I just leave the applet alone and connect/disconnect the VPN through Network Manager, the applet icon *appears* to change colour correctly. This is OK for now.

Thanks again for all your help and also for welcoming me to these forums. I hope to be able to share back myself one day.

Cheers!!

DV
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

strange behavior... and you are not required to keep this thread marked solved, for sure lol... we are still trying to resolve a good visible theme level change showing VPN status for you- so if it is not working out, then we continue (and maybe others take notice and add their thoughts and recommendations :wink:

I do see you use NM to manage it, all good (although I don't rely on LookOut to do anything more than green light/red light me, and shut down transmission (torrents client) if VPN drops- which it does, immediately. fwiw, in recent past I successfully used LookOut to even run a script for UFW (kill switch effect) if VPN dropped when dev added/fixed that feature. but then dumped NM handling VPN and use eddie (Airvpn ovpn client) for multi-server and multi-provider config managing, auto-reconnects, instant switching servers and providers, and a very good 'kill switch' (basically just a UFW/iptables action script) as well a simpler way to tell VPN what I have going locally- ref dnscrypt-proxy&dnsmasq, and local networking desires, etc... After that I told LookOut to watch tun0 and it just works, flawlessly (continuing to shut down torrent if drop as well, saying the up/down execute this function does work, as expected)

saying all that, no sweat and certainly no shame. if this is not actually solved for you- you can edit that <solved> back out (I've removed it from this reply, just in case you decide to pursue further 8)

although My issue is/now becomes a lack of clear cut commandline knowledge useful to pull effective log reports showing reasons or indicators towards what may be going on, and drill down to a fix from there... so...

my thoughts are troubleshooting where I feel a bit more competent, eg. is your VPN a provided service? if so, by who? and do they provide pre-generated ovpn configs you imported into NM? (do share link to, if not violating your privacy concerns)

We'll get this sorted, if you hang in there- I will too :mrgreen:
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

From my OP:
DVScuba wrote: Sun Jan 20, 2019 3:14 pm I'm looking for a highly visible indication that my OpenVPN is connected. ie. A red coloured panel, different desktop background, alternate coloured browser frame, blinking network icon etc... or something like that. Just something to let me know my work VPN is still connected so I don't accidentally hit an NSFW site while on the VPN.
So this is working, in a sense, *backwards* to what I wanted, but it's workable if it works consistently, which it doesn't. The expected behaviour of the applet is to warn and protect against privacy concerns if a private VPN, used for torrenting and such, drops unexpectedly. My situation is the reverse of this. I don't want my *work VPN* to remain connected after I finish my work. Sometimes I forget to disconnect the VPN...

Disconnecting with a middle click on the applet icon disconnects the VPN, but it reconnects immediately, even though I've selected the option to "Do not try to reconnect automatically if the VPN has been disconnected by the user." It seems to work OK as a notification icon only, with reversed colours to what I would have liked, so long as I use the NM to control the VPN but even then, it appears it reconnects automatically according to the applet, where in reality the VPN has not reconnected providing false information about the VPN status. Does that make sense?

Head scratcher for sure...

DV
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

it does make sense, much more so now than I envisioned before, as my approach is always VPN up, otherwise immediate reconnect or cutoff internets. as I assumed this sort of function was what you wanted as well, but..not! :oops:

ok, next mess I make :shock: :mrgreen:

Your VPN should not reconnect automagically unless you tell it to... and I don't think LookOut applet is responsible for reconnects, unless it is set to :? (or... there is another sneaky offender somewhere)

Try: left click NM, select Network Connections (not Network Settings), select your connection type (wired or wireless, not VPN) and click the gear box (lower left) to edit connection details, and in general tab ensure "Automatically connect to VPN when using this connection" is not selected/checked, then save and close.

While still in NM Network Connections, next select your VPN and click the gear box to edit. Go to VPN tab and click "Advanced" (lower right), at the bottom ensure there is nothing listed for "ping-restart" at the very bottom option "Specify exit or restart ping".

Also, in VPN LookOut applet, right click, select configure, turn off "Manage VPN-related apps" in the tab with same name, then in VPN tab jsut a quick double-check to ensure all is unselected.

Another option may work nicely is app to show your public IP address on the panel (systray), this will show your home IP when connected VPN free and will show your work exit if/when VPN is connected. I use bovendar PPA indicator-IP for this and it works great.

The cinnamon applet, IP-indicator (not bovendar PPA, but in menu> applets) and it can be configured for quite a few different options, including changing icon to anything showing ISP vs VPN up/down, takes a bit more to get it sorted but very doable and does work nicely even for multiple public exits and providers.

I imagine you could also set controls to what "Users" can use the VPN (Network Connections, General tab) and create a 'user' authorized to use VPN, then when you want VPN you have to run it with those credentials. I'm not familiar with this method of control as my VPN up desire is and always has been opposite what you are wanting to do :lol:

It is also possible to run ovpn through a local proxy, basically limiting what goes thru VPN to be only apps (with proxy support options), that you manually configure to use proxy/VPN to access the internet (instead of default entire system internet access routed thru VPN). This could be real useful if combined with browser profile(s) with one set to use proxy/VPN and other to not use proxy, but a non-starter if your work apps and personal use apps don't support proxy and/or profiles.
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

Hey redlined. I've carefully followed all your suggestions, step-by-step and really need to take a break from this for a bit. It's making me crazy that the LookOut VPN applet shows connected when the VPN is disconnected. I tried the Cinnamon applet IP-Indicator, but it doesn't seem to be configurable as I would like. Both my provider and VPN concentrator are the same ISP (I work for the ISP that my basic connection is through) so that won't work well.

I tried Bovendar PPA Indicator-IP also and it shows my public IP when I'm not connected, shows ...-...-...-... when the VPN is connected then when VPN is disconnected, it remains at ...-...-...-... No amount of refreshing corrects this.

Could this be a kernel level thing?

My head hurts. Tomorrow is a new day.
redlined

Re: Theme Change While VPN Connected?

Post by redlined »

DVScuba wrote: Fri Jan 25, 2019 6:24 pm Both my provider and VPN concentrator are the same ISP
new information! wow, unique situation, for sure...

this is from some online source:
What is a VPN Concentrator?

A “VPN Concentrator” is essentially an advanced router that is setup to handle multiple secure connections into the given network, or in other words, a VPN Concentrator is a device that handles multiple VPN tunnels remotely.
and I've never worked with one providing me service. I'm thinking this ups the ante on cost to solve, for sure :P

and unless you are in control of that "advanced router" (highly unlikely), then I have no clue what is going on at provider level router and/or the openvpn server behind it unless you have ovpn configs to share (again, for privacy concerns consider sharing, but remove any IPs listed and any credentials, replaced with dots, that may be present before posting such)
DVScuba wrote: I tried Bovendar PPA Indicator-IP also and it shows my public IP when I'm not connected, shows ...-...-...-... when the VPN is connected then when VPN is disconnected, it remains at ...-...-...-... No amount of refreshing corrects this.
now this is weird, as refresh should prompt it to recheck- although it does use URL (checkip.amazonaws.com by default) to determine your public IP...meaning it needs working DNS to resolve the URL in the first place) but that 'should' be good, at least by the time connection establishes!
DVScuba wrote:Could this be a kernel level thing?

My head hurts. Tomorrow is a new day.
nah, not a kernel thing, rather a can't accurately report due to configuration now seems apparent to me... Since both Look-Out and Indicator-IP both have issue with reporting what is going on which means something is blocking them access to connection state.

and for sure this is an OpenVPN connection? (I ask for confirm since pptp, l2tp/ipsec, ssl, ms-sstp and, oh, and Cisco vpn :?: other such VPNs are certainly not the same and I can hack my way thru an ovpn config to determine what is going on- or have better hints, tips and clues.

ps. my head hurts too :lol:

but it's time for beer/pizza/movie... and, yes! tomorrow is a new day (I always look forward :mrgreen:
DVScuba
Level 1
Level 1
Posts: 36
Joined: Sun Jan 20, 2019 12:19 pm
Location: Kitchener, ON

Re: Theme Change While VPN Connected?

Post by DVScuba »

and for sure this is an OpenVPN connection? (I ask for confirm since pptp, l2tp/ipsec, ssl, ms-sstp and, oh, and Cisco vpn :?: other such VPNs are certainly not the same and I can hack my way thru an ovpn config to determine what is going on- or have better hints, tips and clues.
Yes. OpenVPN for certain. I've edited out the security keys and changed the remote FQDN for security reasons, as well as renamed the .ovpn file name with a .txt extension so I can attach it here:
firstname.lastname.ovpn.txt
I really don't know what I could be doing wrong, but I suppose it's possible that there are security measures in place on the VPN concentrator preventing something, although I wouldn't know what.

On another angle, I know the public IP when the VPN is connected is static whereas my local public IP at home is dynamic. I also use a DDNS service for remote access to stuff here at home. Just throwing some more info out there in case I could have a flashing ICON somewhere when my public IP becomes the static one. Just a thought...
Locked

Return to “Other topics”