-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create docker-compose for easy development environment bootstrap
Create docker-compose configuration, sample postfwd and postfwd antispam configuration together with initial mysql database creation script. This allows developers to simply create development environment on local computer and actively develop and test postfwd plugin. The postfwd branch is frozen to version `v1.37`. Signed-off-by: Ondrej Vasko <[email protected]>
- Loading branch information
Showing
6 changed files
with
96 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM postfwd/postfwd:latest | ||
FROM postfwd/postfwd:v1.37 | ||
|
||
LABEL maintainer="Postfwd GeoIp Spam Plugin Maintainer <[email protected]>" | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[database] | ||
driver = mysql | ||
database = postfwd-antispam-test | ||
host = mysql-postfwd-db | ||
port = 3306 | ||
userid = testuser | ||
password = testpasswordpostfwdantispam | ||
|
||
[logging] | ||
# logfile = | ||
|
||
[debugging] | ||
# Enable(1) or disable(0) logging | ||
debug = 1 | ||
# Make log after exceeding unique country count limit | ||
country_limit = 5 | ||
# Make log after exceeding unique ip count limit | ||
ip_limit = 20 | ||
|
||
[app] | ||
# Flush database records with last login older than 1 day | ||
db_flush_interval = 86400 |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "3.3" | ||
services: | ||
mysql-postfwd-db: | ||
image: mariadb:latest | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
- MYSQL_ALLOW_EMPTY_PASSWORD=no | ||
- MYSQL_RANDOM_ROOT_PASSWORD=yes | ||
- MYSQL_USER=testuser | ||
- MYSQL_PASSWORD=testpasswordpostfwdantispam | ||
- MYSQL_DATABASE=postfwd-antispam-test | ||
volumes: | ||
- type: volume | ||
source: ./dev-create-antispam-db.sql | ||
target: /docker-entrypoint-initdb.d/dev-create-antispam-db.sql | ||
postfwd-geoip-antispam: | ||
build: ../ | ||
ports: | ||
- "10040:10040" | ||
volumes: | ||
- type: volume | ||
source: ./dev-anti-spam.conf | ||
target: /etc/postfwd/anti-spam.conf | ||
- type: volume | ||
source: ./dev-postfwd.cf | ||
target: /etc/postfwd/postfwd.cf |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
USE postfwd-antispam-test; | ||
CREATE TABLE IF NOT EXISTS postfwd_logins ( | ||
sasl_username varchar(100), | ||
ip_address varchar(16), | ||
state_code varchar(4), | ||
login_count int, | ||
last_login timestamp | ||
); | ||
CREATE INDEX postfwd_sasl_client_state_index ON postfwd_logins (sasl_username, ip_address, state_code); | ||
CREATE INDEX postfwd_sasl_username ON postfwd_logins (sasl_username); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Anti spam botnet rule: | ||
# This example shows how to limit e-mail address defined by `sasl_username` | ||
# to be able to login from max. 5 different countries, otherwise it will | ||
# be blocked from sending messages. | ||
|
||
&&PRIVATE_RANGES { \ | ||
client_address=!!(10.0.0.0/8) ; \ | ||
client_address=!!(172.16.0.0/12) ; \ | ||
client_address=!!(192.168.0.0/16) ; \ | ||
}; | ||
&&LOOPBACK_RANGE { \ | ||
client_address=!!(127.0.0.0/8) ; \ | ||
}; | ||
|
||
id=COUNTRY_LOGIN_COUNT ; \ | ||
sasl_username=~^(.+)$ ; \ | ||
&&PRIVATE_RANGES ; \ | ||
&&LOOPBACK_RANGE ; \ | ||
incr_client_country_login_count != 0 ; \ | ||
action=jump(BAN_BOTNET) | ||
|
||
id=BAN_BOTNET ; \ | ||
sasl_username=~^(.+)$ ; \ | ||
&&PRIVATE_RANGES ; \ | ||
&&LOOPBACK_RANGE ; \ | ||
client_uniq_country_login_count > 5 ; \ | ||
action=rate(sasl_username/1/3600/554 Your mail account ($$sasl_username) was compromised. Please change your password immediately after next login.); |