6

When I do netstat -tanup as root on my Debian host, process 1/init is displayed for port 993. How is this possible ? I never saw such behavior.

The command systemctl list-sockets shows the correct service dovecot associated to port 993.

EDIT: I noticed another strange thing: Sytemd reports that davecot is listening on port 143 (imap) and dovecot is configured to not listen on port 143. I get a warning in the logs about that: dovecot: master: Error: systemd listens on port 143, but it's not configured in Dovecot. Closing.: 2 Time(s)

2
  • It seems to be a feature of the way that systemd works - see for example init(pid=1) listen on port 9418(git) - would love to hear a real answer though Commented Oct 26, 2016 at 20:57
  • I noticed this on my machine too. How is this a feature? - just seems like a vector of attack to me, and I have these installed and it stills show 1/init, time for unix.stackexchange.com/questions/218933/… Commented Oct 23, 2018 at 5:37

2 Answers 2

3

By default dovecot run pop , imap , pop3 and imaps on the following ports:

110: pop 143: imap 995: pop3s 993: imaps 

install dovecot-pop3d then copy dovecot.socket to /etc/systemd

sudo cp /lib/systemd/system/dovecot.socket /etc/systemd/system/ sudo systemctl reenable dovecot.socket 

Modify dovecot.socket:

sudo sed -i '/:143$/s/^/#/' /etc/systemd/system/dovecot.socket 

Restart the service:

sudo systemctl stop dovecot.service sudo systemctl start dovecot.socket sudo systemctl daemon-reload 

Check the status:

sudo systemctl status dovecot.socket 
11
  • Why do you tell me to install dovecot-pop3d if I only need and use imaps ? Does the sed line simply comment out lines with port 143 ? Commented Oct 27, 2016 at 12:27
  • Yes it will comment out lines with port 143 Commented Oct 27, 2016 at 12:29
  • I have test it on my debian jessie . Can you try it ? Commented Oct 27, 2016 at 12:31
  • 1
    I'll try it. It seam more appropriate to create a symbolic link ln -s /lib/systemd/system/dovecot.socket /etc/systemd/system as this is what has been done for ssh I see. Commented Oct 27, 2016 at 12:37
  • 1
    Ok. It works. I overwrote the /lib/systemd/system/dovecot.socket file with the commented out lines with 143 ports. Then the reeanable was required because it doesn't simply create a link. Apparently systemd updates its state. After that netstat showed dovecot instead of init. Don't know if the systemctl daemon-reload is required. Commented Oct 27, 2016 at 13:39
1

Without modifying files:

sudo systemctl stop dovecot.service sudo systemctl stop dovecot.socket sudo systemctl mask dovecot.socket sudo systemctl start dovecot.service 

and enjoy netstat -tanup ouput...

1
  • Do you mind explaining this magic. What does mask dovecot.socket do ? Why stopping socket and not start socket ? Commented Mar 9, 2019 at 11:32

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.