Zimbra 雑多なメモ

From misc notes
Revision as of 12:55, 6 April 2021 by Nxhack (talk | contribs)
Jump to navigation Jump to search
  • BLOCK customer.worldstream.nl
zmprov mcf zimbraMtaHeaderChecks 'pcre:/opt/zimbra/conf/postfix_header_checks  pcre:/opt/zimbra/conf/custom_header_checks'
zmmtactl restart

/opt/zimbra/conf/custom_header_checks

/^Received: from customer\.worldstream\.nl/ DISCARD
/opt/zimbra/common/sbin/postfix reload
https://wiki.zimbra.com/wiki/King0770-Notes-Header-Checks
https://gato.intaa.net/archives/12999
  • TLSv1.2 のみしたかったが

iPhone (iOS12) Mail (IMAP) から繋がらず、 TLSv1 を有効にしないといけないらしい...アカンやつやw

  • Unable to start TLS: SSL connect attempt failed error:

SSL routines:ssl3_get_server_certificate:certificate verify failed when connecting to ldap master.

apt でパッケージが 8.7b8 から 8.7b9 に upgrade されたら StartTLS がこわれた...

強引な解決方法

zmlocalconfig -e ldap_starttls_supported=0
When upgrading to 8.5x, "Unable to create a successful TLS connection to the ldap masters" comes up
  • gzip: stdin: file size changed while zipping
    postrotate
      kill -USR1 `cat /opt/zimbra/log/nginx.pid 2> /dev/null` 2> /dev/null && sleep 5 || true
    endscript
Network/Zimbra - Sebastian's Wiki
  • OS upgrade の場合

imbra Collaboration 8.7.x and Ubuntu OS update corrupts/removes Zimbra installation

cd /opt
cd zimbra.lts16
cp -adpRx bin common/bin common/lib common/libexec common/sbin common/share lib libexec /opt/zimbra

コピーがうまくいかないので、tar cf - ./bin|(cd /opt/zimbra;tar xf -) でちまちまコピる

cd /opt
cd zimbra.lts16
tar cf - ./bin ./common/bin ./common/lib ./common/libexec ./common/sbin ./common/share ./lib ./libexec |(cd /opt/zimbra;tar xf -)
  • よくあるからメモ

zimbra を update したあとに、

Jul 15 16:30:03 mail1 postfix/postdrop[7889]: warning: mail_queue_enter: create file maildrop/370137.7889: Permission denied

が大量にでる。

zmcontrol stop
sudo killall postdrop
# もし必要なら
#sudo usermod -a -G postdrop zimbra
#sudo /opt/zimbra/libexec/zmfixperms
zmcontrol start

killall postdrop が肝

  • high precision timestamps 再

/opt/zimbra/common/bin/prepflog.pl

250c250
<             /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:[\+\-](?:\d{2}):(?:\d{2})|Z) \S+ (.+)$/o) == 10);
---
>             /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[\+\-](?:\d{2}):(?:\d{2})|Z) \S+ (.+)$/) == 7);
255,256c255,257
<     unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 ||
<            (($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2)
---
>     unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix-?\w*|$syslogName)(?:/(?:smtps|submission))?/([^\[:]*).*?: ([^:\s]+)#o) == 2 ||
>            (($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2 ||
>            (($cmd, $qid) = $logRmdr =~ m#^MailScanner\[\d+\]: (Requeue): (\w+)\.#) == 2)
560c561
< # return a date string to match in log
---
> # return traditional and RFC3339 date strings to match in log
562c563
<     my $dateOpt = $_[0];
---
>     my ($dateOpt) = $_[0];
572c573
<     my ($t_mday, $t_mon) = (localtime($time))[3,4];
---
>     my ($t_mday, $t_mon, $t_year) = (localtime($time))[3,4,5];
574c575
<     return sprintf("%s %2d", $monthNames[$t_mon], $t_mday);
---
>     return sprintf("%s %2d", $monthNames[$t_mon], $t_mday), sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday);
  • postfix : Specific Whitelist/Blacklist per IP

Specific Whitelist/Blacklist per IP

su - zimbra
# Blacklist Edit /opt/zimbra/conf/postfix_blacklist. Add IP address SPACE REJECT to the file, one IP address per line.
postmap /opt/zimbra/conf/postfix_blacklist
zmprov mcf +zimbraMtaRestriction 'check_client_access lmdb:/opt/zimbra/conf/postfix_blacklist'
zmmtactl restart
postmap will need to be rerun on the file anytime an IP address is added or removed.
fail2ban というのもある
結局、大胆に...
iptables -A INPUT -s 62.150.168.221 -j DROP
iptables -A INPUT -s 62.150.168.194 -j DROP


  • reset admin password

Admin password Reset

su - zimbra
zmprov gaaa
zmprov sp <admin email address> <new password>
  • proxy memcache and set https only

Enabling Zimbra Proxy and memcached

su - zimbra
./libexec/zmproxyconfig -e -w -o -a 8080:80:8443:443 -x https  -H `zmhostname`
./libexec/zmproxyconfig -e -m -o -i 7143:143:7993:993 -p 7110:110:7995:995 -H `zmhostname`
zmprov ms `zmhostname` zimbraMailReferMode reverse-proxied
zmmailboxdctl restart
#zmprov ms `zmhostname` +zimbraServiceEnabled memcached
#zmcontrol restart
zmprov ms `zmhostname` zimbraReverseProxyMailMode https
zmcontrol restart
lsof -i :443
lsof -i :11211


  • Errors mysql After Upgrade to 8.7

Errors mysql After Upgrade to 8.7

MariaDB が エラー出す。

This behavior is caused by bug in Zimbra installation script which doesn't perform mysql_upgrade during Zimbra upgrade process.

Resolution:

1. Obtain mysql root password:
$ zmlocalconfig -s | grep mysql | grep password

2. Create missing directory and symbolic link:
$ mkdir /opt/zimbra/data/tmp/mysqldata
$ ln -s /opt/zimbra/data/tmp/mysql/mysql.sock /opt/zimbra/data/tmp/mysqldata/mysql.sock

3. Perform mysql_upgrade
$ /opt/zimbra/common/bin/mysql_upgrade -u root -p


  • /opt/zimbra/libexec/zmfixperms -extended したら...
Jul 15 16:30:03 mail1 postfix/postdrop[7889]: warning: mail_queue_enter: create file maildrop/370137.7889: Permission denied
結局これで FIX
usermod -a -G postdrop zimbra
  • zimbra-proxy を使っていない場合に slapd が起動しなくなった。
Failed to start slapd.  Attempting debug start to determine error.
TLS: error:02001002:system library:fopen:No such file or directory bss_file.c:175
TLS: error:2006D080:BIO routines:BIO_new_file:no such file bss_file.c:178
57e0763b main: TLS init def ctx failed: -1
zimbra ユーザでコマンド実行
openssl dhparam -out /opt/zimbra/conf/dhparam.pem 2048
  • 8.7.0 upgrade でハマる
https://wiki.zimbra.com/wiki/Recovering_from_upgrade_failure
log 確認すると パッケージインストールで失敗している。どうも、昔仕込んでいた mta-dummy_1.0_all.deb の関連で、bsd-mailx と競合しているっぽい。
bsd-mailx を削除して、上記の方法でなんとかインストールできた。その後パッケージの依存関係が壊れたところを手で修復...疲れた。
  • メモ
How to obtain an A+ in the Qualys SSL Labs security test


  • Enabling Zimbra Proxy
8.5 以降は proxy が標準になっており、過去からのアップデートのおりに不具合がでる(ほったらかし系)
Enabling Zimbra Proxy
imap の SSL が繋がらなくって小一時間はまった...けっきょく解決策は proxy を有効にする。


  • no such data source: InternalGAL
zmgsautil createAccount -a galsync@example.com -n InternalGAL --domain example.com -s `zmhostname` -t zimbra -f _InternalGAL
zmgsautil forceSync -a galsync@example.com -n InternalGAL
  • メモ
zmlocalconfig -s | grep mysql | grep password
/opt/zimbra/mysql/bin/mysql_upgrade -S /opt/zimbra/db/mysql.sock  -u root -p
  • high precision timestamps

rsyslog の時刻精度をあげようとおもったら、zimbra でいろいろ不具合

admin web のサーバーステータスが fail に、daily report が変になったり。

daily report の patch

/opt/zimbra/libexec/zmdailyreport
64c64,65
< 	my $today = strftime("%b %e ", localtime);
---
> 	# my $today = strftime("%b %e ", localtime);
> 	my $today = strftime("%F", localtime);
portfix レポートプログラム pflogsumm を 1.1.5 のベータバージョンに
/opt/zimbra/pflogsumm/bin/pflogsumm.pl
http://linxnet.com/postfix_contrib.html
https://github.com/KTamas/pflogsumm
/opt/zimbra/libexec/zmlogger
525c525,526
<     my $logregex = qr/(^.{15}) ((\d+\.\d+\.\d+\.\d+)|(\S+)) ([^[]+)(\[(\d+)\])?: (.*)$/o;
---
>     # my $logregex = qr/(^.{15}) ((\d+\.\d+\.\d+\.\d+)|(\S+)) ([^[]+)(\[(\d+)\])?: (.*)$/o;
>     my $logregex = qr/(^.{32}) ((\d+\.\d+\.\d+\.\d+)|(\S+)) ([^[]+)(\[(\d+)\])?: (.*)$/o;
/opt/zimbra/libexec/zmlogprocess
211c211,212
<     my $logregex = qr/(^.{15}) ((\d+\.\d+\.\d+\.\d+) \S+|(\S+)) ([^[]+)(\[(\d+)\])?: (.*)$/o;
---
>     # my $logregex = qr/(^.{15}) ((\d+\.\d+\.\d+\.\d+) \S+|(\S+)) ([^[]+)(\[(\d+)\])?: (.*)$/o;
>     my $logregex = qr/(^.{32}) ((\d+\.\d+\.\d+\.\d+) \S+|(\S+)) ([^[]+)(\[(\d+)\])?: (.*)$/o;
もしダメで切り戻しのために zimbraログを(だけ) TraditionalFileFormat に設定する場合は
/opt/zimbra/60-zimbra.conf
local0.*                -/var/log/zimbra.log;RSYSLOG_TraditionalFileFormat
local1.*                -/var/log/zimbra-stats.log;RSYSLOG_TraditionalFileFormat
auth.*                  -/var/log/zimbra.log;RSYSLOG_TraditionalFileFormat
mail.*                -/var/log/zimbra.log;RSYSLOG_TraditionalFileFormat


  • Zimbra 8 に上げたら rsync が失敗する

なんと 80GB のファイルが...

Notes on MDB

rsync に

-S, --sparse                handle sparse files efficiently

オプションで解決

  • 32bit から 64bit への移行
Network Edition: Moving from 32-bit to 64-bit Server
ZCS Open Source Edition ですこしはまった
Zimbra server reserving server socket port=110 bindaddr=null ssl=false
Zimbra server reserving server socket port=995 bindaddr=null ssl=true
Fatal error: exception while binding to ports
java.net.SocketException: Unbound server sockets not implemented
        at javax.net.ServerSocketFactory.createServerSocket(ServerSocketFactory.java:80)
これは SSL オレオレ証明書の不備が原因
mv /opt/zimbra/mailboxd/etc/keystore /opt/zimbra/mailboxd/etc/keystore.old
 32bit 版から /opt/zimbra/mailboxd/etc/keystore をコピー
/opt/zimbra/bin/zmcertmgr deploycrt self
Zimbra 6 mailboxd and zmmailboxdctl do not start after upgrade
$ zmmailboxdctl restart
Stopping mailboxd...done.
ls: cannot access ZimbraConnectorOLK*x86.msi: No such file or directory
ls: cannot access ZimbraConnectorOLK*x64.msi: No such file or directory
ls: cannot access zimbra-isync*.dmg: No such file or directory
Starting mailboxd...done.
といわれる。bug というか OSE は無視すればよい。
Stange message when using zmmailboxdctl (Zimbra 7) 
zmupdatedownload (via zmmailboxdctl) complains about ZimbraConnectorOLK*
あとは、OSE には zmbackup ないし...
  • cron や command line からのメール
http://wiki.zimbra.com/wiki/Ubuntu_8.04_LTS_Server_%28Hardy_Heron%29_Install_Guide
の Sending Mail from Terminal (optional) 
wget http://ubuntu.lnix.net/misc/mta-dummy/mta-dummy_1.0_all.deb 
dpkg -i mta-dummy_1.0_all.deb
apt-get install mailx

Add the following to /etc/mail.rc:
 set sendmail=/opt/zimbra/postfix/sbin/sendmail
  • VMware 傘下になったよかったよかった
しっかり press に NTT com って出てるし ;)
まー よかった よかった
  • SpamAssassin 2010年問題
FH_DATE_PAST_20XX - Spamassassin bug - incorrect tagging from Jan 1, 2010 on - Zimbra - Forums
新年そうそう祭り〜
  • OCNメールもZimbraだ
プロバイダ OCN のユーザ用の Web メールは Zimbra だったんですね。そのままやん。
ブラウザで利用する - OCNメール -
  • Zimbra 6.x (GunsNRoses) on FreeBSD !!!
GNR on FreeBSD 7 - Zimbra :: Wiki
  • RackSpace 社がこんなキャンペーン始めました
Introducing… the Rackspace Rescue Plan for Zimbra Customers | Rackspace Email & Apps Blog
そういやぁ Scott Dietzen さん 辞めたんですねぇ...
rPath Brings Scott Dietzen to Board of Directors
  • いろいろ噂が...
Yahoo to Sell Open-Source Email Service Zimbra | Kara Swisher | BoomTown | AllThingsD
かつてのライバルも
The Real Cost of Acquisitions: the Zimbra Story | Zoho Blogs
ふーーーーむ
  • NTT com セキュアICT Bizメール は Yahoo! Zimbra ですね
メールホスティングサービス|セキュアICTサービス(セキュアICT Bizメール概要)|NTT com 法人のお客さま
NTT Com、10GBの容量・国内DCを利用したクラウドメールサービス -INTERNET Watch
住商もプレスしてないし、Zimbra 本体も無反応だし、裏があるのかな?
  • SOAP connection error
原因不明で悩んでたのだが、
at ch.ethz.ssh2.Connection.connect(Connection.java:591)
あっ! TCPwrappers で 22 番 port 制限してた...
自己の IP address を許可して解決
  • Critical Security Issue
Critical Security Issue
DESCRIPTION:

Zimbra has been made aware of a potentially critical security vulnerability in Zimbra Collaboration Suite. All released versions of ZCS Network Edition & Open Source Edition are impacted

This vulnerability allows unauthorized, remote access to files that are readable by the "zimbra user" account on the ZCS Mailbox Server (also known as mailbox service, or "mailboxd"; "tomcat" on 4.5 versions and earlier).
(追記) 5.0.18 GA が出ています。(5.0.18 GA Release Release Notes)
このリリースには上記のパッチが含まれていますので、そのままでOKです。
詳細な修正点 Zimbra Product Portal - Patch: 5.0.18
(Security issue については記述がないな 39002, 39003)
  • メール本文の送信コード
やっぱ quoted-printable になってるんだよなぁ
昔は、ISO-2022-JP で もちろん 7bit なのでエンコード不要だぜ っていってたんだけど、
最近の動向ってどうなんだろう
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: quoted-printable
  • ClamAV からの忠告
ClamAV - Updating Version
ClamAV FAQ
  • Zimbra Tuning
Performance Tuning Guidelines for Large Deployments
Jetty - Addressing High TCP Slot Usage
  • MacOS X版 Yahoo! Zimbra Desktop の 削除
Beta版のときもそう思ったけど、やたらでかいJavaプロセスが常駐しているのって、なんか嫌い。
% open ~/zimbra/zdesktop/Yahoo!\ Zimbra\ Desktop\ アンインストーラ.app
  • アップグレード
リリースノートを確認
Release Notes
リリースノートの Upgrade Instructions に従い、upgrade する。
  • メール系設定さわったら
# su - zimbra
% postfix reload
これでもだめなら、サーバ再起動
% zmcontrol stop
% zmcontrol start
  • zimbra アカウントの bash の調整
/etc/bashrc
に記述しましょう。
/opt/zimbra/.bashrc はアップグレードで書き換えられちゃいます。
  • 日本語のドキュメントが少なすぎ...なんとかしないとユーザが増えないぞ!
(言い出しっぺの法則やなぁ ぉぃ)
  • 十分すぎるぐらい高機能かつ洗練されている
しかし、高機能すぎて、専門家(SIer)でないとさわれないような現状はまずいな。
手っ取り早く、インストーラー厨でも使える(実際使えちゃうけど)ように、なにか考えないといけないな。