Email Administration

This documentation shows how to set up an automatic procedure to handle email UntilUru server administration. Thus giving your co-admins a tool to enable them to administrate your shard using email. This doc assume you have already installed latest server scripts available on this site. Security is based on fact only admins knows their AccountGUID.

Note: This is a false assumption since the client can retrieve a player's guid from the vault.

Email formating

Each co-admin must know their AccountGID (as found in VM) in order to send mail.

Email format is:

Subject: GUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

And a line or two into body:

command=yyyy argument=zzzzz

where yyyy can be:

  1. LIST shows all online players
  2. LISTA shows all defined players in your shard
  3. NEIGHB shows all neighborhoods created on your shard
  4. BACKUP backup your shard in off-line mode (will stop and restart UntilUru server)

  5. RESTORE restore your shard from very last backup available
  6. RESTART stop and restart your shard. will restart it also if UU was down.

'argument' line is only needed if command asks for an arg

Prerequisites

  1. Postfix (or another MTA) must be installed *and* configured on your Linux server
  2. Procmail must be installed also
  3. UntilUru server script as found in ServerScripts page should be installed.

How-To

1. create a .forward file in your UntilUru installation directory, replacing xxxxxxxx by your UntilUru user (RUNAS parameter as found in PlasmaServer.ini file):

"|IFS=' '&&p=/usr/bin/procmail&&test -f $p&&exec $p -Yf-||exit 75 xxxxxxxx"

2. create a .procmailrc file in your UntilUru installation directory, edit ADMIN parameter to enter your email address which will receive in Cc: all commands sent to your shard. Edit also line showing member1, 2 and 3 and change them to your co-admins member's name. Feel free to restrict or add additionnal names here (AcccountGUID will be checked against those names).

PATH=/bin:/usr/bin:/usr/bin
MAILDIR=$HOME/Mail          #you'd better make sure it exists
DEFAULT=$MAILDIR/mbox       #completely optional
LOGFILE=$MAILDIR/from       #recommended
ADMIN=you_email@here        #who gets Cc: email

:0
* ^Subject:.*GUID=
{
  SUBJECT=`formail -xSubject: | awk -F= '{ print $2 }'`    # regular field
  NAME=`$HOME/etc/showplayers A | grep $SUBJECT | head -n +1 | awk '{ print $2 }'`

  :0 Wi
  * ? test -z "$NAME"
  | (formail -rI"Precedence: junk" ; \
      echo "Account error: $NAME was not found" \
    ) | $SENDMAIL -oi -t

  :0 Wi
  * ? test "$NAME" != "member1" -a "$NAME" != "member2" -a "$NAME" != "member3"
  |  (formail -rI"Precedence: junk" ; \
        echo "Account error: $NAME is not authorized" \
     ) | $SENDMAIL -oi -t

  :0 b
  CMD=| grep "command=" | head -n +1 | awk -F= '{ print $2 }' | sed 's/^3D//'

  :0 b
  ARG=| grep "argument=" | head -n +1 | awk -F= '{ print $2 }' | sed 's/^3D//'

  :0 c
  ! $ADMIN

  :0 Wi
  * ? test "$CMD" = "LIST"
  | (formail -rI"Precedence: junk" ; \
       $HOME/etc/showplayers $ARG \
    ) | $SENDMAIL -oi -t

  :0 Wi
  * ? test "$CMD" = "NEIGHB"
  | (formail -rI"Precedence: junk" ; \
       $HOME/etc/neighblist \
    ) | $SENDMAIL -oi -t

  :0 Wi
  * ? test "$CMD" = "FIXGZ"
  | (formail -rI"Precedence: junk" ; \
       $HOME/etc/fixgz $ARG \
    ) | $SENDMAIL -oi -t

  :0 Wi
  * ? test "$CMD" = "RESTART"
  | (formail -rI"Precedence: junk" ; \
       cd $HOME && rc.d/plasma-servers.sh stop && sleep 20 && rc.d/plasma-servers.sh start \
    ) | $SENDMAIL -oi -t

  :0 Wi
  * ? test "$CMD" = "BACKUP"
  | (formail -rI"Precedence: junk" ; \
       $HOME/etc/backup ; \
       echo "Backup done" \
    ) | $SENDMAIL -oi -t

  :0 Wi
  * ? test "$CMD" = "RESTORE"
  | (formail -rI"Precedence: junk" ; \
       $HOME/etc/restore A ; \
       echo "Restore complete" \
    ) | $SENDMAIL -oi -t
}

--- Submitted by - KhouFou

EmailAdministration (last edited 2008-12-27 16:35:30 by localhost)