GPGSesame
PGPDate: 2005-05-16 15:15
This is a fairly simple perl script which use OpenPGP encrypted
email to authenticate users and add access rules to iptables.
I wrote this so I could send a signed encrypted email to my PC
and request SSH access from anywhere I happen to be.
You need an iptables chain with a RETURN rule at the bottom.
Jump into this chain from INPUT and sesame.pl will add/remove
rules from that chain.
sesame.pl should be run from cron, it will check for mail,
add rules and delete expired rules. You will probably want to
set the frequency of the checks to sensible values based on
your Access and email timeouts.
rules are added at the begining. Each host gets two entries.
One rule to log the access and one rule to accept the access.
the logging rule contains the expiry timestamp and will be
seen in you kernel log when an access occurs. When sesame.pl
deletes the rule after expirey it first deletes the log rule
then any rule that has the same source address.
Mail::GnuPG
GnuPG::Interface
MIME::Entity
Net::POP3
Date::Calc
To add an iptables chain:
iptables -N PGPHOST
To add a RETURN rule to this chain so processing returns and
continues through the INPUT chain:
iptables -A PGPHOST -j RETURN
To jump into this chain from INPUT
iptables -A INPUT -j PGPHOST
===============================================================
To generate your gpg key:
gpg --homedir=<GPGDIR> --gen-key
To import a gpg key from your own keyring into the applications keyring:
gpg --export <KEYID> -a | gpg --homedir=<GPGDIR> --import
To trust an imported key:
gpg --homedir=<GPGDIR> --sign-key <KEYID>
To list your keys
gpg --homedir=<GPGDIR> --list-keys