Merge lp:~mvo/aptdaemon/support-for-whitelisted-repositories into lp:aptdaemon
| Status: | Merged |
|---|---|
| Merged at revision: | 858 |
| Proposed branch: | lp:~mvo/aptdaemon/support-for-whitelisted-repositories |
| Merge into: | lp:aptdaemon |
| Diff against target: |
821 lines (+506/-36) 14 files modified
aptdaemon/core.py (+31/-1) aptdaemon/policykit1.py (+4/-1) aptdaemon/test.py (+15/-5) aptdaemon/utils.py (+1/-0) aptdaemon/worker.py (+112/-16) data/org.debian.apt.policy.in (+24/-0) tests/data/high-trust-repository-whitelist-broken.cfg (+10/-0) tests/data/high-trust-repository-whitelist.cfg (+10/-0) tests/repo/whitelisted/Packages (+34/-0) tests/repo/whitelisted/Packages.gpg (+34/-0) tests/repo/whitelisted/Release (+17/-0) tests/test_client.py (+1/-0) tests/test_high_trust_repository_whitelist.py (+201/-0) tests/test_worker.py (+12/-13) |
| To merge this branch: | bzr merge lp:~mvo/aptdaemon/support-for-whitelisted-repositories |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Vogt | Resubmit on 2012-08-31 | ||
| Martin Pitt (community) | 2012-08-24 | Approve on 2012-08-29 | |
|
Review via email:
|
|||
Description of the Change
This branch implements the whitelist feature discussed in #1035207
It adds a new type of policykit priv "org.debian.
that can be overriden by to allow passwordless installs. If its not
overriden it has the same requirements as install-
The whitelist is defined via /etc/aptdaemon/
[webapps test]
origin = Ubuntu
component = universe
pkgnames = 2vcard
[more whitelist]
origin = Ubuntu
component = main
pkgnames = ^unity.*
- 861. By Michael Vogt on 2012-08-24
-
aptdaemon/
worker. py: more paranoia
- 862. By Michael Vogt on 2012-08-28
-
make config parser more robust against errors in the config file and add tests
- 863. By Michael Vogt on 2012-08-28
-
small cleanup/comment updates
- 864. By Michael Vogt on 2012-08-28
-
move the whitelsit releated tests into a single file
- 865. By Michael Vogt on 2012-08-28
-
test that the right polkit action is used for whitelisted packages
- 866. By Michael Vogt on 2012-08-28
-
test that non-whitelisted package fails to install with aptdaemon.
policykit1. PK_ACTION_ INSTALL_ PACKAGES_ FROM_WHITELISTE D_REPO - 867. By Michael Vogt on 2012-08-28
-
aptdaemon/test.py: make the debug in start_session_aptd option to have less noise
- 868. By Michael Vogt on 2012-08-28
-
documation updates and ensure that the is install-
from-whitelist only applies to install
| Michael Vogt (mvo) wrote : | # |
On Mon, Aug 27, 2012 at 01:55:22PM -0000, Martin Pitt wrote:
> Review: Needs Fixing
Thanks for the review.
> As a general nitpick, I'd prefer to rename "whitelisted" in any public API/properties etc. to "passwordless" or something similarly meaningful, to point out what this list actually does. This especially applies to the conffile, as renaming it later is painful.
Right. I tend to agree but its not neseccarily passwordless, i.e. the
default implementation of this has auth_admin. Its just easier to
override this via e.g. the policykit-
webapps packages that does the same. Maybe a better name would be
"potentially_
bit long :/ Any hints appreciated.
> The test case does not actually verify that the expected PK privilege is being used, as it only goes until the simulation stage (or did I get that wrong?). You could tell the mock polkitd to permit org.debian.
Indeed good points, I added tests for that now too and also
consolidated the whitelist test stuff into a single file.
> I also think read_repository
Thanks, good point. This is more robust now I added tests and logging
(and test for the logging).
This should be ready for re-review, except that we need to find a
better name for whitelisted.
Thanks,
Michael
| Martin Pitt (pitti) wrote : | # |
The code/tests look good to me now, many thanks for the changes!
Some other ideas about the privilege name:
- org.debian.
- org.debian.
Perhaps you can also extend the comment to say what kind of packages this privilege is meant to be used for, i. e. webapps wrappers.
- 869. By Michael Vogt on 2012-08-31
-
rename read_repository
_whitelist to read_high_ trust_repositor y_whitelist - 870. By Michael Vogt on 2012-08-31
-
rename transaction_
only_installs_ packages_ from_whiteliste d_repos to transaction_ only_installs_ packages_ from_high_ trust_repos - 871. By Michael Vogt on 2012-08-31
-
rename self._whitelist
ed_packages to self._high_ trust_whitelist ed_packages - 872. By Michael Vogt on 2012-08-31
-
rename PK_ACTION_
INSTALL_ PACKAGES_ FROM_WHITELISTE D_REPO to PK_ACTION_ INSTALL_ PACKAGES_ FROM_HIGH_ TRUST_WHITELIST ED_REPO - 873. By Michael Vogt on 2012-08-31
-
rename /etc/aptdaemon/
repository- whitelist. cfg to /etc/aptdaemon/ high-trust- repository- whitelist. cfg - 874. By Michael Vogt on 2012-08-31
-
read the high-trust repository whitelist from /etc/aptdaemon/
high-trust- repository- whitelist. d by default and make it a .d directory to ensure packages like e.g. webapps can drop there whitelist in
| Michael Vogt (mvo) wrote : | # |
Thanks Martin! I like the "high-trust" one best, the current code calls it:
"org.debian.
I also tried to make the naming clearer and improve the examples. A quick
double check would be very cool
| Martin Pitt (pitti) wrote : | # |
There are still a few places where this hasn't been renamed consistently:
+ def _get_whiteliste
+class WhiteListedRepo
+ """ Test the whitelist feature inside the chroot """
and a few more.
Do we really need both "high trust" and "whitelisted" in the name? But anyway, that's bikeshedding at some point, at least it more self-explaining now.
Thanks!
- 875. By Michael Vogt on 2012-08-31
-
rename AptWorker.
_whitelisted_ repositories to _high_trust_ repositories
| Michael Vogt (mvo) wrote : | # |
On Fri, Aug 31, 2012 at 08:38:20AM -0000, Martin Pitt wrote:
> There are still a few places where this hasn't been renamed consistently:
>
> + def _get_whiteliste
>
> +class WhiteListedRepo
> + """ Test the whitelist feature inside the chroot """
>
> and a few more.
Thanks, I look over the diff once more and eliminiate the remaining
ones.
> Do we really need both "high trust" and "whitelisted" in the name? But anyway, that's bikeshedding at some point, at least it more self-explaining now.
I guess you are right about this, its a bit too much, so I will get
rid of more of the "whitelisted" strings.
- 876. By Michael Vogt on 2012-08-31
-
-PK_ACTION_
INSTALL_ PACKAGES_ FROM_HIGH_ TRUST_WHITELIST ED_REPO -> +PK_ACTION_ INSTALL_ PACKAGES_ FROM_HIGH_ TRUST_REPO - 877. By Michael Vogt on 2012-08-31
-
trans.whitelist
ed_packages, -> trans.high_ trust_packages - 878. By Michael Vogt on 2012-08-31
-
more renaming
- 879. By Michael Vogt on 2012-09-03
-
data/org.
debian. apt.policy. in: fix name to match org.debian. apt.install- packages. high-trust- repo - 880. By Michael Vogt on 2012-09-03
-
some more renames

As a general nitpick, I'd prefer to rename "whitelisted" in any public API/properties etc. to "passwordless" or something similarly meaningful, to point out what this list actually does. This especially applies to the conffile, as renaming it later is painful.
The test case does not actually verify that the expected PK privilege is being used, as it only goes until the simulation stage (or did I get that wrong?). You could tell the mock polkitd to permit org.debian. apt.install- packages- from-whiteliste d-repo and nothing else, and verify that installation of silly-* works, but other-pkg fails due to a permission error. It would also be nice to then try to remove the package again and verify that for this case (i. e. any but "install" it requires the "full" privilege.
I also think read_repository _whitelist( ) should become more robust against errors in the conffile. ConfigParser defaults to "strict" and thus excepts out if there a duplicate keys, etc. We don't want aptdaemon to crash on a ConfigParser.* exception; I think it should just be logged and it should return an empty set then. (Also easy to testcase).
Otherwise this looks good to me. Thanks!