In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
(1) postfix configuration
One configuration dns
1 yum install bind-y
2 systemctl start named
3 vim / etc/named.conf
Content:
Options {
/ / listen-on port 53 {127.0.0.1;}
/ / listen-on-v6 port 53 {:: 1;}
Directory "/ var/named"
Dump-file "/ var/named/data/cache_dump.db"
Statistics-file "/ var/named/data/named_stats.txt"
Memstatistics-file "/ var/named/data/named_mem_stats.txt"
/ / allow-query {localhost;}
Whether dnssec-validation no;### is legal, that is, whether it can act as a dns on the public network. If there is no application, write no###.
4 vim / etc/named.rfc1912.zones
Content:
Zone "westos.com" IN {
Type master
File "westos.com.zone"
Allow-update {none;}
}
Zone "qq.com" IN {
Type master
File "qq.com.zone"
Allow-update {none;}
}
5 cd / var/named/
6 cp-p named.localhost westos.com.zone
7 vim westos.com.zone
Content:
$TTL 1D
@ IN SOA dns.westos.com. Root.westos.com. (
0; serial
1D; refresh
1H; retry
1W; expire
3H); minimum
NS dns.westos.com.
Dns A 172.25.254.112
Westos.com. MX 1 172.25.254.112.
8 cp-p westos.com.zone qq.com.zone
9 vim qq.com.zone
Content:
$TTL 1D
@ IN SOA dns.qq.com. Root.qq.com. (
0; serial
1D; refresh
1H; retry
1W; expire
3H); minimum
NS dns.qq.com.
Dns A 172.25.254.112
Qq.com. MX 1 172.25.254.212.
10 systemctl restart named
11 systemctl stop firewalld.service
12 systemctl disable firewalld.service
Basic E-mail delivery
1) postfix definition:
Postfix provides smtp protocol for mail delivery. The default port is 25 and the log is / var/log/maillog.
MDA: "Mail sending Agent"
2) important Postfix configuration instructions
1 myorigin:
Rewrite locally published e-mail messages so that they appear to be from this domain. This helps ensure that the response is returned to the inbound mail server
Default: myorigin = $myhostname
2 inet_interfaces:
Controls the network interface on which Postfix listens for incoming e-mail. If set to loopback-only, only listen for 127.0.0.1 and:: 1
If set to all, listen on all network interfaces. You can also specify a specific address.
Default: inet_interfaces = localhost
3 mydestination:
Emails received at these domains are delivered to MDA for local delivery.
Default: mydestination = $myhostname, localhost.$mydomain, localhost
4 mynetworks
A comma-separated list of IP addresses and networks (in CIDR notation). These addresses and networks can be forwarded to the
Any location without further authentication.
Default: mynetworks = 127.0.0.0Comp8
3) send mail
Email sender:
1 vim / etc/postfix/main.cf### Edit the main configuration file of postfix #
Content:
116 inet_interfaces = Network interface with the all###25 port up by default, Postfix listens only for incoming emails from the local host. To reconfigure postfix to receive messages sent from a remote host
Local mail sent, inet_interfaces = all### must be set
76 myhostname = westos-mail.westos.com### specifies the mta host name #
83 mydomain = westos.com### specifies the domain name of mta #
99 myorigin = westos.com### specifies the end of the message source (the character content after @)
Mydestination = $myhostname, $mydomain, localhost### accept the specified # of the end character of the message
2 systemctl restart postfix.service### restart service #
3. Systemctl stop firewalld###, turn off firewall #
4 mail root@qq.com### send email #
Subject: hello
Hello
. # to "." Indicates the end #
EOT
5 mailq (or postqueue-p) # displays a list of all outgoing messages that have been queued #
6 postqueue-fallow email # send all queued messages immediately again #
The receiving end:
1 vim / etc/postfix/main.cf
Content:
116 inet_interfaces = all # the network interface opened on port 25. By default, Postfix listens only for incoming emails from the local host. To reconfigure postfix to receive messages sent from a remote host
Local mail sent, inet_interfaces = all### must be set
76 myhostname = qq-mail.westos.com # specify the mta host name #
83 mydomain = qq.com # specify the domain name of mta #
99 myorigin = $mydomain # specify the end of the message source (the character content after @)
Mydestination = $myhostname, $mydomain, localhost # accept the specified # of the end character of the message
2 systemctl restart postfix.service
3 systemctl stop firewalld.service
4. Mail### to view the obtained email #
The process is as follows:
Email end:
[root@westos-mail named] # vim / etc/postfix/main.cf
116 inet_interfaces = network interface with all###25 port open #
76 myhostname = westos-mail.westos.com### specifies the mta host name #
83 mydomain = westos.com### specifies the domain name of mta #
99 myorigin = westos.com### specifies the end of the message source (the character content after @)
Mydestination = $myhostname, $mydomain, localhost### accept the specified # of the end character of the message
[root@westos-mail named] # systemctl restart postfix.service
[root@westos-mail named] # systemctl stop firewalld
[root@westos-mail named] # mail root@qq.com
Subject: hello
Hello
.
EOT
[root@westos-mail named] # mailq
Mail queue is empty
[root@westos-mail named] #
The receiving end:
[root@qq-mail ~] # vim / etc/postfix/main.cf
116 inet_interfaces = all # Network interface opened on port 25 #
76 myhostname = qq-mail.qq.com # specify the mta host name #
83 mydomain = qq.com # specify the domain name of mta #
99 myorigin = $mydomain # specify the end of the message source (the character content after @)
Mydestination = $myhostname, $mydomain, localhost # accept the specified # of the end character of the message
[root@qq-mail ~] # systemctl restart postfix.service
[root@qq-mail ~] # systemctl stop firewalld.service
[root@qq-mail ~] # mailq
Mail queue is empty
You have mail in / var/spool/mail/root
[root@qq-mail ~] # cat / var/spool/mail/root
From root@westos.com Sat May 20 03:13:41 2017
Return-Path:
X-Original-To: root@qq.com
Delivered-To: root@qq.com
Received: from westos-mail.westos.com (unknown [172.25.254.112])
By qq-mail.westos.com (Postfix) with ESMTP id 3442417E84B
For; Sat, 20 May 2017 03:13:41-0400 (EDT)
Received: by westos-mail.westos.com (Postfix, from userid 0)
Id CD43D2462AE; Sat, 20 May 2017 03:13:40-0400 (EDT)
Date: Sat, 20 May 2017 03:13:40-0400
To: root@qq.com
Subject: hello
User-Agent: Heirloom mailx 12.5 7-5-10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Three mail aliases
The receiving end:
1 vim / etc/aliases
Content:
Admin: root
Alias, real name.
2 postalias / etc/aliases### takes effect immediately #
3 systemctl restart postfix.service### restart service #
Test:
Email end:
1 mail admin@qq.com
Subject: haa
Haa
.
EOT
2 mailq
The receiving end:
The process is as follows:
Email end:
[root@westos-mail ~] # mail admin@qq.com
Subject: haa
Haa
.
EOT
[root@westos-mail ~] # mailq
Mail queue is empty
Email recipient:
[root@qq-mail ~] # vim / etc/aliases
[root@qq-mail ~] # postalias / etc/aliases # effective immediately #
[root@qq-mail ~] # systemctl restart postfix.service
[root@qq-mail ~] # mail
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/spool/mail/root": 3 messages 1 new 3 unread
U 1 root Sat May 20 03:13 22 amp 741 "hello"
U 2 root Sat May 20 03:25 22 amp 747 "world"
> N 3 root Sat May 20 04:09 21 amp 731 "haa"
& Q
Held 3 messages in / var/spool/mail/root
You have mail in / var/spool/mail/root
Four e-mails are sent in groups
The receiving end:
1 vim / etc/aliases
Content:
Moreuser:: include:/etc/postfix/moreuser
Alias
2 vim / etc/postfix/moreuser
Content:
Student
Root
3 postalias / etc/aliases### takes effect immediately #
4 systemctl restart postfix.service### restart service #
Test:
Email end:
1 mail moreuser@qq.com
Subject: hello
Kaa
.
EOT
2 mailq
Email recipient:
1 mail-u student # View student email #
2 mail-u root # View root email #
The process is as follows:
Email end:
[root@westos-mail ~] # mail moreuser@qq.com
Subject: hello
Kaa
.
EOT
[root@westos-mail ~] # mailq
Mail queue is empty
[root@qq-mail ~] # vim / etc/aliases
Moreuser:: include:/etc/postfix/moreuser
Alias
[root@qq-mail ~] # vim / etc/postfix/moreuser
Student
Root
Email recipient:
[root@qq-mail ~] # postalias / etc/aliases
[root@qq-mail ~] # systemctl restart postfix.service
[root@qq-mail ~] # > / var/spool/mail/root
[root@qq-mail ~] # mail-u student # View student email #
No mail for student
[root@qq-mail ~] # mail-u root # View root email #
No mail for root
[root@qq-mail] # mail-u root
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/mail/root": 1 message 1 new
N 1 root Sat May 20 04:12 24 amp 868 "hello"
& Q
Held 1 message in / var/mail/root
[root@qq-mail] # mail-u student
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/mail/student": 1 message 1 new
> N 1 root Sat May 20 04:12 24 amp 871 "hello"
& Q
Held 1 message in / var/mail/student
You have mail in / var/spool/mail/root
Fifth, test the mail service through the remote host
1 telnet 172.25.254.112 25 # connection to port 25 # of 172.25.254.112
Trying 172.25.254.112...
Connected to 172.25.254.112.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Ehlo hello # say hello to the 112 host # #
250-westos-mail.westos.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Mail from:root@westos.com # email sent from root@westos.com #
250 2.1.0 Ok
Rcpt to:root@qq.com # email to root@qq.com###
250 2.1.5 Ok
Data # email content #
354 End data with.
Hello world
Hai
. # # to "." Indicates the end #
250 2.0.0 Ok: queued as EEB672462AF
Six deny remote host connection
1 postconf-e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access" # use the smtpd_client_restrictions parameter to detect / etc/postfix/access, but what is really detected is the encrypted file access.db####
2 vim / etc/postfix/main.cf
3 vim / etc/postfix/access### edits the host you refused to connect to #
Content:
172.25.254.12 REJECT
4 postmap / etc/postfix/access # encryption #
5 cd / etc/postfix/### encrypted files in this directory #
6 systemctl restart postfix.service
Test:
Telnet 172.25.254.112 25
The process is as follows:
[root@westos-mail ~] # postconf-d | grep client### displays the default value of client # #
Broken_sasl_auth_clients = no
Local_header_rewrite_clients = permit_inet_interfaces
Parent_domain_matches_subdomains = debug_peer_list,fast_flush_domains,mynetworks,permit_mx_backup_networks,qmqpd_authorized_clients,relay_domains,smtpd_access_maps
Postscreen_client_connection_count_limit = $smtpd_client_connection_count_limit
Qmqpd_authorized_clients =
Qmqpd_client_port_logging = no
Relay_clientcerts =
Smtpd_authorized_verp_clients = $authorized_verp_clients
Smtpd_authorized_xclient_hosts =
Smtpd_client_connection_count_limit = 50
Smtpd_client_connection_rate_limit = 0
Smtpd_client_event_limit_exceptions = ${smtpd_client_connection_limit_exceptions:$mynetworks}
Smtpd_client_message_rate_limit = 0
Smtpd_client_new_tls_session_rate_limit = 0
Smtpd_client_port_logging = no
Smtpd_client_recipient_rate_limit = 0
Smtpd_client_restrictions =
Unknown_client_reject_code = 450
[root@westos-mail ~] # postconf-e "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access" # use the smtpd_client_restrictions parameter to detect / etc/postfix/access, but what is really detected is the encrypted file access.db####
[root@westos-mail ~] # vim / etc/postfix/main.cf
[root@westos-mail ~] # vim / etc/postfix/access
[root@westos-mail ~] # vim / etc/postfix/access
[root@westos-mail ~] # postmap / etc/postfix/access # encryption #
[root@westos-mail ~] # ls
Anaconda-ks.cfg Documents Music Public Videos
Desktop Downloads Pictures Templates
[root@westos-mail ~] # cd / etc/postfix/
[root@westos-mail postfix] # ls
Access generic master.cf virtual
Access.db header_checks relocated
Canonical main.cf transport
[root@westos-mail postfix] #
Test:
[root@foundation12 Desktop] # telnet 172.25.254.112 25
Trying 172.25.254.112...
Connected to 172.25.254.112.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Mail from:root@westos.com
250 2.1.0 Ok
Rcpt to:root@qq.com
554 5.7.1: Client host rejected: Access denied
Q
502 5.5.2 Error: command not recognized
Quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@foundation12 Desktop] #
Seventh, restrict remote host connection users from sending
Connected hosts:
1 postconf-d | grep sender### view parameter #
2 postconf-e "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender" # use smtpd_sender_restrictions parameter to detect
/ etc/postfix/sender file #
3. Vim / etc/postfix/sender### edit file #
Content:
Student@westos.com REJECT### refuses student@westos.com users to send #
4 postmap / etc/postfix/sender### encryption #
5 cd / etc/postfix/### encrypted files are in this directory
6 systemctl restart postfix.service### restart service #
The process is as follows:
[root@westos-mail ~] # postconf-d | grep sender
Address_verify_sender = $double_bounce_sender
Address_verify_sender_dependent_default_transport_maps = $sender_dependent_default_transport_maps
Address_verify_sender_dependent_relayhost_maps = $sender_dependent_relayhost_maps
Address_verify_sender_ttl = 0s
Canonical_classes = envelope_sender, envelope_recipient, header_sender, header_recipient
Double_bounce_sender = double-bounce
Lmtp_sender_dependent_authentication = no
Masquerade_classes = envelope_sender, header_sender, header_recipient
Proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps
Sender_bcc_maps =
Sender_canonical_classes = envelope_sender, header_sender
Sender_canonical_maps =
Sender_dependent_default_transport_maps =
Sender_dependent_relayhost_maps =
Smtp_sender_dependent_authentication = no
Smtpd_reject_unlisted_sender = no
Smtpd_sender_login_maps =
Smtpd_sender_restrictions =
Unverified_sender_defer_code = 450
Unverified_sender_reject_code = 450
Unverified_sender_reject_reason =
Unverified_sender_tempfail_action = $reject_tempfail_action
[root@westos-mail ~] # postconf-e "smtpd_sender_restrictions = check_sender_acess hash:/etc/postfix/sender"
[root@westos-mail ~] # vim / etc/postfix/sender
[root@westos-mail ~] # postmap / etc/postfix/sender
[root@westos-mail ~] # systemctl restart postfix.service
[root@westos-mail ~] # systemctl start named
[root@westos-mail ~] # systemctl stop firewalld
[root@westos-mail postfix] # ls
Access canonical header_checks master.cf sender transport
Access.db generic main.cf relocated sender.db virtual
Test:
[kiosk@foundation12 Desktop] $telnet 172.25.254.112 25
Trying 172.25.254.112...
Connected to 172.25.254.112.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Mail from:student@westos.com
250 2.1.0 Ok
Rcpt to:root@westos.com
554 5.7.1: Client host rejected: Access denied
Quit
221 2.0.0 Bye
Connection closed by foreign host.
[kiosk@foundation12 Desktop] $
Eight restrict users to receive
The receiving end:
1 postconf-e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"
2 vim / etc/postfix/recip
Content:
Westos@westos.com REJECT### restricts westos@wests.com users to receive #
3 postmap / etc/postfix/recip # encryption #
4 systemctl restart postfix.service
The process is as follows:
[root@westos-mail ~] # postconf-e "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip"
[root@westos-mail ~] # vim / etc/postfix/recip
Westos@westos.com REJECT
[root@westos-mail ~] # postmap / etc/postfix/recip
[root@westos-mail ~] # systemctl restart postfix.service
Test:
[kiosk@foundation12 Desktop] $telnet 172.25.254.112 25
Trying 172.25.254.112...
Connected to 172.25.254.112.
Escape character is'^]'.
220 westos-mail.westos.com ESMTP Postfix
Mail from:westos@westos.com
250 2.1.0 Ok
Rcpt to:root@westos.com
250 2.1.5 Ok
Data
354 End data with.
Hello
Hello
.
250 2.0.0 Ok: queued as D00F9EAC27
Mail from:root@westos.com
250 2.1.0 Ok
Rcpt to:westos@westos.com
554 5.7.1: Recipient address rejected: Access denied
421 4.4.2 westos-mail.westos.com Error: timeout exceeded
Connection closed by foreign host.
Nine inbound address translation
Email sender:
1 postconf-e "smtp_generic_maps = hash:/etc/postfix/generic"
2 vim / etc/postfix/generic
3 postmap / etc/postfix/generic
Westos@westos.com hello@haa.com
Real user virtual user
4 postmap / etc/postfix/generic### encryption #
Test:
Su-westos
Mail root@qq.com
The process is as follows:
Email sender:
[root@westos-mail ~] # postconf-d | grep generic
Lmtp_generic_maps =
Proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps
Smtp_generic_maps =
[root@westos-mail ~] # postconf-e "smtp_generic_maps = hash:/etc/postfix/generic"
[root@westos-mail ~] # vim / etc/postfix/generic
[root@westos-mail ~] # postmap / etc/postfix/generic
Test:
Email sender:
[root@westos-mail ~] # su-westos
[westos@westos-mail ~] $mail root@qq.com
Subject: hello hello
Hello
.
EOT
[westos@westos-mail ~] $mailq
Mail queue is empty
Recipient of the message:
[root@qq-mail ~] # mail
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/spool/mail/root": 3 messages 1 new
1 root Sat May 20 04:12 25 amp 879 "hello"
2 root@westos.com Sat May 20 04:36 15/510
> N 3 hello@haa.com Sat May 20 22:32 21 amp 725 "hello hello"
& 3
Message 3:
From hello@haa.com Sat May 20 22:32:21 2017
Return-Path: # name has changed #
X-Original-To: root@qq.com
Delivered-To: root@qq.com
Date: Sat, 20 May 2017 22:32:23-0400
To: root@qq.com
Subject: hello hello
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: hello@haa.com
Status: R
Hello
&
Ten outbound address translation
1) do dns parsing first:
1 vim / etc/named.rfc1912.zones
Content:
Zone "haa.com" IN {
Type master
File "haa.com.zone"
Allow-update {none;}
}
2 cd / var/named/
3 cp-p qq.com.zone haa.com.zone
4 vim haa.com.zone
Content:
$TTL 1D
@ IN SOA dns.haa.com. Root.haa.com. (
0; serial
1D; refresh
1H; retry
1W; expire
3H); minimum
NS dns.haa.com.
Dns A 172.25.254.112
Haa.com. MX 1 172.25.254.112.room# is the ip### of the real name host
~
5 systemctl restart named
The process is as follows:
[root@westos-mail westos] # vim / etc/named.rfc1912.zones
Zone "haa.com" IN {
Type master
File "haa.com.zone"
Allow-update {none;}
}
[root@westos-mail named] # cd / var/named/
[root@westos-mail named] # ls
Data named.ca named.localhost qq.com.zone westos.com.zone
Dynamic named.empty named.loopback slaves
[root@westos-mail named] # cp-p qq.com.zone haa.com.zone
[root@westos-mail named] # vim haa.com.zone
$TTL 1D
@ IN SOA dns.haa.com. Root.haa.com. (
0; serial
1D; refresh
1H; retry
1W; expire
3H); minimum
NS dns.haa.com.
Dns A 172.25.254.112
Haa.com. MX 1 172.25.254.112.
~
[root@westos-mail named] # systemctl restart named
2) configuration
1 postconf-e "virtual_alias_maps = hash:/etc/postfix/virtual"
2 vim / etc/postfix/virtual
Content:
Hello@haa.com westos@westos.com
Alias real name
3 postmap / etc/postfix/virtual### encryption #
4 systemctl restart postfix.service
The process is as follows:
[root@westos-mail named] # postconf-d | grep virtual
Address_verify_virtual_transport = $virtual_transport
Propagate_unmatched_extensions = canonical, virtual
Proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps
Unknown_virtual_alias_reject_code = 5505
Unknown_virtual_mailbox_reject_code = 5505
Virtual_alias_domains = $virtual_alias_maps
Virtual_alias_expansion_limit = 1000
Virtual_alias_maps = $virtual_maps
Virtual_alias_recursion_limit = 1000
Virtual_delivery_slot_cost = $default_delivery_slot_cost
Virtual_delivery_slot_discount = $default_delivery_slot_discount
Virtual_delivery_slot_loan = $default_delivery_slot_loan
Virtual_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
Virtual_destination_concurrency_limit = $default_destination_concurrency_limit
Virtual_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
Virtual_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
Virtual_destination_rate_delay = $default_destination_rate_delay
Virtual_destination_recipient_limit = $default_destination_recipient_limit
Virtual_extra_recipient_limit = $default_extra_recipient_limit
Virtual_gid_maps =
Virtual_initial_destination_concurrency = $initial_destination_concurrency
Virtual_mailbox_base =
Virtual_mailbox_domains = $virtual_mailbox_maps
Virtual_mailbox_limit = 51200000
Virtual_mailbox_lock = fcntl, dotlock
Virtual_mailbox_maps =
Virtual_minimum_delivery_slots = $default_minimum_delivery_slots
Virtual_minimum_uid = 100
Virtual_recipient_limit = $default_recipient_limit
Virtual_recipient_refill_delay = $default_recipient_refill_delay
Virtual_recipient_refill_limit = $default_recipient_refill_limit
Virtual_transport = virtual
Virtual_uid_maps =
[root@westos-mail named] # postconf-e "virtual_alias_maps = hash:/etc/postfix/virtual"
[root@westos-mail named] # vim / etc/postfix/virtual
Hello@haa.com westos@westos.com
Alias real name
[root@westos-mail named] # postmap / etc/postfix/virtual### encryption #
[root@westos-mail named] # systemctl restart postfix.service
Test:
Email sender:
1 mail hello@haa.com### email #
2 mailq
Email receiver:
The process is as follows:
[root@westos-mail named] # mail
Heirloom Mail version 12.5 7-5-10. Type? For help.
"/ var/spool/mail/westos": 1 message 1 new
N 1 root Sat May 20 22:42 21 amp 719 "hai"
& 1
Message 1:
From root@qq.com Sat May 20 22:42:59 2017
Return-Path:
X-Original-To: hello@haa.com
Delivered-To: westos@westos.com
Date: Sat, 20 May 2017 22:42:58-0400
To: hello@haa.com
Subject: hai
User-Agent: Heirloom mailx 12.5 7-5-10
Content-Type: text/plain; charset=us-ascii
From: root@qq.com (root)
Status: R
Hai
&
[root@qq-mail ~] # mail hello@haa.com### email #
Subject: hai
Hai
.
EOT
[root@qq-mail ~] # mailq
Mail queue is empty
[root@qq-mail ~] #
(2) dovecot configuration
One definition:
Dovecot is used to provide pickup protocols.
Protocol: Port:
Pop3110
Imap143
Imaps993
Pop3s995
Given the user name and password, the dovecot program takes us to see the user's mail file.
Second configuration
1 vim / etc/dovecot/dovecot.conf### who can access and pass authentication #
Content:
24 protocols = imap pop3 lmtp### Open pickup Protocol #
48 login_trusted_networks = 0.0.0.0 Universe # allow everyone to connect #
49 disable_plaintext_auth = no### supports plaintext #
2 what file vim / etc/dovecot/conf.d/10-mail.conf### takes the user to see #
Content:
30 mail_location = mbox:~/mail:INBOX=/var/mail/%u
3 mkdir / etc/skel/mail/.imap-paired directory # create a directory in the user skeleton file, then all newly created users have the directory #
4 touch / etc/skel/mail/.imap/INBOX
5 mkdir / home/westos/mail/.imap-paired directory # if it is a pre-existing user, create a separate directory, because the user's directory # is not found in the user skeleton file
6 touch / home/westos/mail/.imap/INBOX
The process is as follows:
[root@westos-mail ~] # yum install dovecot-y
[root@westos-mail ~] # systemctl start dovecot
[root@westos-mail ~] # netstat-anplte | grep dovecot
Tcp 0 0 0.0.0.0 5989/dovecot 993 0.0.0.0 5989/dovecot
Tcp 0 0 0.0.0.0 5989/dovecot 995 0.0.0.0 5989/dovecot
Tcp 0 0 0.0.0.0 5989/dovecot 110 0.0.0.0 5989/dovecot
Tcp 0 0 0.0.0 0 5989/dovecot 143 0.0.0 0 5989/dovecot
Tcp6 0 0: 993: * LISTEN 0 92794 5989/dovecot
Tcp6 0 0: 995: * LISTEN 0 92770 5989/dovecot
Tcp6 0 0: 110: * LISTEN 0 92768 5989/dovecot
Tcp6 0 0: 143: * LISTEN 0 92792 5989/dovecot
[root@westos-mail ~] # vim / etc/dovecot/dovecot.conf
[root@westos-mail ~] # vim / etc/dovecot/conf.d/10-mail.conf
[root@westos-mail ~] # systemctl restart dovecot.service
[root@westos-mail ~] # mkdir / etc/skel/mail/.imap-p
[root@westos-mail ~] # touch / etc/skel/mail/.imap/INBOX
[root@westos-mail ~] # passwd westos
Changing password for user westos.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
Passwd: all authentication tokens updated successfully.
[root@westos-mail ~] # mkdir / home/westos/mail/.imap-p
[root@westos-mail ~] # touch / home/westos/mail/.imap/INBOX
Test:
Mutt-f pop://westos@172.25.254.112
Three profix+mysql
1) preparatory work:
1 yum install httpd php php-mysql.x86_64 mariadb-server.x86_64-y
2 vim / etc/my.cnf
Content:
Skip-networking = 1
3 mysql_secure_installation # Database initialization #
4 cd / var/www/html/
5 tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
6 mv phpMyAdmin-3.4.0-all-languages/ myadmin
7 cd myadmin/
8 cp config.sample.inc.php config.inc.php
9 vim config.inc.php
10 systemctl restart httpd
11 create user postuser@localhost identified by 'postuser'
12 create db, usermessage,dbuser
2) configuration
1 cd / etc/postfix/
2 vim mailuser.cf### user name query #
Content:
Hosts = host where the localhost### database resides #
User = postuser### user logging into the database #
Password = postuser### login password #
Dbname = name of the library to be queried by email###postfix #
Table = name of the table to be queried by emailuser###postfix #
Select_field = the field to be queried by username###postfix #
Where_field = query condition of postfix given by username### user #
3 query the domain name of cp mailuser.cf maildomain.cf### users #
4 vim maildomain.cf
Hosts = localhost
User = postuser
Password = postuser
Dbname = email
Table = emailuser
Select_field = domain
Where_field = domain
5 cp mailuser.cf mailbox.cf
6 vim mailbox.cf # user mailbox query #
Hosts = localhost
User = postuser
Password = postuser
Dbname = email
Table = emailuser
Select_field = maildir
Where_field = username
7 postmap-Q "lee@lee.com" mysql:/etc/postfix/mailuser.cf # check whether the user name will be output. If so, it means that the user name is written correctly.
8 postmap-Q "lee.com" mysql:/etc/postfix/maildomain.cf
9 postmap-Q "lee@lee.com" mysql:/etc/postfix/mailbox.cf
3) postfix configuration
1 groupadd-g 666 vmail
2 useradd-s / sbin/nologin-u 666 vmail-g 666
3 postconf-d | grep virtual
4 postconf-e "virtual_mailbox_base = / home/vmail" # set the mail directory of the virtual user #
5 postconf-e "virtual_uid_maps = static:666" # uid### of files created by virtual users
6 postconf-e "virtual_gid_maps = static:666" # gid### of the virtual user's creation file
7 postconf-e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf"
8 postconf-e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"
9 postconf-e "virtual_mailbox_maps = mysql:/etc/postfix/maildomain.cf"
Whether the test is written correctly: if it exists, it means it is written correctly.
Ll / etc/postfix/mailuser.cf
Ll / etc/postfix/mailbox.cf
Ll / etc/postfix/maildomain.cf
Test:
Mail lee@lee.com### to see if you can use the user in the database to send email #
The process is as follows:
[root@westos-mail myadmin] # cd / etc/postfix/
[root@westos-mail postfix] # vim mailuser.cf
Hosts = localhost
User = postuser
Password = postuser
Dbname = email
Table = emailuser
Select_field = username
Where_field = username
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:mailuser.cf
Postmap: fatal: bad string length 0 < 1: mailuser.cf_dbname =
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailuser.cf
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailuser.cf
[root@westos-mail postfix] # vim mailuser.cf
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailuser.cf
Lee@lee.com
[root@westos-mail postfix] # cp mailuser.cf maildomain.cf
[root@westos-mail postfix] # vim maildomain.cf
Hosts = localhost
User = postuser
Password = postuser
Dbname = email
Table = emailuser
Select_field = domain
Where_field = domain
~
[root@westos-mail postfix] # postmap-Q "lee.com" mysql:/etc/postfix/maildomain.cf
Lee.com,lee.com
[root@westos-mail postfix] # cp mailuser.cf mailbox.cf
[root@westos-mail postfix] # vim mailbox.cf
Hosts = localhost
User = postuser
Password = postuser
Dbname = email
Table = emailuser
Select_field = maildir
Where_field = username
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailbox.cf
Postmap: warning: mysql query failed: Unknown column 'madir' in' field list'
Postmap: fatal: table mysql:/etc/postfix/mailbox.cf: query error: Success
[root@westos-mail postfix] # vim mailbox.cf
[root@westos-mail postfix] # postmap-Q "lee@lee.com" mysql:/etc/postfix/mailbox.cf
/ mnt/lee.com/lee
[root@westos-mail postfix] #
[root@westos-mail] # groupadd-g 666 vmail
[root@westos-mail] # useradd-s / sbin/nologin-u 666 vmail-g 666
[root@westos-mail ~] # id vmail
Uid=666 (vmail) gid=666 (vmail) groups=666 (vmail)
[root@westos-mail ~] # postconf-d | grep virtual
Address_verify_virtual_transport = $virtual_transport
Propagate_unmatched_extensions = canonical, virtual
Proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps
Unknown_virtual_alias_reject_code = 5505
Unknown_virtual_mailbox_reject_code = 5505
Virtual_alias_domains = $virtual_alias_maps
Virtual_alias_expansion_limit = 1000
Virtual_alias_maps = $virtual_maps
Virtual_alias_recursion_limit = 1000
Virtual_delivery_slot_cost = $default_delivery_slot_cost
Virtual_delivery_slot_discount = $default_delivery_slot_discount
Virtual_delivery_slot_loan = $default_delivery_slot_loan
Virtual_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
Virtual_destination_concurrency_limit = $default_destination_concurrency_limit
Virtual_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
Virtual_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
Virtual_destination_rate_delay = $default_destination_rate_delay
Virtual_destination_recipient_limit = $default_destination_recipient_limit
Virtual_extra_recipient_limit = $default_extra_recipient_limit
Virtual_gid_maps =
Virtual_initial_destination_concurrency = $initial_destination_concurrency
Virtual_mailbox_base =
Virtual_mailbox_domains = $virtual_mailbox_maps
Virtual_mailbox_limit = 51200000
Virtual_mailbox_lock = fcntl, dotlock
Virtual_mailbox_maps =
Virtual_minimum_delivery_slots = $default_minimum_delivery_slots
Virtual_minimum_uid = 100
Virtual_recipient_limit = $default_recipient_limit
Virtual_recipient_refill_delay = $default_recipient_refill_delay
Virtual_recipient_refill_limit = $default_recipient_refill_limit
Virtual_transport = virtual
Virtual_uid_maps =
[root@westos-mail ~] # postconf-e "virtual_mailbox_base = / home/vmail"
[root@westos-mail ~] # postconf-e "virtual_uid_maps = static:666"
[root@westos-mail ~] # postconf-e "virtual_gid_maps = static:666"
[root@westos-mail ~] # postconf-e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf"
[root@westos-mail ~] # postconf-e "virtual_mailbox_maps = mysql:/etc/postfi/maildomain.cf
[root@westos-mail ~] # postconf-e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"
[root@westos-mail ~] # ll / etc/postfix/mailuser.cf
-rw-r--r--. 1 root root 134 May 21 04:06 / etc/postfix/mailuser.cf
[root@westos-mail ~] # ll / etc/postfix/mailbox.cf
-rw-r--r--. 1 root root 133 May 21 04:21 / etc/postfix/mailbox.cf
[root@westos-mail ~] # ll / etc/postfix/maildomain.cf
-rw-r--r--. 1 root root 130 May 21 04:19 / etc/postfix/maildomain.cf
[root@westos-mail ~] # cd / home/vmail/
[root@westos-mail vmail] # ls
[root@westos-mail vmail] # mail lee@lee.com
Subject: hello
Hello hello
.
EOT
[root@westos-mail vmail] # mailq
Mail queue is empty
[root@westos-mail vmail] # ls
Lee.com mail
[root@westos-mail vmail] # cd lee.com/
[root@westos-mail lee.com] # ls
Lee
[root@westos-mail lee.com] # cd lee/
[root@westos-mail lee] # ls
Cur new tmp
[root@westos-mail lee] # cd new/
[root@westos-mail new] # cat new/
Cat: new/: No such file or directory
[root@westos-mail new] # cd ne
-bash: cd: ne: No such file or directory
[root@westos-mail new] # cd new/
-bash: cd: new/: No such file or directory
[root@westos-mail new] #
[root@westos-mail new] # ls
1495357341.Vfd01I30059aaM65037.westos-mail.westos.com
[root@westos-mail new] # cat 1495357341.Vfd01I30059aaM65037.westos-mail.westos.com
Return-Path:
X-Original-To: lee@lee.com
Delivered-To: lee@lee.com
Received: by westos-mail.westos.com (Postfix, from userid 0)
Id DF62F273AC2; Sun, 21 May 2017 05:02:20-0400 (EDT)
Date: Sun, 21 May 2017 05:02:20-0400
To: lee@lee.com
Subject: hello
User-Agent: Heirloom mailx 12.5 7-5-10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id:
From: root@westos.com (root)
Hello hello
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.