Repair Network Connection via Self Service

asegura
Contributor

I would like to offer my users to be able to repair their network connection in case they are having issues connection to the internet. Since they don't have admin rights they are limited on what they can do. I was looking for a way to script this. I know on windows all you have to do is ipconfig /release and then ipconfig /renew and that usually refreshes your IP addresses. Is it possible to script this or is anyone here offer this as a self service item??

6 REPLIES 6

bentoms
Release Candidate Programs Tester

@asegura, if the Mac has issues connecting to the Internet... How will they connect to Self Service?

Might be better at looking at an AppleScript app that runs some shell commands to "fix" the connection.

mm2270
Legendary Contributor III

I was thinking the same thing. Self Service.app requires a connection to the JSS to work at all, which would mean a valid network connection. Its really just a browser of sorts.
If the users aren't admins, coming up with something for this could be very tricky.

Only thing I can think of is to create a LaunchDaemon that uses a WatchPath file or folder that is writable by a non admin user. Create a simple Applescript or Applescript app, etc that writes a value to the file/folder that the LaunchDaemon sees and then runs a script to correct their network connection (if it can)

Edit: Actually, the above would only be necessary if the commands you need to run require admin rights (root). I'm not certain if it would.

asegura
Contributor

@bentoms you have a valid point. Not sure what I was thinking I guess I will chalk this up to a Monday :). But if I wanted to create a self service policy that will renew their DHCP is that possible?

davidhiggs
Contributor III

So does Self Service need an offline mode for cached policies? :)

mm2270
Legendary Contributor III

@davidhiggs, already requested a while ago- https://jamfnation.jamfsoftware.com/featureRequest.html?id=222 :)

Since Self Service is really just loading a web page, I don't see why it couldn't be directed to a local web cache on the Mac for any cached policies. I think it would be a neat feature to be able to set up offline cached policies to show up in a special 'limited' Self Service mode that would load if the Mac didn't have a connection back to the JSS, or even if it didn't have an active network connection, although that last option would be a little tricky, since its possible some cached SS policies might still require an internet connection of some kind to work at all.

sean
Valued Contributor

To renew a lease you'll need to work out which port is active and then run the following (setting the variable activeNetworkPort as, for example, en0)

Needs to run as root.

echo "add State:/Network/Interface/${activeNetworkPort}/RefreshConfiguration temporary" | scutil

You could use something like Platypus to wrap a script into your own Self Service application.