Debian Codegraph @

init.d/audit.bash_completion

raw
1 # Bash completion for audit utilities
2 # Installed to /etc/bash_completion.d/audit
3
4 _ausearch_opts="--event --arch --comm --debug --checkpoint --eoe-timeout \
5 --exit --escape --extra-keys --extra-labels --extra-obj2 --extra-time \
6 --file --format --gid-all --input --input-logs --just-one --key \
7 --line-buffered --message --node --object --pid --ppid --raw --syscall \
8 --context --session --subject --success --end --start --terminal \
9 --uid-all --uid-effective --uid --loginuid --uuid --version --word \
10 --executable"
11
12 _aureport_opts="--auth --avc --comm --config --crypto --debug --eoe-timeout \
13 --event --escape --file --failed --host --help --interpret --input \
14 --input-logs --integrity --key --login --mods --mac --anomaly --node \
15 --no-config --pid --response --syscall --success --summary --log \
16 --tty --end --start --user --version --virt --executable"
17
18 _augenrules_opts="--check --load"
19
20 _auditctl_opts="-b --backlog_wait_time --reset_backlog_wait_time_actual -c -D \
21 -e -f -h -i --loginuid-immutable -q -r --reset-lost -R --signal -t -l -m \
22 -s -v -a -A -C -d -D -F -S -w -W"
23
24 _ausearch_complete()
25 {
26 local cur prev
27 COMPREPLY=()
28 cur="${COMP_WORDS[COMP_CWORD]}"
29 prev="${COMP_WORDS[COMP_CWORD-1]}"
30
31 case "$prev" in
32 -if|--input)
33 _filedir
34 return 0
35 ;;
36 -ts|--start|-te|--end)
37 local times="now recent this-hour boot today yesterday this-week \
38 week-ago this-month this-year checkpoint"
39 COMPREPLY=( $(compgen -W "$times" -- "$cur") )
40 return 0
41 ;;
42 -m|--message)
43 local types
44 types=$(ausearch -m 2>&1 | grep -oE '\b[A-Z_]+\b' | sort)
45 COMPREPLY=( $(compgen -W "$types" -- "$cur") )
46 return 0
47 ;;
48 esac
49
50 COMPREPLY=( $(compgen -W "$_ausearch_opts" -- "$cur") )
51 }
52
53 _aureport_complete()
54 {
55 local cur prev
56 COMPREPLY=()
57 cur="${COMP_WORDS[COMP_CWORD]}"
58 prev="${COMP_WORDS[COMP_CWORD-1]}"
59
60 case "$prev" in
61 -if|--input)
62 _filedir
63 return 0
64 ;;
65 -ts|--start|-te|--end)
66 local times="now recent this-hour boot today yesterday this-week \
67 week-ago this-month this-year"
68 COMPREPLY=( $(compgen -W "$times" -- "$cur") )
69 return 0
70 ;;
71 esac
72
73 COMPREPLY=( $(compgen -W "$_aureport_opts" -- "$cur") )
74 }
75
76 _augenrules_complete()
77 {
78 local cur
79 COMPREPLY=()
80 cur="${COMP_WORDS[COMP_CWORD]}"
81 COMPREPLY=( $(compgen -W "$_augenrules_opts" -- "$cur") )
82 }
83
84 _auditctl_complete()
85 {
86 local cur prev
87 COMPREPLY=()
88 cur="${COMP_WORDS[COMP_CWORD]}"
89 prev="${COMP_WORDS[COMP_CWORD-1]}"
90
91 case "$prev" in
92 -S)
93 local syscalls
94 syscalls=$(ausyscall --dump 2>/dev/null | cut -f2)
95 COMPREPLY=( $(compgen -W "$syscalls" -- "$cur") )
96 return 0
97 ;;
98 -R)
99 _filedir
100 return 0
101 ;;
102 --signal)
103 COMPREPLY=( $(compgen -W "stop reload rotate resume state" -- "$cur") )
104 return 0
105 ;;
106 -f|-e)
107 COMPREPLY=( $(compgen -W "0 1 2" -- "$cur") )
108 return 0
109 ;;
110 -m)
111 local types
112 types=$(ausearch -m 2>&1 | grep -oE '\b[A-Z_]+\b' | sort)
113 COMPREPLY=( $(compgen -W "$types" -- "$cur") )
114 return 0
115 ;;
116 esac
117
118 COMPREPLY=( $(compgen -W "$_auditctl_opts" -- "$cur") )
119 }
120
121 complete -F _ausearch_complete ausearch
122 complete -F _aureport_complete aureport
123 complete -F _augenrules_complete augenrules
124 complete -F _auditctl_complete auditctl
125