lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Mar 2024 17:57:27 +0100
From: Max Gautier <mg@....gautier.name>
To: netdev@...r.kernel.org
Cc: Max Gautier <mg@....gautier.name>
Subject: [PATCH iproute2-next] Makefile: use systemd-tmpfiles to create /var/lib/arpd

Only apply on systemd systems (detected in the configure script).
The motivation is to build distributions packages without /var to go
towards stateless systems, see link below (TL;DR: provisionning anything
outside of /usr on boot).

The feature flag can be overridden on make invocation:
`make USE_TMPFILES_D=n DESTDIR=<install_loc> install`

Links: https://0pointer.net/blog/projects/stateless.html
---
 Makefile          |  8 +++++++-
 configure         | 14 ++++++++++++++
 etc/tmpfiles.conf |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 etc/tmpfiles.conf

diff --git a/Makefile b/Makefile
index 8024d45e..8ce69a35 100644
--- a/Makefile
+++ b/Makefile
@@ -101,10 +101,16 @@ config.mk:
 		sh configure $(KERNEL_INCLUDE); \
 	fi
 
+ifeq ($(USE_TMPFILES_D),y)
+INSTALL_ARPDDIR := install -m 0644 -D etc/tmpfiles.conf $(DESTDIR)$(TMPFILESDIR)/iproute2-arpd.conf
+else
+INSTALL_ARPDDIR := install -m 0755 -d $(DESTDIR)$(ARPDDIR)
+endif
+
 install: all
 	install -m 0755 -d $(DESTDIR)$(SBINDIR)
 	install -m 0755 -d $(DESTDIR)$(CONF_USR_DIR)
-	install -m 0755 -d $(DESTDIR)$(ARPDDIR)
+	$(INSTALL_ARPDDIR)
 	install -m 0755 -d $(DESTDIR)$(HDRDIR)
 	@for i in $(SUBDIRS);  do $(MAKE) -C $$i install; done
 	install -m 0644 $(shell find etc/iproute2 -maxdepth 1 -type f) $(DESTDIR)$(CONF_USR_DIR)
diff --git a/configure b/configure
index 928048b3..2e974e75 100755
--- a/configure
+++ b/configure
@@ -432,6 +432,17 @@ check_cap()
 	fi
 }
 
+check_tmpfiles_d()
+{
+    if ${PKG_CONFIG} systemd --exists; then
+        echo "USE_TMPFILES_D ?= y" >>$CONFIG
+        echo "yes"
+        echo 'TMPFILESDIR ?=' "$(${PKG_CONFIG} systemd --variable=tmpfilesdir)" >> $CONFIG
+	else
+		echo "no"
+	fi
+}
+
 check_color()
 {
 	case "$COLOR" in
@@ -615,6 +626,9 @@ check_cap
 echo -n "color output: "
 check_color
 
+echo -n "systemd tmpfiles: "
+check_tmpfiles_d
+
 echo >> $CONFIG
 echo "%.o: %.c" >> $CONFIG
 echo '	$(QUIET_CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CPPFLAGS) -c -o $@ $<' >> $CONFIG
diff --git a/etc/tmpfiles.conf b/etc/tmpfiles.conf
new file mode 100644
index 00000000..39c6d13c
--- /dev/null
+++ b/etc/tmpfiles.conf
@@ -0,0 +1 @@
+d %S/arpd 0755
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ