Commit graph

249 commits

Author SHA1 Message Date
Азалия Смарагдова
ba828befe0 Landlock functions are added to the code of Firejail, removing the dependency on tinyLL 2022-08-15 14:36:02 +05:00
Азалия Смарагдова
61b1544289 Landlock support has been added. 2022-08-15 13:32:24 +05:00
Kelvin M. Klann
011d84b462 build: reduce autoconf input files from 32 to 2
Configure summary: autoconf essentially only parses configure.ac and
generates the configure script (that is, the "./configure" shell
script).  The latter is what actually checks what is available on the
system and internally sets the value of the output variables.  It then,
for every filename foo in AC_CONFIG_FILES (and for every output variable
name BAR in AC_SUBST), reads foo.in, replaces every occurrence of
`@BAR@` with the value of the shell variable `$BAR` and generates the
file foo from the result.  After this, configure is finished and `make`
could be executed to start the build.

Now that (as of #5140) all output variables are only defined on
config.mk.in and on config.sh.in, there is no need to generate any
makefile nor any other mkfile or shell script at configure time.  So
rename every "Makefile.in" to "Makefile", mkdeb.sh.in to mkdeb.sh,
src/common.mk.in to src/common.mk and leave just config.mk and config.sh
as the files to be generated at configure time.

This allows editing and committing all makefiles directly, without
potentially having to run ./configure in between.

Commands used to rename the makefiles:

    $ git ls-files -z -- '*Makefile.in' | xargs -0 -I '{}' sh -c \
      "git mv '{}' \"\$(dirname '{}')/Makefile\""

Additionally, from my (rudimentary) testing, this commit reduces the
time it takes to run ./configure by about 20~25% compared to commit
72ece92ea ("Transmission fixes: drop private-lib (#5213)", 2022-06-22).
Environment: dash 0.5.11.5-1, gcc 12.1.0-2, Artix Linux, ext4 on an HDD.

Commands used for benchmarking each commit:

    $ : >time_configure && ./configure && make distclean &&
      for i in $(seq 1 10); do
      { time -p ./configure; } 2>>time_configure; done
    $ grep real time_configure |
      awk '{ total += $2 } END { print total/NR }'
2022-06-30 05:30:14 -03:00
Kelvin M. Klann
50c64e0a9a configure*: Move LDFLAGS below CFLAGS
To match the usual usage order.

Relates to commit 222a2d772 ("order options alphabetically in
configure.ac report", 2022-06-13).
2022-06-15 01:23:22 -03:00
Kelvin M. Klann
eb548749f0 configure*: fix typo in output (--ouput -> --output)
This amends commit 72ba0b7e5 ("compile time: disable --output",
2021-02-28).
2022-06-15 01:23:13 -03:00
netblue30
222a2d7720 order options alphabetically in configure.ac report 2022-06-13 10:14:57 -04:00
netblue30
bebf68303a compile time: changed --disable-firetunnel into --enable-firetunnel 2022-06-13 10:05:06 -04:00
Kelvin M. Klann
95bfe7d71b mkdeb.sh.in: move configure-time vars into new config.sh.in
For better organization and so that they can be used by other shell
scripts by just sourcing config.sh.
2022-06-12 16:08:47 -03:00
Kelvin M. Klann
4e8244fb81 makefiles: deduplicate configure-time vars into new config.mk.in
Currently, the configure-time variables (that is, the ones that assign
to placeholders, such as "@HAVE_MAN@", which are set/replaced at
configure-time) are defined on multiple files (such as on Makefile.in
and on common.mk.in).

To avoid duplication, centralize these variables on a single file
(config.mk.in) and replace all of the other definitions of them with an
include of config.mk.
2022-06-12 16:08:47 -03:00
Kelvin M. Klann
62866784b4 configure*: sort AC_CONFIG_FILES 2022-06-12 16:08:47 -03:00
Kelvin M. Klann
f0344753d7 configure*: list one file per line on AC_CONFIG_FILES
To make it easier to read and edit them and to make the diffs clearer.

vim commands used to search and replace:

    :0/AC_CONFIG_FILES/1 | ,+3s/ \\// | -3,+1s/ /\r/g
2022-06-12 16:08:47 -03:00
netblue30
f483fc0a6f 0.9.71 2022-06-12 11:02:59 -04:00
netblue
b4b08d21cd release 0.9.70 testing 2022-06-09 09:21:13 -04:00
Kelvin M. Klann
68dc790639 Revert "I am preparing a point release for next week, fixes and small number of new features. Check in everything you have out."
This reverts commit e8cb03cde8.

More specifically: s/0.9.68.1/0.9.69/.

The current development version contains not only new features, but also
breaking changes (see "modif:" on the RELNOTES).  Ensure at least a
minor (rather than only a patch) version bump (to 0.9.70 on the final
version) to avoid breaking user expectations.
2022-06-04 20:56:30 -03:00
netblue30
e8cb03cde8 I am preparing a point release for next week, fixes and small number of new features. Check in everything you have out. 2022-06-03 08:38:27 -04:00
netblue30
880f2c98a1 Removed IDS feature from the default build. To enable it, use --enable-ids at compile time. 2022-05-25 07:36:42 -04:00
Kelvin M. Klann
4421517c55 configure*: remove ultimately unused INSTALL and RANLIB check macros
From the manual of GNU Autoconf (version 2.69):

>  -- Macro: AC_PROG_INSTALL
>      Set output variable 'INSTALL' to the name of a BSD-compatible
>      'install' program, if one is found in the current 'PATH'.
>      Otherwise, set 'INSTALL' to 'DIR/install-sh -c', checking the
>      directories specified to 'AC_CONFIG_AUX_DIR' (or its default
>      directories) to determine DIR (*note Output::).  Also set the
>      variables 'INSTALL_PROGRAM' and 'INSTALL_SCRIPT' to '${INSTALL}'
>      and 'INSTALL_DATA' to '${INSTALL} -m 644'.

>  -- Macro: AC_PROG_RANLIB
> 	 Set output variable 'RANLIB' to 'ranlib' if 'ranlib' is found,
> 	 and otherwise to ':' (do nothing).

None of the aforementioned variables are used:

    $ git grep -F -e '${INSTALL}' -e INSTALL_PROGRAM -e INSTALL_SCRIPT \
      -e INSTALL_DATA -e RANLIB
    $

So remove the macros that define them.

Misc: The macros in question have been present on configure.ac since it
was created, on commit 137985136 ("Baseline firejail 0.9.28",
2015-08-08).  And while the install command is called multiple times,
ranlib is not used anywhere (and it seems that it was never used):

    $ git grep -E '^[[:blank:]]+install ' -- '*Makefile*' '*.mk*' |
      wc -l
    32
    $ git grep -F ranlib | wc -l
    0
    $ git log --pretty= --name-only -G'RANLIB|ranlib' \
      137985136..master | sort -u
    README.md

Kind of relates to #4695.
2022-05-08 09:52:49 +00:00
netblue30
1cdfa6f955 more on firecfg --guide: fzenity 2022-04-25 15:34:24 -04:00
netblue30
68a2d01b6b nettrace 2022-04-08 11:15:51 -04:00
Dmitry Chestnykh
c238147fc1 Add ability to disable user profiles at compile time. 2022-02-28 23:26:36 +03:00
netblue30
d18aec7101 fix --disable-private-home compile option 2022-02-08 17:50:46 -05:00
glitsj16
ad56b37c72
Refer to firejail.config in configuration files (#4916)
* fix globalcfg help string

* fix --disable-globalcfg explanation
2022-02-08 14:31:36 +00:00
netblue30
4a2aeb0696 moving to 0.9.69 2022-02-06 08:48:08 -05:00
netblue30
66f4247972 0.9.68 testing 2022-02-04 16:29:24 -05:00
netblue30
37ee3e03e4 rc1 is out, moving to rc2 2022-01-19 09:46:59 -05:00
netblue30
9903aaa9cc rel 0.9.68rc1 testing 2022-01-18 15:34:54 -05:00
netblue30
54b28a0b63 nettrace/netlock 2021-12-28 11:04:59 -05:00
Kelvin M. Klann
8344145f25 build: Normalize HAVE_CONTRIB_INSTALL
Added on commit 8d8686af2 ("Make installation of contrib scripts
configurable", 2017-04-13).

Remove redundant argument to AS_IF and make it look more like the other
nearby AS_IF calls.
2021-11-25 11:32:08 -03:00
Kelvin M. Klann
6d42e13a46 build: Normalize HAVE_SUID
See commit 15d793838 ("Try to fix #2310 -- Can't create run directory
without suid-root", 2021-05-13) / PR #4273.

It is the only "HAVE_" option whose value is set by if/else on a
makefile.  Also, it is set in different places to either "yes", "no",
blank or "-DHAVE_SUID".  Set the value only on configure.ac and only to
either blank or to "-DHAVE_SUID".

Misc: The `ifeq ($(HAVE_SUID),-DHAVE_SUID)` comparison that this adds is
based on the existing `ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR)`
comparison on Makefile.in.
2021-11-25 11:32:08 -03:00
Kelvin M. Klann
c84dc09257 configure*: Remove redundant AC_SUBST calls near HAVE_LTS
Added on commit d1acb31c9 ("compile time: enable LTS", 2021-02-28).

It only needs to be called once for each variable.  See the configure
script diff and the previous commit ("configure*: Move AC_SUBST calls to
more obvious places").
2021-11-25 11:32:08 -03:00
Kelvin M. Klann
36058bc54a configure*: Move AC_SUBST calls to more obvious places
These macros should always be called regardless of the intended value of
each variable, as even if e.g.: no --enable-apparmor flag is given, the
configure script still has to substitute `@HAVE_APPARMOR@` with blank in
the relevant files.

Something similar is already being done for HAVE_OVERLAYFS since commit
fb9f2a5fb ("disabled overlayfs, fixes pending; added video channels to
README* files", 2021-02-06).

Note that each AC_SUBST is not immediately converted into search/replace
code when generating the configure script.  It appears that the
variables are handled only after parsing all of configure.ac (or until a
specific command is found), as all arguments passed to every AC_SUBST
call are defined at once on the `ac_subst_vars` list.  The actual
substitutions are also done all at once (while iterating through the
list) and that happens much later in the script (see both occurrences of
`ac_subs_vars` on the current script).
2021-11-25 11:32:07 -03:00
Kelvin M. Klann
221c10177e configure*: Add missing quotes to arguments
For increased safety and consistency.  In addition, this should make it
clearer where each argument starts and ends.

See also the following item from autoconf NEWS[1]:

> * Noteworthy changes in release 2.70 (2020-12-08) [stable]

[...]

> *** Many macros have become pickier about argument quotation.
>
>   If you get a shell syntax error from your generated configure
>   script, or seemingly impossible misbehavior (e.g. entire blocks of
>   the configure script not getting executed), check first that all
>   macro arguments are properly quoted. The “M4 Quotation” section of
>   the manual explains how to quote macro arguments properly.
>
>   It is unfortunately not possible for autoupdate to correct
>   quotation errors.

[1] https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=NEWS;h=ba418d1af5da752de77a2c388f9af56f8f1bf6a4;hb=97fbc5c184acc6fa591ad094eae86917f03459fa
2021-11-25 11:30:25 -03:00
Kelvin M. Klann
ef6df15def configure*: Fix wrong quote character in AC_MSG_ERROR
Square brackets are used as quotes in autoconf.

From Section 8.1.1, Active Characters of the Autoconf manual[1]:

> To fully understand where proper quotation is important, you first
> need to know what the special characters are in Autoconf: ‘#’
> introduces a comment inside which no macro expansion is performed, ‘,’
> separates arguments, ‘[’ and ‘]’ are the quotes themselves, ‘(’ and
> ‘)’ (which M4 tries to match by pairs), and finally ‘$’ inside a macro
> definition.

[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/autoconf.html#Active-Characters
2021-11-24 15:58:51 -03:00
Kelvin M. Klann
b20a1f3ebf configure*: Trim trailing spaces on var assignments
Command used to find them:

    grep ' "$' configure.ac
2021-11-24 15:58:48 -03:00
Kelvin M. Klann
3c6d5232b8 configure.ac: Ensure whitespace after each comma
For increased consistency and readability.

This restores the spaces removed on commit bf81cd6ad ("configure.ac: run
autoupdate to fix autoconf warning") / PR #4316.

Command used to check for the lack of whitespace:

    grep ',[^ ]' configure.ac
2021-11-24 15:58:33 -03:00
Kelvin M. Klann
9abb0a89ae
build: Stop linking pthread (#4695)
Added on commit 137985136 ("Baseline firejail 0.9.28", 2015-08-08).  See
also commit ad6bb83fa ("consolidate makefiles", 2018-03-31).

It is not used anywhere.  And it looks like it has never been used
anywhere:

    $ git log --oneline -Gpthread.h 137985136..master
    $

Issue mentioned by @rusty-snake:
https://github.com/netblue30/firejail/issues/4642#issuecomment-955795463
2021-11-17 18:24:32 +01:00
Reiner Herrmann
2164412bb5
build: allow building with sanitizer (#4594) 2021-10-13 23:27:59 +02:00
a1346054
47f7347715
fix spelling (#4573) 2021-09-22 23:05:33 +02:00
netblue30
a627071b33 intrusion detection system 2021-07-28 08:30:24 -04:00
netblue30
c08414fdbb deprecated --disable-whitelist at compile time 2021-07-03 19:24:31 -04:00
netblue30
8816dd541d rel 0.9.66 is out, moving to 0.9.67 2021-06-29 15:21:54 -04:00
netblue30
b3ce082430 release 0.9.66 testing 2021-06-28 13:12:42 -04:00
netblue30
4522ccb4ef version 0.9.66rc1 released 2021-06-02 11:28:00 -04:00
Kelvin M. Klann
bfbed383d8 configure*: use cat instead of many echoes
For simplicity and increased portability.
2021-05-28 18:02:25 -03:00
Kelvin M. Klann
bf81cd6ad9 configure.ac: run autoupdate to fix autoconf warning
This fixes the following warning:

    $ autoconf
    configure.ac:306: warning: AC_OUTPUT should be used without arguments.
    configure.ac:306: You should run autoupdate.

Environment:

    $ grep '^NAME' /etc/os-release
    NAME="Artix Linux"
    $ pacman -Q autoconf
    autoconf 2.71-1

Though keep `AC_PREREQ` at 2.68 (released on 2010-09-23[1]), as version
2.71 (which autoupdate automatically bumps to) is rather recent
(released on 2021-01-28[2]) and the changes do not appear to require a
version bump, as on `AC_INIT` it only adds some quotes, and the rest of
the changes are consistent with the autoconf 2.68 manual.  From Section
18.4, Obsolete Macros[3]:

> — Macro: AC_OUTPUT ([file]..., [extra-cmds], [init-cmds])
>
>     The use of AC_OUTPUT with arguments is deprecated.  This obsoleted
>     interface is equivalent to:
>
>               AC_CONFIG_FILES(file...)
>               AC_CONFIG_COMMANDS([default],
>                                  extra-cmds, init-cmds)
>               AC_OUTPUT
>
>     See AC_CONFIG_FILES, AC_CONFIG_COMMANDS, and AC_OUTPUT.

Note: The usage of the above format has been present since the inception
of configure.ac, on commit 137985136 ("Baseline firejail 0.9.28").

Misc: This is a continuation of #4293.

[1] https://lists.gnu.org/archive/html/info-gnu/2010-09/msg00013.html
[2] https://lists.gnu.org/archive/html/autoconf/2021-01/msg00126.html
[3] https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Obsolete-Macros.html#index-AC_005fOUTPUT-2058
2021-05-28 18:02:17 -03:00
Reiner Herrmann
07b85f39af CI: build with GCC 11
this fixes a new false positive memory leak (#4297), but unfortunately
opens a few new false positives (#4274).
therefore let it ignore memleak checks for now, until the detection
is a bit more stable in GCC.

Fixes: #4274, #4297
2021-05-23 11:48:27 +02:00
Kelvin M. Klann
0c5d5d77b3 configure*: fix build with non-bash /bin/sh
The configure script happens to work if /bin/sh supports the non-POSIX
"+=" operator (e.g.: bash) and fails otherwise (e.g.: dash).

This usage first appeared on configure.ac on commit 66a476419 ("gcov
support"), which is from 2016.

If the --enable-apparmor flag is passed to ./configure (which is the
default on Arch Linux), running `make` fails due to the missing
-lapparmor LDFLAG.  Thus, building firejail-git from the AUR does not
work if /bin/sh is e.g.: dash.

Errors when running the build commands below from makepkg:

    $ ./configure --prefix=/usr --enable-apparmor >/dev/null
    ./configure: 3174: EXTRA_CFLAGS+= -mindirect-branch=thunk: not found
    ./configure: 3246: EXTRA_CFLAGS+= -fstack-clash-protection: not found
    ./configure: 3282: EXTRA_CFLAGS+= -fstack-protector-strong: not found
    ./configure: 3518: EXTRA_CFLAGS+= : not found
    $ make >/dev/null
    /usr/bin/ld: apparmor.o: in function `apparmor_test':
    /tmp/firejail-git/src/firejail-git/src/jailcheck/apparmor.c:28: undefined reference to `aa_gettaskcon'
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:10: jailcheck] Error 1
    make: *** [Makefile:42: src/jailcheck/jailcheck] Error 2
    make: *** Waiting for unfinished jobs....
    /usr/bin/ld: apparmor.o: in function `print_apparmor':
    /tmp/firejail-git/src/firejail-git/src/firemon/apparmor.c:28: undefined reference to `aa_gettaskcon'
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:10: firemon] Error 1
    make: *** [Makefile:42: src/firemon/firemon] Error 2
    /usr/bin/ld: join.o: in function `extract_apparmor':
    /tmp/firejail-git/src/firejail-git/src/firejail/join.c:65: undefined reference to `aa_is_enabled'
    /usr/bin/ld: sandbox.o: in function `set_apparmor':
    /tmp/firejail-git/src/firejail-git/src/firejail/sandbox.c:133: undefined reference to `aa_change_onexec'
    collect2: error: ld returned 1 exit status
    make[1]: *** [Makefile:10: firejail] Error 1
    make: *** [Makefile:42: src/firejail/firejail] Error 2

Without the apparmor flag, the CFLAGS related to HAVE_SPECTRE do not get
applied either, but `make` does not error out, so the problem is harder
to detect in this case.

Diff comparing the output of `./configure 2>&1` when running without and
then with this patch:

    $ git --no-pager diff --no-index configure_current.log configure_patch.log
    diff --git a/configure_current.log b/configure_patch.log
    index f5e814f..099d836 100644
    --- a/configure_current.log
    +++ b/configure_patch.log
    @@ -10,12 +10,9 @@ checking for gcc option to accept ISO C89... none needed
     checking for a BSD-compatible install... /usr/bin/install -c
     checking for ranlib... ranlib
     checking whether C compiler accepts -mindirect-branch=thunk... yes
    -./configure: 3174: EXTRA_CFLAGS+= -mindirect-branch=thunk: not found
     checking whether C compiler accepts -mretpoline... no
     checking whether C compiler accepts -fstack-clash-protection... yes
    -./configure: 3246: EXTRA_CFLAGS+= -fstack-clash-protection: not found
     checking whether C compiler accepts -fstack-protector-strong... yes
    -./configure: 3282: EXTRA_CFLAGS+= -fstack-protector-strong: not found
     checking for pkg-config... /usr/bin/pkg-config
     checking pkg-config is at least version 0.9.0... yes
     checking for gawk... yes
    @@ -88,7 +85,7 @@ Configuration options:
        busybox workaround: no
        Spectre compiler patch: yes
        EXTRA_LDFLAGS:
    -   EXTRA_CFLAGS:
    +   EXTRA_CFLAGS:  -mindirect-branch=thunk -fstack-clash-protection -fstack-protector-strong
        fatal warnings:
        Gcov instrumentation:
        Install contrib scripts: yes
2021-05-22 08:57:39 -03:00
netblue30
b79e4416fe jailtest -> jailcheck (#4268) 2021-05-18 13:49:02 -04:00
netblue30
5c95f0f957 retiring --audit (replaced by jailtest) 2021-03-01 07:24:29 -05:00
rusty-snake
b02d8f91c7 Add ./configure --enable-force-nonewprivs
This will always set 'nonewprivs', 'caps.drop all' and 'nogroups'.
2021-03-01 12:40:02 +01:00