Reboot Machines by Monitoring email Instructions
Revision as of 13:07, 17 April 2018 by Michael.mast (talk | contribs) (Created page with "==Purpose== To monitor for emails, then execute commands. In this case we want to *Look for emails from users *Verify the user sent the email *Reboot their remote desktop *Che...")
Purpose
To monitor for emails, then execute commands. In this case we want to
- Look for emails from users
- Verify the user sent the email
- Reboot their remote desktop
- Check for errors
- Report to the user the desktop is ready
For this run we want a Linux server to be the middle man to watch an inbox hosted on Office365, then tell Windows machines to reboot. If the Windows machine does not respond we want to use powercli to forcibly reboot using vsphere (and eventually KVM, which is ironically much easier to do. But when execs want to spend money on the main stream....)
Process
Here I am using Centos 7 with a basic install. Epel-release is installed as well.
Fetchmail
- Install fetchmail
yum -y install fetchmail
- Create a non-root user dedicated to the task
useradd mailuser passwd mailuser su mailuser cd ~/
- Create .fetchmailrc and add the following contents
poll outlook.office365.com protocol imap port 993 username "user@login.tld" password "password" ssl sslfingerprint "97:08:33:5A:74:09:CC:EA:28:2D:9C:A4:49:3B:A2:C7"