How can i restrict user not send mail to other domain. Only they can send mail to my domain? i am using sendmail/

How can i restrict user not send mail to other domain. Only they can send mail to my domain? i am using sendmail/
LVL 1
aloknet21Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Artysystem administratorCommented:
Turn off mail relay.
edit /etc/mail/access file
remove these lines (and all other RELAY or OK lines):
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY

and rebuild access.db:
cd /etc/mail
make access.db

then they will be able to send only to your local domain, that is served by this server.
0
Jan SpringerCommented:
The real answer, without a milter, is that you cannot.

You can block "To:", "From:", etc by username and/or IP but there is not regular expression that says "block From except To and From".

You also need to consider that the client may not even use your SMTP server.

Please do not do what was recommended above.  You need to be able to receive messages that originate locally (like daily logwatch information, local bounces, etc).

Defining what email for which domain your server accepts (as suggested above) is located in /etc/mail/local-host-names.  This is not applicable to your question.
0
Artysystem administratorCommented:
_jesper_, hi.

>  You need to be able to receive messages that originate locally (like daily logwatch information, local bounces, etc).

All these emails will be delivered successfully with disabled RELAY as above. Just believe me or test it yourself :-)

> Defining what email for which domain your server accepts (as suggested above) is located in /etc/mail/local-host-names

That's true. All mail, that comes to local-host-name will be accepted regardless of 'RELAY' rules. All 'RELAY' rules are applicable to outgoing email.
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Jan SpringerCommented:
This doesn't address the author's problem.  Vanilla sendmail does not do regular expressions.  He also hasn't given any indication that the mail server does _not_ talk to other MTAs.  And, he hasn't said that other users may/may not send to other domains.

Removing the localhost information does not address this issue.
0
aloknet21Author Commented:
I want to disable to some users only. i have seen on google that make aliases for user who you want to enable send outside domain. and  do not make aliases for users who you want to restrict.

i have tested this but it is not working.

Please suggest i want to restrict only some users not all users?
0
fosiul01Commented:
Have a look to this one

http://www.sendmail.org/~ca/email/restrict.html


Create this file

/etc/mail/intern.only

insert aliases in intern.only like this

alok

then in sendmail.cf file add those rules


#LOCAL_CONFIG
F{Internal}/etc/mail/intern.only
#LOCAL_RULESETS
SLocal_check_rcpt
# get sender address and canonify it
R$*                             $: $1 $| $>3 $&f
R$* $| <>                       $@ OK           <> is always ok
R$* $| $={Internal} <@$=w.>     $: $1           luser@mail.domain.co.uk?
R$* $| $={Internal}             $: $1           luser?
R$* $| $*                       $@ OK           someone else
R$*                             $: $>3 $1       check recipient
R$+<@$=w.>                      $@ OK           local? ok
R$+<@$+>                        $#error $@ 5.1.8 $: "551 sorry luser your boss does not like you"



Now when alok will try to sent email, that email will be saved in user's home directory as deadletter . and in /var/log/maillog
you will see its saying, "sorry alok your boss does not like you"

0
aloknet21Author Commented:
should i add these lines at sendmail.mc file and then use m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

should i define my domain name here also?

R$* $| <>                       $@ OK           <> is always ok
R$* $| $={Internal} <@$=w.>     $: $1           luser@mail.domain.co.uk?

please suggest!
0
fosiul01Commented:
no add those rules in sendmail.cf  ( NOT sendmail.mc )


R$* $| $={Internal} <@$=w.>     $: $1           luser@mail.yourmailserver.com?  ( THIS ONE IS MAILSERER HOSTNAME)
R$* $| $={Internal}             $: $1           luser?  


you dont have to insert username here, keep everything as it is. instead of mail.yourmailserver.com , write your mailserver host name thats all
0
aloknet21Author Commented:
ok
Thanks fosiul. i will check this on sunday because i can't do this on working hours.

Thanks for your support.

Alok
0
fosiul01Commented:
you welcome
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.