Testing Postfix after installation with Clamav and Spamassasin






Test files


touch sample-virus-simple.txt


touch sample-spam-GTUBE-junk.txt

Normal Message test

swaks –to testuser@yourdomain.com –server localhost

amavis[1486]: (01486-02) Passed CLEAN {RelayedInternal}, LOCAL []:50268

(testuser@yourdomain.com – This is where you would like a test message to be delivered)

Testing VIRUS checking

swaks -t root@localhost –server localhost -d sample-virus-simple.txt

amavis[1488]: (01488-02) Blocked INFECTED (Eicar-Test-Signature) {DiscardedOutbound,Quarantined}, LOCAL []:50314


Install test files:

sudo apt-get install clamav-testfiles

Then test it:

sudo clamdscan /usr/share/clamav-testfiles/

Once tested you can remove them:

sudo apt-get remove clamav-testfiles

Testing SPAM checking

swaks -t root@localhost –server localhost -d sample-spam-GTUBE-junk.txt

amavis[1487]: (01487-02) Blocked SPAM {DiscardedInternal,Quarantined}, LOCAL []:50238

File Examples:


Subject: Test spam mail (GTUBE)
Message-ID: <GTUBE1.1010101@example.net>
Date: Wed, 23 Jul 2003 23:30:00 +0200
From: Sender <sender@example.net>
To: Recipient <recipient@example.net>
Precedence: junk
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

This is the GTUBE, the
Test for

If your spam filter supports it, the GTUBE provides a test by which you
can verify that the filter is installed correctly and is detecting incoming
spam. You can send yourself a test mail containing the following string of
characters (in upper case and with no white spaces and line breaks):


You should send this test mail from an account outside of your network.


From: virus-tester
To: undisclosed-recipients:;
Subject: amavisd test – simple – virus scanner test pattern



On Debian you can use: pflogsumm

sudo apt-get install pflogsumm

sudo pflogsumm -d today /var/log/mail.log

Postfix log summaries for Oct 3

Grand Totals

16 received
16 delivered
0 forwarded
0 deferred
0 bounced
2 rejected (11%)
0 reject warnings
0 held
0 discarded (0%)

14189 bytes received
14189 bytes delivered
3 senders
2 sending hosts/domains
3 recipients
2 recipient hosts/domains



How to use wget to test user agents blocking

You need to use the following syntax

Testing if the site is blocking empty user agent

{ ~ } » wget –user-agent=”” http://www.exampple.co.uk ~ 8
HTTP request sent, awaiting response… 403 Forbidden: Access is denied.
2017-09-26 12:21:36 ERROR 403: Forbidden: Access is denied..

Specific user agent

» wget –user-agent=”PriceDrone-Bot+(http://www.pricedrone.co.uk/index.php/pricedrone-bot/)” http://www.example.co.uk

List of useful Linux commands – tips and tricks

Linux is a powerful system with many commands available and I found the below to be quite useful in my daily work.

ls -l –block-size=M – List size in MB instead of bytes.

:w !sudo tee % – save buffer to current file with ‘root’ permission

scp -redmine_subtask_list_columns-master.zip domain\\username@server:/home/DOMAIN/username/ – copy files using scp while using AD logins

tail -f /var/log/logfile.txt – display/refresh changes on last 10 lines of a file


How to save a current file opened with vim when ‘root’ access is required

Sometimes when editing a configuration you may find out that the file you opened was opened as ‘sudo’ hence you won’t be able to save it.

There is a solution to it so you don’t have to lose the configuration you have already done.

:w !sudo tee %

% means the current file

:w is saving the buffer not a current file, so if you type type in :w !sudo tee test2.txt ,this would save the buffer in the new test2.txt file instead of the current opened file.

How to change a default gateway on Debian Stretch

First type in

ip route 

this will display a line with ‘default‘ this is your current default gateway

to change it type in as route

ip route change default  via ethX

where ethX is the network interface you want to traffic to go through.

How to fix XenServer Updating issue

Login to your XenServer using SSH then run

xe patch-list

and take uuid

uuid ( RO) : 32e5c75c-29ce-4826-a971-bd92f5615caa
name-label ( RO): XS70E017
name-description ( RO): Public Availability: fixes to Toolstack
size ( RO): 24075528
hosts (SRO): bfcc59b8-322f-4e91-8493-9dee7dec04dc
after-apply-guidance (SRO): restartXAPI

then navigate to

cd /opt/xensource/patch-backup/


and remove the folder based on UUID above which can’t update.

Once this is done you will be able to install problematic update.

How to change server name using ILO with no OS

This cannot be easily changed using GUI apparently ILO is taking this form OS host name but how to changed if there is no OS installed on the server?

ssh to ILO first


cd system1

set oemhp_server_name= YourNewServerName

once done you can check if it has been changed

show oemhp_server_name

and your set sername should be displayed