/scripts/posteximup help

morrow95

Well-Known Member
Oct 8, 2006
189
12
168
Just added DKIM signing to all my emails. I needed to edit the exim.conf file from :

Code:
remote_smtp:
 driver = smtp
 interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
 helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostn
 ame}}}{$primary_hostname}}
to

Code:
remote_smtp:
 driver = smtp
 # dkim added below this - dkim_domain was changed from your_domain_name.com
 dkim_domain=$sender_address_domain
 dkim_selector=mail
 dkim_private_key=/usr/local/cpanel/etc/exim/dkim.key
 interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
 helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
 # before dkim added - interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
 # before dkim added - helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}
Works perfect! The problem is that this will be overwritten by cpanel/whm if there is an update. So I logged into WHM and was going to modify through the exim advanced editor, but it doesn't support changing of the remote_smtp transport. So I am stuck. I contacted cpanel support and they gave me the following response :

1. Create a file named /scripts/posteximup

2. Give it permissions of 0700

3. Place code inside that file that will change the remote_smtp transport
to the one you wish to use. This can be shell scripting, or perl, or any other
language you'd like.

The "posteximup" hook is documented here:

Service script hooks
cPanel & WHM Script Hooks

Basically it just says this:

~~~~~~~~~~~~~~~~~~~~~~~~~~
Runs after Exim updates
(post /scripts/eximup)
~~~~~~~~~~~~~~~~~~~~~~~~~~

, but they cannot give me the code to do what I want. Doing such a thing is way over my head and languages I am not familiar with in any way.

Can anyone help out with this? I need to keep DKIM intact, but if exim will just wipe it away on any upgrade that defeats the whole thing...

thanks!
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
The easiest would like be to do something like this:

1. Create a working version of /etc/exim.conf that contains the DKIM configuration you need
2. Create a backup of what you did in step 1, for example:
Code:
    mkdir /root/my_configs
    cp /etc/exim.conf /root/my_configs
3. Create a simple posteximup that copies your backup to /etc. For example:
Code:
    touch /scripts/posteximup
    chmod 0700 /scripts/posteximup
    echo "echo \"Updating exim.conf to support DKIM\"; cp -f /root/my_configs/exim.conf /etc"
4. Test the script by running /scripts/eximup --force

You should have the working exim.conf file in place after running eximup. There are some flaws with the above, like if we drastically alter the exim configuration files. However this easy method should work until we release version 11.32, with DKIM support.
 

raghav

Registered
Mar 7, 2012
1
0
51
cPanel Access Level
Root Administrator
The easiest would like be to do something like this:

1. Create a working version of /etc/exim.conf that contains the DKIM configuration you need
2. Create a backup of what you did in step 1, for example:
Code:
    mkdir /root/my_configs
    cp /etc/exim.conf /root/my_configs
3. Create a simple posteximup that copies your backup to /etc. For example:
Code:
    touch /scripts/posteximup
    chmod 0700 /scripts/posteximup
    echo "echo \"Updating exim.conf to support DKIM\"; cp -f /root/my_configs/exim.conf /etc"
4. Test the script by running /scripts/eximup --force

You should have the working exim.conf file in place after running eximup. There are some flaws with the above, like if we drastically alter the exim configuration files. However this easy method should work until we release version 11.32, with DKIM support.

"Followed all the steps this is the error i am getting/ Plz help

Error message from syntax check:
2012-03-06 23:26:02 Exim configuration error in line 1165 of /etc/exim.conf.buildtest.work.jRc38kDTtlB_xqHq:
option setting expected: {$primary_hostname}}}"
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

We have DKIM in 11.32, which is available in EDGE and CURRENT tiers. Have you considered switching to CURRENT tier to have DKIM added to exim without needing to make manual changes? You can change the tier in WHM > Update Preferences area.

Thanks!