Do user switch after SSL keys are initialized
authorWim de With <nauxuron@wimdewith.com>
Tue, 5 Jan 2016 14:04:59 +0000 (15:04 +0100)
committerWim de With <nauxuron@wimdewith.com>
Mon, 4 Apr 2016 18:45:39 +0000 (20:45 +0200)
commit571e132795d595c7c4ce39b5b1bc9aae6a72f4cd
treee8dbde06d50d9f7881aff52e37927a0e4ebe5c63
parent779660334a7291f4918e313a78ed48f4d3d6e0a5
Do user switch after SSL keys are initialized

Since SSL private keys are usually stored as readable by root only, and
if a user to switch to is specified, the switch will already have taken
place before the SSL keys are read. This means that umurmur still won't
have permission to read the keys. The fix is to switch users after
initialization.

The second problem occurs when systemd is used. If systemd is used, it's
better to let systemd handle the daemonizing of the process. However,
this means that the process will never switch users when the systemd
service is started. So this fixes that by switching the user in all
cases.
src/main.c