You are not logged in.
Pages: 1
Hello everyone.
I'm wondering if there's a best-practices for emails regarding system alerts. I've tried two different systems to handle this by setting up relay agents: ssmtp (and now msmtp) and postfix.
My concern with both relates to security. With postfix, I've got my password stored in a file that only root has permission to access. I had no concerns with this since that seemed to be how everything was recommended. Then I found a places that discussed how ssmtp was being recommended as being more lightweight and I thought I would like to try it. I used the same security: email password stored in a file only root can access. Then I read ssmtp isn't being developed and I should use msmtp instead. So I installed that and I find that storing the password in a file only root can access is now not recommended. I did see the instructions on the wiki for msmtp where it discussed using gpg to encrypt the password into a file and then use gpg to decrypt (https://wiki.archlinux.org/index.php/Msmtp#GnuPG). I set that up and it works well if I am around to send the email manually and enter my root password to decrypt the file. However, I am trying to set up a relay agent for unattended emails about system status (HDD smart, service failures, etc) so that doesn't really work. I figured why not set up my root account and configure my gpg with no password so it can decrypt unattended. Of course that works, but my concern is that this is really no different from simply storing the password in a file only root has access to, is it? At the end of the day, if someone can get root access, they get my email password in both cases.
My question I suppose is twofold:
1) Should I be concerned about this or is securing my root account using the standard methods all I need worry about? or
2) Is there a better way to handle this for a small one-server user? (A full mail server seems overkill, but is that what I should be doing?)
Thanks!
Last edited by dtjohnst (2017-08-08 22:46:26)
Offline
Encrypted files require decryption, in doubt login of a local user. Unencrypted files can be read offline (booting a live linux with granted root access allows you to open anything)
What you need to worry about is whether there's a potential offline attack on the machine (basically whether an attacker can gain physical access)
If that's no concern, storing the password in a file w/ limited access is just as good (if the attacker can guess your root password, he can guess your encryption password likewise - let alone that w/ a rootshell your mail password is the least concern you should have ...)
General remarks:
- Don't use your "main" mail account to send semi-public data around. Just setup a freemail account that you can trash any time. Use a unique password.
- Maybe you don't need to use *pubic* mail but can use a local mailserver or even just write into the local spool
This is a pretty dumb scritpt to write into some users spool. If you want to write into another users spool, you need to execute it as UID0 - otherwise you can just run it.
#!/bin/sh
SENDER=`whoami`
RECEIVER=${3:-$SENDER}
echo "From ${SENDER} `LC_ALL=C date +%c`
From: ${SENDER}
Date: `date -R`
To: ${RECEIVER}
Subject: $1
User-Agent: local_mail script
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
$2
" >> /var/spool/mail/${RECEIVER}Offline
Makes sense, sort of was what I was thinking but glad to have it confirmed by someone who knows what they're talking about. Thanks!
Offline
Pages: 1