Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please do not chown/chmod if the log file is a device like e.g. /dev/null #383

Closed
xtaran opened this issue Feb 9, 2015 · 5 comments
Closed
Assignees

Comments

@xtaran
Copy link

xtaran commented Feb 9, 2015

Please suppress the chown/chmod on the log file if the destination file is a device like e.g. /dev/null, i.e. any path starting with /dev/.

Changing the permissions of /dev/null unexpectedly is known to cause the weirdest issues as e.g. shell scripts running under a non-root user will fail upon redirection to /dev/null, etc.

(Yes, I know doing so isn't the best idea, but someone may try it just for an experiment, reverts it soon afterwards, but the damage is done already. And maybe the administrator doesn't even relate the new issues caused by this with his little experiment, because he already reverted that change -- which does't revert the permission changes on /dev/null.)

For completeness: I experienced this behaviour on Debian 7 Wheezy (current Debian Stable Release) which ships syslog-ng 3.3.5.

@faxm0dem
Copy link
Contributor

faxm0dem commented Feb 9, 2015

happened to a collegue of mine too :)

@bazsi
Copy link
Collaborator

bazsi commented Feb 16, 2015

This is a good idea, although it should probably be based on a filename,
and not the file type. unix-stream() driver opens a UNIX socket.

Anyway, this is pretty straightforward to implement something like this,
anyone volunteering? :) I can help with review and getting the patch
integrated. Maybe you can even ask for help on the mailing list.

Bazsi

On Mon, Feb 9, 2015 at 4:37 PM, Fabien Wernli notifications@github.com
wrote:

happened to a collegue of mine too :)


Reply to this email directly or view it on GitHub
#383 (comment).

@xtaran
Copy link
Author

xtaran commented Feb 16, 2015

Hi,

On Mon, Feb 16, 2015 at 02:38:05AM -0800, Balazs Scheidler wrote:

This is a good idea, although it should probably be based on a filename,
and not the file type.

Actually that was what I had in mind: Any file name that matches
"/dev/" at the beginning (i.e. "^/dev/").

    Kind regards, Axel

/~\ Plain Text Ribbon Campaign | Axel Beckert
\ / Say No to HTML in E-Mail and News | abe@deuxchevaux.org (Mail)
X See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber)
/ \ I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)

@deirf
Copy link

deirf commented Jul 7, 2015

I think it could not be checked only if the file (source or destination) is a device because all devices are system entity in filesystem.

@deirf
Copy link

deirf commented Jul 7, 2015

PR: #550

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants