Systemd/src/network
Lennart Poettering d3dcf4e3b9 fileio: beef up READ_FULL_FILE_CONNECT_SOCKET to allow setting sender socket name
This beefs up the READ_FULL_FILE_CONNECT_SOCKET logic of
read_full_file_full() a bit: when used a sender socket name may be
specified. If specified as NULL behaviour is as before: the client
socket name is picked by the kernel. But if specified as non-NULL the
client can pick a socket name to use when connecting. This is useful to
communicate a minimal amount of metainformation from client to server,
outside of the transport payload.

Specifically, these beefs up the service credential logic to pass an
abstract AF_UNIX socket name as client socket name when connecting via
READ_FULL_FILE_CONNECT_SOCKET, that includes the requesting unit name
and the eventual credential name. This allows servers implementing the
trivial credential socket logic to distinguish clients: via a simple
getpeername() it can be determined which unit is requesting a
credential, and which credential specifically.

Example: with this patch in place, in a unit file "waldo.service" a
configuration line like the following:

    LoadCredential=foo:/run/quux/creds.sock

will result in a connection to the AF_UNIX socket /run/quux/creds.sock,
originating from an abstract namespace AF_UNIX socket:

    @$RANDOM/unit/waldo.service/foo

(The $RANDOM is replaced by some randomized string. This is included in
the socket name order to avoid namespace squatting issues: the abstract
socket namespace is open to unprivileged users after all, and care needs
to be taken not to use guessable names)

The services listening on the /run/quux/creds.sock socket may thus
easily retrieve the name of the unit the credential is requested for
plus the credential name, via a simpler getpeername(), discarding the
random preifx and the /unit/ string.

This logic uses "/" as separator between the fields, since both unit
names and credential names appear in the file system, and thus are
designed to use "/" as outer separators. Given that it's a good safe
choice to use as separators here, too avoid any conflicts.

This is a minimal patch only: the new logic is used only for the unit
file credential logic. For other places where we use
READ_FULL_FILE_CONNECT_SOCKET it is probably a good idea to use this
scheme too, but this should be done carefully in later patches, since
the socket names become API that way, and we should determine the right
amount of info to pass over.
2020-11-03 09:48:04 +01:00
..
generator tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
netdev fileio: beef up READ_FULL_FILE_CONNECT_SOCKET to allow setting sender socket name 2020-11-03 09:48:04 +01:00
tc tree-wide: assorted coccinelle fixes 2020-10-09 15:02:23 +02:00
wait-online tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
fuzz-netdev-parser.c fuzz: use fflush() and drop unnecessary rewind() 2019-02-25 12:35:51 +09:00
fuzz-network-parser.c network: add Reload() dbus method 2019-10-24 14:18:09 +09:00
fuzz-network-parser.options fuzz: limit the maximum size of test inputs for a few parsers 2019-03-12 19:30:05 +01:00
meson.build network: move sysctl related functions to networkd-sysctl.c 2020-10-07 02:50:51 +09:00
networkctl.c networkctl: use and print full hardware address 2020-10-28 15:18:01 +01:00
networkd-address-label.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-address-label.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-address-pool.c network: manage address pools by OrderedSet 2020-10-07 02:50:50 +09:00
networkd-address-pool.h network: manage address pools by OrderedSet 2020-10-07 02:50:50 +09:00
networkd-address.c network: store full hardware address in Link struct 2020-10-28 14:44:43 +01:00
networkd-address.h network: also unref IPv4 ACD clients in Address objects 2020-10-15 08:11:32 +09:00
networkd-brvlan.c network: merge link_set_bridge_vlan() and br_vlan_configure() 2020-10-07 02:50:50 +09:00
networkd-brvlan.h network: merge link_set_bridge_vlan() and br_vlan_configure() 2020-10-07 02:50:50 +09:00
networkd-can.c network: downgrade log level in conf parsers 2020-07-17 00:40:09 +09:00
networkd-can.h network: can: introduce a config parser function for bitrates 2020-04-01 20:07:20 +02:00
networkd-conf.c network: downgrade log level in conf parsers 2020-07-17 00:40:09 +09:00
networkd-conf.h network: Move config_parse_ip_service_type to networkd-dhcp4.c and 2020-03-03 11:53:49 +09:00
networkd-dhcp-common.c network: introduce network_adjust_dhcp() 2020-10-15 07:06:58 +09:00
networkd-dhcp-common.h network: introduce network_adjust_dhcp() 2020-10-15 07:06:58 +09:00
networkd-dhcp-server-bus.c tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
networkd-dhcp-server-bus.h networkd: start a DBus interface for the DHCP server 2020-06-04 11:16:15 +02:00
networkd-dhcp-server.c network: move link_dhcp4_server_enabled() 2020-10-07 02:50:50 +09:00
networkd-dhcp-server.h network: clean-up DHCP lease server data configuration 2020-06-18 13:08:18 +09:00
networkd-dhcp4.c dhcp4: fix DHCP on InfiniBand interfaces 2020-10-28 14:44:43 +01:00
networkd-dhcp4.h network: check feature is enabled in xxx_configure() 2020-10-07 02:50:51 +09:00
networkd-dhcp6.c dhcp4: fix DHCP on InfiniBand interfaces 2020-10-28 14:44:43 +01:00
networkd-dhcp6.h network: introduce dhcp6_update_mac() 2020-10-07 02:50:51 +09:00
networkd-fdb.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-fdb.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-gperf.gperf network: Add support to ignore foreign routes 2020-03-07 01:42:52 +09:00
networkd-ipv4ll.c network: store full hardware address in Link struct 2020-10-28 14:44:43 +01:00
networkd-ipv4ll.h network: introduce ipv4ll_update_mac() 2020-10-07 02:50:50 +09:00
networkd-ipv6-proxy-ndp.c network: ignore error in writing proxy_ndp 2020-10-23 23:07:12 +09:00
networkd-ipv6-proxy-ndp.h network: rename ipv6_proxy_ndp_addresses_configure() -> link_set_ipv6_proxy_ndp_addresses() 2020-10-07 02:44:42 +09:00
networkd-link-bus.c tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
networkd-link-bus.h network: add DBus method to set DNS server with port number and SNI 2020-07-21 04:08:22 +09:00
networkd-link.c dhcp4: fix DHCP on InfiniBand interfaces 2020-10-28 14:44:43 +01:00
networkd-link.h dhcp4: fix DHCP on InfiniBand interfaces 2020-10-28 14:44:43 +01:00
networkd-lldp-rx.c network: store full hardware address in Link struct 2020-10-28 14:44:43 +01:00
networkd-lldp-rx.h network: check feature is enabled in xxx_configure() 2020-10-07 02:50:51 +09:00
networkd-lldp-tx.c network: store full hardware address in Link struct 2020-10-28 14:44:43 +01:00
networkd-lldp-tx.h LLDP: Add support to transmit MUD URL 2020-04-08 00:20:54 +02:00
networkd-manager-bus.c tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
networkd-manager-bus.h network: move manager dbus prototypes to networkd-manager-bus.h 2019-07-17 06:59:12 +09:00
networkd-manager.c network: selinux hook handling to enumerate nexthop 2020-11-01 23:28:21 +09:00
networkd-manager.h network: also manage routes without RTA_OIF attribute 2020-10-07 15:22:10 +02:00
networkd-mdb.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-mdb.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-ndisc.c network: store full hardware address in Link struct 2020-10-28 14:44:43 +01:00
networkd-ndisc.h network: introduce network_adjust_ipv6_accept_ra() 2020-10-15 07:06:36 +09:00
networkd-neighbor.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-neighbor.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-network-bus.c tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
networkd-network-bus.h network: move prototypes related to network Network bus objects to networkd-network-bus.h 2019-06-30 05:12:51 +09:00
networkd-network-gperf.gperf network: rename IPv6PrefixDelegation= to IPv6SendRA= 2020-10-19 14:55:18 +09:00
networkd-network.c network: rename IPv6PrefixDelegation= to IPv6SendRA= 2020-10-19 14:55:18 +09:00
networkd-network.h network: rename IPv6PrefixDelegation= to IPv6SendRA= 2020-10-19 14:55:18 +09:00
networkd-nexthop.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-nexthop.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-radv.c network: store full hardware address in Link struct 2020-10-28 14:44:43 +01:00
networkd-radv.h network: introduce network_adjust_radv() 2020-10-19 10:09:38 +09:00
networkd-route.c network: drop routes managed by Manager when link is removed 2020-10-23 23:07:12 +09:00
networkd-route.h network: when Gateway=_dhcp4, set several properties based on lease if they are not explicitly specified 2020-10-15 07:06:23 +09:00
networkd-routing-policy-rule.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-routing-policy-rule.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-speed-meter.c tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
networkd-speed-meter.h network: monitor link bit rates 2019-06-01 10:24:47 +09:00
networkd-sriov.c network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-sriov.h network: rename network_verify_xxx() -> network_drop_invalid_xxx() 2020-10-07 03:22:03 +09:00
networkd-sysctl.c network: fix typo 2020-10-23 23:07:12 +09:00
networkd-sysctl.h network: introduce network_adjust_ipv6_accept_ra() 2020-10-15 07:06:36 +09:00
networkd-util.c network: introduce hashmap_find_free_section_line() 2020-10-07 02:44:43 +09:00
networkd-util.h network: introduce hashmap_find_free_section_line() 2020-10-07 02:44:43 +09:00
networkd-wifi.c network: cleanup networkd-fdb.h 2020-10-07 02:44:42 +09:00
networkd-wifi.h network: also read BSSID 2019-10-15 01:59:13 +09:00
networkd.c network: introduce helper function to enumerate information using netlink 2020-10-07 02:39:13 +09:00
networkd.conf network: Add support to ignore foreign routes 2020-03-07 01:42:52 +09:00
org.freedesktop.network1.conf network: implement DBus methods to set DNS related properties 2019-07-17 06:59:12 +09:00
org.freedesktop.network1.policy network: Add policy in polkit DHCP server forcenenew 2020-02-19 07:41:36 +01:00
org.freedesktop.network1.service Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
systemd-networkd.pkla network: request product UUID when DUIDType=uuid but DUIDRawData= is not set 2018-08-08 10:15:00 +09:00
systemd-networkd.rules network: request product UUID when DUIDType=uuid but DUIDRawData= is not set 2018-08-08 10:15:00 +09:00
test-network-tables.c tree-wide: use the usual SPDX header for our own files 2020-10-29 10:47:20 +01:00
test-network.c network: read peer address, label, broadcast from rtnl message 2020-10-13 20:30:35 +09:00
test-networkd-conf.c network: drop list of static addresses 2020-10-07 02:50:50 +09:00
test-routing-policy-rule.c network: drop list of static routing policy rules 2020-10-07 02:36:29 +09:00