Towards first version.

This commit is contained in:
urosj 2017-07-25 12:24:23 +02:00
parent 70713c71d8
commit baa9d2656a

View File

@ -4,16 +4,16 @@ package main
// //
// How to make it work on a server with postfix installed: // How to make it work on a server with postfix installed:
// ======================================================= // =======================================================
// Create autoresponse username: // Create autoresponder username:
// useradd -d /var/spool/autoresponse -s `which nologin` autoresponse // useradd -d /var/spool/autoresponder -s $(which nologin) autoresponder
// //
// Copy autoresponse binary to /usr/local/sbin // Copy autoresponder binary to /usr/local/sbin
// cp autoresponse /usr/local/sbin/ // cp autoresponder /usr/local/sbin/
// //
// RESPONSE_DIR, RATE_LOG_DIR must be created: // RESPONSE_DIR, RATE_LOG_DIR must be created:
// mkdir -p /var/spool/autoresponse/log /var/spool/autoresponse/responses // mkdir -p /var/spool/autoresponder/log /var/spool/autoresponder/responses
// chown -R autoresponse:autoresponse /var/spool/autoresponse // chown -R autoresponder:autoresponder /var/spool/autoresponder
// chmod -R 0770 /var/spool/autoresponse // chmod -R 0770 /var/spool/autoresponder
// //
// Edit /etc/postfix/master.cf: // Edit /etc/postfix/master.cf:
// Replace line: // Replace line:
@ -23,7 +23,7 @@ package main
// -o content_filter=autoresponder:dummy // -o content_filter=autoresponder:dummy
// At the end of file append the following two lines: // At the end of file append the following two lines:
// autoresponder unix - n n - - pipe // autoresponder unix - n n - - pipe
// flags=Fq user=autoresponse argv=/usr/local/sbin/autoresponse -s ${sender} -r ${recipient} -S ${sasl_username} -C ${client_address} // flags=Fq user=autoresponder argv=/usr/local/sbin/autoresponder -s ${sender} -r ${recipient} -S ${sasl_username} -C ${client_address}
// //
// //
// Written by Uros Juvan <asmpro@gmail.com> 2017 // Written by Uros Juvan <asmpro@gmail.com> 2017
@ -39,8 +39,8 @@ import (
const VERSION = "1.0.0001" const VERSION = "1.0.0001"
const DEBUG = true const DEBUG = true
const RESPONSE_DIR = "/var/spool/autoresponse/responses" const RESPONSE_DIR = "/var/spool/autoresponder/responses"
const RATE_LOG_DIR = "/var/spool/autoresponse/log" const RATE_LOG_DIR = "/var/spool/autoresponder/log"
const SENDMAIL_BIN = "/usr/sbin/sendmail" const SENDMAIL_BIN = "/usr/sbin/sendmail"
@ -99,16 +99,16 @@ func main() {
fmt.Print(` fmt.Print(`
How to make it work on a server with postfix installed: How to make it work on a server with postfix installed:
======================================================= =======================================================
Create autoresponse username: Create autoresponder username:
useradd -d /var/spool/autoresponse -s $(which nologin) autoresponse useradd -d /var/spool/autoresponder -s $(which nologin) autoresponder
Copy autoresponse binary to /usr/local/sbin Copy autoresponder binary to /usr/local/sbin
cp autoresponse /usr/local/sbin/ cp autoresponder /usr/local/sbin/
RESPONSE_DIR, RATE_LOG_DIR must be created: RESPONSE_DIR, RATE_LOG_DIR must be created:
mkdir -p /var/spool/autoresponse/log /var/spool/autoresponse/responses mkdir -p /var/spool/autoresponder/log /var/spool/autoresponder/responses
chown -R autoresponse:autoresponse /var/spool/autoresponse chown -R autoresponder:autoresponder /var/spool/autoresponder
chmod -R 0770 /var/spool/autoresponse chmod -R 0770 /var/spool/autoresponder
Edit /etc/postfix/master.cf: Edit /etc/postfix/master.cf:
Replace line: Replace line:
@ -118,7 +118,7 @@ func main() {
-o content_filter=autoresponder:dummy -o content_filter=autoresponder:dummy
At the end of file append the following two lines: At the end of file append the following two lines:
autoresponder unix - n n - - pipe autoresponder unix - n n - - pipe
flags=Fq user=autoresponse argv=/usr/local/sbin/autoresponse -s ${sender} -r ${recipient} -S ${sasl_username} -C ${client_address} flags=Fq user=autoresponder argv=/usr/local/sbin/autoresponder -s ${sender} -r ${recipient} -S ${sasl_username} -C ${client_address}
`) `)
os.Exit(0) os.Exit(0)
} }