[Unit] Description=im: the family's sign-in provider (OpenID Connect) After=network-online.target Wants=network-online.target StartLimitIntervalSec=60 StartLimitBurst=5 [Service] Type=simple User=im Group=im Environment=IM_CONFIG=/etc/im/im.toml ExecStart=/usr/local/bin/im serve WorkingDirectory=/var/lib/im StateDirectory=im StateDirectoryMode=0700 Restart=on-failure RestartSec=2 LimitNOFILE=65536 # Hardening. The service writes only to its state directory: database, data_dir (instance key, photos) and # the backup dir. If [backup] dir is set outside /var/lib/im, add that path to ReadWritePaths. NoNewPrivileges=yes ProtectSystem=strict ProtectHome=yes ReadWritePaths=/var/lib/im PrivateTmp=yes PrivateDevices=yes PrivateUsers=yes ProtectKernelTunables=yes ProtectKernelModules=yes ProtectKernelLogs=yes ProtectControlGroups=yes ProtectClock=yes ProtectHostname=yes RestrictSUIDSGID=yes RestrictRealtime=yes RestrictNamespaces=yes RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 LockPersonality=yes MemoryDenyWriteExecute=yes SystemCallArchitectures=native SystemCallFilter=@system-service SystemCallFilter=~@privileged ProtectProc=invisible ProcSubset=pid RemoveIPC=yes PrivateMounts=yes KeyringMode=private # A photo decode may use up to 96 MiB and two run at once; this leaves room for that and the rest. MemoryMax=1G CapabilityBoundingSet= AmbientCapabilities= UMask=0077 [Install] WantedBy=multi-user.target