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
667 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
  • 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
 
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SMTP using .net w/o mail server 2 58
Zimbra opensource backup 10 43
change default ports in Postfix 1 16
multiple email servers same domain 7 18
MS outlook is a premier email client that enable you to send and receive the e-mails with various file formats of attachments such as document files, media file, and many others formats. There is some scenario occurs when a receiver of an e-mail mes…
Import PST to Exchange using Power Shell new-mailboximportrequest command, you can simply import the PST file into Exchange mailbox or archived. To know How to import PST into Exchange  2013 read the complete article.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

914 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now