Configuration can be splitted into two parts as follows.
## Installation & configuration
### ssmtp
**1)** Install `ssmtp` package
To-be-added
**2)** Configure files `/etc/ssmtp/revaliases` ([sample](ssmtp_conf-sample/revaliases)) and `/etc/ssmtp/ssmtp.conf` ([sample](ssmtp_conf-sample/ssmtp.conf)). More information about these files on [sSMTP Arch Wiki site](https://wiki.archlinux.org/index.php/SSMTP).
### wanip-checker
**3)** Insert [wanchecker.sh](ssmtp_conf-sample/wanchecker.sh) into `/etc/ssmtp/` folder.
**1)** Insert `wanchecker@.service` and `wanchecker@.timer` into `/usr/lib/systemd/system/` folder
**4)** Configure sSMTP as described in [sSMTP Readme file](ssmtp_conf-sample/README.md).
- WAN IP check interval is customizable in systemd timer file. Default value is `20min`
**2)** Insert `wanchecker.sh` into your `/home/myuser/` folder (where `myuser` is your real username on your Linux system)
**3)** Configure your email address and message form in `wanchecker.sh` file. Configure WAN IPv4 log file location (default is `$HOME`)
**5)** Insert `wanchecker.service` and `wanchecker.timer` into `/usr/lib/systemd/system/` folder
- log file is updated only when WAN IPv4 changes have been detected
- WAN IP check interval is customizable in systemd timer file. Default value is `20min`
**3)** Install `ssmtp`, and configure files `/etc/ssmtp/revaliases` and `/etc/ssmtp/ssmtp.conf` as described on [SSMTP Arch Wiki site](https://wiki.archlinux.org/index.php/SSMTP).
- This log file is updated only when WAN IPv4 changes have been detected
User & group mail exists, directory /`var/spool/mail` exists:
**NOTE:** User & group `mail` are defined on Arch Linux by default, preinstalled with `filesystem` package. If they do not exist, then do the following.
**2)** Make sure user & group `mail` exists, and directory /`var/spool/mail` exists with proper permissions:
Once you have sSMTP installed on your Linux system, insert [ssmtp.conf](ssmtp.conf), [revaliases](revaliases) and [wanchecker.sh](wanchecker.sh) into `/etc/ssmtp/` folder. These files should have following permissions:
Once you have sSMTP installed on your Linux system, configure [ssmtp.conf](ssmtp.conf) and [revaliases](revaliases) in `/etc/ssmtp/` folder.
## Mail message formatting & email address
Configure your message defined in [wanchecker.sh](wanchecker.sh) file.
| MESSAGE_STDOUT | Internal Linux system message about sent email message | String |
| WANIP_DIR | Log file directory path. User `mail` must have write access to this folder. | String |
| WANIP_LOG | Log file name | String |
**NOTE:** At minimum, you should configure proper email addresses in variables `EMAIL_SENDER` and `EMAIL_RECIPIENTS`. `EMAIL_SENDER` takes same value as defined in `/etc/ssmtp/ssmtp.conf` ([sample](ssmtp.conf)) and `/etc/ssmtp/revaliases` ([sample](revaliases)) files.
## Folder & file permissions
Permissions for `/etc/ssmtp` folder should be:
```
> stat -c "%A %a %U:%G %n" /etc/ssmtp/*
> stat -c "%A %a %U:%G %n" /etc/ssmtp
-rw-r----- 640 root:mail /etc/ssmtp/revaliases
-rw-r----- 640 root:mail /etc/ssmtp/ssmtp.conf
-rwxr-x--- 750 root:mail /etc/ssmtp/wanchecker.sh
drwxr-x--- 750 root:mail /etc/ssmtp
```
Contents of `/etc/ssmtp/` folder should contain the following files & permissions:
```
> stat -c "%A %a %U:%G %n" /etc/ssmtp/*
-rw-r----- 640 root:mail /etc/ssmtp/revaliases
-rw-r----- 640 root:mail /etc/ssmtp/ssmtp.conf
-rwxr-x--- 750 root:mail /etc/ssmtp/wanchecker.sh
```
where group `mail` refers to Arch Linux mail group, preinstalled with `filesystem` package.
**NOTE:** As `/etc/ssmtp/ssmtp.conf` contains a _clear-text email password_, the file must be protected from any eavesdropping with correct permission policy! The file must not be readable to any other than `mail` user, and `mail` user must not be available for normal usage. Still, any `sudo` group member can access the file, so make sure `sudo` group does not contain hostile or unwanted members, and configure your `/etc/sudoers` file properly.