sendmail.mc

These days I had to configure a new installed debian box for mail relay. The problem was, that the debian base system is configured to use exim and that the guy who set up the system chose local delivery only.

So I first had to install the packages sendmail-bin and sensible-mda and then edit the sendmail.mc file.

DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=<your_ip>')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, Addr=127.0.0.1')dnl
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, Addr=<your_ip>)dnl

or

DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp')dnl 
DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission')dnl

After you have added one of the above to the sendmail.mc file you have to create the sendmail.cf file. You can do that by using either

  • $ sendmailconfig
  • This will create the sendmail.cf, the aliases db and access db.

    or

  • $ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  • This will only create the sendmail.cf file.
    Afterwards you have to issue the command:

    /etc/init.d/sendmail reload

    You can now check if the desired ports (25) are open with netstat.

    $ netstat -nl
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 <your_ip>:587           0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:587           0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:113             0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
    tcp        0      0 <your_ip>:25            0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:921             0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:6012          0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:6013          0.0.0.0:*               LISTEN
    tcp6       0      0 :::22                   :::*                    LISTEN
    tcp6       0      0 ::1:6010                :::*                    LISTEN
    tcp6       0      0 ::1:6011                :::*                    LISTEN
    tcp6       0      0 ::1:6012                :::*                    LISTEN
    tcp6       0      0 ::1:6013                :::*                    LISTEN
    udp        0      0 0.0.0.0:915             0.0.0.0:*
    udp        0      0 0.0.0.0:918             0.0.0.0:*
    udp        0      0 0.0.0.0:111             0.0.0.0:*
    Active UNIX domain sockets (only servers)
    Proto RefCnt Flags       Type       State         I-Node Path
    unix  2      [ ACC ]     STREAM     LISTENING     162930   /.../mta/smcontrol
    unix  2      [ ACC ]     STREAM     LISTENING     15833    /.../authdaemon/socket.tmp
    unix  2      [ ACC ]     STREAM     LISTENING     37418    /dev/printer
    

    …or with nmap:

    $ nmap localhost && nmap <your_ip>
    
    Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2007-02-07 11:23 CET
    Interesting ports on localhost.localdomain (127.0.0.1):
    (The 1656 ports scanned but not shown below are in state: closed)
    PORT    STATE SERVICE
    21/tcp  open  ftp
    22/tcp  open  ssh
    25/tcp  open  smtp
    111/tcp open  rpcbind
    113/tcp open  auth
    587/tcp open  submission
    921/tcp open  unknown
    
    Nmap finished: 1 IP address (1 host up) scanned in 0.243 seconds
    
    Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2007-02-07 11:23 CET
    Interesting ports on ...:
    (The 1656 ports scanned but not shown below are in state: closed)
    PORT    STATE SERVICE
    21/tcp  open  ftp
    22/tcp  open  ssh
    25/tcp  open  smtp
    111/tcp open  rpcbind
    113/tcp open  auth
    587/tcp open  submission
    921/tcp open  unknown

    Schreib einen Kommentar

    Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *