1

Topic: iRedMail issue with FreeBSD jail

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.4
- Linux/BSD distribution name and version: FreeBSD 10.3-STABLE ( r297561 ) in jail
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PostgreSQL
- Web server (Apache or Nginx):nginx
- Manage mail accounts with iRedAdmin-Pro? no
- Related log if you're reporting an issue:

Apr 20 19:06:08 mail postfix/postfix-script[49256]: starting the Postfix mail system
Apr 20 19:06:09 mail postfix/master[49258]: /usr/local/etc/postfix/master.cf: line 144: using backwards-compatible default setting chroot=y
Apr 20 19:06:09 mail postfix/master[49258]: /usr/local/etc/postfix/master.cf: line 150: using backwards-compatible default setting chroot=y
Apr 20 19:06:09 mail postfix/master[49258]: daemon started -- version 3.1.0, configuration /usr/local/etc/postfix
Apr 20 19:06:09 mail postfix/pickup[49259]: 1529510C4D2: uid=846 from=<sogod>
Apr 20 19:06:09 mail postfix/proxymap[49263]: warning: connect to pgsql server 127.0.0.1: FATAL:  password authentication failed for user "vmail"?FATAL:  password authentication failed for user "vmail"?
Apr 20 19:06:09 mail postfix/trivial-rewrite[49266]: warning: proxy:pgsql:/usr/local/etc/postfix/pgsql/transport_maps_domain.cf lookup error for "*"
Apr 20 19:06:09 mail postfix/trivial-rewrite[49266]: warning: proxy:pgsql:/usr/local/etc/postfix/pgsql/transport_maps_domain.cf lookup error for "*"
Apr 20 19:06:09 mail postfix/proxymap[49263]: warning: connect to pgsql server 127.0.0.1: FATAL:  password authentication failed for user "vmail"?FATAL:  password authentication failed for user "vmail"?
Apr 20 19:06:09 mail postfix/cleanup[49264]: warning: proxy:pgsql:/usr/local/etc/postfix/pgsql/sender_bcc_maps_user.cf lookup error for "sogod@mail.XXXXXXXXX.com"
Apr 20 19:06:09 mail postfix/cleanup[49264]: warning: 1529510C4D2: sender_bcc_maps map lookup problem -- message not accepted, try again later
Apr 20 19:06:09 mail postfix/pickup[49259]: warning: maildrop/1E02810C43F: error writing 1529510C4D2: queue file write error

====


Hi,

this is a fresh installation on a dedicated jail. It seems like there is an issue with the setup of the postgresql server.
To reproduce it is enough to execute the iRedMail.sh script and choose nginx, postgresql, sogo.
I tried also to replace all the "127.0.0.1" occurrences in "/usr/local/etc/postfix/" directory and subdirs with the jail ip address ( 192.168.2.232 ) without luck, i.e.: same errors with "192.168.2.232" instead of "127.0.0.1". Please note that my jail has only access to 192.168.2.232 ip. Localhost is not available.
Please let me know if I can provide additional details that may help in tracking down the problem.
Thank you!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iRedMail issue with FreeBSD jail

tinotom wrote:

Apr 20 19:06:09 mail postfix/proxymap[49263]: warning: connect to pgsql server 127.0.0.1: FATAL:  password authentication failed for user "vmail"?FATAL:  password authentication failed for user "vmail"?

Could you please verify the SQL username and passwords in /usr/local/etc/postfix/pgsql/*.cf?
Also, any error in iRedMail-0.9.4/runtime/install.log?

3 (edited by tinotom 2016-04-23 03:57:23)

Re: iRedMail issue with FreeBSD jail

Hi,

actually there are some errors in the install.log file. I'll attach it.
It seems that a jail without the 127.0.0.1 address available is not supported by iRedMail. Is it true ? For what I know, it is a quite common configuration for a freebsd jail ( i.e.: no 127.0.0.1 binds allowed ).
Thank you,

tino

Post's attachments

install.log 28.37 kb, 2 downloads since 2016-04-22 

You don't have the permssions to download the attachments of this post.

4

Re: iRedMail issue with FreeBSD jail

Did you run the iRedMail installer with 'LOCAL_ADDRESS=xxx' parameter? It's mentioned in iRedMail installation guide:
http://www.iredmail.org/docs/install.ir … -installer

like this:

cd /root/iRedMail-0.9.4
LOCAL_ADDRESS='192.168.1.2' bash iRedMail.sh

5

Re: iRedMail issue with FreeBSD jail

Hi Zhang,

shame on me, that was the only thing to setup before running the iRedMail.sh script and I didn't run it.
Anyway, I have rerun the installation, on a fresh jail, but it failed. It seems that postgresql setup fails at some point and the server does not start successfully or the script fails to connect, resulting in an empty database.
I tried to add a "trust" line in pg_hba.conf so I can connect to postgresql server and run the "pgsql_init.pgsql" from the runtime dir just to try if this is enough, but there are still errors in /var/log/maillog file about amavisd that cannot connect to the postgresql server. I performed a quick check and, as expected and reasonable, the database is called by many services.

Please find below the relevant lines from the new install.log:

[...snip...]
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/local/bin/postgres -D /usr/local/pgsql/data
or
    /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

 + < DEBUG > Make sure PostgreSQL binds to local address: 192.168.2.232.
 + < DEBUG > Set client_min_messages to ERROR.
 + < DEBUG > Copy iRedMail SSL cert/key with strict permission.
 + < DEBUG > Start PostgreSQL server
pg_ctl: PID file "/usr/local/pgsql/data/postmaster.pid" does not exist
Is server running?
starting server anyway
pg_ctl: could not read file "/usr/local/pgsql/data/postmaster.opts"
 + < DEBUG > Sleep 5 seconds for PostgreSQL daemon initialize ...
 + < DEBUG > Setting password for PostgreSQL admin: (pgsql).
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
 + < DEBUG > Update pg_hba.conf to force local users to authenticate with md5.
 + < DEBUG > Restart PostgreSQL server and sleeping for 5 seconds.
pg_ctl: PID file "/usr/local/pgsql/data/postmaster.pid" does not exist
Is server running?
starting server anyway
pg_ctl: could not read file "/usr/local/pgsql/data/postmaster.opts"
 + < DEBUG > Generate /usr/local/pgsql/.pgpass.
 + < DEBUG > Generating SQL template for postfix virtual hosts: /root/iRedMail-0.9.4/runtime/pgsql_init.pgsql.
 + < DEBUG > Import virtual mail accounts: /root/iRedMail-0.9.4/runtime/pgsql_init.pgsql.
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[ INFO ] Setup daily cron job to backup PostgreSQL databases with /var/vmail/backup/backup_pgsql.sh
[ INFO ] Configure Postfix (Message Transfer Agent).
 + < DEBUG > Enable chroot.
 + < DEBUG > Enable submission and additional transports required by Amavisd and Dovecot.
 + < DEBUG > Copy: /etc/{hosts,resolv.conf,localtime,services} -> /var/spool/postfix/etc/
 + < DEBUG > Configure Postfix for SQL/LDAP lookup.
 + < DEBUG > Enable postscreen service.
* [BACKUP] /usr/local/etc/postfix/main.cf -> /usr/local/etc/postfix/main.cf.2016.04.23.14.35.02.
* [BACKUP] /usr/local/etc/postfix/master.cf -> /usr/local/etc/postfix/master.cf.2016.04.23.14.35.02.
* Comment out 'smtp inet ... smtpd' service in /usr/local/etc/postfix/master.cf.
* Uncomment the new 'smtpd pass ... smtpd' service in /usr/local/etc/postfix/master.cf.
* Uncomment the new smtp inet ... postscreen service in /usr/local/etc/postfix/master.cf.
* Uncomment the new 'tlsproxy unix ... tlsproxy' service in /usr/local/etc/postfix/master.cf.
* Uncomment the new 'dnsblog unix ... dnsblog' service in /usr/local/etc/postfix/master.cf.
* Update /usr/local/etc/postfix/main.cf to enable postscreen.
* Create /var/spool/postfix//var/db/postfix/postscreen_cache.db.
* Reloading postfix service to read the new configuration.
* postscreen is now enabled.
[ INFO ] Configure Dovecot (pop3/imap/managesieve server).
 + < DEBUG > Configure dovecot: /usr/local/etc/dovecot/dovecot.conf.
 + < DEBUG > Copy global sieve filter rule file: /var/vmail/sieve/dovecot.sieve.
 + < DEBUG > Create dovecot log file: /var/log/dovecot.log.
 + < DEBUG > Create dovecot log file: /var/log/dovecot-sieve.log.
 + < DEBUG > Create dovecot log file: /var/log/dovecot-lmtp.log.
 + < DEBUG > Enable dovecot SASL support in postfix: /usr/local/etc/postfix/main.cf.
 + < DEBUG > Create directory for Dovecot plugin: Expire.
 + < DEBUG > Setting logrotate for dovecot log file.
ln: /usr/lib/sendmail: Read-only file system
[ INFO ] Configure ClamAV (anti-virus toolkit).
 + < DEBUG > Configure ClamAV: /usr/local/etc/clamd.conf.
 + < DEBUG > Configure freshclam: /usr/local/etc/freshclam.conf.
 + < DEBUG > Add clamav user to amavid group.
[ INFO ] Configure Amavisd-new (interface between MTA and content checkers).
 + < DEBUG > Configure amavisd-new: /usr/local/etc/amavisd.conf.
 + < DEBUG > Generate DKIM pem files: /var/lib/dkim/XXXXXXXX.XXX.pem.
 + < DEBUG > Setting cron job for vmail user to delete virus mail per month.
 + < DEBUG > Import Amavisd database and privileges.
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
[ INFO ] Configure SpamAssassin (content-based spam filter).
 + < DEBUG > Copy sample SpamAssassin config file: /root/iRedMail-0.9.4/samples/spamassassin/local.cf -> /usr/local/etc/mail/spamassassin/local.cf.
 + < DEBUG > Enable crontabs for SpamAssassin update.
 + < DEBUG > Compile SpamAssassin ruleset into native code.
Apr 23 14:35:10.732 [88463] info: generic: base extraction starting. this can take a while...
cd /
rm -rf /tmp/.spamassassin88463H0IcXitmp
[ INFO ] Configure iRedAPD (postfix policy daemon).
 + < DEBUG > Extracting: iRedAPD-1.8.0.tar.bz2 -> /opt
 + < DEBUG > Configure iRedAPD.
 + < DEBUG > Make iredapd start after system startup.
 + < DEBUG > Import iRedAPD database template.
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
 + < DEBUG > Updating greylisting whitelists based on whitelist domain names.
[ INFO ] Configure iRedAdmin (official web-based admin panel).
[...snip...]

Please let me know if I can help in some way.
Thank you,

tino

6

Re: iRedMail issue with FreeBSD jail

tinotom wrote:

+ < DEBUG > Restart PostgreSQL server and sleeping for 5 seconds.
pg_ctl: PID file "/usr/local/pgsql/data/postmaster.pid" does not exist
Is server running?
starting server anyway
pg_ctl: could not read file "/usr/local/pgsql/data/postmaster.opts"

I can reproduce this issue, will try to fix it and come back to you later.

7

Re: iRedMail issue with FreeBSD jail

Fixed moment ago. Cannot start PostgreSQL with "service postgresql restart" right after populating initial database, instead we should run "start".

Commit log:
https://bitbucket.org/zhb/iredmail/comm … 43f8fc339a

8

Re: iRedMail issue with FreeBSD jail

Hi Zhang,

your fix works, thank you!
There was only an issue with the "wbxml2" package, but the port seems broken. Anyway, as a workaround I installed it from the binary package repository, rerun iRedMail.sh and all went fine.
Thank you!

9

Re: iRedMail issue with FreeBSD jail

tinotom wrote:

There was only an issue with the "wbxml2" package, but the port seems broken.

I reported to port maintainer and got a patch to fix it. Still waiting for port maintainer to submit the patch.