IGELSecurityUMS

Disable Wifi when you are connected by cable.

Wifi detects
Published by Daniel Ugarte 21 Feb 2019
When we use Wifi in a laptop and you connect to your Corporate Network, you don’t want your users to be connected to an unsecure wifi and at the same time in your Corporate Network. So, we can create a new profile where we use a script to detect the LAN network connection and automatically  disable wifi adapter. After you disconnect from the LAN network, wifi adapter is activated again.

This Script is for the Igel version 10. Wifi detects

echo '#!/bin/bash' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'if [ "$1" = "eth0" ]; then' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'case "$2" in' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'up)' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'nmcli radio wifi off' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo ';;' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'down)' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'nmcli radio wifi on' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo ';;' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'esac' >> /etc/NetworkManager/dispatcher.d/99-wlan
echo 'fi' >> /etc/NetworkManager/dispatcher.d/99-wlan
chmod +x /etc/NetworkManager/dispatcher.d/99-wlan

Comments (2)

  1. Daniel, Thanks for this script. It’s exactly what I was looking for. Do you know if it’s still compatible with version 11? I would think it would be.

Comment here