-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SMTP Mail sending in docker container and documentation for sending m…
…ail with msmtp (#2809) * Add msmtp to allow sending mail in the docker container. Config file should be in /home/oxidized/.config/oxidized/.msmtprc * Include sending mail in documentation * Apply correct rights to the .msmtprc file * Wrong file to setup access rights * Added required files and directory (cannot chmod a broken symlink) * oxodized -> oxidized * Update CHANGELOG.md * Remove useless line in msmtp default config. * Remove useless option in msmtp command
- Loading branch information
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ Exec hook recognizes the following configuration keys: | |
* `async`: Execute the command in an asynchronous fashion. The main thread by default will wait for the hook command execution to complete. Set this to `true` for long running commands so node configuration pulls are not blocked. Default: `false` | ||
* `cmd`: command to run. | ||
|
||
### exec hook configuration example | ||
### Exec Hook configuration example | ||
|
||
```yaml | ||
hooks: | ||
|
@@ -62,6 +62,42 @@ hooks: | |
timeout: 120 | ||
``` | ||
### Exec Hook configuration example to send mail | ||
To send mail you need the package `msmtp` (It is pre-installed with the docker container) | ||
|
||
You then need to update the `~/.msmtprc` file to contain your SMTP credentials like this: | ||
|
||
*Note: In the docker container the file is in /home/oxidized/.config/oxidized/.msmtprc so you can create the file if it doesn't exist in your oxidized config folder.* | ||
|
||
```cfg | ||
# Default settings | ||
defaults | ||
auth on | ||
tls on | ||
# Outlook SMTP | ||
account mainaccount | ||
host smtp.office365.com | ||
port 587 | ||
from [email protected] | ||
user [email protected] | ||
password edit-password | ||
account default : mainaccount | ||
``` | ||
|
||
For non docker users this file should have the 600 permission, using: `chmod 600 .msmtprc` and the owner of the file should be the owner of oxidized `chown oxidized:oxidized .msmtprc` | ||
|
||
Then, you can configure Hooks to send mail like this: | ||
|
||
```yaml | ||
hooks: | ||
send_mail_hook: | ||
type: exec | ||
events: [node_fail] | ||
cmd: '/usr/bin/echo -e "Subject: [Oxidized] Error on node $OX_NODE_NAME \n\nThe device $OX_NODE_NAME has not been backed-up, reason: \n\n$OX_EVENT: $OX_ERR_REASON" | msmtp [email protected]' | ||
``` | ||
|
||
## Hook type: githubrepo | ||
|
||
Note: You must not use the same name as any local repo configured under output. Make sure your 'git' output has a unique name that does not match your remote_repo. | ||
|