Commit Graph

67483 Commits

Author SHA1 Message Date
Bertrand Jacquin
bdf58b47c3 resolved: never respond to .alt pseudo-TLD.
From RFC 9476:

Because names beneath .alt are in an alternative namespace, they have no
significance in the regular DNS context. DNS stub and recursive
resolvers do not need to look them up in the DNS context.

See: https://datatracker.ietf.org/doc/html/rfc9476#name-the-alt-namespace
2023-09-28 12:07:47 +02:00
Mike Yuan
b92abd712e Merge pull request #29333 from YHNdnzj/systemctl-warn-half-masked
systemctl-enable: warn if disabled/masked unit has active triggering units
2023-09-28 17:58:21 +08:00
Mike Yuan
d708bb7c02 systemctl-enable: warn if disabled/masked units has active triggering units
Closes #311
2023-09-28 05:24:51 +08:00
Mike Yuan
0b675f97d6 systemctl-start: suppress the triggering unit warning when --no-warn 2023-09-28 05:24:51 +08:00
Mike Yuan
002db03f54 systemctl: clean up check_triggering_units
Preparation for #311
2023-09-28 05:24:51 +08:00
Mike Yuan
6ea32f61f3 systemctl: make unit_is_masked always query manager 2023-09-28 05:24:51 +08:00
Mike Yuan
c36c81e467 systemctl: don't duplicate string needlessly 2023-09-28 05:14:42 +08:00
Mike Yuan
1f998158a9 systemctl: reflect that statically enabled units can be in .upholds/
Follow-up for 38f901791f
2023-09-28 05:14:42 +08:00
Luca Boccassi
89e7b9652b Merge pull request #29353 from YHNdnzj/nft-followup
man/org.freedesktop.systemd1: add version info for NFTSet
2023-09-27 21:02:43 +01:00
Mike Yuan
05ae788d28 Merge pull request #29265 from YHNdnzj/sleep-util-refactor
sleep-util: split into three and first round of cleanups
2023-09-28 03:06:48 +08:00
Mike Yuan
6bd8340d11 man/org.freedesktop.systemd1: add version info for NFTSet
Follow-up for dc7d69b3c1
2023-09-28 03:04:28 +08:00
Mike Yuan
95f7492875 core/unit: use RET_GATHER in one more function 2023-09-28 03:00:13 +08:00
Topi Miettinen
435d523956 test: testing for core NFTSet= feature 2023-09-27 18:10:11 +00:00
Topi Miettinen
3bb48b19bd core: add user and group to NFTSet=
The benefit of using this setting is that user and group IDs, especially dynamic and random
IDs used by DynamicUser=, can be used in firewall configuration easily.

Example:

```
[Service]
NFTSet=user:inet:filter:serviceuser
```

Corresponding NFT rules:

```
table inet filter {
        set serviceuser {
                typeof meta skuid
        }
        chain service_output {
                meta skuid @serviceuser accept
                drop
        }
}
```

```
$ cat /etc/systemd/system/dunft.service
[Service]
DynamicUser=yes
NFTSet=user:inet:filter:serviceuser
ExecStart=/bin/sleep 1000

[Install]
WantedBy=multi-user.target
$ sudo nft list set inet filter serviceuser
table inet filter {
        set serviceuser {
                typeof meta skuid
                elements = { 64864 }
        }
}
$ ps -n --format user,group,pid,command -p `systemctl show dunft.service -P MainPID`
    USER    GROUP     PID COMMAND
   64864    64864   55158 /bin/sleep 1000
```
2023-09-27 18:10:11 +00:00
Topi Miettinen
dc7d69b3c1 core: firewall integration of cgroups with NFTSet=
New directive `NFTSet=` provides a method for integrating dynamic cgroup IDs
into firewall rules with NFT sets. The benefit of using this setting is to be
able to use control group as a selector in firewall rules easily and this in
turn allows more fine grained filtering. Also, NFT rules for cgroup matching
use numeric cgroup IDs, which change every time a service is restarted, making
them hard to use in systemd environment.

This option expects a whitespace separated list of NFT set definitions. Each
definition consists of a colon-separated tuple of source type (only "cgroup"),
NFT address family (one of "arp", "bridge", "inet", "ip", "ip6", or "netdev"),
table name and set name. The names of tables and sets must conform to lexical
restrictions of NFT table names. The type of the element used in the NFT filter
must be "cgroupsv2". When a control group for a unit is realized, the cgroup ID
will be appended to the NFT sets and it will be be removed when the control
group is removed.  systemd only inserts elements to (or removes from) the sets,
so the related NFT rules, tables and sets must be prepared elsewhere in
advance.  Failures to manage the sets will be ignored.

If the firewall rules are reinstalled so that the contents of NFT sets are
destroyed, command systemctl daemon-reload can be used to refill the sets.

Example:

```
table inet filter {
...
        set timesyncd {
                type cgroupsv2
        }

        chain ntp_output {
                socket cgroupv2 != @timesyncd counter drop
                accept
        }
...
}
```

/etc/systemd/system/systemd-timesyncd.service.d/override.conf
```
[Service]
NFTSet=cgroup:inet:filter:timesyncd
```

```
$ sudo nft list set inet filter timesyncd
table inet filter {
        set timesyncd {
                type cgroupsv2
                elements = { "system.slice/systemd-timesyncd.service" }
        }
}
```
2023-09-27 18:10:11 +00:00
Lennart Poettering
b28bd48238 update TODO 2023-09-27 19:08:56 +02:00
Lennart Poettering
174e8e9897 Merge pull request #29345 from poettering/measured-uki-condition
pid1: introduce ConditionSecurity=measured-uki
2023-09-27 16:39:46 +02:00
Mike Yuan
563ef8f950 sleep-config: add explanatory comment on "modes" 2023-09-27 21:48:40 +08:00
Mike Yuan
087a25d2ca sleep-config: several cleanups
* Rename free_sleep_config to sleep_config_free
* Rearrange functions
* Make SleepConfig.modes and .states only contain
  operations that needs configuration
* Add missing assert
2023-09-27 21:48:39 +08:00
Mike Yuan
f3afe9dc20 sleep/battery-capacity: rearrange functions 2023-09-27 21:48:39 +08:00
Mike Yuan
7f88eee935 sleep/battery-capacity: drop unused error-handling 2023-09-27 21:48:39 +08:00
Mike Yuan
fbc1dbf296 sleep/battery-capacity: don't report we have trip alarm if no battery is found 2023-09-27 21:48:39 +08:00
Mike Yuan
54d7fcc6a3 sleep-util: split into sleep-config and hibernate-util 2023-09-27 21:48:39 +08:00
Mike Yuan
7d769198e0 sleep-util: split battery-capacity into sleep/
This is only used by sleep.c. Let's start shrinking down
the "mixed" sleep-util.
2023-09-27 21:48:39 +08:00
Mike Yuan
43309f14d9 sleep: rebreak lines in check_wakeup_type 2023-09-27 21:48:39 +08:00