| 1 |
.TH "reducecap" "8" "0.1.0" "Klavs Klavsen <kl@vsen.dk>" "System Administration" |
|---|
| 2 |
.SH "NAME" |
|---|
| 3 |
.LP |
|---|
| 4 |
reducecap \- The reducecap utility is used to lower the capability ceiling of a process and child process. |
|---|
| 5 |
.SH "SYNTAX" |
|---|
| 6 |
.LP |
|---|
| 7 |
reducecap [\fIoptions\fP] <\fIcommand arguments\fP> |
|---|
| 8 |
.SH "DESCRIPTION" |
|---|
| 9 |
.LP |
|---|
| 10 |
The reducecap utility is used to lower the capability ceiling of a process and child process. Even setuid program won't be able to grab more capabilities. |
|---|
| 11 |
.SH "OPTIONS" |
|---|
| 12 |
.LP |
|---|
| 13 |
.TP |
|---|
| 14 |
\fB\-\-secure\fR Removes all dangerous capabilities from the process executed.Specificly it removes: |
|---|
| 15 |
CAP_LINUX_IMMUTABLE CAP_NET_BROADCAST CAP_NET_ADMIN, CAP_NET_RAW CAP_IPC_LOCK CAP_IPC_OWNER CAP_SYS_MODULE CAP_SYS_RAWIO CAP_SYS_PACCT CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_NICE CAP_SYS_RESOURCE CAP_SYS_TIME CAP_MKNOD. |
|---|
| 16 |
|
|---|
| 17 |
Leaving the following capabilities: |
|---|
| 18 |
CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH CAP_FOWNER CAP_FSETID CAP_KILL CAP_SETGID CAP_SETUID CAP_NET_BIND_SERVICE CAP_SYS_CHROOT CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG CAP_LEASE CAP_QUOTACTL |
|---|
| 19 |
.TP |
|---|
| 20 |
\fB\-\-show\fR Shows the current process capabilities. |
|---|
| 21 |
.TP |
|---|
| 22 |
\fB\-\-flag\fR |
|---|
| 23 |
sets the security context flags. The option may be repeated |
|---|
| 24 |
several times. Here are the values: |
|---|
| 25 |
|
|---|
| 26 |
lock: The security context can't be changed. The process is trapped |
|---|
| 27 |
in this context. This is generally used for vservers because yoy |
|---|
| 28 |
do not want them to hide in new security context. |
|---|
| 29 |
|
|---|
| 30 |
sched: Each process in a security context contribute (lower) to the general |
|---|
| 31 |
priority of every processes in the context. Mostly, all processes |
|---|
| 32 |
in a security context take as much CPU together as one process |
|---|
| 33 |
not bound to this flag. Said again differently, a vserver having |
|---|
| 34 |
100 active processes won't get more CPU than another vserver |
|---|
| 35 |
with a single active process. |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
nproc: The "ulimit -u N" setting becomes global to the security context. It means |
|---|
| 39 |
the security context is not allowed to have more than N processes. |
|---|
| 40 |
|
|---|
| 41 |
private: No other processes, even root in security context 0, is allowed to |
|---|
| 42 |
enter this security context. Once a security context is setup |
|---|
| 43 |
with this flag, it is on its own. This also means that root |
|---|
| 44 |
in security context 0 won't be able to kill or interact with those |
|---|
| 45 |
processes. |
|---|
| 46 |
|
|---|
| 47 |
hideinfo: Hides various information in /proc. |
|---|
| 48 |
|
|---|
| 49 |
.TP |
|---|
| 50 |
\fB--LINUX_IMMUTABLE\fR |
|---|
| 51 |
.TP |
|---|
| 52 |
\fB--NET_BIND_SERVICE\fR |
|---|
| 53 |
.TP |
|---|
| 54 |
\fB--NET_BROADCAST\fR |
|---|
| 55 |
.TP |
|---|
| 56 |
\fB--NET_ADMIN\fR |
|---|
| 57 |
.TP |
|---|
| 58 |
\fB--NET_RAW\fR |
|---|
| 59 |
.TP |
|---|
| 60 |
\fB--IPC_LOCK\fR |
|---|
| 61 |
.TP |
|---|
| 62 |
\fB--IPC_OWNER\fR |
|---|
| 63 |
.TP |
|---|
| 64 |
\fB--SYS_MODULE\fR |
|---|
| 65 |
.TP |
|---|
| 66 |
\fB--SYS_RAWIO\fR |
|---|
| 67 |
.TP |
|---|
| 68 |
\fB--SYS_PACCT\fR |
|---|
| 69 |
.TP |
|---|
| 70 |
\fB--SYS_ADMIN\fR |
|---|
| 71 |
.TP |
|---|
| 72 |
\fB--SYS_BOOT\fR |
|---|
| 73 |
.TP |
|---|
| 74 |
\fB--SYS_NICE\fR |
|---|
| 75 |
.TP |
|---|
| 76 |
\fB--SYS_RESOURCE\fR |
|---|
| 77 |
.TP |
|---|
| 78 |
\fB--SYS_TIME\fR |
|---|
| 79 |
.TP |
|---|
| 80 |
\fB--MKNOD\fR |
|---|
| 81 |
|
|---|
| 82 |
All these options remove one capability. These options may be used |
|---|
| 83 |
after the |
|---|
| 84 |
\fB--secure\fR |
|---|
| 85 |
option to remove more capabilities. |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
.SH "FILES" |
|---|
| 89 |
.LP |
|---|
| 90 |
\fI/usr/sbin/reducecap\fP |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
.SH "EXAMPLES" |
|---|
| 94 |
.LP |
|---|
| 95 |
# You are not root now |
|---|
| 96 |
# What is the current capability ceiling |
|---|
| 97 |
cat /proc/self/status |
|---|
| 98 |
# The capBset line presents mostly 1s. |
|---|
| 99 |
/usr/sbin/reducecap \-\-secure /bin/sh |
|---|
| 100 |
cat /proc/self/status |
|---|
| 101 |
# The capBset now shows many more 0s. |
|---|
| 102 |
# The capEff shows all 0s, you have no privilege now |
|---|
| 103 |
# We su to root |
|---|
| 104 |
su |
|---|
| 105 |
cat /proc/self/status |
|---|
| 106 |
# capEff is much better now, but there are still many 0s |
|---|
| 107 |
# Now we try to see if we are really root |
|---|
| 108 |
tail /var/log/messages |
|---|
| 109 |
# So far so good, we see the content |
|---|
| 110 |
/sbin/ifconfig eth0 |
|---|
| 111 |
/sbin/ifconfig eth0 down |
|---|
| 112 |
# No way, we can't configure the interface. In fact |
|---|
| 113 |
# we have lost most privilege normally assigned to root |
|---|
| 114 |
exit |
|---|
| 115 |
.LP |
|---|
| 116 |
Please contribute some more, if you feel it's important. |
|---|
| 117 |
.SH "AUTHORS" |
|---|
| 118 |
.LP |
|---|
| 119 |
This Man page was written by Klavs Klavsen <kl@vsen.dk> and based upon the helpful output from the program itself and the documentation on the Virtual Server site <http://www.solucorp.qc.ca/miscprj/s_context.hc?prjstate=1&nodoc=0> |
|---|
| 120 |
.SH "SEE ALSO" |
|---|
| 121 |
.LP |
|---|
| 122 |
chcontext(8) rebootmgr(8) chbind(8) |
|---|
| 123 |
vps(8) vpstree(8) vrpm(8) vserver(8) |
|---|
| 124 |
vserver\-stat(8) vtop(8) |
|---|