Skip to content

Commit

Permalink
add libwrap files to landlock read list (fix #450)
Browse files Browse the repository at this point in the history
  • Loading branch information
yrutschle committed Jun 17, 2024
1 parent 93ab4f1 commit eb84c6a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions landlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ static int add_resolv(int ruleset_fd)
return 0;
}

static int add_libwrap(int ruleset_fd)
{
/* Files for libwrap */
#ifdef LIBWRAP
add_path_ro(ruleset_fd, LL_FILE, "/etc/hosts.allow");
add_path_ro(ruleset_fd, LL_FILE, "/etc/hosts.deny");
#endif

return 0;
}



void setup_landlock(void)
{
Expand Down Expand Up @@ -147,6 +159,7 @@ void setup_landlock(void)
/* Add all the paths we need */
add_libs(ruleset_fd);
add_resolv(ruleset_fd);
add_libwrap(ruleset_fd);

if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
print_message(msg_config_error, "Landlock: Failed to restrict privileges");
Expand Down

0 comments on commit eb84c6a

Please sign in to comment.