Repository navigation
Expand file tree
/
Copy pathrust-junosmcp.service
More file actions
74 lines (71 loc) · 2.51 KB
/
Copy pathrust-junosmcp.service
File metadata and controls
74 lines (71 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
[Unit]
Description=Rust Junos and SRX MCP server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=jmcp
Group=jmcp
ExecStart=/usr/local/bin/rust-junosmcp \
--device-mapping /etc/jmcp/devices.json \
--transport streamable-http \
--host 127.0.0.1 \
--port 30030 \
--tokens-file /var/lib/jmcp/tokens.json \
--device-lease-dir /var/lib/jmcp/device-leases \
--audit-hmac-key-file /var/lib/jmcp/audit-hmac.key \
--inventory-readonly
Restart=on-failure
RestartSec=5
Environment=RUST_LOG=info
Environment=JMCP_SUPPORT_BUNDLE_STAGING_DIR=/var/lib/jmcp/srx-staging/bundles
Environment=JMCP_SUPPORT_BUNDLE_STAGING_MAX_BYTES=524288000
UMask=0077
StateDirectory=jmcp
StateDirectoryMode=0700
# Hardening
NoNewPrivileges=true
PrivateTmp=true
PrivateDevices=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/jmcp
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
ProtectClock=true
ProtectHostname=true
ProtectProc=invisible
ProcSubset=pid
RestrictNamespaces=true
LockPersonality=true
RestrictRealtime=true
RestrictSUIDSGID=true
RemoveIPC=true
MemoryDenyWriteExecute=true
CapabilityBoundingSet=
AmbientCapabilities=
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
SystemCallArchitectures=native
# Syscall filtering: SystemCallErrorNumber=EPERM is load-bearing. Without it,
# systemd's default applies and a denied syscall raises SIGSYS, killing the
# process mid-request (mecmcp#351). An EPERM denial is silent at the systemd
# layer — seccomp return actions have a precedence order and ERRNO outranks LOG,
# so a denied call never reaches the audit action. Such denials can only become
# visible if the application stops discarding the errno.
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @obsolete @mount @swap @reboot @module
SystemCallErrorNumber=EPERM
# NOTE: IPAddressAllow/IPAddressDeny are accepted by systemd and reported by
# `systemctl show`, but are NOT enforced in an unprivileged LXC — systemd cannot
# attach the cgroup BPF program there. Every guest in this fleet is one. The
# directives stay because they do enforce on a normal host or privileged
# container, but do not read them as active protection here. The installer
# probes real enforcement and prints ENFORCED / NOT ENFORCED / NO POLICY /
# UNKNOWN. See the operations doc, "Enforcing it where systemd cannot" (mecmcp#322).
IPAddressDeny=169.254.169.254/32
IPAddressAllow=localhost
IPAddressAllow=192.168.0.0/16
[Install]
WantedBy=multi-user.target