Change default SOA mail recipient

LiZZaRd

New member
Joined
May 4, 2006
Messages
3
If a user add new domain SOA mail recipient always get root.<DOMAIN>
As i have seen DA does not create mailbox or alias for root@<DOMAIN> automatic.
My question is how can i set the default SOA recipient to <USER>.<DOMAIN> or create alias automatic?

I have tried to edit named.db in templates dir.
|LOGIN|.|DOMAIN|
|USER|.|DOMAIN|
|NAME|.|DOMAIN|
did not work.

Thanks for your help.
 
If you changed the named.db template you've probably broken your system's ability to create DNS zones properly; you should probably change them back.

As for your question, I just don't understand it <frown>.

What does SOA mean to you?

What exactly are you trying to do? Can you give a real-world example?

Jeff
 
Actually, I have to agree with LiZZaRd.
DirectAdmin creates DNS zonefiles with SOA records that have root@domain.com as the administrative email address (the RNAME field). But no such email address is created by default so mail addressed at that address will not be delivered (unless of course 'catchall' is activated or a 'root' mailbox is created manually).
I think LiZZaRd's suggestion of having |USER| (if that would work) as the default mail address in the SOA record would be a good way of solving this. Either that or automatically create a root mailbox when new accounts are created.


(PS: RFC 2142 "strongly recommends" using hostmaster@domain.com instead of root)
 
Last edited:
Okay, I get it Start Of Authority.

:)

Now that I understand ...

If you copy the named.db template to the custom directory you can modify it.

Have you tried |USER|@|DOMAIN| ?

That should work. You can also use hostmaster@|DOMAIN| if you create that alias.

Jeff
 
Yes, i copied named.db to the custom directory, and modified it.

I have tried |USER|.|DOMAIN| too, without success. The newly added domain's zone file had: |USER|.domain.com in.
 
I also tried |USER|.|DOMAIN|. as well as some other combinations... none worked.

Then I was thinking: this will never work!
Because, how would the DNS template be parsed if a zone is being created manually (through "DNS Administration" -> "Add Zone")? In that case no user exists!
So I'm pretty sure the named.db parser doesn't have variables like |USER|, |USERNAME|, |NAME| etc. to substitute.

I guess the only solution is for DA to automatically create the |EMAIL| mailbox when new users are created.
 
Aspegic said:
I guess the only solution is for DA to automatically create the |EMAIL| mailbox when new users are created.
You're right of course; I hadn't thought of that.

You can create a post create shell script yourself.

Jeff
 
In case anyone is interrested, I've written the following tiny script that does what
LiZZaRd was asking for by automatically creating a forwarder from [email protected]
to the user's default mail account.

Create (or edit if it exists): /usr/local/directadmin/scripts/custom/user_create_post.sh
Code:
[SIZE=2]#!/bin/sh

echo "Forwarding root@$domain to $username@$domain in /etc/virtual/$domain/aliases" >> /usr/local/directadmin/scripts/custom/user_create_post.log

echo "root: $username@$domain" | cat - /etc/virtual/$domain/aliases > /etc/virtual/$domain/aliases~
mv -f /etc/virtual/$domain/aliases~ /etc/virtual/$domain/aliases
chmod 600 /etc/virtual/$domain/aliases
chown mail:mail /etc/virtual/$domain/aliases

echo -e "Done\n" >> /usr/local/directadmin/scripts/custom/user_create_post.log

exit 0;[/SIZE]
and chmod 755 user_create_post.sh
 
Last edited:
Back
Top