Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install dovecot in linux system

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to install dovecot in the linux system, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

CentOS system comes with yum to install, the installation is very simple, only one package is needed: dovecot

# yum install dovecot

Everything will be done.

It also has only one main configuration file, located at / etc/dovecot.conf

Base_dir = / var/run/dovecot/ # dovecot run directory protocols = pop3 pop3s # use the protocol listen = * # to listen for connected ip addresses, * = > all IPV4 [:] = > all IPV6disable_plaintext_auth = nolog_path = / var/log/dovecot.log # log file location info_log_path = / var/log/dovecot-info.log # debug information log_timestamp = "% Y-%m-%d% H:%M:%S" ssl_disable = yesmail_location = maildir:/var/vmail/%u # user's mail directory location Here, maildir is used to store mail_privileged_group = mailprotocol imap {} protocol pop3 {pop3_uidl_format = XuXv} protocol lda {postmaster_address = postmaster@example.com} auth_verbose = yes # Authentication detailed log auth _ debug = yes # authenticated debug information is opened, and SQL query statement can be displayed. After normal operation, auth_debug_passwords = yes # can be turned off to display the details of password failure. After normal operation, you can close auth default {mechanisms = plain login # authentication mechanism passdb pam {} passdb passwd-file {args = / etc/dovecot/passwd # password file} userdb passwd {} userdb static {args = uid=vmail gid=vmail home=/var/vmail/%u # where uid and gid need to be able to access / home/vmail mailbox directory} user = rootsocket listen {client {path = / var/spool/postfix/private/auth-client # postfix need to connect to this sock to authenticate mode = 0660user = postfixgroup = postfix} dict {} plugin {}

/ etc/dovecot/passwd, you can use plain code or encoded password:

User1@example.com: {PLAIN} user1's passworduser2@example.com: {PLAIN} user2's password

The plaintext password is used here, or the encrypted password can be used:

Dovecotpw-s sshaEnter new password: fooRetype new password: foo {SSHA} dZ9TYI7DTM+J558QUBRAIMd/WCOoFGeU

In / etc/dovecot/passwd

Joe: {SSHA} dZ9TYI7DTM+J558QUBRAIMd/WCOoFGeU

The method of using file storage for accounts is described above. Here's how to use mysql database for account storage. You only need to modify the auth default block:

Auth default {mechanisms = plain loginpassdb pam {} passdb sql {args = / etc/dovecot/dovecot-sql.conf} userdb passwd {} userdb sql {args = / etc/dovecot/dovecot-sql.conf} user = rootsocket listen {client {path = / var/spool/postfix/private/auth-client mode = 0660user = postfixgroup = postfix}

/ etc/dovecot/dovecot-sql.conf

Driver = mysqlconnect = host=/tmp/mysql.sock dbname=postfix user=postfix password=mypassworddefault_pass_scheme = MD5-CRYPT # if you use postfixadmin management, you need to use this encryption method password_query = SELECT username as user, password from mailbox WHERE username ='% u'user_query = SELECT maildir, 501 AS uid, 501 AS gid FROM mailbox WHERE username ='% u'# where uid and gid need to be able to access the account mail storage directory

It's that simple, and the configuration is complete, so let's do a simple test:

Helo mail.xxx.net250 mail.xxx.net > auth login334 VXNlcm5hbWU6 > dXNlcjFAZXhhbXBsZS5jb20= (username after Base64: user1@example.com) 334 UGFzc3dvcmQ6 > Zm9vYmFy (password after Base64: foobar) 235 2.7.0 Authentication successful

Authentication by plain

Telnet localhost 25

220 mail.xxx.net ESMTP Postfix > auth plain334 > AHVzZXIxQGV4YW1wbGUuY29tAGZvb2Jhcg== (username and password after Base64:\ 0user1@example.com\ 0foobar) 235 2.7.0 Authentication successful

When using plain authentication, it should be noted that the user name and password need to be encoded together, using\ 0 as the delimiter.

There are many ways to Base64. Finally, we will introduce a method of coding using Ruby:

Inosin@mac:~ > ruby-rbase64-e'puts Base64.encode64 ("\ 0user1@example.com\ 0foobar") 'AHVzZXIxQGV4YW1wbGUuY29tAGZvb2Jhcg==inosin@mac:~ > ruby-rbase64-e' puts Base64.encode64 ("user1@example.com") 'dXNlcjFAZXhhbXBsZS5jb20=inosin@mac:~ > ruby-rbase64-e' puts Base64.encode64 ("foobar") 'Zm9vYmFy after reading the above, do you have any further understanding of how to install dovecot in linux system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report