Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603266 - app-mobilephone/smstools: init script should use checkpath instead of mkdir/chown/chmod
Summary: app-mobilephone/smstools: init script should use checkpath instead of mkdir/c...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Tony Vroon (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-20 23:10 UTC by Michael Orlitzky
Modified: 2017-09-12 07:22 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-20 23:10:34 UTC
The init script for smstools uses a series of mkdir, chown, and chmod to create a directory it needs at runtime:

  if ! [ -d /var/run/smsd ]; then
      ebegin "Creating /var/run/smsd for ${SVCNAME}"
      mkdir /var/run/smsd \
          && chown smsd:sms /var/run/smsd \
          && chmod 770 /var/run/smsd
          eend $?
  fi

  chown smsd:sms /var/log/smsd.log
  ...

It would be better to use "checkpath" (man openrc-run) which comes with OpenRC. It's more portable, since users are guaranteed to have OpenRC, and more secure: chown and chmod will follow symlinks and change ownership/permissions on the target. Checkpath won't, so if root:root ever loses full control of those paths, having the init script use checkpath will prevent a root privilege escalation by the smsd user or sms group, who might be able to change /var/run/smsd to a symlink.
Comment 1 Tony Vroon (RETIRED) gentoo-dev 2017-09-11 13:22:52 UTC
Resolved in tree with 3.1.21-r1; thank you for your report.
Comment 2 Michael Orlitzky gentoo-dev 2017-09-11 14:49:30 UTC
Thanks! I haven't done the CVE or Gentoo bug for this yet, but just to give you a heads up -- there's another problem with the init script that's going to be kinda hard to fix without upstream cooperation:

http://smstools3.kekekasvi.com/topic.php?id=1459

It looks like the maintainer is leaning towards having the init script do all the work to ensure that it doesn't kill the wrong process.
Comment 3 Tony Vroon (RETIRED) gentoo-dev 2017-09-12 07:22:34 UTC
Michael, if you can write a fixed init script and test that it stops & starts okay, please feel free to revbump this package in the tree.