Making Root Unprivileged
Listing 2. File Capabilities to Empower Partially Privileged Admins
/bin/kill:=ei /bin/ls:=ei /bin/cat:=ei /bin/ls:=ei /bin/mv:=ei /bin/touch:=ei /bin/mount:=ei /bin/umount:=ei /bin/vi:=ei /bin/rm:=ei /bin/chgrp:=ei /bin/find:=ei /bin/chmod:=ei /bin/chown:=ei /bin/mkdir:=ei /usr/sbin/useradd:=ei /usr/bin/passwd:=ei /usr/sbin/setcap:cap_setfcap=ei /bin/ping:cap_net_raw=ep /bin/su:=ep
Listing 3. Script to Apply File Capabilities
#!/bin/sh
for l in `cat $1`; do
fglob=`echo $l | awk -F: '{ print $1 '}`
p=`echo $l | awk -F: '{ print $2 '}`
for f in `/bin/ls $flglob`; do
setcap $p $f
done
done
Now, log in as each of these users and play around.
There are still a few problems though. For instance, log in as useradmin and try to change someone's password:
useradmin@kvm# passwd netadmin passwd: Only root can specify a user name.
That's no good! The passwd program has noticed that you are not root and won't let you change another user's password. We are finding more and more code, written to accommodate the subtleties of different operating systems, which would now need to be further complicated to support our unprivileged-root model.
You can work around this case for now in one of two easy ways. First, you simply can use the root user instead of useradmin. The root user still will not carry privileges unless it executes a (trusted) file with file capabilities. Second, you can continue to use the useradmin user name, but give it userid 0. Go ahead and try that. Edit /etc/passwd.conf, find the entry for useradmin, and change the first numeric column to 0. Then chown -R 0 /home/useradmin, so that he still can access his home directory. Now, you can log out and back in, and passwd will succeed. Actually, it ends with an error message, but you'll find that you did actually succeed in changing the password.
Now that you have some partially privileged administrative users, let's put the whole system in unprivileged-root mode. You could do this by patching the kernel, but in this case, let's patch init to use prctl() the same way that capwrap did. A patch to upstart, the Fedora init program, can be found in the Resources. You can apply it using steps similar to the openssh steps:
# yumdownloader --source upstart # rpm -i upstart*.rpm # cd rpmbuild # rpmbuild -bc SPECS/upstart.spec # cd BUILD/upstart* # patch -p1 < /usr/src/upstart.patch # cp /sbin/init /sbin/init.orig # make && make install
Also, in case something goes wrong, edit /boot/grub/grub.conf, comment out hiddenmenu, and set timeout to 10 instead of 0. Now if something goes wrong, you can interrupt the boot process and add init=/sbin/init.orig to the end of your boot line.
The patched init enables all capabilities in its inheritable set. It also keeps its permitted and effective sets filled, although you should be able to drop many from its permitted set, keeping its effective set empty for most of its run. You will need to add file capabilities to many of the programs used during system startup. Ideally, you would modify each of these programs so as to avoid setting the legacy bit, but again this is a lazy proof of concept. Listing 4 contains a list that is sufficient for boot to succeed on the F10 image.
Listing 4. Capabilities Needed to Boot Fedora with Unprivileged Root
/sbin/fsck:=ei /sbin/udevd:=ei /sbin/shutdown:=ei /sbin/e2fsck:=ei /sbin/mingetty:cap_chown,cap_dac_override,cap_sys_tty_config+ei /sbin/dhclient:=ei /sbin/reboot:=ei /sbin/fsck.ext3:=ei /sbin/hwclock:cap_sys_time=ei /bin/setfont:cap_sys_admin,cap_sys_resource,cap_sys_tty_config=ei /bin/hostname:cap_sys_admin=ei /bin/loadkeys:cap_sys_admin,cap_sys_resource,cap_sys_tty_config=ei /usr/bin/stat:cap_dac_override,cap_dac_read_search=ei /sbin/rsyslogd:cap_sys_admin,cap_audit_write=ei /bin/login:all=ei /sbin/MAKEDEV:=ei /sbin/auditd:=ei /sbin/auditctl:=ei /sbin/microcode_ctl:=ei /usr/bin/hal-*:=ei /usr/sbin/hald:=ei /usr/libexec/hal*:=ei /sbin/insmod:=ei /sbin/modprobe:=ei /sbin/rmmod:=ei /bin/plymouth:=ei /usr/bin/Xorg:=ei /usr/sbin/gdm-binary:=ei /bin/dbus-daemon:=ei /usr/sbin/avahi-daemon:=ei /usr/bin/sessreg:=ei /sbin/pam_console_apply:=ei /usr/sbin/gpm:=ei /lib/dbus-1/dbus-daemon-launch-helper:=ep /sbin/initctl:=ei /usr/sbin/console-kit-daemon:=ep /usr/sbin/NetworkManager:=ei /usr/libexec/gdm*:=ei /usr/sbin/gdm-binary:=ei
You can apply these with the same script as before (Listing 3).
You'll also need to execute:
chmod go-x /usr/sbin/console-kit-daemon
You're giving it forced rather than inherited permissions in lieu of changing the (setuid-root) dbus-daemon-launch-helper code so as to fill its inheritable set. This means any user would receive full privilege when executing it, so you allow only root to execute it.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Speed Up Your Web Site with Varnish | Jun 19, 2013 |
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
- Speed Up Your Web Site with Varnish
- Containers—Not Virtual Machines—Are the Future Cloud
- Linux Systems Administrator
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- Non-Linux FOSS: libnotify, OS X Style
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- RSS Feeds
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




1 hour 41 min ago
1 hour 58 min ago
3 hours 14 min ago
4 hours 3 min ago
4 hours 6 min ago
4 hours 15 min ago
4 hours 45 min ago
7 hours 11 min ago
11 hours 10 min ago
12 hours 27 min ago