Download - NA Homework 4+5
![Page 1: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/1.jpg)
NA Homework 4+5Postfix + DNS
![Page 2: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/2.jpg)
2
Demo
> Setup everything before Demo, or you’ll get no point if something don’t work.
> Show your mail functions to TA, you could use ‘Remote Desktop’.
> Be prepared, TA will ask some questions.
![Page 3: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/3.jpg)
3
Installation Steps
> postfix> cyrus-sasl2-saslauthd> imap-uw> amavisd-new> postgrey> Clamav> spamassassin
![Page 4: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/4.jpg)
4
Postfix
# cd /usr/ports/mail/postfix# make install clean
![Page 5: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/5.jpg)
5
Postfix
===> Installing for postfix-2.4.1,1===> postfix-2.4.1,1 depends on file: /usr/local/lib/libcrypto.so.5 - found===> postfix-2.4.1,1 depends on shared library: pcre.0 – found===> postfix-2.4.1,1 depends on shared library: sasl2.2 - foundAdded group "postfix".Added group "maildrop".Added user "postfix".You need user "postfix" added to group "mail".Would you like me to add it [y]? y
install -d -o root -g wheel -m 555 /usr/local/share/doc/postfixInstalled HTML documentation in /usr/local/share/doc/postfixWould you like to activate Postfix in /etc/mail/mailer.conf [n]? y
![Page 6: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/6.jpg)
6
Postfix
> edit /etc/rc.conf
sendmail_enable="NONE“
postfix_enable="YES"
daily_clean_hoststat_enable="NO"daily_status_mail_rejects_enable="NO"daily_status_include_submit_mailq="NO"daily_submit_queuerun="NO"
> edit /etc/defaults/periodic.conf
> edit /usr/local/etc/postfix/main.cf – edit it by yourself– ex: myhostname, mynetworks, alias_maps…
![Page 7: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/7.jpg)
7
Postfix with TLS
> make your certificates> edit /usr/local/etc/postfix/main.cf
![Page 8: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/8.jpg)
8
Cyrus-sasl2-saslauthd
![Page 9: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/9.jpg)
9
Cyrus-sasl2-saslauthd
# cd /usr/ports/security/cyrus-sasl2-saslauthd# make install clean
> edit /etc/rc.conf
saslauthd_enable="YES"
![Page 10: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/10.jpg)
10
imap-uw
# cd /usr/ports/mail/imap-uw# make install clean
> edit /etc/inetd.conf
pop3 stream tcp nowait root /usr/local/libexec/ipop3d ipop3dimap4 stream tcp nowait root /usr/local/libexec/imapd imapd
> If using TLS
pop3s stream tcp nowait root /usr/local/libexec/ipop3d ipop3dimaps stream tcp nowait root /usr/local/libexec/imapd imapd
![Page 11: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/11.jpg)
11
Hold on and Test
> It’s better to test you can receive and send mail before next step.
> If it’s not work, check /var/log/maillog.
# /usr/local/etc/rc.d/saslauthd start
# /usr/local/etc/rc.d/postfix start
# /etc/rc.d/inetd reload
![Page 12: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/12.jpg)
12
Amavisd-new
# cd /usr/ports/security/amavisd-new# make install clean
![Page 13: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/13.jpg)
13
Amavisd-new
Added group "vscan".Added user "vscan".
Created "/var/amavis" directory.Created "/var/amavis/db" directory.Created "/var/amavis/tmp" directory.Created "/var/virusmails" directory.
To use amavisd-new, you need to install at least one virus scanner. The following virus scanners are available in the FreeBSD ports collection:
/usr/ports/security/vscan McAfee VirusScan /usr/ports/security/clamav Clam Antivirus /usr/ports/security/f-prot F-Prot Antivirus /usr/ports/security/drweb DrWeb antivirus suite
![Page 14: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/14.jpg)
14
Amavisd-new
Enable amavisd-new in /etc/rc.conf with the following line:
amavisd_enable="YES"
If you want to use the amavis sendmail milter interface, you need the following additional line in /etc/rc.conf
amavis_milter_enable="YES"
Configuration templates are available in /usr/local/etc as amavisd.conf-dist, amavisd.conf-sample and amavisd.conf-default. Documentation is available in /usr/local/share/doc/amavisd-new.
![Page 15: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/15.jpg)
15
postgrey
# cd /usr/ports/mail/postgrey# make install clean
> edit /etc/rc.conf
postgrey_enable="YES"postgrey_pidfile="/var/run/postgrey.pid"postgrey_flags="--delay=60 --pidfile=${postgrey_pidfile} \ --inet=10023 -d --user=postgrey --group=postgrey \ --dbdir=/var/db/postgrey"
![Page 16: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/16.jpg)
16
Clamav
# cd /usr/ports/security/clamav# make install clean
![Page 17: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/17.jpg)
17
Clamav
> edit /etc/rc.conf
clamav_clamd_enable="YES"clamav_freshclam_enable="YES"
> edit where you put your aliases file
virusalert: root
> edit /usr/local/etc/clamd.conf by yourself
![Page 18: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/18.jpg)
18
Final Configuration
![Page 19: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/19.jpg)
19
Final Configuration for Postfix
> edit /usr/local/etc/postfix/main.cf
content_filter = smtp-amavis:[127.0.0.1]:10024
> edit /usr/local/etc/postfix/master.cf
smtp-amavis unix - - n - 2 lmtp -o smtp_data_done_timeout=1200s -o smtp_never_send_ehlo=yes -o notify_classes=protocol,resource,software127.0.0.1:10025 inet n - n - - smtpd -o content_filter= -o mynetworks=127.0.0.0/8 -o myhostname=localhost -o local_recipient_maps= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject
![Page 20: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/20.jpg)
20
Final Configuration for Amavisd-new
> edit /usr/local/etc/amavisd.conf
$mydomain = ‘cs.nctu.edu.tw'$notify_method = 'smtp:[127.0.0.1]:10025';$forward_method = 'smtp:[127.0.0.1]:10025';
![Page 21: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/21.jpg)
21
Now Startup everything
# /usr/local/etc/rc.d/clamav-clamd start# /usr/local/etc/rc.d/postgrey start# /usr/local/etc/rc.d/amavisd start# /usr/local/etc/rc.d/postfix restart
![Page 22: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/22.jpg)
22
Test for Virus
# telnet localhost 25Trying ::1...Trying 127.0.0.1...Connected to localhost.twbbs.org.Escape character is '^]'.220 nabsd.cs.nctu.edu.tw ESMTP Postfixmail from: <[email protected]>250 Okrcpt to: <[email protected]>250 Okdata354 End data with <CR><LF>.<CR><LF>Subject: Virus ComingX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*.250 Ok: queued as 647781152Equit221 ByeConnection closed by foreign host. da
![Page 23: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/23.jpg)
23
> Normal Mail
> Mail with virus
May 13 16:55:50 nabsd amavis[29004]: (29004-05) Blocked INFECTED (Eicar-Test-Signature), [127.0.0.1] <?@localhost> -> <[email protected]>, quarantine: virus-VivGNwT9NIja, Message-ID: <[email protected]>, mail_id: VivGNwT9NIja, Hits: -, 1071 ms
May 11 20:09:27 nabsd amavis[29003]: (29003-01) Passed CLEAN, <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: Vidtcl9St6oz, Hits: -, 1312 ms
Test for Virus
![Page 24: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/24.jpg)
24
Spamassassin
> /usr/local/etc/amavis.conf
> /usr/local/etc/mail/spamassassin/local.cf
> man Mail::SpamAssassin::Conf
![Page 25: NA Homework 4+5](https://reader035.vdocuments.mx/reader035/viewer/2022070410/568146a4550346895db3bfc5/html5/thumbnails/25.jpg)
25
Spamassassin
Content-Type: text/html;charset="big5"
Content-Transfer-Encoding: 8bitSender: =?big5?B?wnmkSKR+?= <[email protected]>Reply-To: [email protected]: amavisd-new at csie.nctu.edu.twX-Spam-Status: Yes, hits=10.687 tagged_above=3 required=6.3 tests=BAYES_60, DATE_IN_PAST_96_XX, DOMAIN_RATIO, HTML_90_100, HTML_IMAGE_ONLY_20, HTML_IMAGE_RATIO_02, HTML_MESSAGE, HTML_WEB_BUGS, MIME_HTML_ONLYX-Spam-Level: **********X-Spam-Flag: YESStatus: