vexim / vexim2

Virtual Exim 2
Other
70 stars 47 forks source link

vexim database setup incompatible with systemd private tmp files #168

Closed ikonia closed 8 years ago

ikonia commented 8 years ago

using vexim's default and documented configuration it tries to use a mysql socket file /tmp/mysql.sock.

systemd enabled systems Centos7/RHEL 7, ubuntu 16.04, Debian 8 etc, have private tmp directories configured which will jail process tmp directories within /tmp, eg: /tmp/systemd-private-81035528fa9c40a18d3bcbf021ef25a2-mariadb.service-8HqHnS/tmp/ for mysql/maria db, this string will always be random, so there is no way to configure it as a static file.

The three immediate work a round for this are

a.) disable systemd private tmp directorys (not good practice. b.) set mysql tmp file to a static location (eg: /run/mysql.sock) but this defeats the object of private tmp dirs c.) change references from localhost to to 127.0.0.1 in any reference to mysql, to force it to use a tcp connection rather than tmp socket file.

In the mean time I'm looking at options on how to better configure vexim to use private system temp directories as most modern distros are using this now.

Udera commented 8 years ago

using vexim's default and documented configuration it tries to use a mysql socket file /tmp/mysql.sock.

I think this part dates back to the first releases of vexim (based on FreeBSD systems): https://github.com/vexim/vexim2/blame/4d7bd7be8643035a96f8e23d51cc5474bd746596/docs/configure#L86

I'm not sure about the whole private tmp-dir concept. It seems to me as if processes store their tmp-data in such a folder that they don't (want to) share with other services. But a db-server socket allows other services to get access to the database. http://serverfault.com/questions/735987/mysql-cant-create-socket-in-tmp-but-everywhere-else

Debian/Ubuntu put the mysql socket by default to /var/run/mysqld/mysqld.sock. I'm not sure for CentOS or FreeBSD how they are supposed to handle this. I don't see why your solution b) defeats the object of private tmp dirs, runtime tmp-data will still be in a private tmp-dir.

rimas-kudelis commented 8 years ago

It's not really default configuration, but more of example configuration.

However, I'm thinking that perhaps we should make Debian or CentOS that example. Holding on to these decade-old pathnames while not even being sure if they still apply (because we aren't using FreeBSD ourselves) doesn't make much sense. I'm a Debian/Ubuntu user, and from my understanding, @Udera is as well. Unless anyone wants to ensure the correctness of our examples on CentOS/RHEL, I think the choice is quite obvious.

Udera commented 8 years ago

Normally, I'm using debian. Now, I installed a FreeBSD system and used the packages from https://www.freshports.org/mail/vexim/. That works surprisingly good. I already was successful with the database migration, I still have to review the configure-file. These packages are really nice, they copy all files to the right place, fixe the user permissions and so on. Perhaps it would be nice to provide *.deb-packages as well that we reduce the manual steps.

The FreeBSD ports were updated over the time. So I think there are some users on FreeBSD.

rimas-kudelis commented 8 years ago

The example has now been changed to /var/run/mysqld/mysqld.sock. I'm not sure if this is correct for EL-based distros, but I just want to point that the MySQL socket file is not really a "temporary" file in the usual sense, so I don't expect it to be hidden somewhere in a process-private dir in CentOS or RHEL. The path above applies in Debian/Ubuntu, and I suppose something similar would apply to EL-based distributions. I think we can close this?

Udera commented 8 years ago

FreeBSD still uses /tmp-directory for sockets. This has little to do with vexim, best is to do what your distro does and fix the path in your configuration. So I think we can close this.

rimas-kudelis commented 8 years ago

Usage of /tmp under FreeBSD can be mentioned in the README, that's about all we can do.