2017年04月
2017年04月16日
spamhaus にはいくつかのDSNBLがあるようです。
SBL、XBL、PBL、ZENなどがそれです。
postfix などのフィルターで利用するときには、ZENを利用するのが一番いいようです。
ZENには SBL、SBLCSS、XBL、PBL のリストが含まれているようです。
・SBL
迷惑メールを送信してくるサーバー
Unsolicited Bulk Email (UBE)
・SBLCSS
スノーシュースパム送信元
1つのメールをたくさんのIPから送信しているということのようです。
・XBL
トロイやオープンプロキシーなど、第三者によって悪用されているIP
・PBL
動的IPのリスト
PBLのフィルターを見ると、動的IPからのメールを排除してしまう可能性があるようですね。
厳密にフィルターする場合には、リターンコードが 127.0.0.2 〜 127.0.0.11 で区別できるようなので、フィルターの設定をそのようにする必要があります。
また、無料で利用するには、以下の条件がありました。
・非商用
・SMTP接続は100,000未満
・DNSBLのクエリが300,000未満
上記を超える場合には、 Professional があるようです。
■利用方法について
smtpd_recipient_restrictions =
(途中略)
reject_rbl_client zen.spamhaus.org=127.0.0.[2..11]
上記の通り設定することで利用可能です。返ってくるIPが127.0.0.X で複数あるので、イコールで指定しています。
postfix で RBL を利用する場合
Enable DNSBL service in Postfix to reduce spam
SBL、XBL、PBL、ZENなどがそれです。
postfix などのフィルターで利用するときには、ZENを利用するのが一番いいようです。
ZENには SBL、SBLCSS、XBL、PBL のリストが含まれているようです。
・SBL
迷惑メールを送信してくるサーバー
Unsolicited Bulk Email (UBE)
・SBLCSS
スノーシュースパム送信元
1つのメールをたくさんのIPから送信しているということのようです。
・XBL
トロイやオープンプロキシーなど、第三者によって悪用されているIP
・PBL
動的IPのリスト
PBLのフィルターを見ると、動的IPからのメールを排除してしまう可能性があるようですね。
厳密にフィルターする場合には、リターンコードが 127.0.0.2 〜 127.0.0.11 で区別できるようなので、フィルターの設定をそのようにする必要があります。
また、無料で利用するには、以下の条件がありました。
・非商用
・SMTP接続は100,000未満
・DNSBLのクエリが300,000未満
上記を超える場合には、 Professional があるようです。
■利用方法について
smtpd_recipient_restrictions =
(途中略)
reject_rbl_client zen.spamhaus.org=127.0.0.[2..11]
上記の通り設定することで利用可能です。返ってくるIPが127.0.0.X で複数あるので、イコールで指定しています。
postfix で RBL を利用する場合
Enable DNSBL service in Postfix to reduce spam
2017年04月15日
postgrey の最近のバージョンは、RPMがありませんね。困りましたね。
ということで、以下の通りインストールしました。
参考
SPAM撃退モジュール postgrey を Postfix で使用する!
1. ダウンロード
SPAMメール対策ツールPostgrey(Postfix Greylisting Policy Server)
Download it here と書かれているところです。
# wget http://postgrey.schweikert.ch/pub/postgrey-1.37.tar.gz
# tar -zxvf postgrey-1.37.tar.gz
2. 必要なパッケージのインストール
yum install perl-NetAddr-IP
yum install perl-Net-Server
yum install perl-Net-BerkeleyDB
yum install perl-BerkeleyDB
3. ユーザー / グループの作成
groupadd postgrey
useradd -g postgrey -s /bin/false postgrey
4. 必要なファイルのコピー
cp postgrey_whitelist_clients postgrey_whitelist_recipients
cp postgrey /usr/sbin
5. ディレクトリ権限の変更
mkdir /var/spool/postfix/postgrey
chown postgrey:postgrey /var/spool/postfix/postgrey
6. init スクリプトの作成
・・・※古いの Cent OS に RPM でインストールしたことがあり、そのときのスクリプトを流用です。
動作するときのグループがどこかのバージョンから変わったようで、動作するグループを指定しないとエラーになってしまいました。ということで、以下のスクリプトでは、OPTIONでグループの指定をしています。
# vi /etc/init.d/postgrey
-----------------
#!/bin/sh
#
# chkconfig: - 79 31
# description: Postfix Greylisting Policy Server
#
# processname: postgrey
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
prog=postgrey
postgrey=/usr/sbin/$prog
DBPATH=/var/spool/postfix/postgrey
SOCKET=$DBPATH/socket
GROUP=postgrey
OPTIONS="--unix=$SOCKET --delay=60 --group=$GROUP --whitelist-clients=/etc/postfix/postgrey_whitelist_clients"
# Source an auxiliary options file if we have one, and pick up OPTIONS,
if [ -r /etc/sysconfig/$prog ]; then
. /etc/sysconfig/$prog
fi
[ -x $postgrey -a -d $DBPATH ] || exit 0
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $postgrey -d $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping $prog: "
killproc $postgrey
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading $prog: "
killproc $postgrey -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart
;;
status)
status $postgrey
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
exit 1
esac
exit $RETVAL
-----------------
7. 起動確認
# /etc/init.d/postgrey start
# /etc/init.d/postgrey status
# ps -ef |grep postgrey
postgrey 22265 1 0 18:09 ? 00:00:00 postgrey -d --unix=/var/spool/postfix/postgrey/socket --delay=60 --group=postgrey --whitelist-clients=/etc/postfix/postgrey_whitelist_clients
# cat /var/log/maillog
: Process Backgrounded
: 2017/06/03-18:09:38 postgrey (type Net::Server::Multiplex) starting! pid(22265)
: Binding to UNIX socket file "/var/spool/postfix/postgrey/socket"
: Setting gid to "501 501"
: Setting uid to "501"
あとは postfix と連携して進めます。
ということで、以下の通りインストールしました。
参考
SPAM撃退モジュール postgrey を Postfix で使用する!
1. ダウンロード
SPAMメール対策ツールPostgrey(Postfix Greylisting Policy Server)
Download it here と書かれているところです。
# wget http://postgrey.schweikert.ch/pub/postgrey-1.37.tar.gz
# tar -zxvf postgrey-1.37.tar.gz
2. 必要なパッケージのインストール
yum install perl-NetAddr-IP
yum install perl-Net-Server
yum install perl-Net-BerkeleyDB
yum install perl-BerkeleyDB
3. ユーザー / グループの作成
groupadd postgrey
useradd -g postgrey -s /bin/false postgrey
4. 必要なファイルのコピー
cp postgrey_whitelist_clients postgrey_whitelist_recipients
cp postgrey /usr/sbin
5. ディレクトリ権限の変更
mkdir /var/spool/postfix/postgrey
chown postgrey:postgrey /var/spool/postfix/postgrey
6. init スクリプトの作成
・・・※古いの Cent OS に RPM でインストールしたことがあり、そのときのスクリプトを流用です。
動作するときのグループがどこかのバージョンから変わったようで、動作するグループを指定しないとエラーになってしまいました。ということで、以下のスクリプトでは、OPTIONでグループの指定をしています。
# vi /etc/init.d/postgrey
-----------------
#!/bin/sh
#
# chkconfig: - 79 31
# description: Postfix Greylisting Policy Server
#
# processname: postgrey
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
prog=postgrey
postgrey=/usr/sbin/$prog
DBPATH=/var/spool/postfix/postgrey
SOCKET=$DBPATH/socket
GROUP=postgrey
OPTIONS="--unix=$SOCKET --delay=60 --group=$GROUP --whitelist-clients=/etc/postfix/postgrey_whitelist_clients"
# Source an auxiliary options file if we have one, and pick up OPTIONS,
if [ -r /etc/sysconfig/$prog ]; then
. /etc/sysconfig/$prog
fi
[ -x $postgrey -a -d $DBPATH ] || exit 0
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $postgrey -d $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}
stop() {
echo -n $"Stopping $prog: "
killproc $postgrey
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading $prog: "
killproc $postgrey -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart
;;
status)
status $postgrey
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
exit 1
esac
exit $RETVAL
-----------------
7. 起動確認
# /etc/init.d/postgrey start
# /etc/init.d/postgrey status
# ps -ef |grep postgrey
postgrey 22265 1 0 18:09 ? 00:00:00 postgrey -d --unix=/var/spool/postfix/postgrey/socket --delay=60 --group=postgrey --whitelist-clients=/etc/postfix/postgrey_whitelist_clients
# cat /var/log/maillog
: Process Backgrounded
: 2017/06/03-18:09:38 postgrey (type Net::Server::Multiplex) starting! pid(22265)
: Binding to UNIX socket file "/var/spool/postfix/postgrey/socket"
: Setting gid to "501 501"
: Setting uid to "501"
あとは postfix と連携して進めます。
2017年04月14日
dovecot と mysql を組み合わせて利用しています。このとき、クライアント端末から、POP3 で受信するとき、dovecot が mysql に接続できず、エラーがでてしまいました。
エラーは以下の通り。
dovecot: auth: Warning: Configuration file /etc/dovecot/dovecot-sql.conf.ext line 2: Ambiguous '#' character in line, treating it as comment. Add a space before it to remove this warning.
これは、mysql に接続するときのパスワードに # が含まれていることによるものです。
# cat /etc/dovecot/dovecot-sql.conf.ext
connect = host=127.0.0.1 dbname=postfix user=postfix_user password=#Password#
この場合には、右側の引数をすべてシングルクオートで囲います。
connect = 'host=127.0.0.1 dbname=postfix user=postfix_user password=#Password#'
これでエラーが出なくなりました。
エラーは以下の通り。
dovecot: auth: Warning: Configuration file /etc/dovecot/dovecot-sql.conf.ext line 2: Ambiguous '#' character in line, treating it as comment. Add a space before it to remove this warning.
これは、mysql に接続するときのパスワードに # が含まれていることによるものです。
# cat /etc/dovecot/dovecot-sql.conf.ext
connect = host=127.0.0.1 dbname=postfix user=postfix_user password=#Password#
この場合には、右側の引数をすべてシングルクオートで囲います。
connect = 'host=127.0.0.1 dbname=postfix user=postfix_user password=#Password#'
これでエラーが出なくなりました。
2017年04月13日
dovecot と mysql を組み合わせて利用しています。このとき、クライアント端末から、POP3 で受信するとき、dovecot が mysql に接続できず、エラーがでてしまいました。
エラーは以下の通り。
dovecot: auth: Error: mysql: Connect failed to 127.0.0.1 (postfix): Access denied for user 'postfix_user'@'localhost' (using password: YES)
これは、mysql にDBにログインできるユーザーを登録するとき、ログインできるホスト設定を % にしていたからのようです。
ということで、mysqladmin で直接接続して修正するか、以下のSQLを発行しました。
UPDATE `user` SET `Host` = 'localhost' WHERE `user`.`Host` = '%' AND `user`.`User` = 'postfix_user'
これでログインできるようになりました。
エラーは以下の通り。
dovecot: auth: Error: mysql: Connect failed to 127.0.0.1 (postfix): Access denied for user 'postfix_user'@'localhost' (using password: YES)
これは、mysql にDBにログインできるユーザーを登録するとき、ログインできるホスト設定を % にしていたからのようです。
ということで、mysqladmin で直接接続して修正するか、以下のSQLを発行しました。
UPDATE `user` SET `Host` = 'localhost' WHERE `user`.`Host` = '%' AND `user`.`User` = 'postfix_user'
これでログインできるようになりました。
2017年04月12日
2017年04月11日
以前はこんな感じで作業していました。
2016年01月10日:HP ProLiant で ESXi 5.1 から 5.5 にアップグレードする。
今回は 6.5 が出ていたので、それにアップグレードしたいと思います。
■前提
アップデートは zip ファイルを利用して行います。
SSH ログインはキーボードインタラクティブになります。
1. まずは HP のサイトから ProLiant用にカスタマイズされた vmware をダウンロードします。
現在のURLは http://www.hpe.com/info/esxidownload
vmware のサイトに飛び、ダウンロード項目が表示されます。
2. HPE Custom Image for VMware ESXi 6.5 Offline Bundle をダウンロード
ISOもありますが、今回は zip ファイルを利用してアップデートします。
3. zip ファイルを (Windows環境で) 解凍します。
前回のとおりです。
4. vmware のローカルにコピーします。
※ VMware vSphere Client を利用して、データストアにファイルをアップロードしました。
以下からは以前と概ね同様です。
5. ESXi バージョンの確認
# esxcli system version get
6. Profile の確認
# esxcli software profile get
7. アップデートファイルの確認
esxcli software profile update -d /vmfs/volumes/datastore1/vmupd/ -p HPE-ESXi-6.5.0-OS-Release-650.9.6.0.28
ここでエラーになりました。
[DependencyError]
VIB Emulex_bootbank_scsi-lpfc820_10.5.55.0-1OEM.500.0.0.472560 requires com.vmware.driverAPI-9.2.0.0, but the requirement cannot be satisfied within the ImageProfile.
VIB Emulex_bootbank_scsi-lpfc820_10.5.55.0-1OEM.500.0.0.472560 requires vmkapi_2_0_0_0, but the requirement cannot be satisfied within the ImageProfile.
VIB QLogic_bootbank_scsi-qla2xxx_934.5.45.0-1OEM.500.0.0.472560 requires vmkapi_2_0_0_0, but the requirement cannot be satisfied within the ImageProfile.
VIB QLogic_bootbank_scsi-qla2xxx_934.5.45.0-1OEM.500.0.0.472560 requires com.vmware.driverAPI-9.2.0.0, but the requirement cannot be satisfied within the ImageProfile.
Please refer to the log file for more details.
QLogic_bootbank_scsi でも同じようなメッセージが。
正直よくわかりません。とりあえず利用していないと思われるため、以下のコマンドで削除しました。
参考
VMware vSphere 6.5 – Conflicting VIBs when upgrading ESXi 6.0 to 6.5
esxcli software vib list | grep QLogic
以下の行がありました。
scsi-qla2xxx
これを削除。
esxcli software vib remove -n scsi-qla2xxx
Emulex も同様に行いました。
8. アップデートの実行
esxcli software profile update -d /vmfs/volumes/datastore1/vmupd/ -p HPE-ESXi-6.5.0-OS-Release-650.9.6.0.28
9. reboot
再起動が必要だというステータスがでているので reboot を行います。
Reboot Required: true
再起動には少し時間がかかります。
10. 確認
# esxcli system version get
Product: VMware ESXi
Version: 6.5.0
Build: Releasebuild-4564106
Update: 0
Patch: 0
なおこれからは webui を利用するようになるようですね。ブラウザからのアクセスは便利です。
2016年01月10日:HP ProLiant で ESXi 5.1 から 5.5 にアップグレードする。
今回は 6.5 が出ていたので、それにアップグレードしたいと思います。
■前提
アップデートは zip ファイルを利用して行います。
SSH ログインはキーボードインタラクティブになります。
1. まずは HP のサイトから ProLiant用にカスタマイズされた vmware をダウンロードします。
現在のURLは http://www.hpe.com/info/esxidownload
vmware のサイトに飛び、ダウンロード項目が表示されます。
2. HPE Custom Image for VMware ESXi 6.5 Offline Bundle をダウンロード
ISOもありますが、今回は zip ファイルを利用してアップデートします。
3. zip ファイルを (Windows環境で) 解凍します。
前回のとおりです。
4. vmware のローカルにコピーします。
※ VMware vSphere Client を利用して、データストアにファイルをアップロードしました。
以下からは以前と概ね同様です。
5. ESXi バージョンの確認
# esxcli system version get
6. Profile の確認
# esxcli software profile get
7. アップデートファイルの確認
esxcli software profile update -d /vmfs/volumes/datastore1/vmupd/ -p HPE-ESXi-6.5.0-OS-Release-650.9.6.0.28
ここでエラーになりました。
[DependencyError]
VIB Emulex_bootbank_scsi-lpfc820_10.5.55.0-1OEM.500.0.0.472560 requires com.vmware.driverAPI-9.2.0.0, but the requirement cannot be satisfied within the ImageProfile.
VIB Emulex_bootbank_scsi-lpfc820_10.5.55.0-1OEM.500.0.0.472560 requires vmkapi_2_0_0_0, but the requirement cannot be satisfied within the ImageProfile.
VIB QLogic_bootbank_scsi-qla2xxx_934.5.45.0-1OEM.500.0.0.472560 requires vmkapi_2_0_0_0, but the requirement cannot be satisfied within the ImageProfile.
VIB QLogic_bootbank_scsi-qla2xxx_934.5.45.0-1OEM.500.0.0.472560 requires com.vmware.driverAPI-9.2.0.0, but the requirement cannot be satisfied within the ImageProfile.
Please refer to the log file for more details.
QLogic_bootbank_scsi でも同じようなメッセージが。
正直よくわかりません。とりあえず利用していないと思われるため、以下のコマンドで削除しました。
参考
VMware vSphere 6.5 – Conflicting VIBs when upgrading ESXi 6.0 to 6.5
esxcli software vib list | grep QLogic
以下の行がありました。
scsi-qla2xxx
これを削除。
esxcli software vib remove -n scsi-qla2xxx
Emulex も同様に行いました。
8. アップデートの実行
esxcli software profile update -d /vmfs/volumes/datastore1/vmupd/ -p HPE-ESXi-6.5.0-OS-Release-650.9.6.0.28
9. reboot
再起動が必要だというステータスがでているので reboot を行います。
Reboot Required: true
再起動には少し時間がかかります。
10. 確認
# esxcli system version get
Product: VMware ESXi
Version: 6.5.0
Build: Releasebuild-4564106
Update: 0
Patch: 0
なおこれからは webui を利用するようになるようですね。ブラウザからのアクセスは便利です。