メールソフトの設定自動検出用DNSレコード

久しぶりにメールサーバの設定をいろいろやった。

その際にテスト用にメールソフトを設定したが、何やら自動検出の仕組みがあるようだ
調べて見ると、RFC6186により定義されているDNSのSRVレコードにより、IMAP/POP3/SMTPのサーバ名、ポート番号情報を広報することができるらしい。

SRVレコードの定義:RFC2782 A DNS RR for specifying the location of services (DNS SRV)
SRVレコードでメールサーバ定義を配布:RFC6186 Use of SRV Records for Locating Email Submission/Access Services

設定例としてmailcowの「DNS setup」の「The advanced DNS configuration」にちょうどいい感じのがあったので引用

Example DNS server configuration
mail                IN A       1.2.3.4
autodiscover        IN A       1.2.3.4
autoconfig          IN A       1.2.3.4

@                   IN MX 10   mail

_imap._tcp          IN SRV     0 1 143 mail.example.org.
_imaps._tcp         IN SRV     0 1 993 mail.example.org.
_pop3._tcp          IN SRV     0 1 110 mail.example.org.
_pop3s._tcp         IN SRV     0 1 995 mail.example.org.
_submission._tcp    IN SRV     0 1 587 mail.example.org.
_caldavs._tcp       IN SRV     0 1 443 dav.example.org.
_carddavs._tcp      IN SRV     0 1 443 dav.example.org.
_autodiscover._tcp  IN SRV     0 1 443 autodiscover.example.org.

@                   IN TXT     "v=spf1 mx ~all"
default._domainkey  IN TXT     "v=DKIM1; k=rsa; t=s; s=email; p=..."
; _dmarc            IN TXT     "v=DMARC1; p=reject; rua=mailto:mailauth-reports@example.org"

「_サービス名.tcp IN SRV 優先度 ウェイト ポート番号 サーバ名」というのが基本書式
優先度は0が最優先。最大は65535。
優先度が同じもののなかで、どちらが使われるかをウェイトで定義。ウェイトは数が大きい方が優先される。こちらも値は0~65535の範囲。

例えば、SSL無しのアクセスを禁止する場合、下記のように禁止するサービスの名前解決を「.」が返るようにする

_imap._tcp          IN SRV     0 0 0 .
_imaps._tcp         IN SRV     0 1 993 mail.example.org.
_pop3._tcp          IN SRV     0 0 0 .
_pop3s._tcp         IN SRV     0 1 995 mail.example.org.

IMAPを優先して使わせたい場合は、以下のようになるようだ。

_imap._tcp          IN SRV     0 1 143 mail.example.org.
_imaps._tcp         IN SRV     0 1 993 mail.example.org.
_pop3._tcp          IN SRV     10 1 110 mail.example.org.
_pop3s._tcp         IN SRV     10 1 995 mail.example.org.

Outlookの場合は、DNSの_autodiscoverについてのSRVレコード登録から、Webサーバ上にあるxmlファイル内にアクセスして、サーバ設定を読み込むようになっているようだ
Outlook 2010 におけるユーザー アカウント自動構成の計画

Exchange互換のSOGoを使う場合の設定は「6.5. Name Service Configuration for Web Services」に記載がある。

このページにSPF/DKIM/DMARCの動作確認「HAD Email Test Tool」が紹介されていたので記載されているメールアドレスに「test」と書いたメールを送ってみた。

・・・30分ぐらい待ってもメールが来ない
「 A reply will be sent with the findings」とあるから、何か見付かったらメールが来るってことで、来ないってことは問題ないということでいいのかな?っと


2018/07/18追記

Thunderbird MailとOutlookの古いやつだとxmlファイルを置いて設定検出が出来る
ただし、どちらもURLとxml書式が異なる

Thunderbirdの場合
・http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=fred@example.com
・http://example.com/.well-known/autoconfig/mail/config-v1.1.xml

Outlookの場合
・https://*domain*/autodiscover/autodiscover.xml
・https://autodiscover.*domain*/autodiscover/autodiscover.xml
・HTTP GET: http://autodiscover.*domain*/autodiscover/autodiscover.xml

Thunderbird のアカウント情報自動設定機能
Outlook 2010 におけるユーザー アカウント自動構成の計画
Exchange Server 2013 の自動検出サービス 」と「White Paper: Exchange 2007 Autodiscover Service

postfix/dovecotメールサーバでWindows Live Mail 2012がエラーになる

qmail+vpopmailという古代の環境から、postfix/dovecotのiredmailメールサーバに移行した。
移行の詳細については別途記事にしますが、移行後、Windows Live Mail 2012ユーザからクレームが・・・

POP3で受信ができないという

原因は、Windows Live Mail 2012のPOP3アクセス機能が古い、という点に尽きる。
対処するにはサーバ側でセキュリティを弱める設定を入れる必要があった。

2020/09/10追記 その1については、iredmail公式にも「Allow insecure POP3/IMAP/SMTP connections without STARTTLS」という形で対処方法が記載された。

その1:POP3受信時にエラー

/var/log/dovecot/pop3.log に下記のログ

Feb 19 10:35:59 oflex-1096-1 dovecot: pop3-login: Disconnected (tried to use disallowed plaintext auth): user=<osakana@example.net>, rip=xxx.xxx.xxx.xxx, lip=xxx.xx.x.xxx, session=<brxUt4ZlTfPbavEx>

→ dovecotの「ssl = required」と「disable_plaintext_auth = yes」の設定により発生
これを「ssl = yes」と「disable_plaintext_auth = no」に変更することで対処できる

設定箇所は下記の3ファイル

/etc/dovecot/dovecot.conf ではsslとdisable_plaintext_authの双方が設定されている可能性がある
/etc/dovecot/conf.d/10-auth.conf ではdisable_plaintext_authが設定されている可能性がある
/etc/dovecot/conf.d/10-ssl.conf ではsslが設定されている可能性がある

3ファイルをそれぞれ確認して修正すること

うちの環境ではssl=requriedがdovecot.confと10-ssl.confの双方で設定されていたが、
10-ssl.confしか認識しておらずいくら設定しても反映されないと悩んだ。

その2:SMTP送信時にエラー1

/var/log/maillog に下記のログ

Feb 19 10:41:49 mailserver.osakana.net postfix/smtpd[8343]: NOQUEUE: reject: RCPT from clienthostname.osakana.net[xxx.xxx.xxx.xxx]: 504 5.5.2 <clienthostname>: Helo command rejected: need fully-qualified hostname; from=<osakana@osakana.net> to=<osakana@example.com> proto=ESMTP helo=<clienthostname>

→postfixの「smtpd_helo_restrictions」で「reject_non_fqdn_helo_hostname」が設定されているため発生

まずは、現在値確認

# postconf smtpd_helo_restrictions
smtpd_helo_restrictions = permit_mynetworks permit_sasl_authenticated check_helo_access pcre:/etc/postfix/helo_access.pcre reject_non_fqdn_helo_hostname reject_unknown_helo_hostname
#

変更前の /etc/postfix/main.cf の該当部分を確認

# HELO restriction
smtpd_helo_required = yes
smtpd_helo_restrictions =
    permit_mynetworks
    permit_sasl_authenticated
    check_helo_access pcre:/etc/postfix/helo_access.pcre
    reject_non_fqdn_helo_hostname
    reject_unknown_helo_hostname

変更後の /etc/postfix/main.cf の該当部分

# HELO restriction
smtpd_helo_required = yes
smtpd_helo_restrictions =
    permit_mynetworks
    permit_sasl_authenticated
    check_helo_access pcre:/etc/postfix/helo_access.pcre
    reject_unknown_helo_hostname
#    reject_non_fqdn_helo_hostname

postconfを実行して、変更されたことを確認

# postconf smtpd_helo_restrictions
smtpd_helo_restrictions = permit_mynetworks permit_sasl_authenticated check_helo_access pcre:/etc/postfix/helo_access.pcre reject_unknown_helo_hostname
#

その3:SMTP送信時にエラー2

/var/log/maillog に以下のログ

Feb 19 11:04:48 mailserver.osakana.net postfix/smtpd[11966]: NOQUEUE: reject: RCPT from clienthostname.osakana.net[xxx.xxx.xxx.xxx]: 450 4.7.1 <clienthostname>: Helo command rejected: Host not found; from=<osakana@osakana.net> to=<osakana@example.com> proto=ESMTP helo=<clienthostname>

→postfixの「smtpd_helo_restrictions」で「reject_unknown_helo_hostname」が設定されているため発生

変更前の値はエラー1と同じなのでここでは省略

変更後の /etc/postfix/main.cf の該当部分

# HELO restriction
smtpd_helo_required = yes
smtpd_helo_restrictions =
    permit_mynetworks
    permit_sasl_authenticated
    check_helo_access pcre:/etc/postfix/helo_access.pcre
#    reject_non_fqdn_helo_hostname
#    reject_unknown_helo_hostname

コメントアウト記述が2つに増えただけですね。

その4:SMTP送信時にエラー3

/var/log/maillog に以下のログ

Feb 19 11:07:08 mailserver.osakana.net postfix/smtpd[12710]: NOQUEUE: reject: RCPT from clienthostname.osakana.net[xxx.xxx.xxx.xxx]: 454 4.7.1 <osakana@example.com>: Relay access denied; from=<osakana@osakana.net> to=<osakana@example.com> proto=ESMTP helo=<clienthostname>

これは単純にテスト用にセットアップしたアカウントがSMTPポート25を使っていたせいで失敗していた。
ポート587に変更したら成功

fail2banで全JAILのステータスを確認したい

Linuxサーバでfail2banを使ってアクセス拒否設定を行っている。

JAILを複数している場合に、全部を一括で確認する手段が標準ではない模様。
調べたところ「kamermans/fail2ban-allstatus.sh」の下記コメントを発見

joergludwig commented on 20 Dec 2017
Shorter version:
fail2ban-client status | sed -n ‘s/,//g;s/.*Jail list://p’ | xargs -n1 fail2ban-client status

これを ~/.bashrc に対して下記のように追加し、「fail2ban-check」で確認出来るように設定した。

alias fail2ban-check="fail2ban-client status | sed -n 's/,//g;s/.*Jail list://p' | xargs -n1 fail2ban-client status"

Orange Pi One Plus用のUbuntu Serverをインストールしてみた

Orange Pi One Plus用のUbuntu Serverがいつの間にかにでていたのでダウンロードしてみた。

公式ダウンロードページ」から入手して、microSDに書き込み。
初期ユーザは「root」でパスワードは「orangepi」

X-Windowsが設定されていないので、HDMI出力はコンソール画面のまま起動し、loginプロンプトが表示されます。

で・・・
実は、ちょっと不可解なことが起きてまして
うちの環境だとUSBコネクタにキーボードをつけた状態だと電源オン状態から起動せず、途中でエラーメッセージを出力しつづけてるという状態に・・・
Androidの時は5V2.3Aだと起動しなかったので、5V3Aにしてたんですが、今回は5V 3Aでも起動が完了しないという問題が発生

loginプロンプトが表示された後にキーボードつなぐと使えるんですけどね・・・

それはさておき、ログインするとこんな感じ

Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 3.10.65 aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Tue Jan 23 10:56:10 2018 from 192.168.1.150
root@OrangePi:~# uname -a
Linux OrangePi 3.10.65 #35 SMP PREEMPT Tue Jan 23 18:13:02 CST 2018 aarch64 aarch64 aarch64 GNU/Linux
root@OrangePi:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2  1.1G  520M  488M  52% /
devtmpfs        481M     0  481M   0% /dev
tmpfs           489M     0  489M   0% /dev/shm
tmpfs           489M  6.6M  483M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           489M     0  489M   0% /sys/fs/cgroup
/dev/mmcblk0p1   50M   29M   22M  58% /boot
root@OrangePi:~#

Kernel 3.10.64のUbuntu 16.04.1 LTS

root@OrangePi:~# cat /proc/cpuinfo
Processor       : AArch64 Processor rev 4 (aarch64)
processor       : 0
processor       : 1
processor       : 2
processor       : 3
Features        : fp asimd aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: AArch64
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : sun50iw6
Serial          : 0c000141091e3822014b
root@OrangePi:~# cat /proc/meminfo
MemTotal:        1001472 kB
MemFree:          888120 kB
Buffers:            6000 kB
Cached:            38080 kB
SwapCached:            0 kB
Active:            21844 kB
Inactive:          31092 kB
Active(anon):       8968 kB
Inactive(anon):     6576 kB
Active(file):      12876 kB
Inactive(file):    24516 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                24 kB
Writeback:             0 kB
AnonPages:          8872 kB
Mapped:             8984 kB
Shmem:              6692 kB
Slab:              20168 kB
SReclaimable:       8648 kB
SUnreclaim:        11520 kB
KernelStack:        1600 kB
PageTables:          380 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      500736 kB
Committed_AS:      53372 kB
VmallocTotal:   251658176 kB
VmallocUsed:       48964 kB
VmallocChunk:   251607312 kB
root@OrangePi:~#

で、アップデートしてみようと、「apt update」を実行

root@OrangePi:~# apt update
Get:1 http://mirrors.ustc.edu.cn/ubuntu-ports xenial InRelease [247 kB]
Get:2 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-updates InRelease [102 kB]
Get:3 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-backports InRelease [102 kB]
Get:4 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-security InRelease [102 kB]
Get:5 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-updates/main arm64 Packages [576 kB]
Get:6 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-updates/main Translation-en [295 kB]
Get:7 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-updates/universe arm64 Packages [510 kB]
Get:8 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-updates/universe Translation-en [233 kB]
Get:9 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-security/main arm64 Packages [321 kB]
Get:10 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-security/main Translation-en [189 kB]
Get:11 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-security/universe arm64 Packages [181 kB]
Get:12 http://mirrors.ustc.edu.cn/ubuntu-ports xenial-security/universe Translation-en [102 kB]
Fetched 2960 kB in 12s (228 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
20 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@OrangePi:~# apt list --upgradable
Listing... Done
base-files/xenial-updates 9.4ubuntu4.5 arm64 [upgradable from: 9.4ubuntu4.3]
bsdutils/xenial-updates 1:2.27.1-6ubuntu3.3 arm64 [upgradable from: 1:2.27.1-6ubuntu3.2]
coreutils/xenial-updates 8.25-2ubuntu3~16.04 arm64 [upgradable from: 8.25-2ubuntu2]
dpkg/xenial-updates 1.18.4ubuntu1.3 arm64 [upgradable from: 1.18.4ubuntu1.1]
libapparmor1/xenial-updates 2.10.95-0ubuntu2.7 arm64 [upgradable from: 2.10.95-0ubuntu2.6]
libblkid1/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
libcryptsetup4/xenial-updates 2:1.6.6-5ubuntu2.1 arm64 [upgradable from: 2:1.6.6-5ubuntu2]
libfdisk1/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
libmount1/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
libseccomp2/xenial-updates 2.3.1-2.1ubuntu2~16.04.1 arm64 [upgradable from: 2.2.3-3ubuntu3]
libsmartcols1/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
libsystemd0/xenial-updates 229-4ubuntu21 arm64 [upgradable from: 229-4ubuntu15]
libtasn1-6/xenial-updates,xenial-security 4.7-3ubuntu0.16.04.3 arm64 [upgradable from: 4.7-3ubuntu0.16.04.2]
libuuid1/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
makedev/xenial-updates 2.3.1-93ubuntu2~ubuntu16.04.1 all [upgradable from: 2.3.1-93ubuntu1]
mount/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
systemd/xenial-updates 229-4ubuntu21 arm64 [upgradable from: 229-4ubuntu15]
systemd-sysv/xenial-updates 229-4ubuntu21 arm64 [upgradable from: 229-4ubuntu15]
util-linux/xenial-updates 2.27.1-6ubuntu3.3 arm64 [upgradable from: 2.27.1-6ubuntu3.2]
zlib1g/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 arm64 [upgradable from: 1:1.2.8.dfsg-2ubuntu4]
root@OrangePi:~#

Orange Pi 公式のいつものubuntuの公式arm64バイナリだけがアップデートでき、kernelなどの機種依存部分はアップデートできないタイプの設定でした。

MIPS64のloongson(龍芯)のOS入手先

2017年3月8日に「中国製CPU「龍芯3号 3A3000」を搭載したノートPC、間もなく登場か」という記事が出たときに調べたところ、いくつか面白い話を発見したので、メモして置いた

例えば、Oracle OpenJDKにいろいろコードを突っ込んだ話(「龙芯中科与Oracle正式签署OpenJDK Contributor协议」)とか
QEMU、nodejs,Fedoraへの貢献とか(「龙芯向QEMU、nodejs、Fedora等一批开源软件社区提交贡献」)

Linux OSもDebian,Fedora,Ubuntuがあるようで、当時はMIPSコアに関する権利を持っているImagination technologyにあった
https://mipsdistros.imgtec.com/ にて配布していた。
しかし、2017年11月頃に確認してみると、mipsdistrosが消滅・・・

Debianについては「https://wiki.debian.org/MIPSPort」の「Build daemons & porter boxes」に「Loongson 3A」のマシンが何台かいるのでバイナリの入手には問題なさそう
また、「DebianYeeloong」にてLoongson-2Fベースのノートパソコン向けの情報もある。
このノートパソコン、「江苏航天龙梦信息技术有限公司」というメーカが出しておりATXマザーボードとかいろんなLoongson(龙芯)採用製品を販売中。

Fedoraについては「https://fedoraproject.org/wiki/Architectures/MIPS/2015Bootstrap/mips64el」に資料が一部あるが、Fedora24までで、また、ダウンロード先が 消えた https://mipsdistros.imgtec.com/ となっているため役に立たず

じゃぁ、いまはどこに見に行けばいいのかを確認してみると
龙芯3A3000/3B3000」の製品ページに掲載されているPDFにバグ報告先としてhttp://bugs.loongnix.org/とあるところから「Loongnix 系统」を発見。
また、Loongson関連製品を販売している航天龙梦にも「航天龙梦wiki」があった。
また「OPENLOONGSON.ORG」というニュースサイトもあった。

さて・・・2018年1月15日の段階でのOSについてまとめる

・Fedora 21
CPU開発元の推奨はFedora21をベースに開発された「Loongnix」である模様。
搭載製品をリリースしている航天龙梦も「Fedora for Loongson」を見る限り、LoongnixをベースにMETEデスクトップ向けのカスタマイズしたものを使用しているようだ。

・Debian 9
Debian GNU/Linux インストールガイド for MIPS64el
「2.1.1. サポートするアーキテクチャ」に「Loongson 3」がサポート対象として明記されている。
mipselとmips64elの2つでサポートとのこと。

・Ubuntu 16.04
Loongnixのyumレポジトリは「http://ftp.loongnix.org/os/loongnix/1.0/os/」ということなので、試しにツリーをのぼってみるとhttp://ftp.loongnix.org/os/ubuntu/なんてディレクトリが・・・
2017/12/20生成のUbuntu 16.04のISOイメージなんてのを発見(http://ftp.loongnix.org/os/ubuntu/iso/)

・Ubuntuベース?
中标软件有限公司が開発している中标麒麟OSというのもある模様。「中标麒麟桌面操作系统V7.0(龙芯个人版)
アルファベット表記だと「Ubuntu Kylin」になるようだが、Ubuntuのどれベースになるのかが不明。
たぶん、16.04なんだと思いますが、下記の記事のようにWindows XPのような見た目にしているようです

関連記事:PC Watch「龍芯3号で動作するWindowsそっくりなLinux OS「中標麒麟V7.0」

モバイルバージョンを終了