Skip to content

BenjaminGuzman/login-monitor

Repository files navigation

login monitor

login monitor is a script that allows you to monitor logins in a (*nix) remote machine.

This tool sends you email after any successful login*.

The email can:

  • be encrypted and signed
  • contain attachments (e.g. logs)

*You can modify this behaviour

See the full configuration tutorial in my blog

Configuration

Check schema.json and config-example.json to know more about the configuration.

Go SMTP client

The code uses the strategy pattern, so it is easy to change actual SMTP server (e.g. Gmail, postfix, Sendgrid...).

gmail-strategy.go is an implementation using Gmail API

go-smtp-strategy.go is an implementation using Go's net/smtp package

Note: in the code you'll find references to pgp and gpg. Because of their similarity these terms may end up confusing you. So I'll clarify to you these terms briefly:

  • pgp stands for Pretty Good Privacy. It's a software created by Phil Zimmermann, but for sake of brevity I use the term pgp to refer to OpenPGP, which is a standard
  • gpg stands for GNU Privacy Guard. It is an implementation of OpenPGP (pgp)

Therefore, if you see in my code something like // create the pgp message know that it may not be created with gpg but with other software like rnpgp (used by thunderbird). Actually, it'd be nice if we could migrate the code to use something like ProtonMail's OpenPGP implementation or GPGME