Doesn't apply --include to newly installed clicks

Bug #1337253 reported by Martin Pitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
click-apparmor (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

On a freshly installed/factory resetted Ubuntu image, I'm trying the following:

 - During setup, I disable the initial wizards and other things, and run "phablet-config $ADBOPTS autopilot --dbus-probe enable", which effectively does "aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules".

- I install a click package

- I run autopilot on that click package, which fails due to

Jul 3 09:51:50 ubuntu-phablet dbus[2445]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/com/canonical/Autopilot/Introspection" interface="org.freedesktop.DBus.Introspectable" member="Introspect" name=":1.67" mask="receive" pid=4049 profile="com.ubuntu.calculator_calculator_1.3.283" peer_pid=4022 peer_profile="unconfined"

Only after I run "aa-clickhook -f --include=/usr/share/autopilot-touch/apparmor/click.rules" again it starts working.

However:
 1) This isn't easily discoverable
 2) It takes about a minute(!)
 3) Running without -f doesn't work, as apparently the click installation already ran the hook, but without the --include
 4) Specifying the --include on the initial invocation doesn't seem to be remembered

Possibly this is bug 1238007, but I don't understand that description.

So ideally the initial --include should be remembered, and henceforth installation of new clicks should "just work" through the hooks. Alternatively, if this is somehow too hard, it should be possible to only apply that to newly installed clicks (without -f it just takes a few seconds), instead of having to regenerate all profiles (which takes too long).

Changed in click-apparmor (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Why not just change the ordering and install the click before running "phablet-config $ADBOPTS autopilot --dbus-probe enable"? We could adjust click-apparmor to remember the result, but I specifically went this route because --include-path is not supposed to be used under normal circumstances and I would hate to make it too easy to have the changes be persistent since it opens a security hole.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

We shouldn't need to rebuild the click hooks if nothing has changed right? I push tests over and over manually without re-running the command.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Nicholas-- you don't *if* all the clicks that you want to test are already installed when you run aa-clickhook --include.... Martin was wanting to change that ordering requirement.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

@Jamie, I was trying to ask if I needed to run it again if the policy hans't changed. Imagine this,

I install a new music app, then run aa-clickhook . . .

Next, I install yet another music-app with the same policy. I also install a new version of clock, again with the same policy as the previously installed version.

Do I need to run aa-clickhook again after installing any of these apps?

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

@Nicholas, if the version of the click hasn't changed, then you shouldn't have to run it again. If it has, aa-clickhook will be run as part of the click install and so you would have to run aa-clickhook --include-path=... again.

Revision history for this message
Martin Pitt (pitti) wrote :

Jamie,

as I said on IRC I might misunderstand what that aa-clickhook command actually does. But as it takes very long (~ 1 minute), I'd rather just use it once ever instead of calling that for every click package that we test. That's why I'd like to have a semantics where you call it once after configuring the phone for testing, and from then on the existing click hook just does what it needs to do (i. e. apply the hook to newly installed clicks), or I have to call aa-clickhook manually with the --include but without -f (less discoverable, but should still be fast).

If by design neither of this is possible, then of course I can turn it around and always rebuild the whole thing after installing any click. That'll slow down testing but otherwise is of course entirely possible.

Thanks!

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

The aa-clickhook command works within the click system hook system and as such will generate profiles apparmor for any click packages that have a security manifest defined but do not have an apparmor profile generated for the manifest. It will regenerate apparmor profiles if the mtime on the symlink to the security manifest in /var/lib/apparmor/clicks is newer than the mtime of the apparmor profile. aa-clickhook -f unconditionally regenerates all the profiles.

In thinking about this, you can leverage this behavior like so:
1. phablet-config $ADBOPTS autopilot --dbus-probe enable
2. install list of clicks
3. touch -h /var/lib/apparmor/clicks/<list of profiles>.json
4. aa-clickhook --include=/usr/share/autopilot-touch/apparmor/click.rules

I verified this works as intended-- only those clicks whose security manifest was touched get the profile regenerated. I will update the man page for aa-clickhook for all of this.

Revision history for this message
Martin Pitt (pitti) wrote :

Many thanks Jamie! I implemented this now in http://anonscm.debian.org/gitweb/?p=autopkgtest/autopkgtest.git;a=commitdiff;h=b33d5a6e . While that workaround is now 3.84 times more ugly than before ☺ it reduces the time for doing this from ~ 1 minute to ~ 1 second, which is great.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Since I'm uncomfortable making the originally requested change to click-apparmor at this time, I am going to mark this as Won't Fix for now. If needed, we can re-review this or other workarounds in the future-- at which point, feel free to put the bug back at New.

Changed in click-apparmor (Ubuntu):
assignee: Jamie Strandboge (jdstrand) → nobody
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.