Tuesday, 12 August 2014

Linux: Remote Shutdown/WoL Window's with 802.1x enabled

Remote WoL


I will be using my Linux desktop to remotely boot up the workstations connected to the LAN.

Configure NIC's


I should really implement a GPO to configure this, however for this post you can do the following;
  • Click Start
  • Navigate and second click Computer -> Manage
  • Click Device Manager -> Double click your network card under Network Adapters
  • Click Power Management;
    • Allow the this device to wake the computer
    • Only allow a magic packet to wake the computer
  • Click OK

Gather MAC addresses


You can either go to your core switch to gather all of the MAC addresses, or in my case I've gathered them per access switch. So that I have some control over what I will be remotely booting up.

Installing Etherwake




Create bash file


When the bash file is ran it will go though this list of MAC addresses;




You can create a cronjob to run the script at a set time if you want.

 

Test bash file

If you do have any errors, you should have some output explaining why.



802.1x


With 802.1x port authentication on the network, PC's will not boot until they have been authorised. Which means only when they have been booted up and successfully negotiated with your authentication server.

So what I've done to overcome this problem is to create macro's on my switches to quickly enable and disable port authentication.

To create a macro enter the following commands;




Test the macro (the PC's were already on in this case)




Remote shutdown


You can use the following command to remotely shutdown PC's

 

By default remote shutdown is blocked, to enable it complete the following;

Navigate to;

  • Computer Configuration -> Administrative Templates -> Network -> Network Connections -> Windows Firewall


Enable the two settings shown in the screenshot;



You can configure which IP addresses are allowed in the 'Allow unsolicited incoming messages from these IP addresses' box.

Additionally navigate to and configure the following;

  • Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> User Rights Assignments



This will only allow user's with the administrators group to initiate a remote shutdown.

Create bash file


Create a bash file like we did earlier;

Example;

  • sudo net rpc shutdown -I 192.168.1.1 -U USER%PASSWORD

For me I put in commands for 192.168.1.1-199, as that is the IP range of end user PC's.

I also created another bash file with aborts the shutdown

  • sudo net rpc abortshutdown -I 192.168.1.1 -U USER%PASSWORD

Again you can create a cronjob to automate this process


No comments:

Post a Comment