Update DOCKER_INSTALL.md

- full example 
- add postfix integration instructions
- use fastnetmon_notify.py instead of bash
This commit is contained in:
Roberto Bertó 2015-09-10 22:42:02 -03:00
parent 58108a9d40
commit 6e71176e2d

@ -77,3 +77,52 @@ docker build .
``` ```
To send email, we recommend you to use a external and linked postfix container such:
```
docker pull panubo/postfix
docker run \
-e MAILNAME="example.com" \
-e MYNETWORKS="127.0.0.0/8, 172.16.0.0/12" \
--name postfix \
-t panubo/postfix
```
When you link another container with docker other container name will be added to /etc/hosts pointing to its internal IP. So you can use python script notify (https://github.com/FastVPSEestiOu/fastnetmon/blob/master/src/scripts/fastnetmon_notify.py), instead of bash one.
Just change MAIL_HOSTNAME="localhost" to MAIL_HOSTNAME="postfix" if you start fastnetmon docker container with --link postfix:postfix and create another docker instance with panubo/postfix as --name postfix, for example.
A full example of running fastnetmon linked to postfix:
```
docker run -a stdin -a stdout -i \
-v /var/log/fastnetmon_attacks:/var/log/fastnetmon_attacks \
-v /var/log/fastnetmon.log:/var/log/fastnetmon.log \
-v /etc/networks_list:/etc/networks_list \
-v /etc/fastnetmon.conf:/etc/fastnetmon.conf \
-v /etc/networks_whitelist:/etc/networks_whitelist \
-v /usr/local/fastnetmon:/usr/local/fastnetmon \
-v /etc/exabgp_blackhole.conf:/etc/exabgp_blackhole.conf \
-v /var/log/fastnetmon-notify.log:/var/log/fastnetmon-notify.log \
-p 10.100.20.2:2055:2055/udp \
-p 10.100.20.6:2055:2055/udp \
-p 10.100.20.2:179:179/tcp \
--name fastnetmon \
--link postfix:postfix \
-t robertoberto/fastnetmon:latest /bin/bash
```
First, you need to create all those files and dirs in main Linux system.
```
mkdir /usr/local/fastnetmon
touch /var/log/fastnetmon_attacks /var/log/fastnetmon.log /etc/networks_list /etc/networks_whitelist /etc/fastnetmon.conf /etc/exabgp_blackhole.conf/var/log/fastnetmon-notify.log
cp /etc/fastnetmon.conf /etc/fastnetmon.conf.bkp
cp /usr/local/fastnetmon/fastnetmon_notify.py /usr/local/fastnetmon/fastnetmon_notify.py.bkp
wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/scripts/fastnetmon_notify.py -O /usr/local/fastnetmon/fastnetmon_notify.py
chmod +x /usr/local/fastnetmon/fastnetmon_notify.py
wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon.conf -O /etc/fastnetmon.conf
```