Archive for the 'Mailserver' Category

ubuntu 12.04 och smtpauthd

Tuesday, July 10th, 2012

Uppgraderade en av mina servrar från 10.04 till 12.04
Ett bekymmer som uppstod var att den inte längre accepterade att posta på smtp.
Inga vettiga felmeddelande i loggen tyvärr. Det bara inte ville.
Tydligen så buggar det med saslauthd 2.1.25 men med en nedgradering till 2.1.23 så rockar det igen.
Så medan vi väntar på att buggarna ska städas bort så backar jag.

/etc/init.d/saslauthd stop
sudo dpkg -r libsasl2-dev
sudo dpkg -r libsasl2-modules-sql
sudo dpkg -r sasl2-bin
sudo dpkg -r –force-all libsasl2-2 libsasl2-2:i386
sudo dpkg -r –force-all libsasl2-modules

cd /usr/local/src/
dpkg -i –force-all *.deb

echo “libsasl2-modules hold” | dpkg –set-selections
echo “libsasl2-dev hold” | dpkg –set-selections
echo “libsasl2-2 hold” | dpkg –set-selections
echo “sasl2-bin hold” | dpkg –set-selections

/etc/init.d/postfix restart
/etc/init.d/saslauthd restart



Mysql tip of the day postfix virtual address

Monday, March 26th, 2012

I had some struggle with mailalias in a postfix-mysql.

Several tables with different type of user positions and addresses to combine.

i one table I have user and up to three diffrent fordwardingalias, in one other diffrent peoples positions in an organization, well

setup is ubuntuserver with postfix, mysql, postfixadmin

I cooked it down to
1. pic users setting from a joomla cms
2. pic users position from a diffrent organisation-menberdatabase
3. build various combinations of alias
4. check that user i still registered and valid

I run a cron for update data from and to mysql.
hourly run bashscript:


mysql -uuser -ppassword < /scripts/uppdatealias.cmd -vvv > /scripts/uppdated.tmp
sleep 1
< /scripts/uppdated.tmp mail -s “Uppdated alias”
sleep 1
rm /scripts/uppdated.tmp



use postfix;
SET SESSION group_concat_max_len = 8192 ;
UPDATE `alias` set `goto` = (SELECT group_concat(email) FROM WHERE id < ’99’ AND > ”) WHERE address=’’;

UPDATE `alias` set `goto` = (SELECT group_concat(f) FROM (
AND = 1
AND > ”
AND = 1
) as T ) WHERE address=’’;


for postfix-mysql I want select my addresses i one row separated with commas, group_concat solves that
I have some users that dows not have an extra mailalias set and therefor the field ‘namnalias’  is empty but if there is data in email1 I want to select that. Perhaps there is other solutions but I found that with UNION I can combine two or more selects and at same time it remove duplicates.

And then I combine group_concat with my union with use of  AS and update my premade organization.positions mailaddresses

in mysql default group_concat is limit to 1024,
SET SESSION group_concat_max_len = 4096 ;
will increase that 4 times


Distributionslista för mailman

Wednesday, March 17th, 2010

Hur ställa in så bara vissa får posta till listan men alla läsa?

1. Membership Management – Moderering på alla adresser
2. Privacy Options – Filtrering på avsändare, default_member_moderation JA
3. member_moderation_action , Avslå
4. member_moderation_message, “infolista” bara vissa får posta
5. generic_nonmember_action, avslå

restrict_post mailman

PGP encrypted mailinglist – part II

Tuesday, March 25th, 2008

So, of course it would be nice to have an automatically subject-rewriting that include mailinglist [id].
One way to do this, is to use sed and this already when mail arrives to server.

In /etc/aliases:

crypt: “|/bin/sed ‘/\Subject:\ Re:\ [Crypt]*/!s/Subject:/Subject:\ [Crypt]/’ |/etc/pgpalias/ /etc/pgpalias/config”

And all above on a single row a usual

There is one small issue, that is if sender doesn´t include an subject at all, then there is nothing to rewrite.

Otherwise if Subject: test, it will be rewritten to Subject: [Crypt] test
and if you reply to that: Subject: Re: [Crypt] test it will not add [Crypt] agin.