trusteddomainproject / OpenARC

Open source ARC implementation
BSD 2-Clause "Simplified" License
135 stars 45 forks source link

1.0.0 Beta0 fails to start with existing configuration #99

Closed cshawaus closed 4 years ago

cshawaus commented 6 years ago

Hi,

I tried updating to the beta from 0.1.0, compiling goes well but upon restarting the service I get the below error.

systemd[1]: Starting Authenticated Resource Chain (ARC) Milter...
openarc[16589]: openarc: /etc/openarc/openarc.conf: refile:/etc/opendkim/TrustedHosts: arcf_list_load(): No such file or directory
systemd[1]: openarc.service: Control process exited, code=exited status=78
systemd[1]: Failed to start Authenticated Resource Chain (ARC) Milter.

Switching back to 0.1.0 works as expected.

Below is the link to my configuration file which works perfectly with 0.1.0. https://gist.github.com/cshawaus/05e08b939b8ae66644e5340cba1d28c3

System Details

OS: Ubuntu 16.04.4 LTS OpenDKIM: 2.10.3 Postfix: 3.1.0

jeredfloyd commented 6 years ago

Same issue. Mine reads: openarc: /etc/openarc.conf: ::/0: arcf_list_load(): No such file or directory

This is due to a change in the parsing of InternalHosts. #101 includes a patch.

jeredfloyd commented 6 years ago

On further inspection, I am not clear that #101 is the correct patch. It seems that the openarc.conf refers to a "dataset" type akin to opendkim.conf, but the implementation always treats the argument for PeerList and InternalHosts as a file.

Why OpenARC treats fields differently from OpenDKIM is beyond me.

slashrolf commented 6 years ago

I can conform this issue. After starting openarc.service I see:

$ sudo systemctl status openarc ● openarc.service - Authenticated Resource Chain (ARC) Milter Loaded: loaded (/lib/systemd/system/openarc.service; linked; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2018-08-11 12:23:22 CEST; 7min ago Docs: man:openarc(8) man:openarc.conf(5) http://www.trusteddomain.org/openarc Process: 22837 ExecStart=/usr/local/openarc-0.1.0/sbin/openarc $OPTIONS (code=exited, status=78)

Aug 11 12:23:22 lithium systemd[1]: Starting Authenticated Resource Chain (ARC) Milter... Aug 11 12:23:22 lithium systemd[1]: openarc.service: Control process exited, code=exited status=78 Aug 11 12:23:22 lithium systemd[1]: Failed to start Authenticated Resource Chain (ARC) Milter. Aug 11 12:23:22 lithium systemd[1]: openarc.service: Unit entered failed state. Aug 11 12:23:22 lithium systemd[1]: openarc.service: Failed with result 'exit-code'.

mskucherawy commented 6 years ago

I can't reproduce this locally. What's in your openarc.conf and in your InternalHosts file?

mskucherawy commented 6 years ago

What happens when you run openarc from the shell directly?

I agree with the earlier synopsis: You're apparently using OpenDKIM syntax for "InternalHosts". OpenARC does not (yet) know what a "refile" is. It only understands plain text files. Thus, that prefix is assumed to be part of the filename.

slashrolf commented 6 years ago

I didn't set InternalHosts yet.

slashrolf commented 6 years ago

I just set InternalHosts to /etc/openarc/internalhosts

and the contents of internalhosts is just one line:

127.0.0.1

Next, I tried to start openarc using systemctl and got:

systemctl status openarc

● openarc.service - Authenticated Resource Chain (ARC) Milter Loaded: loaded (/lib/systemd/system/openarc.service; linked; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2018-09-17 23:48:37 CEST; 3min 39s ago Docs: man:openarc(8) man:openarc.conf(5) http://www.trusteddomain.org/openarc Process: 29651 ExecStart=/usr/local/openarc-0.1.0/sbin/openarc $OPTIONS (code=exited, status=203/EXEC)

Sep 17 23:48:37 lithium systemd[1]: Starting Authenticated Resource Chain (ARC) Milter... Sep 17 23:48:37 lithium systemd[1]: openarc.service: Control process exited, code=exited status=203 Sep 17 23:48:37 lithium systemd[1]: Failed to start Authenticated Resource Chain (ARC) Milter. Sep 17 23:48:37 lithium systemd[1]: openarc.service: Unit entered failed state. Sep 17 23:48:37 lithium systemd[1]: openarc.service: Failed with result 'exit-code'.

I created /var/run/openarc and made it owner openarc:openarc.

slashrolf commented 6 years ago

cat /lib/systemd/system/openarc.service

After=network.target nss-lookup.target syslog.target

[Unit] Description=Authenticated Resource Chain (ARC) Milter Documentation=man:openarc(8) man:openarc.conf(5) http://www.trusteddomain.org/openarc After=network.target nss-lookup.target syslog.target

[Service] Type=forking PIDFile=/var/run/openarc/openarc.pid EnvironmentFile=/etc/default/openarc ExecStart=/usr/local/openarc-0.1.0/sbin/openarc $OPTIONS ExecReload=/bin/kill -USR1 $MAINPID User=openarc Group=openarc

[Install] WantedBy=multi-user.target

slashrolf commented 6 years ago

and openarc.conf:

AuthservID mx3.mailtransaction.com AutoRestart yes AutoRestartCount 10 AutoRestartRate 10/1h Domain mailtransaction.com InternalHosts /etc/openarc/internalhosts KeepTemporaryFiles no KeyFile /etc/openarc/201808.private MilterDebug 0 Mode sv Selector 201808 SignatureAlgorithm rsa-sha256 Socket inet:3336@localhost SoftwareHeader yes Syslog Yes SyslogFacility mail TemporaryDirectory /tmp UserID openarc:openarc

slashrolf commented 6 years ago

Oh, BTW: when I start openarc from the shell it runs OK. Well, eh..., it runs for a couple of days and then it's gone, not yet had time to investigate that problem.

slashrolf commented 6 years ago

FYI: compiled and run it on Ubuntu server: Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-135-generic x86_64)

mskucherawy commented 6 years ago

Status 203 is interesting. Our exit codes are only the ones defined in .

slashrolf commented 6 years ago

Not sure I did the right thing. As I compiled from source there is no standard systemd startup file, so I copied things from opendkim (IIRC).

slashrolf commented 6 years ago

I'm sorry, corrected the path to the executable and now I get the error=78 again:

journalctl -xe -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit openarc.service has begun starting up. Sep 18 00:25:32 lithium systemd[29955]: openarc.service: Failed at step EXEC spawning /usr/local/openarc-0.1.0/sbin/openarc: No such file or directory -- Subject: Process /usr/local/openarc-0.1.0/sbin/openarc could not be executed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- The process /usr/local/openarc-0.1.0/sbin/openarc could not be executed and failed. -- -- The error number returned by this process is 2. Sep 18 00:25:32 lithium systemd[1]: openarc.service: Control process exited, code=exited status=203 Sep 18 00:25:32 lithium systemd[1]: Failed to start Authenticated Resource Chain (ARC) Milter. -- Subject: Unit openarc.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit openarc.service has failed. -- -- The result is failed. Sep 18 00:25:32 lithium systemd[1]: openarc.service: Unit entered failed state. Sep 18 00:25:32 lithium systemd[1]: openarc.service: Failed with result 'exit-code'. Sep 18 00:25:42 lithium systemd[1]: Reloading. Sep 18 00:25:42 lithium systemd[1]: Started ACPI event daemon. -- Subject: Unit acpid.service has finished start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit acpid.service has finished starting up. -- -- The start-up result is done. Sep 18 00:25:52 lithium systemd[1]: Stopped Authenticated Resource Chain (ARC) Milter. -- Subject: Unit openarc.service has finished shutting down -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit openarc.service has finished shutting down. Sep 18 00:25:57 lithium systemd[1]: Starting Authenticated Resource Chain (ARC) Milter... -- Subject: Unit openarc.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit openarc.service has begun starting up. Sep 18 00:25:57 lithium openarc[29997]: openarc: milter socket must be specified Sep 18 00:25:57 lithium openarc[29997]: (use "-?" for help) Sep 18 00:25:57 lithium systemd[1]: openarc.service: Control process exited, code=exited status=78 Sep 18 00:25:57 lithium systemd[1]: Failed to start Authenticated Resource Chain (ARC) Milter. -- Subject: Unit openarc.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit openarc.service has failed. -- -- The result is failed. Sep 18 00:25:57 lithium systemd[1]: openarc.service: Unit entered failed state. Sep 18 00:25:57 lithium systemd[1]: openarc.service: Failed with result 'exit-code'.

slashrolf commented 6 years ago

Hmm, in /etc/init.d/openarc there is a line:

SOCKET=local:$RUNDIR/$NAME.sock

and a line: CONFIG_SOCKET=awk '$1 == "Socket" { print $2 }' /etc/openarc/openarc.conf

Which one is used?

/rolf

mskucherawy commented 6 years ago

I'd have to see the whole file. If both the command line flag "-p" and the "Socket" value in the config file are present when the filter is started, the config file's value wins.

But even if that path refers to something that doesn't exist, this wouldn't explain a 78 exit code. That's explicitly a configuration error.

Where does stderr go from these invocations? That's where the true error should be visible.

slashrolf commented 6 years ago

/etc/init.d/openarc:

openarc.txt

slashrolf commented 6 years ago

/etc/openarc/openarc.conf:

openarc.conf.txt

slashrolf commented 6 years ago

Not sure where stderr is directed to during startup. Will try to find out.

slashrolf commented 6 years ago

I think stderr is directed to /var/log/syslog. In /var/log/syslog I see the following:

Sep 28 21:53:11 lithium systemd[1]: Starting Authenticated Resource Chain (ARC) Milter... Sep 28 21:53:11 lithium openarc[24968]: openarc: milter socket must be specified Sep 28 21:53:11 lithium openarc[24968]: #011(use "-?" for help) Sep 28 21:53:11 lithium systemd[1]: openarc.service: Control process exited, code=exited status=78 Sep 28 21:53:11 lithium systemd[1]: Failed to start Authenticated Resource Chain (ARC) Milter. Sep 28 21:53:11 lithium systemd[1]: openarc.service: Unit entered failed state. Sep 28 21:53:11 lithium systemd[1]: openarc.service: Failed with result 'exit-code'.

slashrolf commented 6 years ago

I wonder where the startup line in openarc.service:

ExecStart=/usr/local/openarc/sbin/openarc $OPTIONS

gets its OPTIONS variable from?

slashrolf commented 6 years ago

I was able to get a proper working startup, by explicitely setting:

PidFile /var/run/openarc/openarc.pid

in /etc/openarc/openarc.conf and by changing the ExecStart line in the openarc.service file to:

ExecStart=/usr/local/openarc/sbin/openarc -c /etc/openarc/openarc.conf -u openarc

After doing a 'systemctl daemon-reload', openarc started without a problem.