aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/syntax/files/firejail.vim.in
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/syntax/files/firejail.vim.in')
-rw-r--r--contrib/syntax/files/firejail.vim.in99
1 files changed, 99 insertions, 0 deletions
diff --git a/contrib/syntax/files/firejail.vim.in b/contrib/syntax/files/firejail.vim.in
new file mode 100644
index 000000000..ec6b29e4f
--- /dev/null
+++ b/contrib/syntax/files/firejail.vim.in
@@ -0,0 +1,99 @@
1" @make_input@
2" Vim syntax file
3" Language: Firejail security sandbox profile
4" URL: https://github.com/netblue30/firejail
5
6if exists("b:current_syntax")
7 finish
8endif
9
10
11syn iskeyword @,48-57,_,.,-
12
13
14syn keyword fjTodo TODO FIXME XXX NOTE contained
15syn match fjComment "#.*$" contains=fjTodo
16
17"TODO: highlight "dangerous" capabilities differently, as is done in apparmor.vim?
18syn keyword fjCapability audit_control audit_read audit_write block_suspend chown dac_override dac_read_search fowner fsetid ipc_lock ipc_owner kill lease linux_immutable mac_admin mac_override mknod net_admin net_bind_service net_broadcast net_raw setgid setfcap setpcap setuid sys_admin sys_boot sys_chroot sys_module sys_nice sys_pacct sys_ptrace sys_rawio sys_resource sys_time sys_tty_config syslog wake_alarm nextgroup=fjCapabilityList contained
19syn match fjCapabilityList /,/ nextgroup=fjCapability contained
20
21syn keyword fjNamespaces cgroup ipc net mnt pid time user uts nextgroup=fjNamespacesList contained
22syn match fjNamespacesList /,/ nextgroup=fjNamespaces contained
23
24syn keyword fjProtocol unix inet inet6 netlink packet nextgroup=fjProtocolList contained
25syn match fjProtocolList /,/ nextgroup=fjProtocol contained
26
27" Syscalls (auto-generated)
28syn keyword fjSyscall @FJ_SYSCALLS@ nextgroup=fjSyscallErrno contained
29" Syscall groups (auto-generated)
30syn match fjSyscall /\v\@(@FJ_SYSCALL_GROUPS@)>/ nextgroup=fjSyscallErrno contained
31syn match fjSyscall /\$[0-9]\+/ nextgroup=fjSyscallErrno contained
32" Errnos (auto-generated)
33syn match fjSyscallErrno /\v(:(@FJ_SYSTEM_ERRNOS@)>)?/ nextgroup=fjSyscallList contained
34syn match fjSyscallList /,/ nextgroup=fjSyscall contained
35
36syn keyword fjX11Sandbox none xephyr xorg xpra xvfb contained
37syn keyword fjSeccompAction kill log ERRNO contained
38
39syn match fjEnvVar "[A-Za-z0-9_]\+=" contained
40syn match fjRmenvVar "[A-Za-z0-9_]\+" contained
41
42syn keyword fjAll all contained
43syn keyword fjNone none contained
44syn keyword fjLo lo contained
45syn keyword fjFilter filter contained
46
47" Variable names (auto-generated)
48syn match fjVar /\v\$\{(@FJ_PROFILE_MACROS@)}/
49
50" Profile commands with 1 argument (auto-generated)
51syn match fjCommand /\v(@FJ_PROFILE_COMMANDS_ARG1@) / skipwhite contained
52" Profile commands with 0 arguments (auto-generated)
53syn match fjCommand /\v(@FJ_PROFILE_COMMANDS_ARG0@)$/ contained
54syn match fjCommand /ignore / nextgroup=fjCommand,fjCommandNoCond skipwhite contained
55syn match fjCommand /caps\.drop / nextgroup=fjCapability,fjAll skipwhite contained
56syn match fjCommand /caps\.keep / nextgroup=fjCapability skipwhite contained
57syn match fjCommand /protocol / nextgroup=fjProtocol skipwhite contained
58syn match fjCommand /restrict-namespaces / nextgroup=fjNamespaces skipwhite contained
59syn match fjCommand /\vseccomp(\.32)?(\.drop|\.keep)? / nextgroup=fjSyscall skipwhite contained
60syn match fjCommand /x11 / nextgroup=fjX11Sandbox skipwhite contained
61syn match fjCommand /env / nextgroup=fjEnvVar skipwhite contained
62syn match fjCommand /rmenv / nextgroup=fjRmenvVar skipwhite contained
63syn match fjCommand /shell / nextgroup=fjNone skipwhite contained
64syn match fjCommand /net / nextgroup=fjNone,fjLo skipwhite contained
65syn match fjCommand /ip / nextgroup=fjNone skipwhite contained
66syn match fjCommand /seccomp-error-action / nextgroup=fjSeccompAction skipwhite contained
67syn match fjCommand /\vdbus-(user|system) / nextgroup=fjFilter,fjNone skipwhite contained
68syn match fjCommand /\vdbus-(user|system)\.(broadcast|call|own|see|talk) / skipwhite contained
69" Commands that can't be inside a ?CONDITIONAL: statement
70syn match fjCommandNoCond /include / skipwhite contained
71syn match fjCommandNoCond /quiet$/ contained
72
73" Conditionals (auto-generated)
74syn match fjConditional /\v\?(@FJ_PROFILE_CONDITIONALS@) ?:/ nextgroup=fjCommand skipwhite contained
75
76" A line is either a command, a conditional or a comment
77syn match fjStatement /^/ nextgroup=fjCommand,fjCommandNoCond,fjConditional,fjComment
78
79hi def link fjTodo Todo
80hi def link fjComment Comment
81hi def link fjCommand Statement
82hi def link fjCommandNoCond Statement
83hi def link fjConditional Macro
84hi def link fjVar Identifier
85hi def link fjCapability Type
86hi def link fjProtocol Type
87hi def link fjSyscall Type
88hi def link fjSyscallErrno Constant
89hi def link fjX11Sandbox Type
90hi def link fjEnvVar Type
91hi def link fjRmenvVar Type
92hi def link fjAll Type
93hi def link fjNone Type
94hi def link fjLo Type
95hi def link fjFilter Type
96hi def link fjSeccompAction Type
97
98
99let b:current_syntax = "firejail"