Brug Let’s encrypt sammen med Axigen Mailserver

Fra version 10 er det muligt at installere Lets Encrypt fra administrations interface.

Lets Encrypt

Hent og installer Let’s encrypt fra

cd /opt
git clone
cd letsencrypt

Stop mail-servern og tilse at port 80 og 443 er åbne i firewallen.


/opt/letsencrypt/letsencrypt-auto certonly --standalone --email -d -d

– Congratulations! Your certificate and chain have been saved at

Få certifikaten ordnede og på ret plads:

cat /etc/letsencrypt/live/ /etc/letsencrypt/live/ > /var/opt/axigen/
cat /etc/letsencrypt/live/ /etc/letsencrypt/live/ > /var/opt/axigen/CA.crt


Create the certificate PEM file to Axigen Mailserver

A. Create the certificate PEM file – let’s call it my_domain.pem

Axigen uses a .pem file to store both unecrypted private key and the SSL certificate that might be provided to you in a .crt file.
Please note that the private key file should be available as it was generated and used when you have requested the SSL certificate. If you did not saved it (or have lost it afterwards) your SSL certificate became useless as the private key could not be regenerated.

  • Private key – let’s say you have save it in my_domain.key and it should contain several text lines like:

Note: The unencrypted private key could be extract from an encrypted one by using the following command:

openssl rsa -in my_domain.key.encrypted -out my_domain.key

If the encrypted key is protected by a pass phrase, enter the it when prompted otherwise the decrypt process (as expected) will fail

  • Cetificate – let’s say you have save it in my_domain.crt and it should contain several text lines like:

Now you can prepare your my_domain.pem like:

cat my_domain.key my_domain.crt > ${AXIGEN_WORK_DIR}/my_domain.pem

B. (Optional) create the CA (Certificate Authority) CERT file – let’s call it my_CA.pem
This file should contain all CA certificates (root and intermediate ones) you have received from the certificate issuer

This should be as simple as:

cat CA_root.crt CA_intermediate1.crt CA_intermediate2.crt > ${AXIGEN_WORK_DIR}/my_CA.pem

C. Axigen Configuration
Assuming that you have saved the mandatory my_domain.pem and the optional my_CA.pem files in the Axigen working directory (and the files could be read by the user used to ran Axigen process), you could now continue to configure the SSL listener(s) with your new certificate:

Connect to WebAdmin and go to Service > Listener > SSL

  • Certificate file: my_domain.pem
  • (optional) Certificate authorities file: my_CA.pem
  • Save configuration

Note: If you like to use the self signed certificate generated by Axigen (at the installation time) you should use axigen_cert.pem file, that it is also stored in the Axigen working directory.

After you finished certificate configuration you could locally test your SSL listener like:

openssl s_client -connect <listener_ip>:<listener_port>


Secure AXIGEN against brute-force with Fail2Ban [Linux]

Fail2Ban ( protects your server against intruders who try brute force to guess passwords.
Enables you to monitor standard services such as SSH, Apache, etc..

Furthermore, AXIGEN can be secured against password attacks.

The following steps are necessary:
The steps may differ depending on your distribution.

Step 1: Install Fail2Ban
Step 2: Create a shell script:

# $1 - log file to be used
if [ -z "$1" ]
tail --retry --follow=name "$LOG_AXI" | while read l
 timestamp=$(date '+%d-%m-%Y %T')
 case "$l" in
 *"Authentication error"*|*"could not authenticate user"*|*"error authenticating user"*) sid=$(echo "$l" | awk '{print $6}')
 if [ -n "$sid" ]
 con_ip=$(grep -m 1 $sid "$LOG_AXI" | awk '{print $NF}' | sed 's/\[//g;s/:.*$//g')
 if [ -n "$con_ip" ]
 echo "$timestamp $l from $con_ip" >> "$LOG_SEC"

Step 3: Make sure that there script runs automatically, for example, /etc/inittab

If AXIGEN writes the log file to another location, please kindly adjust the path to the variable $ LOG_AXI.
For secure.txt file a log Rotate should be established
Test the script as follows:
Start the script
Check the contents of secure.txt
Run a false login with, this should be reported as follows

18-07-2014 14:35:42 07-28 14:35:42 +0300 02 localhost IMAP:000000CC: Authentication error for user ‘user1@localdomain’: Invalid password from

Step 4: Create a new module Fail2Ban to, for example, axigen.cfg under /etc/fail2ban/filter.d
With content:

# Fail2Ban configuration file
failregex = from <HOST>

Step 5: Configure Fail2Ban where you expand the jail.conf under /etc/fail2ban to block the following:

enabled = true
filter = axigen
port = all
logpath = /var/opt/axigen/log/secure.txt
bantime = 100
maxretry = 3
banaction = iptables-allports

The maximum number of failed attempts, spell-time and path please adjust accordingly.
Then please restart fail2ban.



Oprettelse af selvsigneret SSL certifikat til Axigen Mailserver

Hvordan man skaber en selvsigneret SSL-certifikat til brug med AXIGEN

1. Brug interaktive OpenSSL config:
– Genere en OpenSSL nøgle:

openssl genrsa-out axigen_cert.key 1024

– Generer et selv-signeret certifikat ved hjælp af nøgle:

 openssl req-new-x509-key axigen_cert.key-out axigen_cert.crt

Standard gyldighed for et certifikat er 30 dage. Hvis du ønsker at forøge denne gyldighed vil sige 1 år (365 dage), kan du  tilføje dag 365 parameter til kommandoen ovenfor:

 openssl req -new -x509 -key axigen_cert.key -out axigen_cert.crt

– Kombiner nøgle og certifikat i en PEM-fil:

 cat axigen_cert.key axigen_cert.crt > axigen_cert.pem

2. Brug OpenSSL config file:
– Opret en OpenSSL config fil med navnet axigen_ssl.cnf, med følgende indhold:

[ req ]
default_bits = 1024
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
prompt = no
[ req_dn ]
O=AXIGEN Mail Server
OU=Automatically-generated SSL key
[ cert_type ]
nsCertType = server

– Opret auto-underskrevne certifikat:

openssl req -new -x509 -days 365 -nodes -config axigen_ssl.cnf \-out /var/opt/axigen/axigen_cert.pem -keyout /var/opt/axigen/axigen_cert.pem

3. Brug AXIGEN’s opstartscriptet:
På alle understøttede operativsystemer og platforme, vil AXIGEN’s opstartscriptet skabe, på første løb, et selv-signeret certifikat automatisk, og gemmes i data mappen med et navn på axigen_cert.pem.
Hvis du ønsker at regenerere certifikat, kan du køre en gang til opstartscriptet med init parameter.

For eksempel i RedHat kan du regenerere certifikatet med:
/etc/init.d/axigen init

BEMÆRK: init parameter vil også forsøge at skabe standard domæne-databasen,  (det vil allerede være oprettet).

For at se certifikatet oplysninger:
 openssl x509 -text -noout -in /var/opt/axigen/axigen_cert.pem
For at se udløbsdatoen for det angivne certifikat, skal du bruge -enddate parameter:
 openssl x509 -enddate -noout -in /var/opt/axigen/axigen_cert.pem
Output bør vare noget lignende:
 notAfter=May  1 15:16:16 2008 GMT

Virus beskyttelse på en Axigen Mailserver med ClamAV på OpenSUSE 11.*

Stop freshclam og ClamAV med at fra shell skrive:

/etc/init.d/clamd stop

/etc/init.d/freshclam stop

Skabe et directory for logfiler

mkdir  /var/log/clamav

I /etc/clamd.conf samt /etc/freshclam.conf rette til stier og ejer enligt neden:

## Config file for the Clam AV daemon
## Please read the clamd.conf(5) manual before editing this file.

# Uncomment this option to enable logging.
# LogFile must be writable for the user running daemon.
# A full path is required.
# Default: disabled
LogFile /var/log/clamav/clamd.log

# Path to the database directory.
# Default: hardcoded (depends on installation options)
DatabaseDirectory /var/lib/clamav

# Run as another user (clamd must be started by root for this option to work)

# Default: don’t drop privileges
User axigen

I freshclam.conf

## Config file for freshclam
## Please read the freshclam.conf(5) manual before editing this file.

# Path to the database directory.
# WARNING: It must match clamd.conf’s directive!
# Default: hardcoded (depends on installation options)
DatabaseDirectory /var/lib/clamav

# Path to the log file (make sure it has proper permissions)
# Default: disabled
UpdateLogFile /var/log/clamav/freshclam.log

# By default when started freshclam drops privileges and switches to the
# “clamav” user. This directive allows you to change the database owner.
# Default: clamav (may depend on installation options)
DatabaseOwner axigen

Skift ejerskab med

chown -R axigen:axigen /var/log/clamav


chown -R axigen:axigen /var/lib/clamav

Start ClamAV og freshclam fra shell

/etc/init.d/clamd start

/etc/init.d/freshclam start

Tilse at alt et opdateret med freshclam og  zypper update

ClamAV i Admin-Axigen
ClamAV i Admin-Axigen

I admin panelet Security Filtering/Antivirus Antispam Klik på “To restart the detection process click here.”


Har du en anden Distro så kigge på denne video