Archive for April, 2013

Configure DKIM on Postfix

Here are steps to configure DKIM on Postfix.

I configure DKIM on Postfix using the Ubuntu.

1. Install dkim

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install opendkim opendkim-tools

2. Configure /etc/opendkim.conf

Domain              yourdomain.com
KeyFile             /etc/mail/mail.private
Selector            mail

3. Configure /etc/default/opendkim file

Add to the end of the file.

SOCKET="inet:8891"

4. Configure /etc/postfix/main.cf file

Add these configuration options to the end of the main.cf file.

# DKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891

5. Create directory /etc/mail and go there with cd

6. Generate keys in /etc/mail

sudo opendkim-genkey -t -s mail -d youdomain.com

After generating keys you’ll have mail.private and mail.txt in the directory. mail.private is your private key and mail.txt is the public key that you should set as TXT record of the domain.

7. Configure your domain TXT record for DKIM

mail.txt contains what you should set for the domain. It contains something like this:

mail._domainkey IN TXT "v=DKIM1; k=rsa; t=y; p=MIG...QAB" ; 
----- DKIM key mail for youdomain.com

This means that you need to create TXT record for you domain that has mail._domainkey as a “host name” and v=DKIM1; k=rsa; t=y; p=MI…AQAB as a “ip address/url”.

7. Start opendkim and restart Postfix

sudo service opendkim start
sudo service postfix restart

8. Useful links

help.ubuntu.com/community/Postfix/DKIM

Short ssh alias to access to remote host via ssh

Often, when I want to access my remote DigitalOcean server I have to find out the IP address of it. It isn’t comfortable for me so I decided to create a short alias for this IP in /etc/hosts. Now, after I’ve just made an alias, it’s really more comfortable and faster to login to the remove server via ssh.

/ets/hosts

   localhost
       infous-desktop
    your_alias

Login via ssh using the alias

ssh 

UPDATE:

The another way to set the ssh alias is to edit the ~/.ssh/config file.

Host your_alias
Hostname 

Then to login just type:

ssh 

But there’s a shorter way. Again, edit ~/.ssh/config and set:

Host your_alias
Hostname 
User your_user

Now, you can login to your remote host via ssh like:

ssh your_alias

Thanks to everybody that commented this little note and suggested more elegant solutions!