martincollis
asked on
Alias files for different domains
I have been shown a system (freeBSD) I think, where they can upload an alias file for that domain.
Whats our alternative on Linux, guys?
Whats our alternative on Linux, guys?
What exactly do you mean by "upload an alias file for that domain"? If you can tell me what you are trying to accomplish, it's very likely that I can accomplish the same thing on Linux.
ASKER
Adjusted points from 200 to 250
ASKER
We have clients that previously used to adjust an alias file for their domain in their FTP area, which would be in the format:
carl user123@system1.blob.co.uk
bob user125@system3.blob.co.uk
These aliases would be used by sendmail/the mail app to forward mail.
Lets say these guys have mydomain.com as their domain.
Can we do this?
carl user123@system1.blob.co.uk
bob user125@system3.blob.co.uk
These aliases would be used by sendmail/the mail app to forward mail.
Lets say these guys have mydomain.com as their domain.
Can we do this?
So all you want to do is to let others modify the sendmail alias file. I don't know of any built-in functions in Linux that support this, but I can think of a couple of easy ways to implement it.
A special email account that pipes the update message into a perl scipt would be one way. I'd think you'd want to use some form of authentication in the message to be sure that the update was valid. A better solution would be an login/password protected web page that passes the update data to a system owned perl script which actually does the update.
A special email account that pipes the update message into a perl scipt would be one way. I'd think you'd want to use some form of authentication in the message to be sure that the update was valid. A better solution would be an login/password protected web page that passes the update data to a system owned perl script which actually does the update.
ASKER
What files would I need to adjust.
Would I have to restart sendmail?
Give me an example of what the entries would look like.
Would I have to restart sendmail?
Give me an example of what the entries would look like.
Basically, you'll just be updating the /etc/aliases file with the customer data and then running newaliases to make the data available to sendmail. Since the aliases data is implemented as a database, sendmail does a lookup anytime it uses the alias data so it's not necessary to re-start sendmail.
You could make life a bit easier by requiring the clients to furnish a complete set of aliases for each change. Then you could "mark" that area of the aliases file with comments to make the script easier. It would also be best to do as much sanity checking as possible on the client data. Indeterminate results will occur if there are errors in the alises (alias loop, malformed key/value pairs, etc) when newaliases is run.
You could make life a bit easier by requiring the clients to furnish a complete set of aliases for each change. Then you could "mark" that area of the aliases file with comments to make the script easier. It would also be best to do as much sanity checking as possible on the client data. Indeterminate results will occur if there are errors in the alises (alias loop, malformed key/value pairs, etc) when newaliases is run.
ASKER
OK.
This makes sense.
I can make the pair:-
bob@chips.co.uk user123@sys1.hi.co.uk
..... if it is easier.
Some domain aliases are altered by customers, from their FTP area.
How do I set this system up in the best way.
Keeping in mind that we already have some (5-10) customers who generate a new aliase file themselves, so we cannot change the format.
They already create a full list of aliases each time for themselves.
I have a good working knowledge of Linux, but am a little dryer on sendmail.
This makes sense.
I can make the pair:-
bob@chips.co.uk user123@sys1.hi.co.uk
..... if it is easier.
Some domain aliases are altered by customers, from their FTP area.
How do I set this system up in the best way.
Keeping in mind that we already have some (5-10) customers who generate a new aliase file themselves, so we cannot change the format.
They already create a full list of aliases each time for themselves.
I have a good working knowledge of Linux, but am a little dryer on sendmail.
Are you using one server for multiple domains?
What utility are you using to configure your system? Linuxconf? You might need to look at /etc/vmail/aliases.yourdom ain.
What utility are you using to configure your system? Linuxconf? You might need to look at /etc/vmail/aliases.yourdom
What I was referring to was constructing the master alias file with sections something like:
....
#*** Site them.something.com
alias1: user1
alias2: user2
#*** Site those.nother.com
alias1: user1
alias2: user2
Then it would be easy to write a perl script that could modify the alias file when presented with a site's alias file section.
As an alternative method, you could construct the master alias file from pieces. Probably it would be easiest to collect all of the parts into one directory (/etc/mail-aliases comes to mind). That dir would contain a "system" section file and files for each of your customers (copied there from the FTP area). As often as desired a script could be run from cron to collect customer aliases files into the directory, build a new alias file from the pieces, and finally run newaliases to tell sendmail about it. To avoid unnecessary alias rebuilds you could use make (assuming you preserve the date stamps when copying). Assuming the system section is named system, something similar to:
cd /etc/mail-aliases
cp -p /path-to-ftp-stuff/cust1.a lias alias1
cp -p /path-to-other-stuff/cust2 .alias
alias2
....etc...
make aliases
run periodically from cron would do it. The Makefile would look approximately like:
aliases: system alias1 alias2
`cat system alias? >aliases`
cp aliases /etc/aliases
newaliases
....
#*** Site them.something.com
alias1: user1
alias2: user2
#*** Site those.nother.com
alias1: user1
alias2: user2
Then it would be easy to write a perl script that could modify the alias file when presented with a site's alias file section.
As an alternative method, you could construct the master alias file from pieces. Probably it would be easiest to collect all of the parts into one directory (/etc/mail-aliases comes to mind). That dir would contain a "system" section file and files for each of your customers (copied there from the FTP area). As often as desired a script could be run from cron to collect customer aliases files into the directory, build a new alias file from the pieces, and finally run newaliases to tell sendmail about it. To avoid unnecessary alias rebuilds you could use make (assuming you preserve the date stamps when copying). Assuming the system section is named system, something similar to:
cd /etc/mail-aliases
cp -p /path-to-ftp-stuff/cust1.a
cp -p /path-to-other-stuff/cust2
alias2
....etc...
make aliases
run periodically from cron would do it. The Makefile would look approximately like:
aliases: system alias1 alias2
`cat system alias? >aliases`
cp aliases /etc/aliases
newaliases
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.