I saw a lot of methods for directadmin on the forum, but none realy helped me unfortunatly.
As I figured out my personal method for using PMG in combination with DA, I wanted to post my method here, maybe it can help some future users
But it works, we can create domains in DirectAdmin and not have to worry about manually adding stuff to PMG.
For now, it works realy nice, when people find this usefull and when I make changes, I can post the changes here too
Greetz,
Ronny
As I figured out my personal method for using PMG in combination with DA, I wanted to post my method here, maybe it can help some future users
- As per standard, I added the IP's of my DA servers in the mynetworks part of PMG, so all mail coming from my DA servers is at least accepted on PMG.
- I created a DKIM record in https://PMG:8006/#pmgMailProxyConfiguration:dkim
with the settings below so that the PMG signs all outgoing mail with DKIM
- I added the ssh keys of the DA servers to the PMG servers (limited to the DA IP's) 192 is obvious not my IP
Code:root@pmg:~# cat .ssh/authorized_keys from="192.168.0.1" ssh-rsa ...
- Now comes the DA tricky part, I had to create a few scripts in DA...
Code:cd /usr/local/directadmin/scripts/custom mkdir domain_change_post mkdir domain_create_post mkdir domain_destroy_post
Replace PMG with the hostname of your PMG server
Replace DA with the hostname of your DA server
file : domain_change_post/mx02-transport.sh
Code:#!/bin/sh echo "Removing $domain from PMG transport map" ssh PMG /usr/bin/pmgsh delete /config/transport/$domain echo "Adding $newdomain to PMG transport map" ssh PMG /usr/bin/pmgsh create /config/transport --domain $newdomain --host DA --comment DA_user_$username
file : domain_change_post/mx02-relay.sh
Code:#!/bin/sh echo "Removing $domain from PMG relay list" ssh PMG /usr/bin/pmgsh delete /config/domains/$domain echo "Adding $newdomain to PMG relay list" ssh PMG /usr/bin/pmgsh create /config/domains --domain $newdomain --comment DA_user_$username
file : domain_create_post/mx02-transport.sh
Code:#!/bin/sh echo "Adding $domain to PMG transport map" ssh PMG /usr/bin/pmgsh create /config/transport --domain $domain --host DA --comment DA_user_$username
file : domain_create_post/mx02-dkim.sh
Code:#!/bin/sh echo "Adding $domain to PMG DKIM list" ssh PMG /usr/bin/pmgsh create /config/dkim/domains --domain $domain --comment DA_user_$username
file : domain_create_post/mx02-relay.sh
Code:#!/bin/sh echo "Adding $domain to PMG relay list" ssh PMG /usr/bin/pmgsh create /config/domains --domain $domain --comment DA_user_$username
file : domain_destroy_post/mx02-transport.sh
Code:#!/bin/sh echo "Removing $domain from PMG transport map" ssh PMG /usr/bin/pmgsh delete /config/transport/$domain
file : domain_destroy_post/mx02-relay.sh
Code:#!/bin/sh echo "Removing $domain from PMG relay list" ssh PMG /usr/bin/pmgsh delete /config/domains/$domain
- Finally, add the IP's of your PMG servers to the DA server in
/etc/virtual/whitelist_hosts_ip
That way, you don't get bullshit on your DA server with SPF rejects..
But it works, we can create domains in DirectAdmin and not have to worry about manually adding stuff to PMG.
For now, it works realy nice, when people find this usefull and when I make changes, I can post the changes here too
Greetz,
Ronny