1

Topic: iRedMail behind FreeBSD Jail

==== Provide required information ====
- iRedMail version and backend (LDAP/MySQL/PGSQL):LDAP
- Linux/BSD distribution name and version: FreeBSD
- Any related log? Log is helpful for troubleshooting.
====

I wonder if anyone has experienced iRedMail behind a FreeBSD Jail;
Thanks,

Wendell

----

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

2

Re: iRedMail behind FreeBSD Jail

Here's one: http://www.iredmail.org/wiki/index.php? … eeBSD/Jail

3

Re: iRedMail behind FreeBSD Jail

I did all the steps, but I can not access to mySQL, you have any tips?

Thanks,

Wendell

4

Re: iRedMail behind FreeBSD Jail

Do you have any related error log?
It's hard for me to help troubleshoot without related log.

5

Re: iRedMail behind FreeBSD Jail

I'll do it all again and if the error appears, I'll post the log.

Thanks,

6

Re: iRedMail behind FreeBSD Jail

Oh my, finaly someone with the same problem.

I put iredmail script on a fresh freebsd 91.jail (ezjail)
hostname, reverse dns, all is ok.

Run script without any error msg during his proccess.

When I restart all services, look error on anyone trying to connect to mysql server...

Its is a joke ?

You must by remove freebsd of your indicated OS if you think that linux is better or more important.

I reinstall all, about 5 times, try to look what is can by wrong, but is dificult when I dont have
sure about iredmail ways to do.

I am very disapointed with.

If you (iredmail people) want, I send a ssh root login to this jail for you see with your own eyes the
problem.

(sorry for my english, I am Brazilian)

7

Re: iRedMail behind FreeBSD Jail

FreeBSD 8.3-RELEASE
iRedMail 0.8.1
Jail Environment = ezjail

My process was based on the site [http://www.iredmail.org/wiki/index.php? … eeBSD/Jail] I am also having trouble connecting to mySQL, following error messages:

< INFO > ---- Start iRedMail Configurations ----
< INFO > Create SSL certification files.
< INFO > Create required system accounts: vmail, iredapd, iredadmin.
< INFO > Configure Apache web server and PHP.
/root/iRedMail-0.8.1/functions/apache_php.sh: line 238: /boot/loader.conf: Read-only file system
< INFO > Configure OpenLDAP server.
< INFO > Configure MySQL database server.
ERROR 1130 (HY000): Host '192.168.1.1' is not allowed to connect to this MySQL server
< INFO > Configure Postfix.
< INFO > Configure Policyd (postfix policy server, version 1.8).
ERROR 1130 (HY000): Host '192.168.1.1' is not allowed to connect to this MySQL server
< INFO > Configure Dovecot (pop3/imap server, version 2).
< INFO > Configure ClamAV (anti-virus toolkit).
< INFO > Configure Amavisd-new (interface between MTA and content checkers).
ERROR 1130 (HY000): Host '192.168.1.1' is not allowed to connect to this MySQL server
< INFO > Configure SpamAssassin (content-based spam filter).
< INFO > Configure Roundcube webmail.
ERROR 1130 (HY000): Host '192.168.1.1' is not allowed to connect to this MySQL server
< INFO > Configure phpLDAPadmin (web-based LDAP management tool).
< INFO > Configure phpMyAdmin (web-based MySQL management tool).
< INFO > Configure Awstats (logfile analyzer for mail and web server).
< INFO > Configure iRedAdmin (official web-based admin panel).
ERROR 1130 (HY000): Host '192.168.1.1' is not allowed to connect to this MySQL server
ERROR 1130 (HY000): Host '192.168.1.1' is not allowed to connect to this MySQL server
< INFO > Configure iRedAPD (postfix policy daemon).

8

Re: iRedMail behind FreeBSD Jail

Could you please try again with the latest development version? Update parameter LOCAL_ADDRESS to the IP of your Jail in iRedMail/conf/global before you execute it:

export LOCAL_ADDRESS='192.168.x.x'

Here 192.168.x.x is the IP address of your Jail. Then start iRedMail installer: bash iRedMail.sh.

9

Re: iRedMail behind FreeBSD Jail

ZhangHuangbin wrote:

Could you please try again with the latest development version? Update parameter LOCAL_ADDRESS to the IP of your Jail in iRedMail/conf/global before you execute it:

export LOCAL_ADDRESS='192.168.x.x'

Here 192.168.x.x is the IP address of your Jail. Then start iRedMail installer: bash iRedMail.sh.

I tried this .. But not work for me..  See below:


********************************************************************
* Start iRedMail Configurations
********************************************************************
< INFO > Create SSL certification files.
< INFO > Create required system accounts: vmail, iredapd, iredadmin.
< INFO > Configure Apache web server and PHP.
/root/zhb-iredmail-26d71876e908/iRedMail/functions/apache_php.sh: line 238: /boot/loader.conf: Read-only file system
< INFO > Configure OpenLDAP server (Storing mail accounts).
< INFO > Configure MySQL database server.
ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server
< INFO > Configure Postfix (Message Transfer Agent).
< INFO > Configure Policyd (postfix policy server, version 1.8).
ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server
< INFO > Configure Dovecot (pop3/imap/managesieve server, version 2).
< INFO > Configure ClamAV (anti-virus toolkit).
< INFO > Configure Amavisd-new (interface between MTA and content checkers).
ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server
< INFO > Configure SpamAssassin (content-based spam filter).
< INFO > Configure iRedAPD (postfix policy daemon).
< INFO > Configure iRedAdmin (official web-based admin panel).
ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server
ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server
< INFO > Configure Awstats (logfile analyzer for mail and web server).
< INFO > Configure Roundcube webmail.
ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server
< INFO > Configure phpLDAPadmin (web-based LDAP management tool).
< INFO > Configure phpMyAdmin (web-based MySQL management tool).

Where iredmail is 192.168.1.1 in /etc/hosts;

10

Re: iRedMail behind FreeBSD Jail

perlporter wrote:

ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server

MySQL server doesn't allow connection from 192.168.1.1.

Could you please show me whole file of /var/db/mysql/my.cnf? Do you have "bind-address" or "skip-networking" in my.cnf?

11

Re: iRedMail behind FreeBSD Jail

ZhangHuangbin wrote:
perlporter wrote:

ERROR 1130 (HY000): Host 'iredmail' is not allowed to connect to this MySQL server

MySQL server doesn't allow connection from 192.168.1.1.

Could you please show me whole file of /var/db/mysql/my.cnf? Do you have "bind-address" or "skip-networking" in my.cnf?

See the result:

iredmail# ls -l /var/db/mysql/my.cnf
ls: /var/db/mysql/my.cnf: No such file or directory

12

Re: iRedMail behind FreeBSD Jail

Then please paste me your MySQL config file, my.cnf.

13

Re: iRedMail behind FreeBSD Jail

ZhangHuangbin wrote:

Then please paste me your MySQL config file, my.cnf.


iredmail# find / -name my.cnf -print
/root/zhb-iredmail-26d71876e908/iRedMail/samples/my.cnf
iredmail# uname -a
FreeBSD iredmail.ramenzoni.com.br 8.3-RELEASE-p3 FreeBSD 8.3-RELEASE-p3 #0: Sat Jul  7 20:58:35 BRT 2012     root@duvel.ramenzoni.com.br:/usr/obj/usr/src/sys/STRONGALE  amd64

It seems that the file does not exist, I can access the mysql:

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

The installation process was unable to create tables;

Thanks for help me

14

Re: iRedMail behind FreeBSD Jail

Looks like ports tree doesn't install my.cnf by default, and iRedMail doesn't copy sample config file too.
Could you please try below steps:

- Copy a sample my.cnf to /var/db/mysql/my.cnf. e.g. /usr/local/share/mysql/my-medium.cnf.

/usr/local/share/mysql/my-huge.cnf
/usr/local/share/mysql/my-innodb-heavy-4G.cnf
/usr/local/share/mysql/my-large.cnf
/usr/local/share/mysql/my-medium.cnf
/usr/local/share/mysql/my-small.cnf

- Restarting MySQL service, and check what IP address MySQL is bound to.

15

Re: iRedMail behind FreeBSD Jail

ZhangHuangbin wrote:

Looks like ports tree doesn't install my.cnf by default, and iRedMail doesn't copy sample config file too.
Could you please try below steps:

- Copy a sample my.cnf to /var/db/mysql/my.cnf. e.g. /usr/local/share/mysql/my-medium.cnf.

/usr/local/share/mysql/my-huge.cnf
/usr/local/share/mysql/my-innodb-heavy-4G.cnf
/usr/local/share/mysql/my-large.cnf
/usr/local/share/mysql/my-medium.cnf
/usr/local/share/mysql/my-small.cnf

- Restarting MySQL service, and check what IP address MySQL is bound to.

I tried to put the my.cnf you suggested and I also had no effect;

Look this:

iredmail# sockstat -4 -p 3306
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS     
mysql    mysqld     75034 10 tcp4   192.168.1.1:3306      *:*

mysql is already doing in the binding interface 192.168.1.1, I think that is missing to allow access:

AHost 'iredmail' is not allowed to connect to this MySQL ServerConnection closed by foreign host.

Look what I found on the website of mysql:
http://dev.mysql.com/doc/refman/5.0/en/ … enied.html
----cut----
If the following error occurs when you try to connect from a host other than the one on which the MySQL server is running, it means that there is no row in the user table with a Host value that matches the client host:

Host ... is not allowed to connect to this MySQL server
You can fix this by setting up an account for the combination of client host name and user name that you are using when trying to connect.
----cut----

16

Re: iRedMail behind FreeBSD Jail

Thanks for your research, it makes sense.

iRedMail creates MySQL users like below:

mysql> GRANT SELECT ON vmail.* TO vmail@localhost IDENTIFIED BY 'xxx';

That's why it cannot access from Jail, because it's not considered as "localhost".

17

Re: iRedMail behind FreeBSD Jail

ZhangHuangbin wrote:

Thanks for your research, it makes sense.

iRedMail creates MySQL users like below:

mysql> GRANT SELECT ON vmail.* TO vmail@localhost IDENTIFIED BY 'xxx';

That's why it cannot access from Jail, because it's not considered as "localhost".

How can I resolved ?

18

Re: iRedMail behind FreeBSD Jail

perlporter wrote:

How can I resolved ?

Fixed this issue moment ago: https://bitbucket.org/zhb/iredmail/chan … e94d5331dc

Please try again with the latest development version with below steps:

- Check out the latest development version: hg clone https://bitbucket.org/zhb/iredmail
- Update parameter LOCAL_ADDRESS to the IP of your Jail in iRedMail/conf/global before you execute it:

export LOCAL_ADDRESS='192.168.x.x'

Here 192.168.x.x is the IP address of your Jail.

- There's a new parameter SQL_HOSTNAME after LOCAL_ADDRESS like below.

# Hostname used in MySQL GRANT command.
# Usually it's 'localhost', but not in FreeBSD Jail (use ${LOCAL_ADDRESS} or
# hostname of Jail instead).
if [ X"${LOCAL_ADDRESS}" == X'127.0.0.1' ]; then
    export SQL_HOSTNAME='localhost'
else
    export SQL_HOSTNAME="${LOCAL_ADDRESS}"
fi

As you can see, it will be set to LOCAL_ADDRESS if LOCAL_ADDRESS is not '127.0.0.1', You don't need to update it manually.
So iRedMail will execute MySQL command like below:

mysql> GRANT SELECT ON vmail.* TO vmail@192.168.x.x IDENTIFIED BY 'xxx';

- Execute "bash iRedMail.sh" to start iRedMail installer.

19 (edited by perlporter 2012-08-17 03:05:45)

Re: iRedMail behind FreeBSD Jail

I will try now...
Thanks..

With the latest:

< INFO > Fetching all distfiles for port: www/apache22
===> Fetching all distfiles for apache-2.2.22_6 and dependencies
===>  apache-2.2.22_6 You need to enable at least one DBD backend.
*** Error code 1

Stop in /basejail/usr/ports/www/apache22.
*** Error code 1

Stop in /basejail/usr/ports/www/apache22.
< ERROR > Tarballs were not downloaded correctly, please fix it manually and then re-execute iRedMail.sh.

Lets try again....

Same thing, the error persists;

20 (edited by perlporter 2012-08-18 00:17:53)

Re: iRedMail behind FreeBSD Jail

I tried again with the latest version and the error continues ....

See below:

===>  License GPLv2 accepted by the user
< INFO > Fetching required distfiles for port: www/apache22
===> Fetching all distfiles for apache-2.2.22_6 and dependencies
===>  apache-2.2.22_6 You need to enable at least one DBD backend.
*** Error code 1

Stop in /basejail/usr/ports/www/apache22.
*** Error code 1

Stop in /basejail/usr/ports/www/apache22.
< ERROR > Tarballs were not downloaded correctly, please fix it manually and then re-execute iRedMail.sh.

And try again, now edit functions/packages_freebsd.sh:

OPTIONS_FILE_UNSET+=AUTHN_DBD
OPTIONS_FILE_UNSET+=DBD

And show other errors:


mod_authnz_ldap.c:1262: error: 'util_ldap_cache_compare' undeclared (first use in this function)
mod_authnz_ldap.c:1262: error: 'apr_OFN_uldap_cache_compare_t' undeclared (first use in this function)
mod_authnz_ldap.c:1262: error: expected expression before ')' token
mod_authnz_ldap.c:1262: error: invalid operands to binary *
mod_authnz_ldap.c:1263: error: 'util_ldap_cache_checkuserid' undeclared (first use in this function)
mod_authnz_ldap.c:1263: error: 'apr_OFN_uldap_cache_checkuserid_t' undeclared (first use in this function)
mod_authnz_ldap.c:1263: error: expected expression before ')' token
mod_authnz_ldap.c:1263: error: invalid operands to binary *
mod_authnz_ldap.c:1264: error: 'util_ldap_cache_getuserdn' undeclared (first use in this function)
mod_authnz_ldap.c:1264: error: 'apr_OFN_uldap_cache_getuserdn_t' undeclared (first use in this function)
mod_authnz_ldap.c:1264: error: expected expression before ')' token
mod_authnz_ldap.c:1264: error: invalid operands to binary *
mod_authnz_ldap.c:1265: error: 'util_ldap_ssl_supported' undeclared (first use in this function)
mod_authnz_ldap.c:1265: error: 'apr_OFN_uldap_ssl_supported_t' undeclared (first use in this function)
mod_authnz_ldap.c:1265: error: expected expression before ')' token
mod_authnz_ldap.c:1265: error: invalid operands to binary *
*** Error code 1

I believe that I should not change this file (functions/packages_freebsd.sh), right ?

Waiting for your instructions...

Thanks

21

Re: iRedMail behind FreeBSD Jail

Sorry about this trouble.

Caused by incorrect port config options, fixed in the latest development version, please check it out and try again.

Note: It's recommended to try it on a FRESH FreeBSD installation. If you cannot try it on a FRESH OS, please delete package "apr" first, then execute "bash iRedMail.sh" again.

# pkg_delete /var/db/pkg/apr-*

22

Re: iRedMail behind FreeBSD Jail

ZhangHuangbin wrote:

Sorry about this trouble.

Caused by incorrect port config options, fixed in the latest development version, please check it out and try again.

Note: It's recommended to try it on a FRESH FreeBSD installation. If you cannot try it on a FRESH OS, please delete package "apr" first, then execute "bash iRedMail.sh" again.

# pkg_delete /var/db/pkg/apr-*

I try now.... Thanks...

23 (edited by perlporter 2012-08-18 20:05:49)

Re: iRedMail behind FreeBSD Jail

The error in apache's gone
But the error in mysql continues ..
It seems to me that we need to give access to the root user in IP, something like:

grant select on *. * to root@192.168.1.1 IDENTIFIED BY 'secret';

I did it here .. and now I can not connect to mysql inside the jail type:

mysql-h 192.168.1.1-u root-p

At what point of the installation I could put the above command?

Makes sense to put it? (functions/mysql.sh)

mysqladmin --host=${MYSQL_SERVER} --user=root password "${MYSQL_ROOT_PASSWD}"

I tried to look this way:

| localhost                 | root | *EE814AF0AD6D3711F6100C779F6F606BB41FEAC8 | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |           
| 192.168.1.1               | root | *EE814AF0AD6D3711F6100C779F6F606BB41FEAC8 | Y           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 |        | NULL                  |

Still does not work .. but I think it's a way right?

24

Re: iRedMail behind FreeBSD Jail

Oops, my mistake again. Sorry about this trouble.

Does it allow connection inside Jail if you execute below SQL command out of Jail?

# mysql -h localhost -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.x.x'  IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

With above command, MySQL user "root" is allowed to connect from 192.168.x.x (IP of your Jail).
Then please test the MySQL connection inside Jail. For example:

# mysql -h 192.168.1.1-u root -p

25

Re: iRedMail behind FreeBSD Jail

I try, but not working, do not create the necessary tables in mysql...

Sorry for the inconvenience ..

But I really want to work the iRedMail within a FreeBSD Jail ..