`ServerTransportPlugin` option exit cleanly with exit code `-1`, but with no user-friendly log warning when the argument `path-to-binary` is invalid
If we add in /etc/tor/torrc
the line ServerTransportPlugin obfs4 exec /path/that/does/not/exist
, have log minimum severity to info
and execute the command sudo systemctl reload tor
, we can clearly see in the following log extract, that the path-to-binary
argument is improperly or not at all validated before executing it :
`XXX 00 00:00:00.001 [notice] Tor 0.4.5.6 opening new log file.` \
`[...]` \
`XXX 00 00:00:00.002 [info] process_exec(): Starting new process: /path/that/does/not/exist` \
`XXX 00 00:00:00.020 [info] launch_managed_proxy(): Managed proxy at \'/path/that/does/not/exist\' has spawned with PID \'XXXXX\'. ` \
`[...]` \
`XXX 00 00:00:00.300 [info] notify_waitpid_callback_by_pid(): Child process XXXXX has exited; running callback.` \
`XXX 00 00:00:00.300 [warn] Pluggable Transport process terminated with status code 256` \
`[...]` \
A relay operator who do no pay enough attentions while reading logs and have log minimum severity of notice
will only see :
XXX 00 00:00:00.300 [warn] Pluggable Transport process terminated with status code 256
We should definitely have a user-friendly log message to notify the operator that there is a problem with is configuration file.
The file tor-0.4.5.6/app/config/config.c
, at the fonction pt_parse_transport_line()
, in the else
statement between line 5377 and 5421 look a promising place to validate the path-to-binary
.
There is already a test for this case of non-existent executable, at tor-0.4.5.6/src/test/test_process_slow.c
, test_nonexistent_executable()
, starting at line 331.