Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 603504

Summary: net-dns/dnscrypt-proxy: init script should use checkpath instead of mkdir/touch/chown
Product: Gentoo Linux Reporter: Michael Orlitzky <mjo>
Component: Current packagesAssignee: Georgy Yakovlev <gyakovlev>
Status: RESOLVED FIXED    
Severity: normal CC: gyakovlev, polynomial-c
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=588462
Whiteboard:
Package list:
Runtime testing required: ---

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