server: disable landlock in systemd daemon
This ensures that reloads work correctly
This commit is contained in:
@@ -4,7 +4,7 @@ Requires=muscl.socket
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify
|
||||||
ExecStart=/usr/bin/muscl server --systemd socket-activate
|
ExecStart=/usr/bin/muscl server --systemd --disable-landlock socket-activate
|
||||||
ExecReload=/usr/bin/kill -HUP $MAINPID
|
ExecReload=/usr/bin/kill -HUP $MAINPID
|
||||||
|
|
||||||
WatchdogSec=15
|
WatchdogSec=15
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ in
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = [
|
ExecStart = [
|
||||||
""
|
""
|
||||||
"${lib.getExe cfg.package} ${cfg.logLevel} server --systemd socket-activate"
|
"${lib.getExe cfg.package} ${cfg.logLevel} server --systemd --disable-landlock socket-activate"
|
||||||
];
|
];
|
||||||
|
|
||||||
ExecReload = [
|
ExecReload = [
|
||||||
|
|||||||
@@ -147,8 +147,10 @@ fn handle_server_command(args: &Args) -> anyhow::Result<Option<()>> {
|
|||||||
"The executable should not be SUID or SGID when running the server manually"
|
"The executable should not be SUID or SGID when running the server manually"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if !command.disable_landlock {
|
||||||
landlock_restrict_server(args.config.as_deref())
|
landlock_restrict_server(args.config.as_deref())
|
||||||
.context("Failed to apply Landlock restrictions to the server process")?;
|
.context("Failed to apply Landlock restrictions to the server process")?;
|
||||||
|
}
|
||||||
|
|
||||||
tokio_start_server(
|
tokio_start_server(
|
||||||
args.config.to_owned(),
|
args.config.to_owned(),
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ use crate::{core::common::DEFAULT_CONFIG_PATH, server::supervisor::Supervisor};
|
|||||||
#[derive(Parser, Debug, Clone)]
|
#[derive(Parser, Debug, Clone)]
|
||||||
pub struct ServerArgs {
|
pub struct ServerArgs {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
subcmd: ServerCommand,
|
pub subcmd: ServerCommand,
|
||||||
|
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
systemd: bool,
|
pub systemd: bool,
|
||||||
|
|
||||||
|
#[arg(long)]
|
||||||
|
pub disable_landlock: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug, Clone)]
|
#[derive(Parser, Debug, Clone)]
|
||||||
|
|||||||
Reference in New Issue
Block a user