Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move AppArmor policy to contrib & deb packaging #14609

Merged
merged 1 commit into from Jul 21, 2015

Conversation

ewindisch
Copy link
Contributor

The automatic installation of AppArmor policies prevents the
management of custom, site-specific apparmor policies for the
default container profile. Furthermore, this change will allow
a future policy for the engine itself to be written without demanding
the engine be able to arbitrarily create and manage AppArmor policies.

  • Add deb package suggests for apparmor.
  • Ubuntu postinst use aa-status & fix policy path
  • Add the policies to the debian packages.
  • Add apparmor tests for writing proc files
    Additional restrictions against modifying files in proc
    are enforced by AppArmor. Ensure that AppArmor is preventing
    access to these files, not simply Docker's configuration of proc.
  • Remove /proc/k?mem from AA policy
    The path to mem and kmem are in /dev, not /proc
    and cannot be restricted successfully through AppArmor.
    The device cgroup will need to be sufficient here.
  • Load contrib/apparmor during integration tests
    Note that this is somewhat dirty because we
    cannot restore the host to its original configuration.
    However, it should be noted that prior to this patch
    series, the Docker daemon itself was loading apparmor
    policy from within the tests, so this is no dirtier or
    uglier than the status-quo.

Re-opening of #13144

Signed-off-by: Eric Windisch eric@windisch.us

@ewindisch
Copy link
Contributor Author

Re-opening of #13144

@@ -6,7 +6,7 @@ Vcs-Git: git://github.com/docker/docker.git

Package: docker-engine
Architecture: linux-any
Depends: iptables, ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
Depends: iptables, debhelper, dh-apparmor, ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are necessary at runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use dh-apparmor, you need to Depends the package. It's not a requirement for apparmor itself. A bug in trusty (and possible other distros) has the debhelper requirement missing in the Depends for dh-apparmor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

er... I see what you mean. It should be build-depends.

Copy link
Member

@tianon tianon Jul 14, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tianon
Copy link
Member

tianon commented Jul 13, 2015

Other than the change to hack/make/.build-deb/control, LGTM.

@ewindisch
Copy link
Contributor Author

Updated moving dh_apparmor to build-depends

@ewindisch
Copy link
Contributor Author

@tianon is this better?

@ewindisch
Copy link
Contributor Author

Rebased...

@tianon @crosbymichael @icecrime - libcontainer has been updated with the apparmor profiles now disabled. We need this patch to restore (out of box) AppArmor support.

@@ -7,6 +7,7 @@ Vcs-Git: git://github.com/docker/docker.git
Package: docker-engine
Architecture: linux-any
Depends: iptables, ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
Build-Depends: debhelper, dh-apparmor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line still isn't necessary -- #14609 (comment)

our build-depends lives in the Dockerfiles directly, not in the package metadata

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except if we distributed source debs, this would be necessary for someone to build from them, yes? (or rather, more convenient... they wouldn't need to track down the build depends)

Copy link
Member

@tianon tianon Jul 20, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ewindisch
Copy link
Contributor Author

Removed the build-depends per @tianon's request

@tianon
Copy link
Member

tianon commented Jul 20, 2015 via email

@@ -50,10 +50,6 @@ func NewDriver(root, initPath string, options []string) (*driver, error) {
if err := sysinfo.MkdirAll(root, 0700); err != nil {
return nil, err
}
// native driver root is at docker_root/execdriver/native. Put apparmor at docker_root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to remove daemon/execdriver/native/apparmor.go then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

The automatic installation of AppArmor policies prevents the
management of custom, site-specific apparmor policies for the
default container profile. Furthermore, this change will allow
a future policy for the engine itself to be written without demanding
the engine be able to arbitrarily create and manage AppArmor policies.

- Add deb package suggests for apparmor.
- Ubuntu postinst use aa-status & fix policy path
- Add the policies to the debian packages.
- Add apparmor tests for writing proc files
Additional restrictions against modifying files in proc
are enforced by AppArmor. Ensure that AppArmor is preventing
access to these files, not simply Docker's configuration of proc.
- Remove /proc/k?mem from AA policy
The path to mem and kmem are in /dev, not /proc
and cannot be restricted successfully through AppArmor.
The device cgroup will need to be sufficient here.
- Load contrib/apparmor during integration tests
Note that this is somewhat dirty because we
cannot restore the host to its original configuration.
However, it should be noted that prior to this patch
series, the Docker daemon itself was loading apparmor
policy from within the tests, so this is no dirtier or
uglier than the status-quo.

Signed-off-by: Eric Windisch <eric@windisch.us>
@LK4D4
Copy link
Contributor

LK4D4 commented Jul 21, 2015

LGTM

LK4D4 added a commit that referenced this pull request Jul 21, 2015
Move AppArmor policy to contrib & deb packaging
@LK4D4 LK4D4 merged commit 380959d into moby:master Jul 21, 2015
@ewindisch
Copy link
Contributor Author

+impact/changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants