Bug 782499

Summary: Propose that you turn on PrivateTmp=true in service file for dhcpd
Product: [Fedora] Fedora Reporter: Daniel Walsh <dwalsh>
Component: dhcpAssignee: Jiri Popelka <jpopelka>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jpopelka
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-17 12:23:06 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 782466    

Description Daniel Walsh 2012-01-17 10:39:30 EST
I would like to propose using PrivateTmp for dhcpd systemd unit file
This should make the use of /tmp directory more secure
and avoid users from being able to potentially effect it.

http://fedoraproject.org/wiki/Features/ServicesPrivateTmp
Comment 1 Jiri Popelka 2012-01-25 09:30:00 EST
Actually it's only dhclient (dhclient-script) that uses /tmp.
There's a code in dhcpd that reads attributes of files in /tmp
to generate semi random data, but it doesn't seem to be used anyway.

So I'm going to revert the change I already did and close this as NOTABUG.
Comment 2 Daniel Walsh 2012-01-25 15:44:30 EST
Well do any of the scripts to redirection within bash

command << _EOF
...
_EOF

Also can't dhclient-script execute custom scripts?
Comment 3 Jiri Popelka 2012-01-26 01:57:02 EST
(In reply to comment #2)
> Well do any of the scripts to redirection within bash
> 
> command << _EOF
> ...
> _EOF

Not sure whether this is what you are asking (if that was a question),
but dhclient-script uses /tmp this way:
rscf="$(mktemp ${TMPDIR:-/tmp}/XXXXXX)"
echo "nameserver ${nameserver}" >> ${rscf}
change_resolv_conf ${rscf}
rm -f ${rscf}

change_resolv_conf is from
/etc/sysconfig/network-scripts/network-functions
and for example
/etc/sysconfig/network-scripts/ifup-post
use it the same way.

> Also can't dhclient-script execute custom scripts?

Yes, it runs (if they exist)
/etc/dhcp/dhclient-enter-hooks
/etc/dhcp/dhclient-up-hooks
/etc/dhcp/dhclient-down-hooks
/etc/dhcp/dhclient-exit-hooks
/etc/dhcp/dhclient.d/*.sh
Comment 4 Daniel Walsh 2012-01-26 17:34:16 EST
So why not be secure by default and not have to worry about users hacking something in here to break dhclient or get a privledge exploit?
Comment 5 Jiri Popelka 2012-01-27 03:24:27 EST
I'm not sure I understand.
There's no dhclient systemd unit to put PrivateTmp into.
dhclient is started either by NetworkManager (NM) or by network-scripts.
And in case of NM the dhclient-script is even not used because NM has its own "script" for dhclient.
Comment 6 Daniel Walsh 2012-01-27 11:21:07 EST
I thought I checked that it is had a systemd unit file.  

Sorry never mind.