[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apparmor-dev
Subject:    Re: [apparmor] [patch] Map c (create) log events to w instead of a
From:       Kshitij Gupta <kgupta8592 () gmail ! com>
Date:       2015-11-19 20:29:12
Message-ID: CAMBXP5318sWVop92y48MsxQTBU-bVYT3XDo2h5B0WaZDPk12FA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Fri, Nov 20, 2015 at 1:32 AM, Christian Boltz <apparmor@cboltz.de> wrote:

> Hello,
>
> creating a file is in theory covered by the 'a' permission, however
> discussion on IRC brought up that depending on the open flags it might
> not be enough (real-world example: creating the apache pid file).
>
> Therefore change the mapping to 'w' permissions - that might allow more
> than needed in some cases, but makes sure the profile always works.
>
>
> I propose this patch for 2.9, 2.10 and trunk
>
>
> [ 23-map-create-to-w.diff ]
>
> === modified file ./utils/apparmor/logparser.py
> --- utils/apparmor/logparser.py 2015-11-19 17:42:26.333879063 +0100
> +++ utils/apparmor/logparser.py 2015-11-19 20:51:49.139296808 +0100
> @@ -296,15 +296,15 @@
>                  self.debug_logger.debug('UNHANDLED (missing
> request_mask): %s' % e)
>                  return None
>
> -            # Map c (create) to a and d (delete) to w (logging is more
> detailed than the profile language)
> +            # Map c (create) and d (delete) to w (logging is more
> detailed than the profile language)
>              rmask = e['request_mask']
> -            rmask = rmask.replace('c', 'a')
> +            rmask = rmask.replace('c', 'w')
>              rmask = rmask.replace('d', 'w')
>              if not validate_log_mode(hide_log_mode(rmask)):
>                  raise AppArmorException(_('Log contains unknown mode %s')
> % rmask)
>
>              dmask = e['denied_mask']
> -            dmask = dmask.replace('c', 'a')
> +            dmask = dmask.replace('c', 'w')
>              dmask = dmask.replace('d', 'w')
>              if not validate_log_mode(hide_log_mode(dmask)):
>                  raise AppArmorException(_('Log contains unknown mode %s')
> % dmask)
>
>
>
Acked-by: Kshitij Gupta <kgupta8592@gmail.com>

> Regards,
>
> Christian Boltz
> --
> Warum nochmal benutzen alle Procmail? Das ist eine Art Quiz, oder?
> Wer die unleserlichtste Regel erstellt, bekommt einen Preis?
> [Thorsten Haude in suse-linux]
>
>
> --
> AppArmor mailing list
> AppArmor@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>



-- 
Regards,

Kshitij Gupta

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov \
20, 2015 at 1:32 AM, Christian Boltz <span dir="ltr">&lt;<a \
href="mailto:apparmor@cboltz.de" target="_blank">apparmor@cboltz.de</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br> <br>
creating a file is in theory covered by the &#39;a&#39; permission, however<br>
discussion on IRC brought up that depending on the open flags it might<br>
not be enough (real-world example: creating the apache pid file).<br>
<br>
Therefore change the mapping to &#39;w&#39; permissions - that might allow more<br>
than needed in some cases, but makes sure the profile always works.<br>
<br>
<br>
I propose this patch for 2.9, 2.10 and trunk<br>
<br>
<br>
[ 23-map-create-to-w.diff ]<br>
<br>
=== modified file ./utils/apparmor/logparser.py<br>
--- utils/apparmor/logparser.py 2015-11-19 17:42:26.333879063 +0100<br>
+++ utils/apparmor/logparser.py 2015-11-19 20:51:49.139296808 +0100<br>
@@ -296,15 +296,15 @@<br>
                          self.debug_logger.debug(&#39;UNHANDLED (missing \
request_mask): %s&#39; % e)<br>  return None<br>
<br>
-                  # Map c (create) to a and d (delete) to w (logging is more \
detailed than the profile language)<br> +                  # Map c (create) and d \
(delete) to w (logging is more detailed than the profile language)<br>  rmask = \
                e[&#39;request_mask&#39;]<br>
-                  rmask = rmask.replace(&#39;c&#39;, &#39;a&#39;)<br>
+                  rmask = rmask.replace(&#39;c&#39;, &#39;w&#39;)<br>
                    rmask = rmask.replace(&#39;d&#39;, &#39;w&#39;)<br>
                    if not validate_log_mode(hide_log_mode(rmask)):<br>
                          raise AppArmorException(_(&#39;Log contains unknown mode \
%s&#39;) % rmask)<br> <br>
                    dmask = e[&#39;denied_mask&#39;]<br>
-                  dmask = dmask.replace(&#39;c&#39;, &#39;a&#39;)<br>
+                  dmask = dmask.replace(&#39;c&#39;, &#39;w&#39;)<br>
                    dmask = dmask.replace(&#39;d&#39;, &#39;w&#39;)<br>
                    if not validate_log_mode(hide_log_mode(dmask)):<br>
                          raise AppArmorException(_(&#39;Log contains unknown mode \
%s&#39;) % dmask)<br> <br>
<br></blockquote><div><br>Acked-by: Kshitij Gupta &lt;<a \
href="mailto:kgupta8592@gmail.com" target="_blank">kgupta8592@gmail.com</a>&gt; \
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Regards,<br>
<br>
Christian Boltz<br>
<span class=""><font color="#888888">--<br>
Warum nochmal benutzen alle Procmail? Das ist eine Art Quiz, oder?<br>
Wer die unleserlichtste Regel erstellt, bekommt einen Preis?<br>
[Thorsten Haude in suse-linux]<br>
<br>
<br>
--<br>
AppArmor mailing list<br>
<a href="mailto:AppArmor@lists.ubuntu.com">AppArmor@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a \
href="https://lists.ubuntu.com/mailman/listinfo/apparmor" rel="noreferrer" \
target="_blank">https://lists.ubuntu.com/mailman/listinfo/apparmor</a><br> \
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div \
class="gmail_signature"><div dir="ltr"><div>Regards,<br><br></div>Kshitij \
Gupta<br></div></div> </div></div>



-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic