Commit graph

30 commits

Author SHA1 Message Date
沈澄心
36de842b77
contrib/vim: add ftplugin file (based on cfg.vim) (#6680)
Add a simple vim filetype plugin.
2025-03-10 02:57:57 +00:00
Kelvin M. Klann
6273865394 contrib/vim: match profile files more broadly
Currently it only sets the appropriate filetype for files in
`/etc/firejail` and `~/.config/firejail`.

With this commit, the firejail filetype should also be set when opening
`etc/inc/*.inc`, for example, as long as there is a "firejail" directory
somewhere before that (such as in `/foo/firejail/bar/etc/inc/*.inc`).

Note: At least `*/firejail/*.inc` needs to force the match (by using
`set filetype` rather than `setfiletype`), or else the default vim
checks take precedence (and the filetype for all files in
`etc/inc/*.inc` gets set to `pov`).

Fixes #4319.

Relates to #2679.

Co-authored-by: rusty-snake <41237666+rusty-snake@users.noreply.github.com>
2023-06-10 14:16:41 -03:00
Kelvin M. Klann
2f87ae148c contrib/vim: sort paths in ftdetect 2023-06-09 18:26:39 -03:00
Kelvin M. Klann
88ba851893 build: move syntax files to contrib/syntax/files
Having all of syntax files in the same directory makes it easier to
reference all of them at once on a makefile (such as with
`contrib/syntax/files/*.in`).

Also, this makes the path to the gtksourceview language-spec shorter.
Current path/new path:

* contrib/gtksourceview-5/language-specs/firejail-profile.lang
* contrib/syntax/files/firejail-profile.lang

Currently, adding a rule to the root Makefile to generate the
language-spec in the same directory as an input file would take at least
95 characters (with only a single dependency):

    contrib/gtksourceview-5/language-specs/%.lang: contrib/gtksourceview-5/language-specs/%.lang.in

With this commit, the above shortened to 59 characters:

    contrib/syntax/files/%.lang: contrib/syntax/files/%.lang.in

Which should make it more readable.

Relates to #2679 #5502.
2023-01-27 23:20:40 -03:00
Kelvin M. Klann
fefe8a9ade firejail.vim: use sed instead of rg
To avoid depending on an extra package without need.

Commands used to search and replace:

    $ f=contrib/vim/syntax/firejail.vim; \
      printf '%s\n' "$(sed -E \
        "s|rg -o '([^']+)' -r '\\\$1'|sed -En 's/.*\\1.*/\\\\1/p'|" "$f")" >"$f"

Note: `sed -E` is not in POSIX.1-2017 (Issue 7), but it has been
accepted into the upcoming POSIX standard version[1] and is supported by
at least GNU, busybox and OpenBSD grep.

Added on commit a1cc4a556 ("Add vim syntax and ftdetect files (#2679)",
2019-05-06).

[1] https://www.austingroupbugs.net/view.php?id=528
2023-01-09 02:44:25 -03:00
Kelvin M. Klann
f6ea99dd1c firejail.vim: remove redundant sed -e flags
Only a single script is passed by argument in each invocation.

Added on commit a1cc4a556 ("Add vim syntax and ftdetect files (#2679)",
2019-05-06) and on commit d2e10f2f5 ("vim: update list of syscalls",
2021-05-29) / PR #4318.
2023-01-09 02:44:25 -03:00
Kelvin M. Klann
e0d0739249 firejail.vim: remove non-POSIX grep -x flag
It seems to be equivalent to just delimiting the beginning and the end
of the line with `^foo$`.

Also, put the regex mode (-E) first.

Commands used to search and replace:

    $ f=contrib/vim/syntax/firejail.vim; \
      printf '%s\n' "$(sed -E \
        "s|grep -vEx '([^']+)'|grep -Ev '^\\1\$'|" "$f")" >"$f"

Added on commit a1cc4a556 ("Add vim syntax and ftdetect files (#2679)",
2019-05-06).
2023-01-09 02:44:25 -03:00
Kelvin M. Klann
97c4f09148 firejail.vim: remove literal newline escapes in tr
POSIX tr understands '\n', so use that instead of the less portable
$'\n'.

Commands used to search and replace:

    $ f=contrib/vim/syntax/firejail.vim; \
      printf '%s\n' "$(sed -E \
        "s/tr +\\\$'\\\\n'/tr '\\\\n'/g" "$f")" >"$f"

Added on commit a1cc4a556 ("Add vim syntax and ftdetect files (#2679)",
2019-05-06).
2023-01-09 02:44:25 -03:00
Kelvin M. Klann
97874c3bf9 Revert "Merge pull request #5315 from ChrysoliteAzalea/landlock"
This reverts commit 54cb3e741e, reversing
changes made to 97b1e02d5f.

There were many issues and requests for changes raised in the pull
request (both code-wise and design-wise) and most of them are still
unresolved[1].

[1] https://github.com/netblue30/firejail/pull/5315
2022-09-05 01:07:41 -03:00
Азалия Смарагдова
460fa7a6f9 Proposed fixes. 2022-08-16 12:03:50 +05:00
Азалия Смарагдова
61b1544289 Landlock support has been added. 2022-08-15 13:32:24 +05:00
Азалия Смарагдова
7f3b6c19a0
Add support for custom AppArmor profiles (--apparmor=) 2022-08-05 11:47:24 +05:00
smitsohu
87afef810c introduce new option restrict-namespaces 2022-07-23 16:21:14 +02:00
netblue30
dab6742eee more on removing cgroups (#5200) 2022-06-16 10:12:10 -04:00
smitsohu
c764520b5a keep-fd option (#4845) 2022-01-14 23:58:43 +01:00
Kelvin M. Klann
1271645da9 noprinters: add missing items from new command checklist
See CONTRIBUTING.md.

The changes are based on what was done on commit 5a612029b ("rename
noautopulse to keep-config-pulse", 2021-05-13) / PR #4278.

This amends commit bd15e763e ("--noprinter option", 2021-10-20) and
commit d9403dcdc ("small fix", 2021-10-20).

Relates to #4607.
2022-01-05 18:54:47 -03:00
smitsohu
e20960ab45 deterministic-shutdown option 2021-10-28 13:41:52 +02:00
rusty-snake
c86cae2d08 Add new condition ALLOW_TRAY 2021-09-04 19:08:32 +02:00
Reiner Herrmann
952264e2cc vim: escape dots in seccomp.32 2021-05-29 12:53:54 +02:00
Reiner Herrmann
91cc7e2688 vim: use setfiletype command for setting filetype
this is a bit nicer, as it does not overwrite the filetype if it
already has been set.
2021-05-29 12:53:50 +02:00
Reiner Herrmann
f964aaad2f vim: use type instead of constant for seccomp action 2021-05-29 12:53:46 +02:00
Reiner Herrmann
91dcea1a21 vim: support commands private-cwd, dbus-*, seccomp.32, allow-debuggers 2021-05-29 12:53:41 +02:00
Reiner Herrmann
7fee9c550f vim: update conditionals 2021-05-29 12:53:38 +02:00
Reiner Herrmann
27630857eb vim: update syscall groups 2021-05-29 12:53:35 +02:00
Reiner Herrmann
51469caa09 vim: highlight seccomp-error-action 2021-05-29 12:53:27 +02:00
Reiner Herrmann
d2e10f2f5d vim: update list of syscalls 2021-05-29 12:53:12 +02:00
Kelvin M. Klann
5a612029b6 rename noautopulse to keep-config-pulse
Changes:

* add the keep-config-pulse option
* make noautopulse an alias for keep-config-pulse
* deprecate the noautopulse option
* misc: fix indentation of --keep-dev-shm on src/firejail/usage.c

Even though noautopulse is not intended for hardening, it looks like it
is, because it starts with "no", just like no3d, noroot, etc).  In fact,
it is the only "no" option that differs in such a way.

And it has been accidentally misused as such before; see PR #4269 and
commit e4beaeaa8 ("drop noautopulse from agetpkg").

So effectively rename it to keep-config-pulse in order to avoid
confusion.  This is similar to the keep-var-tmp and keep-dev-shm
options, which are used to "leave a path alone", just like noautopulse.

Note: The changes on this patch are based on the ones from commit
617ff40c9 ("add --noautopulse arg for complex pulse setups") / PR #1854.

See #4269 for the discussion.
2021-05-14 08:56:02 -03:00
Kelvin M. Klann
22a91aedf7 contrib/vim: add missing noinput command to syn match
Added on commit a90386d77 ("Map /dev/input with "--private-dev", add
"--no-input" option to disable it") / PR #4209.  See also commit
0cee0ba5a ("Add noinput to all profiles with private-dev") / PR #4239.

Misc: I noticed that it was missing due to the lack of syntax
highlighting on etc/profile-m-z/webstorm.profile.
2021-05-07 23:15:12 -03:00
glitsj16
81c9451b00
add support for fsaccessat2 syscall 2021-02-10 22:11:02 +00:00
Quentin Minster
a1cc4a5568 Add vim syntax and ftdetect files (#2679) 2019-05-05 18:22:22 -05:00