Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

15.2.2 Configure the Dovecot service program


May 24, 2021 That's what Linux should learn



Dovecot is an open source service program that provides IMAP and POP3 e-mail services to Linux systems, which is highly secure, simple to configure, fast to execute, and uses less server hardware resources, making it a recommended receiving service.

Step 1: Install the Dovecot service package. You can configure your own Yum software repository, mount the disc mirror to the specified directory, and enter the name of the dovecot package you want to install:

[root@linuxprobe ~]# yum install dovecot Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. Y ou can use subscription-manager to register. r hel | 4 .1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package dovecot.x86_64 1:2.2.10-4.el7 will be installed --> Processing Dependency: libclucene-core.so.1()(64bit) for package: 1:dovecot-2.2.10-4.el7.x86_64 --> Processing Dependency: libclucene-shared.so.1()(64bit) for package: 1:dovecot-2.2.10-4.el7.x86_64 --> Running transaction check ---> Package clucene-core.x86_64 0:2.3.3.4-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved

  1. Package Arch Version Repository Size
  2. ================================================================================
  3. Installing:
  4. dovecot x86_64 1:2.2.10-4.el7 rhel 3.2 M
  5. Installing for dependencies:
  6. clucene-core x86_64 2.3.3.4-11.el7 rhel 528 k
  7. Transaction Summary
  8. ================================================================================
  9. Install 1 Package (+1 Dependent package)
  10. Total download size: 3.7 M
  11. Installed size: 12 M
  12. Is this ok [y/d/N]: y
  13. Downloading packages:
  14. --------------------------------------------------------------------------------
  15. Total 44 MB/s | 3.7 MB 00:00
  16. Running transaction check
  17. Running transaction test
  18. Transaction test succeeded
  19. Running transaction
  20. Installing : clucene-core-2.3.3.4-11.el7.x86_64 1/2
  21. Installing : 1:dovecot-2.2.10-4.el7.x86_64 2/2
  22. Verifying : 1:dovecot-2.2.10-4.el7.x86_64 1/2
  23. Verifying : clucene-core-2.3.3.4-11.el7.x86_64 2/2
  24. Installed:
  25. dovecot.x86_64 1:2.2.10-4.el7
  26. Dependency Installed:
  27. clucene-core.x86_64 0:2.3.3.4-11.el7
  28. Complete!

Step 2: Configure the deployment of the Dovecot service program. T he following modifications are made in the main profile of the Dovecot service program. T he first is line 24, which modifies the e-mail protocol supported by the Dovecot service to imap, pop3, and lmtp. A line of parameters is then added below this line to allow the user to authenticate the password in clear text. This is done because the Dovecot service forced the user to log on encrypted by default in order to secure the e-mail system, and since there is currently no encryption system, this parameter needs to be added to allow the user to log on in clear text.

[root@linuxprobe ~]# vim /etc/dovecot/dovecot.conf .................. O mit some of the output information... 2 3 # Protocols we want to be serving. 2 4 protocols = imap pop3 lmtp 25 disable_plaintext_auth = no .................. O mit some of the output information... O n line 48 of the main profile, set the segment address that allows login, which means that we can limit the use of the e-mail system here only by users from a particular segment. If you want to make this parameter available to everyone, you do not need to modify this parameter:

44 # Space separated list of trusted network ranges. C onnections from these 45 # IPs are allowed to override their IP addresses and ports (for logging and 46 # for authentication checks). d isable_plaintext_auth is also ignored for 47 # these networks. T ypically you'd specify your IMAP proxy servers here. 4 8 login_trusted_networks : 192.168.10.0/24 Step 3: Configure the message format and storage path. I n a separate sub-profile for the Dovecot service program, define a path that specifies where to store incoming messages to the server locally. This path is already defined by default, and we just need to delete the hashtag before line 24 in the profile.

[root@linuxprobe ~]# vim /etc/dovecot/conf.d/10-mail.conf 1 ## 2 ## Mailbox locations and namespaces 3 ## 4 # Location for users' mailboxes. The default is empty, which means that Dovecot 5 # tries to find the mailboxes automatically. This won't work if the user 6 # doesn't yet have any mail, so you should explicitly tell Dovecot the full 7 # location. 8 # 9 # If you're using mbox, giving a path to the INBOX file (eg. /var/mail/%u) 10 # isn't enough. You'll also need to tell Dovecot where the other mailboxes are 11 # kept. This is called the "root mail directory", and it must be the first 12 # path given in the mail_location setting. 13 # 14 # There are a few special variables you can use, eg.: 15 # 16 # %u - username 17 # %n - user part in user@domain, same as %u if there's no domain 18 # %d - domain part in user@domain, empty if there's no domain 19 # %h - home directory 20 # 21 # See doc/wiki/Variables.txt for full list. Some examples: 22 # 23 # mail_location = maildir:~/Maildir 24 mail_location = mbox:~/mail:INBOX=/var/mail/%u 25 # mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n ……………… Have some output information ................ Then switch to the BOSS account created when the Postfix service is configured, and the directory for saving the message is created in the category. Remember to restart the DoveCot service and add it to the boot start. At this point, the configuration deployment step for the DoveCot service program ends all.

[root@linuxprobe ~]# su - boss Last login: Sat Aug 15 16:15:58 CST 2017 on pts/1 [boss@mail ~]$ mkdir -p mail/.imap/INBOX [boss@mail ~]$ exit [root@linuxprobe ~]# systemctl restart dovecot [root@linuxprobe ~]# systemctl enable dovecot ln -s '/usr/lib/systemd/system/dovecot.service' '/etc/systemd/system/multi-user.target.wants/dovecot.service'