Operating System - HP-UX
1752773 Members
4929 Online
108789 Solutions
New Discussion юеВ

Re: Converting sendmail generics accounts for outgoing mail

 
support_5
Super Advisor

Converting sendmail generics accounts for outgoing mail

In our sendmail 8.9.3 on Solaris. We use a sendmail.cf rule 93 as follows:

R$+ < @ $=G . > $: < $(generics $1@$2 $) >

which works to replace our domain with that of the required domain for the genericstable users.

I am setting up a HPUX 11.00 sendmail 8.11.1 server and it does not like the syntax of this rule a bit.

Am I going in the right direction trying to do this via rule or is it overcomplicating things? Should the genericstable handle this by itself with the new generics_domains file?

Cheers,

Damo
5 REPLIES 5
Jordan Bean
Honored Contributor

Re: Converting sendmail generics accounts for outgoing mail

Two things:

Make sure that the genericstable keyed database handler is configured in /etc/sendmail.cf. It would look like this:

# Generics table (mapping outgoing addresses)
Kgenerics hash -o /etc/mail/genericstable


The syntax for sendmail rules is quite specific - three parts delimited by one or more tabs:

Rlhs[TAB]rhs[TAB]comment

The rule should look like this:

R$+ < @ $=G . >[TAB]$: < $(generics $1@$2 $) >[TAB]whatever you want to type here

I hope this helps.

Christopher Caldwell
Honored Contributor

Re: Converting sendmail generics accounts for outgoing mail

"Normally", you shouldn't have to write or copy rulesets to make something like the generics table work. You should use m4. Instructions are located in the READMEs in
/usr/contrib/sendmail/usr/newconfig/etc/mail/cf

You'll need m4 if you use some of the more complex features of sendmail 8.11.1 that aren't in the default cf file.

m4 will build a sendmail.cf with the "right" rulesets. My rulesets for generics look like this (note the rulesets are currently commented out):

# Generics table (mapping outgoing addresses)
# Kgenerics dbm /etc/mail/genericstable




# handle generics database
#R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark
#R$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark
#R< $+ > $+ < $* > @ $: < $(generics $1 $: @ $1 $) > $2 < $3 >
#R<@$+ + $* @ $+> $+ < @ $+ >
# $: < $(generics $1+*@$3 $@ $2 $:@$1 + $2@$3 $) > $4 < @ $5 >
#R<@$+ + $* @ $+> $+ < @ $+ >
# $: < $(generics $1@$3 $: $) > $4 < @ $5 >
#R<@$+ > $+ < @ $+ > $: < > $2 < @ $3 >
#R< > $+ < @ $+ . > $: < $(generics @$2 $@ $1 $: $) > $1 < @ $2 . >
#R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >
#R< > $+ + $* < @ $+ > $: < $(generics $1+* $@ $2 $: $) > $1 + $2 < @ $3 >
#R< > $+ + $* < @ $+ > $: < $(generics $1 $: $) > $1 + $2 < @ $3 >
#R< $* @ $* > $* < $* > $@ $>canonify $1 @ $2 found qualified
#R< $+ > $* < $* > $: $>canonify $1 @ *LOCAL* found unqualified
#R< > $* $: $1 not found

support_5
Super Advisor

Re: Converting sendmail generics accounts for outgoing mail

Thanks for you help. I have progressed markedly. Christopher your comment to use m4 was not taken lightly. Previously someone developed an undocumented cf file hack to cater for below:

We receive mail for three domains to one box
Our DNS is on Dom1
Dom1 is masqueraded as Dom2
Dom3 is masqueraded as Dom1
Some mail from Dom1 users is handled by a genericstable as Dom3 users
Mail for Dom1 users is sent via aliases

Here is a go at an mc file for the above scenario:

VERSIONID(`$Id: generic-hpux10.mc,v 8.11 1999/02/07 07:26:02 gshapiro Exp $')
OSTYPE(hpux11)dnl
define(`_MASQUERADE_ENVELOPE_')dnl
define(`confTRY_NULL_MX_LIST',`T')dnl
define(`DATABASE_MAP_TYPE',`dbm')dnl
define(`_CLASS_U_')dnl
#FEATURE(always_add_domain)dnl
MAILER(local)dnl
MAILER(smtp)dnl
FEATURE(`genericstable',`dmb -o /etc/mail/genericstable')dnl
#FEATURE(`masquerade_envelope')dnl
define(`SMART_HOST', smtp:)dnl
Cw Dom1 Dom2 Dom3
define(`MASQUERADE_AS', `Dom2')dnl
FEATURE(`limited_masquerade')dnl
LOCAL_CONFIG
MASQUERADE_DOMAIN(`Dom2 Dom1')dnl
define(`MASQURADE_AS'), Dom1')dnl
FEATURE(`limited_masquerade')dnl
LOCAL_CONFIG
MASQUERADE_DOMAIN(`Dom1 Dom3')dnl

I have also noticed that the cf/cf/generic-hpux10.mc (really a HPUX11 file) does not work without this at the beginning:

include(`../m4/cf.m4')

m4 will run but fail.

By the way I will include any final solutions on this page after reading the good comments about finishing off posts.

Any help or clarifications would be gratefully accepted.

Cheers,

Damo
Christopher Caldwell
Honored Contributor

Re: Converting sendmail generics accounts for outgoing mail

From the directory
/usr/contrib/sendmail/usr/newconfig/etc/mail/cf/cf
the syntax is
# m4 ../m4/cf.m4 generic-hpux10.mc > sendmail.cf

where
generic-hpux10.mc
has your feature list ... mine looks something like this:

divert(-1)
#
# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
# The Regents of the University of California. All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
#
# This is a generic configuration file for HP-UX 9.x.
# It has support for local and SMTP mail only. If you want to
# customize it, copy it to a name appropriate for your environment
# and do the modifications there.
#
divert(0)dnl
divert(-1)
# Ported changes from sendmail-8.9.3 - Rajesh. Dec 20, 2000.
# Fix for JAGaa30867.
# Enabled local site hiding and masquerading in default sendmail.cf file.
# Adding feature(always_add_domain) and define __MASQUERADE_ENVELOPE_
# Fix for JAGaa30300 - Added support for openmail and uucp mailer and defined
# _X400_UCCP.
# Fix for JAGaa31678.
# Defined _CLASS_U so that it will add the rule to handle UUCP.
#
divert(0)dnl
VERSIONID(`$Id: generic-hpux10.mc,v 8.11 1999/02/07 07:26:02 gshapiro Exp $')
OSTYPE(hpux11)dnl
DOMAIN(generic)dnl
define(`_X400_UUCP_')dnl
define(`_MASQUERADE_ENVELOPE_')dnl
define(`confTRY_NULL_MX_LIST',`T')dnl
define(`LUSER_RELAY',`name_of_luser_relay')dnl
define(`DATABASE_MAP_TYPE',`dbm')dnl
define(`_CLASS_U_')dnl
FEATURE(always_add_domain)dnl
FEATURE(`virtuser_entire_domain')
VIRTUSER_DOMAIN_FILE(`/etc/mail/virtuser-domain')dnl
FEATURE(access_db)dnl
FEATURE(access_db)dnl
FEATURE(blacklist_recipients)dnl
FEATURE(mailertable)dnl
FEATURE(genericstable)dnl
FEATURE(virtusertable)dnl
FEATURE(domaintable)dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(openmail)dnl
MAILER(uucp)dnl


You can also use
/usr/contrib/sendmail/usr/newconfig/etc/mail/cf/cf/gen_cf

if you're doing straight forward stuff.
support_5
Super Advisor

Re: Converting sendmail generics accounts for outgoing mail

Here is how to do this:

I have included an attachment of things I found helpful including the best documentation, tips and tricks and a detailed mc file with explanations.

I hope this is of some help.

Cheers,

Damo