Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603504 - net-dns/dnscrypt-proxy: init script should use checkpath instead of mkdir/touch/chown
Summary: net-dns/dnscrypt-proxy: init script should use checkpath instead of mkdir/tou...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Georgy Yakovlev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-22 21:04 UTC by Michael Orlitzky
Modified: 2017-11-19 02:50 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Orlitzky gentoo-dev 2016-12-22 21:04:41 UTC
The existing init scripts for dnscrypt-proxy call mkdir, touch, and chown to create files/directories with some specified permissions:

  mkdir "${rundir}"
  if [ -n "${runas_user}" ]; then
    touch "${DNSCRYPT_LOGFILE}"
    chown ${runas_user}:${runas_group} "${DNSCRYPT_LOGFILE}"
    chown -R ${runas_user}:${runas_group} "${rundir}"
  fi

It would be better to use "checkpath" from OpenRC to create the directory/file. Checkpath is more portable, because it's part of OpenRC. It's also more secure, because chown will follow symlinks (change ownership of the target) while checkpath will not.

It looks like this issue has already been addressed in bug #588462, where the attached init script does not call "chown" at all.
Comment 1 Georgy Yakovlev archtester gentoo-dev 2017-11-19 02:50:54 UTC
The bug has been closed in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ee515fb8a5ff324983ec37c38ec1e2dc8d7aaa6

commit 0ee515fb8a5ff324983ec37c38ec1e2dc8d7aaa6
Author:     Georgy Yakovlev <ya@sysdump.net>
AuthorDate: 2017-08-07 20:52:14 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2017-11-07 08:48:03 +0000