podman --cap-add --cap-drop ordering
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tripleo |
Invalid
|
Medium
|
Unassigned |
Bug Description
Description
===========
podman_container.py ansible module (tripleo-ansible) is mixing up the ordering of arguments that are provided in yaml format.
The commonly recommended usage of the --cap-add and --cap-drop options for podman (or docker) is to first drop all capabilities with --cap-drop=all, then add those that are required with a series of --cap-add=<>
The ordering of those is important.
Steps to reproduce
==================
Run the following with "ansible-playbook logrotate_
$ cat logrotate_
- hosts: localhost
become: true
tasks:
- include_role:
name: "{{ item }}"
with_
- "/usr/share/
- "/usr/share/
vars:
- net_bind_service
- setuid
- setgid
(these are just random capabilities which will probably not work with this container)
Expected result
===============
The ordering of the arguments is preserved
Actual result
=============
--cap-drop=all ends up near the tail of the podman run command, whereas a series of --cap-add instructions are added near the head.
The ordering of cap_drop and cap_add can be switched in the yaml, which doesn't make any difference in the resulting podman run command.
Environment
===========
This was tested on train, but it will have the same result in master, since the implementation is the same.
$ git diff stable/
Changed in tripleo: | |
status: | New → Triaged |
milestone: | none → victoria-1 |
importance: | Undecided → High |
importance: | High → Medium |
Changed in tripleo: | |
status: | Triaged → Incomplete |
It doesn't seems like order is important:
$ podman run --rm -it -d --name set1 --cap-add setuid --cap-add setgid --cap-drop all alpine sleep 1h 366aed71f5e15f4 29712095670afc7 4e9dd1bb9696999 cfc8
7348089e63cf0e1
$ podman run --rm -it -d --name set2 --cap-drop all --cap-add setuid --cap-add setgid alpine sleep 1h cb3a1734da6c6e5 a69683ef85e991e 91c101d1802fe2e 371e
cfcf0b6ca9ba589
$ podman inspect set1 -f "{{ .EffectiveCaps }}"
[CAP_SETUID CAP_SETGID]
$ podman inspect set2 -f "{{ .EffectiveCaps }}"
[CAP_SETUID CAP_SETGID]