<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Hi <br><br>It seems, that logrotate profile works. Everything is OK - no error or DENIED messages in log files etc. I'm testing this profile since four, five days. <br><br>So, I just decided to paste the whole profile here, since I've added only a few rules. It should be easier to read and eventually change the logrotate profile in the future. Also, Mr Christian Boltz wrote, that in this case it's OK (see: <a href="https://lists.ubuntu.com/archives/apparmor/2016-November/010238.html">https://lists.ubuntu.com/archives/apparmor/2016-November/010238.html</a>). <br><br>I think, that it's important to mention: I've changed the order of rules. For example: @{PROC} rules are now at the very end of a profile, capabilities are near the beginning after <abstractions/*> and so on. It just looks better and is easier to read, modify etc. That's just my opinion and it can be changed. <br><br>I've decided to leave directories that are not in my system, but were in the default profile. They are marked with the '#' sign and described with a proper information about existence reason etc. If, for example there is an user using 'privoxy' - a privacy enhancing HTTP Proxy, he can just remove '#' sign and use one of these rules (of course depending on his architecture etc.): <br><br>/var/lib/privoxy/log/** rwl,<br>/var/lib64/privoxy/log/** rwl, <br><br>One more thing about my comments: they are only for an informational purposes and should/could be removed. So, I hope that everything is okay even without using diff(1). <br><br>Okay, so here's an updated 'etc.cron.daily.logrotate' profile (based on this one: <a href="https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/apparmor/wily/view/head:/profiles/apparmor/profiles/extras/etc.cron.daily.logrotate">https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/apparmor/wily/view/head:/profiles/apparmor/profiles/extras/etc.cron.daily.logrotate</a>): <br><br><br># Last Modified: Mon Dec 19 10:29:57 2016 <br># ------------------------------------------------------------------ <br>#<br># Copyright (C) 2002-2006 Novell/SUSE<br># Copyright (C) 2016 Seth Arnold<br># Copyright (C) 2016 Daniel Curtis<br>#<br># This program is free software; you can redistribute it and/or <br># modify it under the terms of version 2 of the GNU General <br># License published by the Free Software Foundation. <br># <br># ------------------------------------------------------------------ <br><br>#include <tunables/global> <br><br>/etc/cron.daily/logrotate { <br> #include <abstractions/base><br> #include <abstractions/bash><br> #include <abstractions/nameservice> <br><br> capability dac_override,<br> capability dac_read_search,<br> capability chown,<br> capability fowner,<br> capability fsetid, <br><br> / r,<br> /bin/sleep mrix,<br> /bin/sed mixr,<br> /bin/mv mixr,<br> /bin/dash mrix,<br><br> /bin/bash mrix,<br> /bin/cat mrix,<br> /bin/gzip mrix,<br> /bin/kill mrix,<br> /bin/logger mrix,<br> /bin/true mrix,<br> <br> /usr/bin/head mrix,<br> /usr/bin/killall mrix,<br> <br> /usr/sbin/invoke-rc.d mrix,<br> /usr/sbin/logrotate mrix, <br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"> ## NOTE: please see 1., 2. <br></div><div class="gmail_default" style="font-family:verdana,sans-serif"> /sbin/initctl Ux,<br> /sbin/runlevel Ux,<br> <br> /etc/cron.daily/logrotate r,<br> /etc/logrotate.conf r,<br> /etc/logrotate.d/ r,<br> /etc/logrotate.d/* r,<br><br> /etc/init.d/* mrix,<br> /etc/lsb-base-logging.sh r, <br><br> ## There is not such directory in 12.04 LTS. <br> #/etc/subdomain.d/ r,<br> <br> /var/lib/logrotate/ r,<br> /var/lib/logrotate/* rw,<br> ## Handled by the previous rules.<br> #/var/lib/logrotate.status rw, <br><br> ## NOTE: it's a 32 bit system - so there is not lib64 directory. <br> ## NOTE2: I'm not using privoxy. <br> #/var/lib64/privoxy/log/** rwl,<br> #/var/lib/privoxy/log/** rwl,<br> ## NOTE3: Maybe it's better to use:<br> #/var/lib{,64}/privoxy/log/** rwl, <br><br> /var/log/ r,<br> /var/log/** rwl, <br><br> ## NOTE: there is not 'syslog.pid' but 'rsyslogd.pid' file <br> #/{,var/}run/syslogd.pid r,<br> /{,var/}run/rsyslogd.pid r, <br><br> ## NOTE: I'm not using 'slrnpull', but maybe someone is. <br> #/var/spool/slrnpull rw,<br> #/var/spool/slrnpull/log* rwl, <br><br> ## NOTE: I don't use samba and httpd, but maybe someone is. <br> #/{run,var}/lock/samba r,<br> #/{,var/}run/httpd.pid r, <br><br> /tmp w,<br> /tmp/file* wl,<br> /tmp/logrot* rwl,<br><br> /dev/tty rw, <br><br> @{PROC} r,<br> @{PROC}/[1-9]* r,<br><br>} <br><br><br>By the way: an official profile contains rule, which confused me: "/var/log r,". Does not should be there: "/var/log/ r,"? As we can see: missing "/". The same thing with: /etc/subdomain.d directory - I've added '/' to these rules. What do you think? <br><br>The last and the most important thing: can someone check this profile; I
mean from a security point of view? It's secure enough to use?
Especially, I'm thinking about permissions for a /tmp directory ('rwl,'
access) etc. <br><br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Best regards. <br>_____________<br>1., 2.: <a href="https://lists.ubuntu.com/archives/apparmor/2016-December/010359.html">https://lists.ubuntu.com/archives/apparmor/2016-December/010359.html</a> <br><a href="https://lists.ubuntu.com/archives/apparmor/2016-December/010363.html">https://lists.ubuntu.com/archives/apparmor/2016-December/010363.html</a> <br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div>