Solved

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

Posted on 2009-07-10
10
671 Views
Last Modified: 2013-12-18
How can i restrict user not send mail to other domain. Only they can send mail to my domain? i am using sendmail/
0
Comment
Question by:aloknet21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 27

Expert Comment

by:Nopius
ID: 24823755
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
 
LVL 28

Expert Comment

by:Jan Springer
ID: 24825223
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
 
LVL 27

Expert Comment

by:Nopius
ID: 24830071
_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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 28

Expert Comment

by:Jan Springer
ID: 24831273
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
 
LVL 1

Author Comment

by:aloknet21
ID: 24833046
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
 
LVL 29

Expert Comment

by:fosiul01
ID: 24877161
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
 
LVL 1

Author Comment

by:aloknet21
ID: 24877181
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
 
LVL 29

Expert Comment

by:fosiul01
ID: 24877192
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
 
LVL 1

Author Comment

by:aloknet21
ID: 24877231
ok
Thanks fosiul. i will check this on sunday because i can't do this on working hours.

Thanks for your support.

Alok
0
 
LVL 29

Accepted Solution

by:
fosiul01 earned 500 total points
ID: 24877238
you welcome
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question