diff options
author | 2023-07-16 11:24:12 -0400 | |
---|---|---|
committer | 2023-07-16 11:24:12 -0400 | |
commit | cb39a0eafd030829c0081e698cb934fd4f09692f (patch) | |
tree | 755ee6a74cd9fee380c4fd1c6a5cb2a4361c4b66 /src/jailcheck | |
parent | fnettrace cleanup (diff) | |
parent | Merge pull request #5900 from kmk3/firecfg-support-doas (diff) | |
download | firejail-cb39a0eafd030829c0081e698cb934fd4f09692f.tar.gz firejail-cb39a0eafd030829c0081e698cb934fd4f09692f.tar.zst firejail-cb39a0eafd030829c0081e698cb934fd4f09692f.zip |
Merge branch 'master' of ssh://github.com/netblue30/firejail
Diffstat (limited to 'src/jailcheck')
-rw-r--r-- | src/jailcheck/main.c | 3 | ||||
-rw-r--r-- | src/jailcheck/utils.c | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/jailcheck/main.c b/src/jailcheck/main.c index 27da309ea..6cc5cf904 100644 --- a/src/jailcheck/main.c +++ b/src/jailcheck/main.c | |||
@@ -86,7 +86,7 @@ int main(int argc, char **argv) { | |||
86 | 86 | ||
87 | // user setup | 87 | // user setup |
88 | if (getuid() != 0) { | 88 | 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"); |
90 | exit(1); | 90 | exit(1); |
91 | } | 91 | } |
92 | user_name = get_sudo_user(); | 92 | user_name = get_sudo_user(); |
@@ -120,6 +120,7 @@ int main(int argc, char **argv) { | |||
120 | // basic sysfiles | 120 | // basic sysfiles |
121 | sysfiles_setup("/etc/shadow"); | 121 | sysfiles_setup("/etc/shadow"); |
122 | sysfiles_setup("/etc/gshadow"); | 122 | sysfiles_setup("/etc/gshadow"); |
123 | sysfiles_setup("/usr/bin/doas"); | ||
123 | sysfiles_setup("/usr/bin/mount"); | 124 | sysfiles_setup("/usr/bin/mount"); |
124 | sysfiles_setup("/usr/bin/su"); | 125 | sysfiles_setup("/usr/bin/su"); |
125 | sysfiles_setup("/usr/bin/ksu"); | 126 | sysfiles_setup("/usr/bin/ksu"); |
diff --git a/src/jailcheck/utils.c b/src/jailcheck/utils.c index 97fe8833b..930820604 100644 --- a/src/jailcheck/utils.c +++ b/src/jailcheck/utils.c | |||
@@ -26,7 +26,10 @@ | |||
26 | #define BUFLEN 4096 | 26 | #define BUFLEN 4096 |
27 | 27 | ||
28 | char *get_sudo_user(void) { | 28 | 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 | |||
30 | if (!user) { | 33 | if (!user) { |
31 | user = getpwuid(getuid())->pw_name; | 34 | user = getpwuid(getuid())->pw_name; |
32 | if (!user) { | 35 | if (!user) { |