What is sendmail in linux

What is sendmail in linux

The sendmail program implements the Postfix to Sendmail compatibility interface. For the sake of compatibility with existing applications, some Sendmail command-line options are recognized but silently ignored.

By default, sendmail reads a message from standard input until EOF or until it reads a line with only a . character, and arranges for delivery. sendmail relies on the postdrop (1) command to create a queue file in the maildrop directory.

Specific command aliases are provided for other common modes of operation: mailq List the mail queue. Each entry shows the queue file ID, message size, arrival time, sender, and the recipients that still need to be delivered. If mail could not be delivered upon the last attempt, the reason for failure is shown. This mode of operation is implemented by executing the postqueue (1) command. newaliases Initialize the alias database. If no input file is specified (with the -oA option, see below), the program processes the file(s) specified with the alias_database configuration parameter. If no alias database type is specified, the program uses the type specified with the default_database_type configuration parameter. This mode of operation is implemented by running the postalias (1) command.

Note: it may take a minute or so before an alias database update becomes visible. Use the postfix reload command to eliminate this delay.

These and other features can be selected by specifying the appropriate combination of command-line options. Some features are controlled by parameters in the main.cf configuration file.

The following options are recognized: -Am (ignored) -Ac (ignored) Postfix sendmail uses the same configuration file regardless of whether or not a message is an initial submission. -B body_type The message body MIME type: 7BIT or 8BITMIME . -C config_file (ignored 🙂 The path name of the sendmail.cf file. Postfix configuration files are kept in /etc/postfix . -F full_name Set the sender full name. This is used only with messages that have no From: message header. -G (ignored) Gateway (relay) submission, as opposed to initial user submission. -I Initialize alias database. See the newaliases command above. -L label (ignored) The logging label. Use the syslog_name configuration parameter instead. -N dsn (ignored) Delivery status notification control. Currently, Postfix does not implement DSN . -R return_limit (ignored) Limit the size of bounced mail. Use the bounce_size_limit configuration parameter instead. -X log_file (ignored) Log mailer traffic. Use the debug_peer_list and debug_peer_level configuration parameters instead. -U (ignored) Initial user submission. -V Variable Envelope Return Path. Given an envelope sender address of the form owner-listname @ origin , each recipient user @ domain receives mail with a personalized envelope sender address.

Читайте также:  Install home assistant on linux

By default, the personalized envelope sender address is owner-listname + user = domain @ origin . The default + and = characters are configurable with the default_verp_delimiters configuration parameter. -V xy As -V , but uses x and y as the VERP delimiter characters, instead of the characters specified with the default_verp_delimiters configuration parameter. -bd Go into daemon mode. This mode of operation is implemented by executing the postfix start command. -bi Initialize alias database. See the newaliases command above. -bm Read mail from standard input and arrange for delivery. This is the default mode of operation. -bp List the mail queue. See the mailq command above. -bs Stand-alone SMTP server mode. Read SMTP commands from standard input, and write responses to standard output. In stand-alone SMTP server mode, UCE restrictions and access controls are disabled by default. To enable them, run the process as the mail_owner user.

This mode of operation is implemented by running the smtpd (8) daemon. -f sender Set the envelope sender address. This is the address where delivery problems are sent to, unless the message contains an Errors-To: message header. -h hop_count (ignored) Hop count limit. Use the hopcount_limit configuration parameter instead. -i When reading a message from standard input, don’t treat a line with only a . character as the end of input. -m (ignored) Backwards compatibility. -n (ignored) Backwards compatibility. -oA alias_database Non-default alias database. Specify pathname or type : pathname . See postalias (1) for details. -o7 (ignored) -o8 (ignored) To send 8-bit or binary content, use an appropriate MIME encapsulation and specify the appropriate -B command-line option. -oi When reading a message from standard input, don’t treat a line with only a . character as the end of input. -om (ignored) The sender is never eliminated from alias etc. expansions. -o x value (ignored) Set option x to value . Use the equivalent configuration parameter in main.cf instead. -r sender Set the envelope sender address. This is the address where delivery problems are sent to, unless the message contains an Errors-To: message header. -q Attempt to deliver all queued mail. This is implemented by executing the postqueue (1) command. -q interval (ignored) The interval between queue runs. Use the queue_run_delay configuration parameter instead. -qR site Schedule immediate delivery of all mail that is queued for the named site . This option accepts only site names that are eligible for the «fast flush» service, and is implemented by executing the postqueue (1) command. See flush (8) for more information about the «fast flush» service. -qS site This command is not implemented. Use the slower sendmail -q command instead. -t Extract recipients from message headers. This requires that no recipients be specified on the command line. -v Enable verbose logging for debugging purposes. Multiple -v options make the software increasingly verbose. For compatibility with mailx and other mail submission software, a single -v option produces no output.

Читайте также:  Find file list linux

SECURITY

By design, this program is not set-user (or group) id. However, it must handle data from untrusted users or untrusted machines. Thus, the usual precautions need to be taken against malicious inputs.

DIAGNOSTICS


ENVIRONMENT

MAIL_CONFIG Directory with Postfix configuration files. MAIL_VERBOSE Enable verbose logging for debugging purposes. MAIL_DEBUG Enable debugging with an external command, as specified with the debugger_command configuration parameter.

FILES

/var/spool/postfix, mail queue /etc/postfix, configuration files

CONFIGURATION PARAMETERS

See the Postfix main.cf file for syntax details and for default values. Use the postfix reload command after a configuration change. alias_database Default alias database(s) for newaliases . The default value for this parameter is system-specific. bounce_size_limit The amount of original message context that is sent along with a non-delivery notification. default_database_type Default alias etc. database type. On many UNIX systems the default type is either dbm or hash . debugger_command Command that is executed after a Postfix daemon has initialized. debug_peer_level Increment in verbose logging level when a remote host matches a pattern in the debug_peer_list parameter. debug_peer_list List of domain or network patterns. When a remote host matches a pattern, increase the verbose logging level by the amount specified in the debug_peer_level parameter. default_verp_delimiters The VERP delimiter characters that are used when the -V command line option is specified without delimiter characters. fast_flush_domains List of domains that will receive «fast flush» service (default: all domains that this system is willing to relay mail to). This list specifies the domains that Postfix accepts in the SMTP ETRN request and in the sendmail -qR command. fork_attempts Number of attempts to fork () a process before giving up. fork_delay Delay in seconds between successive fork () attempts. hopcount_limit Limit the number of Received: message headers. mail_owner The owner of the mail queue and of most Postfix processes. command_directory Directory with Postfix support commands. daemon_directory Directory with Postfix daemon programs. queue_directory Top-level directory of the Postfix queue. This is also the root directory of Postfix daemons that run chrooted. queue_run_delay The time between successive scans of the deferred queue. verp_delimiter_filter The characters that Postfix accepts as VERP delimiter characters.

SEE ALSO

pickup(8) mail pickup daemon postsuper(1) queue maintenance postalias(1) maintain alias database postdrop(1) mail posting utility postfix(1) mail system control postqueue(1) mail queue control qmgr(8) queue manager smtpd(8) SMTP server flush(8) fast flush service syslogd(8) system logging

LICENSE


AUTHOR(S)

Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA

Источник

Sendmail

Sendmail is the classic mail transfer agent from the Unix world. This article builds upon Mail server.

The goal of this article is to setup Sendmail for local user accounts, without using MySQL or other databases, and also allowing the creation of mail-only accounts.

Читайте также:  При загрузке линукс пишет

Installation

The factual accuracy of this article or section is disputed.

Reason: sendmail can be used with other MDAs than procmail. (Discuss in Talk:Sendmail#MDA_compatibility)

Adding users

Create a Linux user for each user that wants to receive email at username@your-domain.com. To add mail-only accounts, that is, users who can get email, but cannot have shell access or login on X, you can add them like this:

# useradd -m -s /usr/bin/nologin username 

Configuration

Obtain TLS certificate

Warning: If you deploy TLS, be sure to follow weakdh.org’s guide and disable SSLv3 to prevent vulnerabilities. For more information see Server-side TLS.

To obtain a certificate, see OpenSSL#Usage.

sendmail.cf

The factual accuracy of this article or section is disputed.

Reason: Are those quotes correct and those end-of-line dnl statements necessary? (Discuss in Talk:Sendmail)

Create the file /etc/mail/sendmail.mc . You can read all the options for configuring sendmail on the file /usr/share/sendmail-cf/README .

Warning: If you create your own sendmail.mc file, remember that plaintext auth over non-TLS is very risky. Using the following example forces TLS and is therefore more safe unless you know what are you doing

Here is an example using auth over TLS. The example has comments explaing how it works. The comments start with dnl .

include(`/usr/share/sendmail-cf/m4/cf.m4') define(`confDOMAIN_NAME', `your-domain.com')dnl FEATURE(use_cw_file) dnl The following allows relaying if the user authenticates, dnl and disallows plaintext authentication (PLAIN/LOGIN) on dnl non-TLS links: define(`confAUTH_OPTIONS', `A p y')dnl dnl dnl Accept PLAIN and LOGIN authentications: TRUST_AUTH_MECH(`LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl dnl dnl Make sure this paths correctly point to your SSL cert files: define(`confCACERT_PATH',`/etc/ssl/certs') define(`confCACERT',`/etc/ssl/cacert.pem') define(`confSERVER_CERT',`/etc/ssl/certs/server.crt') define(`confSERVER_KEY',`/etc/ssl/private/server.key') dnl FEATURE(`virtusertable', `hash /etc/mail/virtusertable.db')dnl OSTYPE(linux)dnl MAILER(local)dnl MAILER(smtp)dnl
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

local-host-names

Put your domains on the local-host-names file:

localhost your-domain.com mail.your-domain.com localhost.localdomain

Make sure the domains are also resolved by your /etc/hosts file.

access.db

Create the file /etc/mail/access and put there the base addresses where you want to be able to relay mail. Lets suppose you have a vpn on 10.5.0.0/24 , and you want to relay mails from any ip in that range:

# makemap hash /etc/mail/access.db < /etc/mail/access

aliases.db

Edit the file /etc/mail/aliases and uncomment the line #root: human being here and change it to be like this:

You can add aliases for your usernames there, like:

coolguy: your-username somedude: your-username

virtusertable.db

Create your virtusertable file and put there aliases that includes domains (useful if your server is hosting several domains)

your-username@your-domain.com your-username joe@my-other.tld joenobody
# makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

Start on boot

SASL authentication

Add a user to the SASL database for SMTP authentication.

# saslpasswd2 -c your-username

Tips and tricks

Forward all the mail of one domain to certain user

To forward all mail addressed to any user in the my-other.tld domain to your-username@your-domain.com:

@my-other.tld your-username@your-domain.com

Do not forget to process it again with

# makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

Источник

Оцените статью
Adblock
detector