LLLL# postmap /etc/postfix/main.cf && postfix reloaddnf -y install postfixdnf -y install postfix-perl-scripts # dnf -y install postfix*
Postfix version 3.5.25
postconf -Apostfix checkpostconf -vpostconf -hpostconf -nRun the following command and you will see pcre is now supported.postconf -msystemctl enable postfixsystemctl restart postfix# cd /etc/postfix
touch body_checkstouch recipient_bcctouch sender_bcctouch block_attachmentstouch allowed-userstouch restricted-mail-groups touch local_domainstouch restricted_senderscp /etc/aliases /etc/postfix/aliasescp main.cf main.cf.ORGcp master.cf master.cf.ORGcp aliases aliases.ORGcp access access.ORG---------------newaliasespostmap master.cfpostmap access postmap aliases postmap transport postmap virtual postmap header_checkspostmap body_checks postmap recipient_bcc postmap sender_bcc postmap block_attachmentspostmap allowed-users postmap restricted-mail-groups postmap local_domains postmap restricted_senders# openssl passwd -crypt AAABBAAKa1234[root@mail ~]# useradd -m u1 -s /sbin/nologinuseradd -m -p VCX97jg6iZebc -s /sbin/nologin u1useradd -m -p 4w5yRzfvfQFAI -s /bin/false u1 useradd -m -p VCX9557jg6iZebc -s /sbin/nologin accessteluseradd -m -p 4w5yR55zfvfQFAI -s /sbin/nologin u1useradd -m -p 4w5yRz55fvfQFAI -s /sbin/nologin u2useradd -m -p 4w5y55RzfvfQFAI -s /sbin/nologin virusalertuseradd -m -p 4w5yR55zfvfQFAI -s /sbin/nologin virusmailsuseradd -m -p 4w5yRz55fvfQFAI -s /sbin/nologin spamalertuseradd -m -p 4w5y55RzfvfQFAI -s /sbin/nologin spam.policeuseradd -m -p 4w5yRzf55vfQFAI -s /sbin/nologin sys_adminuseradd -m -p 4w5y55RzfvfQFAI -s /sbin/nologin inmailuseradd -m -p 4w5yRzfvf55QFAI -s /sbin/nologin outmailuseradd -m -p 4w5yRzfvfQ55FAI -s /sbin/nologin junkmailuseradd -m -p VCX9557jg6iZebc -s /bin/false accessteluseradd -m -p 4w5yR55zfvfQFAI -s /bin/false u1useradd -m -p 4w5yRz55fvfQFAI -s /bin/false u2useradd -m -p 4w5y55RzfvfQFAI -s /bin/false virusalertuseradd -m -p 4w5yR55zfvfQFAI -s /bin/false virusmailsuseradd -m -p 4w5yRz55fvfQFAI -s /bin/false spamalertuseradd -m -p 4w5y55RzfvfQFAI -s /bin/false spam.policeuseradd -m -p 4w5yRzf55vfQFAI -s /bin/false sys_adminuseradd -m -p 4w5y55RzfvfQFAI -s /bin/false inmailuseradd -m -p 4w5yRzfvf55QFAI -s /bin/false outmailuseradd -m -p 4w5yRzfvfQ55FAI -s /bin/false junkmail##### remove main.cf text Line -----# cd /etc/postfix# echo > main.cf OR> main.cf------Postfix version 3.5.25 --------main.cf--------------------------------------compatibility_level = 2queue_directory = /var/spool/postfixcommand_directory = /usr/sbindaemon_directory = /usr/libexec/postfixdata_directory = /var/lib/postfixmail_owner = postfixinet_protocols = ipv4unknown_local_recipient_reject_code = 550debug_peer_level = 2debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5sendmail_path = /usr/sbin/sendmail.postfixnewaliases_path = /usr/bin/newaliases.postfixmailq_path = /usr/bin/mailq.postfixsetgid_group = postdrophtml_directory = nomanpage_directory = /usr/share/mansample_directory = /usr/share/doc/postfix/samplesreadme_directory = /usr/share/doc/postfix/README_FILESsmtpd_tls_security_level = maysmtp_tls_CApath = /etc/pki/tls/certssmtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crtsmtp_tls_security_level = maymeta_directory = /etc/postfixshlib_directory = /usr/lib64/postfixalias_maps = hash:/etc/postfix/aliasestransport_maps = hash:/etc/postfix/transportvirtual_maps = hash:/etc/postfix/virtualvirtual_alias_maps = hash:/etc/postfix/virtualvirtual_alias_domains = hash:/etc/postfix/virtualheader_checks = regexp:/etc/postfix/header_checksmime_header_checks = regexp:/etc/postfix/block_attachmentsbody_checks = regexp:/etc/postfix/body_checkssender_bcc_maps = hash:/etc/postfix/sender_bccrecipient_bcc_maps = hash:/etc/postfix/recipient_bccmyhostname = mail.worldcm.netmydomain = worldcm.netmyorigin = $mydomainmydestination = $myhostname, localhost.$mydomain, localhost, $mydomainmynetworks = 127.0.0.0/8, [::ffff:127.0.0.0]/104, [::1]/128inet_interfaces = allhome_mailbox = Maildir/message_size_limit = 50000000mailbox_size_limit = 7224000000masquerade_domains = worldcm.netsmtpd_banner = $myhostname ESMTP#always_bcc = bkupmailbounce_queue_lifetime = 1dsmtpd_helo_required = yesdisable_vrfy_command = yesallow_mail_to_files = alias,forward,includelocal_recipient_maps = unix:passwd.byname $alias_maps#content_filter = smtp-amavis:127.0.0.1:10024#receive_override_options = no_address_mappings enable_original_recipient = no ##SASLsmtpd_sasl_auth_enable = yessmtpd_sasl_type = dovecotsmtpd_sasl_path = private/authsmtpd_sasl_security_options = noanonymousbroken_sasl_auth_clients = yessmtpd_sasl_authenticated_header = yessmtpd_sasl_local_domain = $myhostname##SSLsmtpd_use_tls = yessmtpd_tls_cert_file = /etc/pki/tls/certs/server.crtsmtpd_tls_key_file = /etc/pki/tls/certs/server.keysmtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache####-SSL#smtpd_tls_security_level = may#smtpd_tls_auth_only = yes#smtpd_tls_key_file = /etc/postfix/ssl/postfix.key#smtpd_tls_cert_file = /etc/postfix/ssl/postfix.crt#smtpd_tls_loglevel = 0#smtpd_tls_received_header = yes#smtpd_tls_session_cache_timeout = 3600s#tls_random_source = dev:/dev/urandom###-----Group Email restricted###----SENDING OUT RESTRICTIONS#smtpd_restriction_classes = insiders_only, local_only#insiders_only = check_sender_access hash:/etc/postfix/allowed-users, reject#local_only = check_recipient_access hash:/etc/postfix/local_domains, reject###SMTPD CLIENT RESTRICTIONSsmtpd_client_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/access, reject_unauth_pipelining, permit_inet_interfaces###SMTPD ETRN RESTRICTIONSsmtpd_etrn_restrictions = permit_mynetworks, permit_sasl_authenticated, reject######Faruqsmtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_invalid_hostname, permit### SMTPD SENDER RESTRICTIONSsmtpd_sender_restrictions = check_sender_access hash:/etc/postfix/restricted_senders, permit_mynetworks, permit_sasl_authenticated, check_sender_access hash:/etc/postfix/access, reject_unauthenticated_sender_login_mismatch, reject_sender_login_mismatch, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unlisted_sender, reject_unauth_pipelining, reject_non_fqdn_hostname, reject_unauth_destination##### SMTPD RECIPIENT RESTRICTIONS smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/restricted-mail-groups, check_sender_access hash:/etc/postfix/restricted_senders, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_invalid_hostname, check_recipient_access hash:/etc/postfix/access, check_client_access hash:/etc/postfix/access, check_sender_access hash:/etc/postfix/access, reject_unauth_pipelining, reject_non_fqdn_sender, reject_unknown_recipient_domain, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unlisted_recipient, reject_multi_recipient_bounce, reject_rbl_client list.dsbl.org, reject_rbl_client bl.spamcop.net, reject_rhsbl_client rhsbl.sorbs.net, reject_rbl_client dnsbl.sorbs.net, # reject_rbl_client sbl-xbl.spamhaus.org, reject_rbl_client dsn.rfc-ignorant.org, reject_rbl_client b.barracudacentral.org, reject_rhsbl_sender dbl.spamhaus.org=127.0.1.[2..99], reject_rhsbl_helo dbl.spamhaus.org=127.0.1.[2..99], reject_rhsbl_reverse_client dbl.spamhaus.org=127.0.1.[2..99]#relayhost = uucphost#relayhost = [an.ip.add.ress]smtpd_verbose = yesdebug_peer_list = 127.0.0.1-------------------------master.cf----------------------------------# ==========================================================================smtp inet n - n - - smtpd -o content_filter=spamassassin#smtp inet n - n - 1 postscreen#smtpd pass - - n - - smtpd#dnsblog unix - - n - 0 dnsblog#tlsproxy unix - - n - 0 tlsproxysubmission inet n - n - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_tls_auth_only=yes -o smtpd_reject_unlisted_recipient=no -o smtpd_client_restrictions=$mua_client_restrictions# -o smtpd_helo_restrictions=$mua_helo_restrictions# -o smtpd_sender_restrictions=$mua_sender_restrictions# -o smtpd_recipient_restrictions= -o smtpd_relay_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATINGsmtps inet n - n - - smtpd -o syslog_name=postfix/smtps -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes -o smtpd_reject_unlisted_recipient=no -o smtpd_client_restrictions=$mua_client_restrictions# -o smtpd_helo_restrictions=$mua_helo_restrictions# -o smtpd_sender_restrictions=$mua_sender_restrictions# -o smtpd_recipient_restrictions= -o smtpd_relay_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING#628 inet n - n - - qmqpd###-------Spam---------------------###spamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}-------------------------------Header_check----------------------------------------------------------# HEADER_CHECKS(5)/^Subject:/ WARN/^User-Agent:/ IGNORE/^From:.*<#.*@.*>/ REJECT/^Return-Path:.*<#.*@.*>/ REJECT/^Received: from 127.0.0.1/ IGNOR/account has been renewed/ DISCARD/Your account has been hacked/ REDIRECT junkmail@worldcm.net-------------------------------------------------------------------------------postmap master.cfpostmap access postmap aliases postmap transport postmap virtual postmap header_checkspostmap body_checks postmap recipient_bcc postmap sender_bcc postmap block_attachmentspostmap allowed-users postmap restricted-mail-groups postmap local_domains postmap restricted_senders# install mail client program
[root@mail ~]# dnf -y install s-nail
# set environment variables to use Maildir
[root@mail ~]# echo 'export MAIL=$HOME/Maildir' >> /etc/profile.d/mail.sh
# send to myself [mail (username)@(hostname)][alma@mail ~]$ mail accesstel@localhost# input subjectSubject: Test Mail#1# input messagesThis is the first mail.# to finish messages, push Ctrl + D key-------(Preliminary) Envelope contains:To: alma@localhostSubject: Test Mail#1Send this message [yes/no, empty: recompose]? yes# see received emails[alma@mail ~]$ mail---------------LLLL