LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   An app for remote system admin via email? (https://www.linuxquestions.org/questions/linux-software-2/an-app-for-remote-system-admin-via-email-399039/)

celejar 01-03-2006 08:35 AM

An app for remote system admin via email?
 
I'm looking for an application to handle remote system administration of a linux box via email. The box will only connect to the internet intermittently to pull in mail, so remote admin via ssh or webmin isn't a satisfactory option. I need something that can read mail (presumably checking pgp / gpg signatures for authentication) and execute commands contained therein. I have googled but not found anything suitable. Anyone have any ideas?

WindowBreaker 01-04-2006 02:00 AM

I would just pipe all email to a specific address, into a script that parses the file for commands.

Here's a weak example:
contents of email:
Quote:

From: somebody@somewhere.com
To: commandparser@yourdomain.com
Date: 01/01/2006
Subject: (empty)

command=/usr/local/backup.sh daily
command=/usr/bin/mail friend@somewhere.com < ~me/email.txt
The script may look like
Code:

#!/bin/sh

cd ~me/tmp
cat > ./email.txt
for i in `cat ./email.txt`; do
 NEWCMD=`echo $i | grep -w command | sed 's/.*=//'`
 ## Could also do the following
 ## NEWCMD=`echo $i | grep -w command | awk -F'=' '{print $2}'`
 $NEWCMD
done

It's just a basic example. I'll leave the rest up to you. Be ABSOLUTELY sure you secure it to avoid A LOT of trouble.

celejar 01-04-2006 03:05 PM

Thanks! I realized I could do it with scripts, but I was indeed worried about security - it is far to easy to make mistakes. I also have almost no experience writing my own scripts (shell or perl). Additionally, there's no point in reinventing the wheel and I assume someone has already done this before, so I'd still like to hear from anyone who knows of such an app.


All times are GMT -5. The time now is 06:41 PM.