cossacklabs / acra

Database security suite. Database proxy with field-level encryption, search through encrypted data, SQL injections prevention, intrusion detection, honeypots. Supports client-side and proxy-side ("transparent") encryption. SQL, NoSQL.
https://www.cossacklabs.com/acra/
Apache License 2.0
1.34k stars 128 forks source link

Fix sighup handler [T2625] #557

Closed Lagovas closed 2 years ago

Lagovas commented 2 years ago

Found that process reloading on SIGHUP stopped properly handling for acra-server and acra-translator. Previously it used first argument of the process which is process's name. Under the hood golang calls execve which doesn't search binary in PATH. Linux has execlp(), execvp(), and execvpe() functions for that. But instead of using raw syscall's we use golang's wrappers from syscall package which doesn't provide these functions. Otherwise it has portability and do other useful things like child checking, lock handling, etc

So, in this PR added searching absolute path of binary from binary name before calling ForkExec. Additionally added integration tests that checks sockets forwarding to child process and pulling config_file changes on SIGHUP.

Checklist