Skip to content

Commit 720c110

Browse files
committed
Add unit file
1 parent 858811d commit 720c110

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ subdir('src/fundamental')
880880
subdir('src/basic')
881881
subdir('src/libsystemd')
882882
subdir('src/shared')
883+
subdir('units')
883884

884885
install_libsystemd_static = static_library(
885886
'systemd',
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# This file is part of systemd.
22
# See systemd-timedated.service(8) for more information.
33

4-
systemd-timesyncd.service
4+
systemd-nts-timesyncd.service

units/meson.build

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
systemd_nts_timesyncd_conf = configure_file(
2+
input : 'nts-timesyncd.service.in',
3+
output : 'nts-timesyncd.service',
4+
configuration : substs)
5+
install_data(systemd_nts_timesyncd_conf,
6+
install_dir : '/lib/systemd/system')

units/nts-timesyncd.service.in

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
#
3+
# This file is part of systemd.
4+
#
5+
# systemd is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License as published by
7+
# the Free Software Foundation; either version 2.1 of the License, or
8+
# (at your option) any later version.
9+
10+
[Unit]
11+
Description=Network Time Synchronization using ntpsec
12+
Documentation=man:nts-timesyncd.service.service(8)
13+
ConditionCapability=CAP_SYS_TIME
14+
ConditionVirtualization=!container
15+
DefaultDependencies=no
16+
After=systemd-sysusers.service
17+
Before=time-set.target sysinit.target shutdown.target
18+
Conflicts=shutdown.target
19+
Wants=time-set.target
20+
21+
[Service]
22+
AmbientCapabilities=CAP_SYS_TIME
23+
BusName=org.freedesktop.ntstimesync1
24+
CapabilityBoundingSet=CAP_SYS_TIME
25+
# Turn off DNSSEC validation for hostname look-ups, since those need the
26+
# correct time to work, but we likely won't acquire that without NTP. Let's
27+
# break this chicken-and-egg cycle here.
28+
Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0
29+
ExecStart=!!/usr/bin/nts-timesyncd
30+
LockPersonality=yes
31+
MemoryDenyWriteExecute=yes
32+
NoNewPrivileges=yes
33+
PrivateDevices=yes
34+
PrivateTmp=yes
35+
ProtectProc=invisible
36+
ProtectControlGroups=yes
37+
ProtectHome=yes
38+
ProtectHostname=yes
39+
ProtectKernelLogs=yes
40+
ProtectKernelModules=yes
41+
ProtectKernelTunables=yes
42+
ProtectSystem=strict
43+
Restart=always
44+
RestartSec=0
45+
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
46+
RestrictNamespaces=yes
47+
RestrictRealtime=yes
48+
RestrictSUIDSGID=yes
49+
RuntimeDirectory=nts-timesync
50+
StateDirectory=nts-timesync
51+
SystemCallArchitectures=native
52+
SystemCallErrorNumber=EPERM
53+
SystemCallFilter=@system-service @clock
54+
Type=notify
55+
User=nts-timesync
56+
57+
58+
[Install]
59+
WantedBy=sysinit.target
60+
Alias=dbus-org.freedesktop.ntstimesync1.service

0 commit comments

Comments
 (0)