Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603376 - net-firewall/ipset: init script should use checkpath instead of touch/chmod
Summary: net-firewall/ipset: init script should use checkpath instead of touch/chmod
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-21 20:34 UTC by Michael Orlitzky
Modified: 2017-11-30 20:36 UTC (History)
0 users

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-21 20:34:32 UTC
The save() function of ipset calls "touch" and "chmod" to create a mode 600 file:

  save() {
    ebegin "Saving ipset session"
    touch "${IPSET_SAVE}"
    chmod 0600 "${IPSET_SAVE}"
    ipset save > "${IPSET_SAVE}"
    eend $?
  }

A single call to "checkpath" from OpenRC (man openrc-run) would be better. It's more portable, being part of OpenRC, but it's also slightly more secure: chmod will follow a symlink and change the mode of a target; checkpath won't.

There's no real risk here, but since checkpath is a better choice anyway, the absence of chmod would be reassuring.
Comment 1 Larry the Git Cow gentoo-dev 2017-11-30 20:36:06 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ae1990e869c46b56da84d4202d52dfb3ebd21aa

commit 3ae1990e869c46b56da84d4202d52dfb3ebd21aa
Author:     Robin H. Johnson <robbat2@gentoo.org>
AuthorDate: 2017-11-30 20:28:32 +0000
Commit:     Robin H. Johnson <robbat2@gentoo.org>
CommitDate: 2017-11-30 20:35:48 +0000

    net-firewall/ipset: improve init.d save
    
    Closes: https://bugs.gentoo.org/603376
    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
    Package-Manager: Portage-2.3.16, Repoman-2.3.6

 net-firewall/ipset/files/ipset.initd-r4 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)