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

Complete capabilites with and without "CAP_" prefix. #2706

Merged
merged 1 commit into from
Sep 8, 2020

Conversation

albers
Copy link
Collaborator

@albers albers commented Sep 4, 2020

This extends bash completion for the capabilities after --cap-add and --cap-drop to also include the CAP_ prefixed variants.
See #2687 (comment).

Before:

$ docker run --cap-drop <TAB TAB>
ALL               DAC_OVERRIDE      KILL              NET_RAW           SETPCAP
AUDIT_WRITE       FOWNER            MKNOD             SETFCAP           SETUID
CHOWN             FSETID            NET_BIND_SERVICE  SETGID            SYS_CHROOT

Now:

$ docker run --cap-drop <TAB TAB>
ALL                   CAP_FSETID            CAP_SETGID            FOWNER                SETFCAP
AUDIT_WRITE           CAP_KILL              CAP_SETPCAP           FSETID                SETGID
CAP_AUDIT_WRITE       CAP_MKNOD             CAP_SETUID            KILL                  SETPCAP
CAP_CHOWN             CAP_NET_BIND_SERVICE  CAP_SYS_CHROOT        MKNOD                 SETUID
CAP_DAC_OVERRIDE      CAP_NET_RAW           CHOWN                 NET_BIND_SERVICE      SYS_CHROOT
CAP_FOWNER            CAP_SETFCAP           DAC_OVERRIDE          NET_RAW

Note the special treatment of ALL: CAP_ALL is not added.

This makes completion consistent with the completion of signals, e.g.

$ docker run --stop-signal <TAB TAB>
CONT     INT      QUIT     SIGHUP   SIGKILL  SIGSTOP  SIGUSR1  STOP     USR1
HUP      KILL     SIGCONT  SIGINT   SIGQUIT  SIGTERM  SIGUSR2  TERM     USR2

Signed-off-by: Harald Albers <github@albersweb.de>
@albers albers force-pushed the completion-capabilities-variants branch from 2cc80a8 to 015cb98 Compare September 4, 2020 09:10
Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@thaJeztah thaJeztah merged commit 551ac13 into docker:master Sep 8, 2020
@albers albers deleted the completion-capabilities-variants branch September 8, 2020 18:59
@thaJeztah thaJeztah added this to the 20.10.0 milestone Jan 5, 2021
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.

3 participants