Sendmail Interview Questions & Answers part 2


Q: – How to configure sendmail to accept mail for local delivery that is addressed to other hosts?

Create a /etc/mail/local-host-names file. Put into that file the hostnames and domain names for which sendmail should accept mail for local delivery. Enter the names with one hostname or domain name per line. And also make sure that Sendmail configuration file should contain "use_cw_file" option.

dnl Load class $=w with other names for the local host

Q: – When an organization stores aliases on an LDAP server, how you will configure sendmail to read aliases from the LDAP server?

Use "sendmail -bt -d0" command to check the sendmail compiler options. If sendmail was not compiled with LDAP support, recompile and reinstall sendmail.

Add an ALIAS_FILE define, containing the string ldap  to the sendmail configuration.

# Set the LDAP cluster value
define(`confLDAP_CLUSTER', `')
# Tell sendmail that aliases are available via LDAP
define(`ALIAS_FILE', `ldap:')

Q: – How to forward emails of a local user to external address?

Add an alias to the aliases file for each user whose mail must be forwarded to another system. The recipient field of the alias entry must be a full email address that includes the host part. After adding the desired aliases, rebuild the aliases database file with the newaliases command.

Q: – You have been asked to create a sendmail configuration that sends all local mail to a mail hub, while directly delivering mail addressed to external systems.

Create a sendmail configuration containing the MAIL_HUB define to identify the mail relay host for local mail. Use the LOCAL_USER command to exempt the root user's mail from relaying.

dnl Define a relay server for local mail
define(`MAIL_HUB', `')
dnl Users whose mail is not passed to the mail hub

Rebuild and reinstall, and then restart sendmail.

Q: – How to  configure multiple mail queues?

mkdir /var/spool/mqueue/queue.1
mkdir /var/spool/mqueue/queue.2
mkdir /var/spool/mqueue/queue.3

chmod 700 /var/spool/mqueue/queue.1
chmod 700 /var/spool/mqueue/queue.2
chmod 700 /var/spool/mqueue/queue.3

Add the QUEUE_DIR define to the sendmail configuration to use the new queue directories.

dnl Declare the queue directory path
define(`QUEUE_DIR', `/var/spool/mqueue/queue.*')

Q: – How to  disable certain SMTP commands?

Add the confPRIVACY_FLAGS define to the sendmail configuration to set Privacy Options that disable unwanted, optional SMTP commands. Here we will disables the EXPN, VRFY, VERB, and ETRN commands.

dnl Disable EXPN, VRFY, VERB and ETRN
define(`confPRIVACY_FLAGS', `noexpn,novrfy,noverb,noetrn')

Rebuild and reinstall, and then restart sendmail.

Q: – In which Sendmail configuration file we have to make changes?

we will make the changes only in the file, and the changes will be moved into the file for us.

Q: – When Sendmail dispatches your email, it places the servers hostname behind your username, which becomes the "from address" in the email (ie. we want to use the domain name and not the hostname?

define(`confDOMAIN_NAME', `')dnl

Q: – What does /etc/mail/access file contains?

The access database ("/etc/mail/access") is a list of IP addresses and domainnames of allowable connections.
FEATURE(`access_db',`hash -T<TMPF> -o /etc/mail/access.db')dnl
and cat  /etc/mail/access

localhost.localdomain           RELAY
localhost                              RELAY                             RELAY
192.168.0                            RELAY                              RELAY

Submitted By:-Naveen Kumar            Email-ID: –