Posted on 07-18-2017 02:03 AM
Hi
i will appreciate if someone will be able to help with that.
Our security department required to block network bridge between WiFiEthernet or two Ethernet connection at the same time equally. i found script here at jamf ( airport.sh) that working great only when switching between WiFi to Ethernet and bi-directional. the problem is that once we are connect with two Ethernet networks it doesn't block the second Ethernet.
so at that scenario the bridge network is available.
what do i need to add to the script? how can i preferred only one Ethernet device to be active?
here the script:
PlistBuddy=/usr/libexec/PlistBuddy
plist=/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
count=networksetup -listallhardwareports | grep Hardware | wc -l | tr -s " "
echo "Found$count network interfaces"
counter=0
while [ $counter -lt $count ]
do
interface[$counter]=$PlistBuddy -c "Print Interfaces:$counter:SCNetworkInterfaceType" $plist
let "counter += 1"
done
counter=0
while [ $counter -lt $count ]
do
bsdname[$counter]=$PlistBuddy -c "Print Interfaces:$counter:BSD Name" $plist
let "counter += 1"
done
counter=0
while [ $counter -lt $count ] do
if [ "${interface[$counter]}" = "IEEE80211" ] then
airportArray[$counter]=${bsdname[$counter]} fi
if [ "${interface[$counter]}" = "Ethernet" ] then
ethernetArray[$counter]=${bsdname[$counter]} fi
let "counter += 1"
done
for i in ${ethernetArray[@]}
do
echo $i is Ethernet
done
for i in ${airportArray[@]}
do
echo $i is Airport
done
for i in ${ethernetArray[@]}
do
activity=netstat -I $i | wc -l
if [ $activity -gt 1 ]
then
echo "$i has activity..."
checkActive=ifconfig $i | grep status | cut -d ":" -f2
if [ "$checkActive" = " active" ] then echo "$i is connected...turning off Airport"
networksetup -setairportpower ${airportArray[@]} off
echo "Airport off"
exit 0
fi
if [ "$checkActive" = " inactive" ]
then
echo "$i is not active"
fi
fi
done
echo "Checked all Interfaces"
networksetup -setairportpower ${airportArray[@]} on
echo "Airport on"
exit 0
thank you
Posted on 07-18-2017 07:09 AM
I suspect applying ifconfig en# down to any non-primary ethernet interface would do the trick, albeit with side effects related to failover. However, why are you trying to stop bridges via script? I just block the sharing prefpane with a configuration profile to prevent their being created. If you are imaging clients, you also have the option of tampering with /System/Library/PreferencePanes/SharingPref.prefPane/Contents/Resources/servicelist.xml in the image.
Posted on 07-18-2017 10:29 PM
Hi can you explain how to apply your solution with Jamf Pro?
thank you