LoginSignup
0
0

More than 5 years have passed since last update.

[obsolete] FreeBSD 4.x 系で sendmail + drac + qpopper の連携で、 POP bofore SMTP を導入する

Last updated at Posted at 2017-05-19

sendmail は OS 付属の版を利用し、 darc と qpopper は ports を利用する

drac のインスコ

# cd /usr/ports/mail/drac && make install

qpopper のインスコ

# cd /usr/ports/mail/qpopper && make WITH_DRAC=yes install

/etc/rc.conf の編集

/etc/rc.conf
portmap_enable="YES"

/etc/rc.conf.local の編集

/etc/rc.conf.local
dracd_enable="YES"

/etc/inetd.conf の編集

/etc/inetd.conf
pop3 stream tcp nowait root /usr/local/libexec/qpopper qpopper -s

/etc/mail/`hostname`.mc の作成

# cd /etc/mail && make

/etc/mail/`hostname`.mc の編集

--- /usr/src/etc/sendmail/freebsd.mc    Wed Dec 31 17:42:16 2003
+++ /etc/mail/releng4x.example.jp.mc
@@ -90,3 +90,11 @@ define(`confNO_RCPT_ACTION', `add-to-und
 define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy')
 MAILER(local)
 MAILER(smtp)
+LOCAL_CONFIG
+Kdrac btree /usr/local/etc/dracd
+LOCAL_RULESETS
+SLocal_check_rcpt
+R$*    $: $&{client_addr}
+R$+    $: $(drac $1 $: ? $)
+R? $@ ?
+R$+    $@ $#OK

注:R\$ 及び R? R\$+ の空白は \t (tab) となるように注意する

/etc/mail/`hostname`.mc から `hostname`.cf の作成とインスコ

# cd /etc/mail && make && make install

ここで一旦 OS の再起動するか、個別 daemon の再起動又は起動させる。

再起動の方法

# kill -HUP `cat /var/run/inetd.pid`
# /usr/local/etc/rc.d/dracd.sh restart
# killall -HUP sendmail
# kill -HUP `ps ax | grep portmap | awk '{print $1}'`

起動方法

# /usr/sbin/inetd -wW -C 60
# /usr/local/etc/rc.d/dracd.sh start
# sh /etc/rc.sendmail
# /usr/sbin/portmap

此処までで、各 daemon の下準備は完了、続いて試験

qpopper の動作確認

# telnet 0 pop3
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
+OK Qpopper (version 4.0.5) at releng4x.example.jp starting.  <0.0@releng4x.example.jp>
user je3kmz
+OK Password required for je3kmz.
pass example.jp
+OK takefu has 0 visible messages (0 hidden) in 0 octets.
list
+OK 0 visible messages (0 octets)
.
quit
+OK Pop server at releng4x.example.jp signing off.
Connection closed by foreign host.

ここで、drac の肝心要となる pop3 で認証成功した IPv4 アドレスと、その時刻の UNIXTIME がデータベースに格納される。

データベースファイルの確認

# ls -l /usr/local/etc/dracd.db
-rw-r--r--  1 root  wheel  1024  1  1  1970 /usr/local/etc/dracd.db

他のユーザーからファイルを操作させないようにパーミッションを設定

# chmod go-r /usr/local/etc/dracd.db

drac データーベースの確認

# makemap -u btree /usr/local/etc/dracd
127.0.0.1       0

ここで、qpopper のテストで他のマシンから telnet 試験した場合は、localhost の IPv4 アドレスでは無くなり、アクセス元の IPv4 アドレスが追加される

sendmail の drac 連携試験

# sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /map drac 127.0.0.1
map_lookup: drac (127.0.0.1) returns 0 (0)

未認証だと以下のように表示される

map_lookup: drac (127.0.0.1) no match (0)

dracd.allow は必要に応じて編集

/usr/local/etc/dracd.allow
255.255.255.255 127.0.0.1

ネットマスク IPv4 アドレス
の順に書く

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0