16 |
|
|
17 |
This project was very inspired by the comic "Card Captor SAKURA", |
This project was very inspired by the comic "Card Captor SAKURA", |
18 |
one of the CLAMP's masterworks. |
one of the CLAMP's masterworks. |
|
The names SAKURA and TOMOYO and SYAORAN were borrowed from the comic |
|
|
with the heartfelt thanks to CLAMP. |
|
|
|
|
|
|
|
19 |
|
|
20 |
ChangeLog: |
ChangeLog: |
21 |
|
|
193 |
@ Fix handling of trailing '\*' in PathMatchesToPattern(). |
@ Fix handling of trailing '\*' in PathMatchesToPattern(). |
194 |
|
|
195 |
PathMatchesToPattern("/tmp/", "/tmp/\*") returned true |
PathMatchesToPattern("/tmp/", "/tmp/\*") returned true |
196 |
because "\*" matches to "more than or equals to 0 character |
because "\*" matches "zero or more repetitions of characters |
197 |
until '/' or end". But since this is a comparison between |
until '/' or end". But since this is a comparison between |
198 |
directory and non-directory, this should not match. |
directory and non-directory, this should not match. |
199 |
|
|
404 |
|
|
405 |
@ Change behavior of pathname pattern matching. |
@ Change behavior of pathname pattern matching. |
406 |
|
|
407 |
Until now, it was impossible to use patterns like "\*.txt" |
Until now, it was impossible to use patterns like "\*.txt" because |
408 |
because "\*" matched to more than 0 characters until next '/'. |
"\*" matched zero or more repetitions of characters until next '/'. |
409 |
Now, "\*" matches to more than 0 characters. |
Now, "\*" matches zero or more repetitions of characters. |
410 |
|
|
411 |
Until now, it was impossible to use patterns like "\$00" |
Until now, it was impossible to use patterns like "\$00" |
412 |
because "\$" matched to more than 1 digits until next |
because "\$" matched one or more repetitions of digits until next |
413 |
non digit character. |
non digit character. |
414 |
Now, "\$" matches to more than 1 digits. |
Now, "\$" matches one or more repetitions of digits. |
415 |
|
|
416 |
Also, new patterns "\x" "\X" "\a" "\A" "\@" are added. |
Also, new patterns "\x" "\X" "\a" "\A" "\@" are added. |
417 |
|
|
428 |
|
|
429 |
@ Change matching rule for CheckFileACL(). |
@ Change matching rule for CheckFileACL(). |
430 |
|
|
431 |
Until now, only first entry that matched to the requested pathname |
Until now, only first entry that matched the requested pathname |
432 |
was used for permission checking. For example, two entries |
was used for permission checking. For example, two entries |
433 |
|
|
434 |
"2 /tmp/file-\$.txt" |
"2 /tmp/file-\$.txt" |
444 |
This may potentially cause trouble because the result of |
This may potentially cause trouble because the result of |
445 |
permission checks depends on the order of entries. |
permission checks depends on the order of entries. |
446 |
|
|
447 |
Now, all entries that matched to the requested pathname |
Now, all entries that matched the requested pathname |
448 |
are used for permission checking so that the result of |
are used for permission checking so that the result of |
449 |
permission checks doesn't depend on the order of entries. |
permission checks doesn't depend on the order of entries. |
450 |
|
|
485 |
domain ACL. For example, |
domain ACL. For example, |
486 |
|
|
487 |
"1 /bin/sh if task.euid!=0" |
"1 /bin/sh if task.euid!=0" |
488 |
|
|
489 |
allows the domain to execute /bin/sh only when the process's euid |
allows the domain to execute /bin/sh only when the process's euid |
490 |
is not 0, and |
is not 0, and |
491 |
|
|
492 |
"6 /home/\*/\* if task.uid=path1.uid" |
"6 /home/\*/\* if task.uid=path1.uid" |
493 |
|
|
494 |
allows the domain to read-write user's home directory |
allows the domain to read-write user's home directory |
495 |
only when the file's owner matches to the process's uid. |
only when the file's owner matches the process's uid. |
496 |
|
|
497 |
Fix 2006/08/22 |
Fix 2006/08/22 |
498 |
|
|
758 |
if /some/program is called from "some_domain" domain. |
if /some/program is called from "some_domain" domain. |
759 |
|
|
760 |
"some_domain" can be just the last component of domainname. |
"some_domain" can be just the last component of domainname. |
761 |
For example, giving "/bin/mail" as "some_domain" matches to |
For example, giving "/bin/mail" as "some_domain" matches |
762 |
all domains whose domainname ends with "/bin/mail". |
all domains whose domainname ends with "/bin/mail". |
763 |
|
|
764 |
Fix 2007/01/19 |
Fix 2007/01/19 |
871 |
based on realpath while argv[0] check is done based on the symlink's |
based on realpath while argv[0] check is done based on the symlink's |
872 |
pathname and argv[0], this specification will allow attackers behave |
pathname and argv[0], this specification will allow attackers behave |
873 |
as /bin/cat in the domain of /bin/ls if "/bin/ls and /bin/cat are |
as /bin/cat in the domain of /bin/ls if "/bin/ls and /bin/cat are |
874 |
links to /sbin/busybox" and "the attacker is permitted to create |
links to /sbin/busybox" and "the attacker is permitted to create |
875 |
a symlink named ~/cat that points to /bin/ls" and "the attacker is |
a symlink named ~/cat that points to /bin/ls" and "the attacker is |
876 |
permitted to run /bin/ls". |
permitted to run /bin/ls". |
877 |
So, I changed to compare the basename of realpath and argv[0]. |
So, I changed to compare the basename of realpath and argv[0]. |
959 |
|
|
960 |
Until now, users had to add init=/.init parameter to load policy |
Until now, users had to add init=/.init parameter to load policy |
961 |
before /sbin/init starts. |
before /sbin/init starts. |
962 |
I inserted call_usermodehelper() to call external policy loader when |
I inserted call_usermodehelper() to call external policy loader when |
963 |
execve("/sbin/init") is requested and external policy loader exists. |
execve("/sbin/init") is requested and external policy loader exists. |
964 |
|
|
965 |
This change will remove init=/.init parameter from most environment, |
This change will remove init=/.init parameter from most environment, |
1003 |
|
|
1004 |
@ Remove initializer directive. |
@ Remove initializer directive. |
1005 |
|
|
1006 |
Use "initialize_domain" instrad of "initializer". |
Use "initialize_domain" instead of "initializer". |
1007 |
|
|
1008 |
Fix 2007/08/21 |
Fix 2007/08/21 |
1009 |
|
|
1917 |
not working. |
not working. |
1918 |
|
|
1919 |
This problem happens on little endian platforms (e.g. x86). |
This problem happens on little endian platforms (e.g. x86). |
1920 |
|
|
1921 |
|
Fix 2009/05/08 |
1922 |
|
|
1923 |
|
@ Add condition for symlink's target pathname. |
1924 |
|
|
1925 |
|
Until now, "allow_symlink" keyword allows creation of a symlink but does |
1926 |
|
not check the symlink's target. Usually it is no problem because |
1927 |
|
permission checks are done using dereferenced pathname. But in some |
1928 |
|
cases, we should restrict the symlink's target. For example, |
1929 |
|
"ln -s .htpasswd /var/www/html/readme.html" by CGI program should be |
1930 |
|
blocked because we will allow Apache to read both |
1931 |
|
/var/www/html/readme.html and /var/www/html/.htpasswd . |
1932 |
|
|
1933 |
|
Thus, I added new condition, "symlink.target". |
1934 |
|
|
1935 |
|
allow_symlink /var/www/html/\*.html if symlink.target="\*.html" |
1936 |
|
|
1937 |
|
allow_symlink /var/www/html/\*\-.\* if symlink.target="\*\-.\*" |
1938 |
|
|
1939 |
|
@ Don't return -EAGAIN at ccs_socket_recvmsg_permission(). |
1940 |
|
|
1941 |
|
It turned out that it is not permitted for accept() and recvmsg() to |
1942 |
|
return -EAGAIN if poll() said connections/datagrams are ready. However, |
1943 |
|
recvmsg() may return -EAGAIN and potentially confuse some applications |
1944 |
|
because ccs_socket_recvmsg_permission() is returning -EAGAIN. |
1945 |
|
|
1946 |
|
Thus, I modified ccs_socket_recvmsg_permission() to return -ENOMEM |
1947 |
|
rather than -EAGAIN. |
1948 |
|
|
1949 |
|
Fix 2009/05/19 |
1950 |
|
|
1951 |
|
@ Don't call get_fs_type() with a mutex held. |
1952 |
|
|
1953 |
|
Until now, when ccs_update_mount_acl() is called with unsupported |
1954 |
|
filesystem, /sbin/modprobe is executed from get_fs_type() to load |
1955 |
|
filesystem module. And get_fs_type() does not return until /sbin/modprobe |
1956 |
|
finishes. |
1957 |
|
|
1958 |
|
This means that it will cause deadlock if /sbin/modprobe (which is |
1959 |
|
executed via get_fs_type() in ccs_update_mount_acl()) calls |
1960 |
|
ccs_update_mount_acl(); although it won't happen unless an administrator |
1961 |
|
inserts execute_handler to call mount() requests in learning mode or to |
1962 |
|
add "allow_mount" entries to /proc/ccs/system_policy . |
1963 |
|
|
1964 |
|
I modified to unlock the mutex before calling get_fs_type(). |
1965 |
|
|
1966 |
|
Fix 2009/05/20 |
1967 |
|
|
1968 |
|
@ Update recvmsg() hooks. |
1969 |
|
|
1970 |
|
Since 1.5.0, I was doing network access control for incoming UDP and RAW |
1971 |
|
packets inside skb_recv_datagram(). But to synchronize with LSM version, |
1972 |
|
I moved ccs_recv_datagram_permission() hook from skb_recv_datagram() to |
1973 |
|
udp_recvmsg()/udpv6_recvmsg()/raw_recvmsg()/rawv6_recvmsg() with name |
1974 |
|
change to ccs_recvmsg_permission(). |
1975 |
|
|
1976 |
|
Version 1.6.8 2009/05/28 Feature enhancement release. |
1977 |
|
|
1978 |
|
Fix 2009/07/03 |
1979 |
|
|
1980 |
|
@ Fix buffer overrun when used with CONFIG_SLOB=y . |
1981 |
|
|
1982 |
|
Since 1.6.7 , ccs_allocate_execve_entry() was requesting for only 4000 |
1983 |
|
bytes while the comment says it is 4096 bytes. This may lead to buffer |
1984 |
|
overrun when slob allocator is used, for slob allocator allocates exactly |
1985 |
|
4000 bytes whereas slab and slub allocators allocate 4096 bytes. |
1986 |
|
|
1987 |
|
Fix 2009/09/01 |
1988 |
|
|
1989 |
|
@ Add garbage collector support. |
1990 |
|
|
1991 |
|
Until now, it was impossible to release memory used by deleted policy. |
1992 |
|
I added SRCU based garbage collector so that memory used by deleted |
1993 |
|
policy will be automatically released. |
1994 |
|
|
1995 |
|
@ Remove word length limitation and line length limitation. |
1996 |
|
|
1997 |
|
Until now, the max length of a word is 4000 and the max length of a line |
1998 |
|
is 8192. To be able to handle longer pathnames, I removed these |
1999 |
|
limitations. Now, the max length (except the domainname and |
2000 |
|
argv[]/envp[]) is 128K (which is the max amount of memory kmalloc() |
2001 |
|
can allocate in most environments). |
2002 |
|
|
2003 |
|
@ Support more fine grained profile configuration. |
2004 |
|
|
2005 |
|
Profile was reconstructed. |
2006 |
|
|
2007 |
|
@ Support more fine grained parameters restrictions. |
2008 |
|
|
2009 |
|
"allow_create", "allow_mkdir", "allow_mkfifo", "allow_mksock" check |
2010 |
|
create mode. "allow_mkblock" and "allow_mkchar" check create mode and |
2011 |
|
major/minor device numbers. "allow_chmod" check new mode. "allow_chown" |
2012 |
|
checks new owner. "allow_chgrp" checks new group. |
2013 |
|
|
2014 |
|
@ Allow number grouping. |
2015 |
|
|
2016 |
|
To help specifying numeric values, a new directive "number_group" is |
2017 |
|
introduced. |
2018 |
|
|
2019 |
|
@ Remove "alias" directive and "allow_argv0" directive. |
2020 |
|
|
2021 |
|
Until now, "allow_execute" used dereferenced pathname if it is a symlink |
2022 |
|
unless explicitly specified by "alias" directive. |
2023 |
|
|
2024 |
|
Now, "allow_execute" uses symlink's pathname if it is a symlink. |
2025 |
|
"exec.realpath" in "if" clause checks the dereferenced pathname. |
2026 |
|
"exec.argv[0]" in "if" clause checks the invocation name. |
2027 |
|
|
2028 |
|
@ Remove /proc/ccs/system_policy and /etc/ccs/system_policy.conf . |
2029 |
|
|
2030 |
|
"deny_autobind" was moved to /proc/ccs/exception_policy and |
2031 |
|
/etc/ccs/exception_policy.conf . Other directives were moved to |
2032 |
|
/proc/ccs/domain_policy and /etc/ccs/domain_policy.conf . |
2033 |
|
|
2034 |
|
@ Remove syaoran filesystem. |
2035 |
|
|
2036 |
|
Since "allow_create"/"allow_mkdir"/"allow_mkfifo"/"allow_mksock"/ |
2037 |
|
"allow_mkblock"/"allow_mkchar"/"allow_chmod"/"allow_chown"/"allow_chgrp" |
2038 |
|
can restrict mode changes and owner/group changes, there is no need to |
2039 |
|
restrict these changes at filesystem level. |
2040 |
|
|
2041 |
|
Thus, I removed syaoran filesystem. |
2042 |
|
|
2043 |
|
@ Reduce spinlocks. |
2044 |
|
|
2045 |
|
Until now, TOMOYO was using own list for detecting memory leak. But as |
2046 |
|
kernel 2.6.31 introduced memory leak detection mechanism |
2047 |
|
( CONFIG_DEBUG_KMEMLEAK ), TOMOYO no longer needs to use own list. |
2048 |
|
|
2049 |
|
I removed the list to reduce use of spinlocks. |
2050 |
|
|
2051 |
|
@ Rewrite ccs-patch-2.\*.diff . |
2052 |
|
|
2053 |
|
ccs-patch-2.\*.diff was rewritten like LSM hooks. |
2054 |
|
|
2055 |
|
@ Don't check "allow_read/write" for open-for-ioctl-only. |
2056 |
|
|
2057 |
|
open(pathname, 3) means open for ioctl() only. |
2058 |
|
Until now, TOMOYO was checking "allow_read/write" for open(pathname, 3). |
2059 |
|
But since TOMOYO checks "allow_ioctl" for ioctl(), I modified not to |
2060 |
|
require "allow_read/write" for open(pathname, 3). |
2061 |
|
|
2062 |
|
@ Add missing sigqueue() and tgsigqueue() hooks. |
2063 |
|
|
2064 |
|
Until now, kill(), tkill(), tgkill() had hooks but sigqueue() and |
2065 |
|
tgsigqueue() didn't. |
2066 |
|
|
2067 |
|
@ Move files from fs/ to security/ccsecurity. |
2068 |
|
|
2069 |
|
Config menu section changed from "File systems" to "Security options". |
2070 |
|
|
2071 |
|
Kernel config symbols changed from CONFIG_SAKURA CONFIG_TOMOYO |
2072 |
|
CONFIG_SYAORAN to CONFIG_CCSECURITY . |
2073 |
|
|
2074 |
|
@ Add global PID to audit logs. |
2075 |
|
|
2076 |
|
ccs-queryd was using domainname for reaching the domain which the process |
2077 |
|
belongs to, but the domain could be deleted while ccs-queryd is handling |
2078 |
|
policy violation. If the domain is deleted, ccs-queryd no longer can |
2079 |
|
reach the domain by domainname. Thus, ccs-queryd now uses PID for |
2080 |
|
reaching the domain which the process belongs to. |
2081 |
|
|
2082 |
|
Kernel 2.6.24 introduced PID namespace. The PID in access logs generated |
2083 |
|
by a process inside a container is useless for ccs-queryd for reaching |
2084 |
|
the domain which the process belongs to. |
2085 |
|
|
2086 |
|
Thus, I added global PID in audit logs. |
2087 |
|
|
2088 |
|
@ Transit to new domain before do_execve() succeeds. |
2089 |
|
|
2090 |
|
Permission checks for interpreters and environment variables are |
2091 |
|
done using new domain. In order to be allow ccs-queryd to reach the new |
2092 |
|
domain via global PID, I reverted "Don't transit to new domain until |
2093 |
|
do_execve() succeeds." made on 2008/10/07. |
2094 |
|
|
2095 |
|
Version 1.7.0 2009/09/03 Feature enhancement release. |
2096 |
|
|
2097 |
|
Fix 2009/09/04 |
2098 |
|
|
2099 |
|
@ Fix wrong ccs_profile() calls. |
2100 |
|
|
2101 |
|
I can't call ccs_profile() for profile existence test because |
2102 |
|
ccs_profile() never returns NULL. |
2103 |
|
|
2104 |
|
Fix 2009/09/06 |
2105 |
|
|
2106 |
|
@ Fix wrong error code in ccs_try_alt_exec(). |
2107 |
|
|
2108 |
|
ccs_try_alt_exec() was returning ENOMEM when kmalloc() failed. |
2109 |
|
It needs to return -ENOMEM to fail. |
2110 |
|
|
2111 |
|
Fix 2009/09/10 |
2112 |
|
|
2113 |
|
@ Do not check umount() permission for mount(MS_MOVE) requests. |
2114 |
|
|
2115 |
|
Until 1.6.x , umount() restriction was black listing. In 1.7.0 , it is |
2116 |
|
white listing. This change caused "mount --move old new" requests to |
2117 |
|
require "allow_unmount old" permission in addition to |
2118 |
|
"allow_mount old new --move 0" permission. |
2119 |
|
But we don't want to allow umount(old) requests when we want to allow |
2120 |
|
only mount(old, new, MS_MOVE) requests. Thus, I modified not to check |
2121 |
|
"allow_unmount old" permission for mount(old, new, MS_MOVE) requests. |
2122 |
|
|
2123 |
|
Fix 2009/09/11 |
2124 |
|
|
2125 |
|
@ Support recursive match operators. |
2126 |
|
|
2127 |
|
Until now, ccs_path_matches_pattern() did not support recursive |
2128 |
|
comparison. Thus, users had to repeat "/\*" when they want to specify |
2129 |
|
recursively. |
2130 |
|
|
2131 |
|
I introduced "\{" and "\}" as repetition operator. |
2132 |
|
To ensure consistency with TOMOYO's '/'-tokenized pattern matching rules |
2133 |
|
and "\-" operator, only "/\{dir\}/" sequences (where dir does not contain |
2134 |
|
'/') is permitted. |
2135 |
|
|
2136 |
|
Fix 2009/09/24 |
2137 |
|
|
2138 |
|
@ Don't check chmod/chown capability for requests from kernel. |
2139 |
|
|
2140 |
|
Until now, ccs_setattr_permission() was inserted in notify_change(). |
2141 |
|
But notify_change() is also called by requests from kernel (e.g. UnionFS) |
2142 |
|
and it made difficult to use TOMOYO on UnionFS. |
2143 |
|
|
2144 |
|
Thus, I moved ccs_capable() checks from ccs_setattr_permission() to |
2145 |
|
ccs_chmod_permission() and ccs_chown_permission(), and removed |
2146 |
|
ccs_setattr_permission(). |
2147 |
|
|
2148 |
|
Fix 2009/09/25 |
2149 |
|
|
2150 |
|
@ Embed more information into audit logs. |
2151 |
|
|
2152 |
|
Until now, /proc/ccs/grant_log /proc/ccs/reject_log /proc/ccs/query were |
2153 |
|
not printing file's information (e.g. file's uid/gid/mode). |
2154 |
|
|
2155 |
|
Recently, users who started using "if" clause expect that the learning |
2156 |
|
mode automatically adds various conditions like "if task.uid=path1.uid". |
2157 |
|
|
2158 |
|
But the profile will become too complicated if I support all possible |
2159 |
|
conditions. Thus, I added all information which is enough to generate |
2160 |
|
"if" clause with all possible conditions from audit logs. |
2161 |
|
|
2162 |
|
Now, the learning mode got different usage. Users can specify |
2163 |
|
"CONFIG::learning={ max_entry=0 }" in the profile. All requests which |
2164 |
|
are not permitted by policy will be sent to /proc/ccs/reject_log with |
2165 |
|
"mode=learning" header lines. Users can selectively append conditions |
2166 |
|
and append to the policy using "/usr/sbin/ccs-loadpolicy -d". |
2167 |
|
The learning mode with "CONFIG::learning={ max_entry=0 }" is almost |
2168 |
|
the same with the permissive mode, only difference is "mode=learning" |
2169 |
|
and "mode=permissive". |
2170 |
|
|
2171 |
|
Fix 2009/10/05 |
2172 |
|
|
2173 |
|
@ Fix size truncation bug at ccs_memcmp(). |
2174 |
|
|
2175 |
|
ccs_memcmp() was using "u8" for size parameter by error. Therefore, when |
2176 |
|
size >= 256 was passed to ccs_memcmp(), it was doing partial comparison |
2177 |
|
(incorrect result) or read overrun (CPU stall). |
2178 |
|
|
2179 |
|
ccs_memcmp() should use "size_t" for size parameter because size of |
2180 |
|
"struct ccs_condition" may exceed 256 bytes if complicated condition was |
2181 |
|
given. |
2182 |
|
|
2183 |
|
Fix 2009/10/08 |
2184 |
|
|
2185 |
|
@ Add CONFIG_CCSECURITY_DEFAULT_LOADER option. |
2186 |
|
|
2187 |
|
I made the default policy loader's pathname ( /sbin/ccs-init ) |
2188 |
|
configurable. |
2189 |
|
|
2190 |
|
@ Add CONFIG_CCSECURITY_ALTERNATIVE_TRIGGER option. |
2191 |
|
|
2192 |
|
Some environments do not have /sbin/init . In such environments, we need |
2193 |
|
to use different program's pathname (e.g. /init or /linuxrc ) as |
2194 |
|
activation trigger. |
2195 |
|
|
2196 |
|
Thus, I made the alternative trigger ( /sbin/ccs-start ) configurable. |
2197 |
|
|
2198 |
|
Fix 2009/11/02 |
2199 |
|
|
2200 |
|
@ Fix buffer contention. |
2201 |
|
|
2202 |
|
A permission like |
2203 |
|
|
2204 |
|
allow_env PATH if exec.envp["PATH"]="/" |
2205 |
|
|
2206 |
|
was not working since I was using the same buffer for both environment |
2207 |
|
variable's name and value. |
2208 |
|
|
2209 |
|
Fix 2009/11/03 |
2210 |
|
|
2211 |
|
@ Fix memory leak in ccs_write_address_group_policy(). |
2212 |
|
|
2213 |
|
I forgot to call kfree() if same entry was added. |
2214 |
|
|
2215 |
|
@ Reduce mutexes. |
2216 |
|
|
2217 |
|
I was using mutex_lock()/mutex_unlock() so that I can use |
2218 |
|
atomic_dec_and_test() for removing an element from a list. |
2219 |
|
I moved that operation to garbage collector in order to reduce frequency |
2220 |
|
of mutex_lock()/mutex_unlock() calls. |
2221 |
|
|
2222 |
|
@ Escape from nested loops correctly. |
2223 |
|
|
2224 |
|
In ccs_read_address_group_policy(), I was escaping from nested loops |
2225 |
|
correctly. But in ccs_read_path_group_policy() and |
2226 |
|
ccs_read_number_group_policy(), I wasn't. |
2227 |
|
|
2228 |
|
As a result, reading path_group and number_group caused kernel oops |
2229 |
|
when they were not read atomically. |