Skip to content

Commit e7225b6

Browse files
committed
feature: add doas support in firecfg and jailcheck
Closes netblue30#5899. Suggested-by: @shaggonit
1 parent 03a0107 commit e7225b6

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

src/firecfg/main.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ static void set_links_homedir(const char *homedir) {
289289
}
290290

291291
static const char *get_sudo_user(void) {
292-
const char *user = getenv("SUDO_USER");
292+
const char *doas_user = getenv("DOAS_USER");
293+
const char *sudo_user = getenv("SUDO_USER");
294+
const char *user = doas_user ? doas_user : sudo_user;
295+
293296
if (!user) {
294297
user = getpwuid(getuid())->pw_name;
295298
if (!user) {

src/jailcheck/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
8686

8787
// user setup
8888
if (getuid() != 0) {
89-
fprintf(stderr, "Error: you need to be root (via sudo) to run this program\n");
89+
fprintf(stderr, "Error: you need to be root (via sudo or doas) to run this program\n");
9090
exit(1);
9191
}
9292
user_name = get_sudo_user();

src/jailcheck/utils.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
#define BUFLEN 4096
2727

2828
char *get_sudo_user(void) {
29-
char *user = getenv("SUDO_USER");
29+
char *doas_user = getenv("DOAS_USER");
30+
char *sudo_user = getenv("SUDO_USER");
31+
char *user = doas_user ? doas_user : sudo_user;
32+
3033
if (!user) {
3134
user = getpwuid(getuid())->pw_name;
3235
if (!user) {

src/man/firecfg.1.in

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ The integration covers:
2323
- programs started by clicking on file icons in file manager - only Cinnamon, KDE, LXDE/LXQT, MATE and XFCE
2424
desktop managers are supported in this moment
2525
.RE
26-
26+
.PP
27+
Note: The examples use \fBsudo\fR, but \fBdoas\fR is also supported.
28+
.PP
2729
To set it up, run "sudo firecfg" after installing Firejail software.
2830
The same command should also be run after
2931
installing new programs. If the program is supported by Firejail, the symbolic link in /usr/local/bin

src/man/jailcheck.1.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ them from inside the sandbox.
2424
\fB5. Seccomp test
2525
.TP
2626
\fB6. Networking test
27-
.TP
28-
The program is started as root using sudo.
29-
27+
.PP
28+
The program should be started using \fBsudo\fR or \fBdoas\fR.
3029
.SH OPTIONS
3130
.TP
3231
\fB\-\-debug

0 commit comments

Comments
 (0)