owner@domain

I know is not suggested and cause that error with user@domain.

Im just trying to find a workaround cause the only caused issue is the mail user@domain one and no other.

Im try to understand why create the domain as server name cause problem and try to make a script that fix it.

Im going to test another idea right now for a workaround.

Thanks
 
ok, seems that my test is working.

For make user@domain work correctly on a server where servername exist as domain (in directadmin) is sufficent add FOR EACH user an alias with the email of the user.

Now, is just necessary use the API and a PHP script for create this alias without much pain.

My only question is related on the user email, ok is stored in data/user/ directory but on user creation that email should have a variable assigned.

Knowing that variable will help me so much for the script.

Otherwise, if anyone know a bash script for add an alias for each user grepping the email from user data would be very very appriciated cause im not such a good programmer.

Thanks

Regards
 
Try to sort things with /etc/virtual/domainowners and /etc/virtual/domains. In general situation the hostname should be in /etc/virtual/domainowners and not in /etc/virtual/domains.

p.s. I do not get, why you need to have hostname as a regular domain. That is why it is a bit difficult to give you any working solution.

p.p.s Aren't there any other way to organize thing on your server?
 
I use to keep servername as domain for have easy access to some resource like server-status mrtg phpsysinfo and other stuff and in the future with the external control panel and api for have a nice view of everything.

Ofc i should use syntax like server.whatever.domain.com but never used to use in that way since i use directadmin :)

Now this workaround is exactly what i needed for.

I know you are for sure a programmer more than me, so, could you please help me with the script for the existing user? Cuase i was thinkin too that is not necessary do for each new created user but run the script that check all user each time a user is added/edited and skip the existing alias or (for email edit) rewrite each time.

But well this is not the main thing atm, the important now is have an alias for each existing user and figure out the email variable on user creation :)

Thanks for your support
 
So you want a script, which would create .forward in /home/<username> for every existing and newly created users? Is it so??

And when an user modify his/her E-Mail in directadmin the script should update .forward. Is that so?

And will this work for you since you've added your hostname as a regular domain?
 
No, sorry maybe i didnt explain well.

The script gonna create an alias into directadmin panel at the domain with servername and gonna be called on user_modify_post.sh (if is a script that directadmin will check on use rmodify :) )

The .forward forward the email but still try to contact user@domain

The alias in directadmin at domain (servername) level redirect the email without try to contact user@domain

This way seems to be working, but, i need some days for be sure... just checking the quantity of frozen messages should be the way to understand if is working or not.

Regards
 
I use to keep servername as domain for have easy access to some resource like server-status mrtg phpsysinfo and other stuff and in the future with the external control panel and api for have a nice view of everything.
Why don't you use the vanilla /var/www/html/ directory for all that stuff?

We have that setup, so RDNS/hostnames are serverN.laws-h.., etc. This are our DA SSL hostnames too. However, our hostnames and RDNS are only there to identify IPs to servers.

On another note, doesn't phpsysinfo need some dangerous PHP functions enabled?
 
There are good reasons why your servername shouldn't be your domain name. The main one is that a domain name should never point to only one system or service. You can do it if you feel you need to, but this won't be the only problem it could cause and you won't be able to get much in the way of support.

Why does your servername need to be example.com; why can't it be host.example.com?

Jeff
 
It is host.server.com but aswell host.server.com is a domain.

Using /var/www/html would allow directaccess via IP/stuff and i would prefer to dont :)

Till now (about 7 years) never had trouble by that exlcuding this mail problem that maybe should be solved.

Ill let you know tomorror when im at office and can do some check on queue (frozen email)

Regards, and thanks

PS. Yes phpSysInfo need some funciotn that should be disabled, im trying to find a way to disable those function excluding defined path i choose.
 
DirectAdmin staff has posted it as a limitation of DirectAdmin, so you're probably on your own as long as you want to use it.

Jeff
 
But if a solution for this is really applicable so why dont use it?

I mean, as you sayd is a limitation, what if there is a working workaround, maybe directadmin staff should use it aswell for who need, or, for default.

Maybe i should try to talk with Mark about this.

What do you think?

Regards
 
I've written many times what I think, but perhaps not in so many words on these forums.

I think that a host is a host, and a service is a service, and a domain is a domain. A domain (or even a subdomain) should never be substituted for a host or a service.

So using the same name for more than one is nothing if not confusing.

Therefore, I think that the limitation is sound.

I also understand other issues which could occur, but I really won't go into them here; this is not the place for a flame war on DNS naming practices.

If you want to discuss this with Mark or John, please don't let me stp you. Go ahead.

Jeff
 
Hello,

I didn't read all posts in this thread, so forgive me if I'm repeating someone else or missed a point. I'll try and clear up any issues.

1)All DirectAdmin accounts have unix accounts on the system. Each unix account can send and receive emails, and do not need a domain associated with them. Unix email accounts live on the hostname, eg: [email protected]. This is the main reason why you cannot create a domain as the server's hostname. If you did, all unix accounts would be "virtual" and there would only be 1 username as the owner of all accounts (eg they would be listed in: /etc/virtual/server.hostname.com/passwd .. all under the owner of server.hostname.com in the domainowners file). Since people tend to enjoy control over their email accounts, we can't allow this, thus the hostname must be totally seperate from any domains created on the box. More explanations here: http://help.directadmin.com/item.php?id=328

We also have the basic rules here: http://help.directadmin.com/item.php?id=16

2) so your [email protected] is not an actual email address, it's a forwarder, as defined in /etc/virtual/domain.com/aliases. eg: "admin: admin". This will forward email from [email protected] to [email protected] (see #1 above as to what this is). Note the /etc/virtual/domain.com/aliases file is controlled in DA, and you can edit your unixuser forwarder on your forwarders page in DA.

If you want your [email protected] to forward somewhere specific, I've been using the /etc/aliases file, eg:
unixuser: [email protected]

and I've not been using the ~/.forward file method, although it may be working for some people. This /etc/aliases file method is needed if you want to change where emails sent to [email protected] are delievered. This doesn't apply to a lot, but does for things like cronjobs, or cgi-bin script deliveries (sending mail to /usr/sbin/senmail as the unixuser process).

If a message is delivered to [email protected], you can change the forward by modifing:
/etc/virtual/domain.com/aliases
eg: unixuser: [email protected]

Note that this is only changinging the [email protected] forwarder, and any email delivered to [email protected] would still arrive (unless you override with /etc/aliases, or ~/.forward)


3) Because all of this is quite rigid in design, it's hard to change for exceptions. If you want to change the access of /var/www/html, there are other ways of doing it. Any dns.value.com that resolves to your server IP and which does not have a VirtualHost setup will point to /var/www/html. If you want to point http://server.hostname.com to a different file location on disk (no recommended), edit /etc/httpd/conf/extra/httpd-vhosts.conf, and change the DocumentRoot values there... but those VHs are not setup for the normal User access. If you want some specific domain value under a User, just create *any other value* as a domain name... eg: anythingelse.hostname.com, under a DA account, and set it up that way, then you get the benefits of full goodies of VHs and dont' need to fight with any custom configs.

John
 
Okay, but, any of my user will never ever check the user@domain mail cause soon will be changed with a code (ex. 00001).

The domain created in admin level with server name will forward all email for user@domain to customer own email created (ex. [email protected]) and there will be the sent mail error and the staff comunication.

Is not such a big work, is just an api to create the right forward on @server.domain.com and the right email @domain.com

This will fit all my needs and.. till now, isnt stopping nothing from work.

But, thanks for explanation.

Regards
 
Hello,

I'm not clear on what you're referring to with changing things to 0001, but if you need to change [email protected] to not accept emails, create a forwarder:
user: :fail:

If you need it to redirect to the 0001 address, add a forwarder:
user: [email protected]

(where user is the unixuser)

The API for forwarders does already exist if that's what you're looking for:
http://www.directadmin.com/features.php?id=411

John
 
But if i forward the user@domain to null all mail delivery that are getting will be lost and user will keep sending email to non-existent remote email (mailing list, forum, newsletter) causing risk of blacklisting and not needed traffic.
 
Then forward it to an account that does exist.

Using the email_create_post.sh you can change the alias for unixuser to the first available email account, eg:
Code:
#!/bin/sh
COUNT=`grep -c imap /etc/virtual/$domain/passwd`
if [ "$COUNT" -eq 1 ]; then
   perl -pi -e "s/$username: $username/$username: $user\@$domain/" /etc/virtual/$domain/aliases
fi
exit 0;
(not tested, but that's the idea)

John
 
But if the user doesnt craete immediatly an account will brake the script.

I was thinkin about forward by default to the email i insert in user creation form, but, i didnt find what the variable is.

Could you help me on this?

Thanks
 
Good idea. Use these 2 scripts:

/usr/local/directadmin/scripts/custom/user_create_post.sh
Code:
#!/bin/sh
perl -pi -e "s/$username: $username/$username: [b]$email[/b]/" /etc/virtual/$domain/aliases
exit 0;

/usr/local/directadmin/scripts/custom/domain_create_post.sh
Code:
#!/bin/sh
if [ ! -e /usr/local/directadmin/data/users/$username/user.conf ]; then
    exit 0;
fi
email=`grep email= /usr/local/directadmin/data/users/$username/user.conf | cut -d= -f2`
perl -pi -e "s/$username: $username/$username: [b]$email[/b]/" /etc/virtual/$domain/aliases
exit 0;
again they're untested. The @ character in the $email variable may need to be escaped \@ for perl... but again, that's the just the idea of the scripts.

John
 
Back
Top