0

In a recent installation of OpenBSD, I noticed that the smtpd daemon is present.

gelima# ps aux
USER       PID %CPU %MEM   VSZ   RSS TT  STAT   STARTED       TIME COMMAND
[...]
root     90899  0.0  0.0  1720  2236 ??  Ip     10:26PM    0:00.02 /usr/sbin/smtpd
_smtpd   46484  0.0  0.0  1452  3244 ??  Ipc    10:26PM    0:00.02 smtpd: crypto (smtpd)
_smtpd   24355  0.0  0.0  1656  3484 ??  Ipc    10:26PM    0:00.03 smtpd: control (smtpd)
_smtpd    2198  0.0  0.0  1524  3356 ??  Ip     10:26PM    0:00.04 smtpd: lookup (smtpd)
_smtpd   10223  0.0  0.1  1932  4700 ??  Ipc    10:26PM    0:00.05 smtpd: dispatcher (smtpd)
_smtpq   87986  0.0  0.0  1652  3464 ??  Ipc    10:26PM    0:00.03 smtpd: queue (smtpd)
_smtpd    9288  0.0  0.0  1456  3304 ??  Ipc    10:26PM    0:00.04 smtpd: scheduler (smtpd)
_sndiop  14528  0.0  0.0  2656   996 ??  IpU    10:26PM    0:00.00 sndiod: helper (sndiod)

How can I find the package which /usr/sbin/smtpd belongs to and remove it from system. I don't want to disable smtpd service from the system, I want to delete it.

I see that it is not available in binary packages.

# pkg_info -mz
htop--
nginx--
pkglocatedb--
quirks--
vim--no_x11

So where is it?

0

1 Answer 1

2

smtpd is part of the OpenBSD base install, as is a number of other daemons (nsd, unbound, httpd, relayd, dhcpd, etc). It is an integral part of the system and it is not meant to be removed. That's why it is useless to search for it in packages.

It can, as all other daemons, be disabled (a simple "rcctl disable smtpd" suffices), but this means you will not receive any of the automatic emails related with the system's administration, namely the alerts when a cron job fails, or the results of the daily and weekly scripts. The latter include things like lists of changed files (see man changelist), changes to setuid binaries, etc. See the man pages for daily and weekly to see all you'll be missing out on. These mails are delivered locally, to root's mbox, unless you change /etc/mail/aliases.

Note that by default, smtpd only listens on lo0, so it does not accept any messages from other hosts. It only accepts messages from local users and either delivers them to local mbox accounts, or relays them to the destination domain's MTAs. If you want to keep local users from sending mail to external domains, you can simply remove the appropriate rule on /etc/mail/smtpd.conf. This won't stop the users from sending to local addresses though, but you can do some filtering (e.g. by sender or by destination address).

You don't specify why you want to actually delete smtpd, so I can only guess, and I find it hard to find a reason to do so. You can simply disable it, as stated above. It can only be started by root (and then runs with extensive privilege separation) so if you are worried that someone might maliciously start it, you are missing the forest for the trees. For someone to be able to start smtpd they must have root access, and if that is the case, you have much bigger problems than a mailer daemon. By disabling it, the system won't be able to send messages like the aforementioned cron outputs and the like, so don't be surprised if things break.

If you still want to do it, you can just rm the binary, of course (just run rcctl disable smtpd first, otherwise you'll get an error everytime you boot the system). Just don't go complaining about some pain and a bullet-shaped hole on your foot, afterwards.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.