log failure in filter reload, use lowered permissions on initial filter-read#219
Closed
HeikoSchlittermann wants to merge 2 commits intotinyproxy:masterfrom
Closed
log failure in filter reload, use lowered permissions on initial filter-read#219HeikoSchlittermann wants to merge 2 commits intotinyproxy:masterfrom
HeikoSchlittermann wants to merge 2 commits intotinyproxy:masterfrom
Conversation
Re-read the filter file with the runtime user permissions, create useful log message when the filter cannot be read. Fixes Debian #756040.
Contributor
|
funny, was just about to remove the SIGHUP functionality at all... see: #218 |
rofl0r
reviewed
Dec 20, 2018
| */ | ||
| if (connfd < 0) { | ||
| log_message (LOG_ERR, | ||
| if (errno != EAGAIN) /* do not spam the logs */ |
Contributor
There was a problem hiding this comment.
under which circumstances do you get an EAGAIN here ?
Author
|
rofl0r <notifications@github.com> (Do 20 Dez 2018 03:14:04 CET):
rofl0r commented on this pull request.
> @@ -304,7 +304,8 @@ static void child_main (struct child_s *ptr)
* Make sure no error occurred...
*/
if (connfd < 0) {
- log_message (LOG_ERR,
+ if (errno != EAGAIN) /* do not spam the logs */
under which circumstances do you get an EAGAIN here ?
When the child process gets the SIGHUP, the accept() gets interrupted
and returns EAGAIN, which is expected and should be fine.
Best regards from Dresden/Germany
Viele Grüße aus Dresden
Heiko Schlittermann
--
SCHLITTERMANN.de ---------------------------- internet & unix support -
Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
gnupg encrypted messages are welcome --------------- key ID: F69376CE -
! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -
|
Author
|
rofl0r <notifications@github.com> (Do 20 Dez 2018 03:11:59 CET):
funny, was just about to remove the SIGHUP functionality at all... see: #218
Ok, you changed the model used for parallelism from pre-fork to pthread.
That's good, I believe, as long as there are no problems with shared
resources. (But I'm not very familiar with libpthread, so I can't tell.)
The change I introduced had the sole purpose to avoid delayed surprise
because the HUPped processes were not able to read the file (depending
on the permissions on the file - here root:root 640).
And somehow I touched the SIGHUP handling, as it seems :)
Best regards from Dresden/Germany
Viele Grüße aus Dresden
Heiko Schlittermann
--
SCHLITTERMANN.de ---------------------------- internet & unix support -
Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
gnupg encrypted messages are welcome --------------- key ID: F69376CE -
! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -
|
Contributor
|
i think this PR is no longer needed; if i'm wrong on that please reopen. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a long standing bug entry in the Debian packaged tinyproxy (Debian #756040).
I fixed this some years ago and I believe, the fix could be included in the upstream source.
Old behaviour:
Tinyproxy read the config and the filter file with the startup permissions (usually root).
After a HUP (reload), e.g. issued after regular logrotate, the child processes ran with lowered permissions and - depending on the perms of the filter file - they couldn't re-read the filter. And they didn't even iussed a notice about that failure.
New behaviour:
Read the filter definition after changing the uid of the tinyproxy processes, and write a log message there is a failure in reading the filter definition.