conf: Generate and install config snippets also for charon-cmd and charon-nm

This allows easier customization for distributions (e.g. disable some
plugins by default).
This commit is contained in:
Tobias Brunner
2026-03-17 08:08:38 +01:00
parent 9d268feabd
commit 0d10fa6dda
4 changed files with 59 additions and 8 deletions
+31 -5
View File
@@ -2,6 +2,8 @@
strongswanconfdir = `dirname $(strongswan_conf)` strongswanconfdir = `dirname $(strongswan_conf)`
strongswanddir = $(strongswanconfdir)/strongswan.d strongswanddir = $(strongswanconfdir)/strongswan.d
charonconfdir = $(strongswanddir)/charon charonconfdir = $(strongswanddir)/charon
cmdconfdir = $(strongswanddir)/charon-cmd
nmconfdir = $(strongswanddir)/charon-nm
# copy these files also to /usr/share # copy these files also to /usr/share
templatesdir = $(pkgdatadir)/templates/config templatesdir = $(pkgdatadir)/templates/config
optionstemplatedir = $(templatesdir)/strongswan.d optionstemplatedir = $(templatesdir)/strongswan.d
@@ -11,6 +13,7 @@ options = \
options/aikgen.opt \ options/aikgen.opt \
options/attest.opt \ options/attest.opt \
options/charon.opt \ options/charon.opt \
options/charon-cmd.opt \
options/charon-logging.opt \ options/charon-logging.opt \
options/charon-nm.opt \ options/charon-nm.opt \
options/charon-systemd.opt \ options/charon-systemd.opt \
@@ -110,9 +113,20 @@ alloptions = $(options) $(plugins)
confsnippets = $(alloptions:opt=conf) confsnippets = $(alloptions:opt=conf)
# we only install snippets for enabled plugins # we only install snippets for enabled plugins (see configure script)
plugins_install_tmp = $(charon_plugins:%=plugins/%.tmp) plugins_install_tmp = $(config_plugins:%=plugins/%.tmp)
plugins_install_src = $(charon_plugins:%=plugins/%.conf) plugins_install_src = $(config_plugins:%=plugins/%.conf)
if USE_CHARON
charon_install_src = $(charon_plugins:%=plugins/%.conf)
endif
if USE_CMD
cmd_install_src = $(cmd_plugins:%=plugins/%.conf)
endif
if USE_NM
nm_install_src = $(nm_plugins:%=plugins/%.conf)
endif
# only install snippets for enabled components # only install snippets for enabled components
# has to be defined via autoconf as we can't do it with automake conditionals # has to be defined via autoconf as we can't do it with automake conditionals
options_install_src = $(strongswan_options:%=options/%.conf) options_install_src = $(strongswan_options:%=options/%.conf)
@@ -174,14 +188,26 @@ maintainer-clean-local:
install-data-local: $(plugins_install_src) install-data-local: $(plugins_install_src)
test -e "$(DESTDIR)${strongswanconfdir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanconfdir)" || true test -e "$(DESTDIR)${strongswanconfdir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanconfdir)" || true
test -e "$(DESTDIR)${strongswanddir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanddir)" || true test -e "$(DESTDIR)${strongswanddir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanddir)" || true
test -e "$(DESTDIR)${charonconfdir}" || $(INSTALL) -d "$(DESTDIR)$(charonconfdir)" || true test -e "$(DESTDIR)${charonconfdir}" || test -z "${charon_install_src}" || $(INSTALL) -d "$(DESTDIR)$(charonconfdir)" || true
test -e "$(DESTDIR)${cmdconfdir}" || test -z "${cmd_install_src}" || $(INSTALL) -d "$(DESTDIR)$(cmdconfdir)" || true
test -e "$(DESTDIR)${nmconfdir}" || test -z "${nm_install_src}" || $(INSTALL) -d "$(DESTDIR)$(nmconfdir)" || true
test -e "$(DESTDIR)$(strongswan_conf)" || $(INSTALL) -m 644 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswan_conf) || true test -e "$(DESTDIR)$(strongswan_conf)" || $(INSTALL) -m 644 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswan_conf) || true
for f in $(options_install_src); do \ for f in $(options_install_src); do \
name=`basename $$f`; \ name=`basename $$f`; \
test -f "$(DESTDIR)$(strongswanddir)/$$name" || $(INSTALL) -m 644 "$(srcdir)/$$f" "$(DESTDIR)$(strongswanddir)/$$name" || true; \ test -f "$(DESTDIR)$(strongswanddir)/$$name" || $(INSTALL) -m 644 "$(srcdir)/$$f" "$(DESTDIR)$(strongswanddir)/$$name" || true; \
done done
for f in $(plugins_install_src); do \ for f in $(charon_install_src); do \
name=`basename $$f`; \ name=`basename $$f`; \
if test -f "$$f"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$f"; then dir=; else dir="$(srcdir)/"; fi; \
test -f "$(DESTDIR)$(charonconfdir)/$$name" || $(INSTALL) -m 644 "$$dir$$f" "$(DESTDIR)$(charonconfdir)/$$name" || true; \ test -f "$(DESTDIR)$(charonconfdir)/$$name" || $(INSTALL) -m 644 "$$dir$$f" "$(DESTDIR)$(charonconfdir)/$$name" || true; \
done done
for f in $(cmd_install_src); do \
name=`basename $$f`; \
if test -f "$$f"; then dir=; else dir="$(srcdir)/"; fi; \
test -f "$(DESTDIR)$(cmdconfdir)/$$name" || $(INSTALL) -m 644 "$$dir$$f" "$(DESTDIR)$(cmdconfdir)/$$name" || true; \
done
for f in $(nm_install_src); do \
name=`basename $$f`; \
if test -f "$$f"; then dir=; else dir="$(srcdir)/"; fi; \
test -f "$(DESTDIR)$(nmconfdir)/$$name" || $(INSTALL) -m 644 "$$dir$$f" "$(DESTDIR)$(nmconfdir)/$$name" || true; \
done
+10
View File
@@ -0,0 +1,10 @@
charon-cmd {}
Section with settings specific to the CLI client `charon-cmd`.
Settings from the `charon` section are not inherited, but many can be used
here as well.
charon-cmd.load_modular := yes
Load only explicitly enabled plugins
charon-cmd.plugins.include charon-cmd/*.conf
Plugin config snippets used by charon-cmd
+6
View File
@@ -12,6 +12,9 @@ charon-nm.install_virtual_ip_on = lo
Interface on which virtual IP addresses are installed. Note that NM Interface on which virtual IP addresses are installed. Note that NM
also installs the virtual IPs on the XFRM interface. also installs the virtual IPs on the XFRM interface.
charon-nm.load_modular := yes
Load only explicitly enabled plugins
charon-nm.mtu = 1400 charon-nm.mtu = 1400
MTU for XFRM interfaces created by the NM plugin. MTU for XFRM interfaces created by the NM plugin.
@@ -43,6 +46,9 @@ charon-nm.routing_table_prio = 210
Priority of the routing table. Higher than the default priority used for the Priority of the routing table. Higher than the default priority used for the
regular IKE daemon. regular IKE daemon.
charon-nm.plugins.include charon-nm/*.conf
Plugin config snippets used by charon-nm
charon-nm.plugins.kernel-netlink.fwmark = !210 charon-nm.plugins.kernel-netlink.fwmark = !210
Make packets with this mark ignore the routing table. Must be the same mark Make packets with this mark ignore the routing table. Must be the same mark
set in charon-nm.plugins.socket-default.fwmark. set in charon-nm.plugins.socket-default.fwmark.
+12 -3
View File
@@ -1950,9 +1950,17 @@ if test "x$plugins_packaged_seperately" != xno; then
fi fi
# ==================================================== # ===============================================================
# options for enabled modules (see conf/Makefile.am) # plugins and options for enabled modules (see conf/Makefile.am)
# ==================================================== # ===============================================================
config_plugins=
AM_COND_IF([USE_CHARON], [config_plugins=${config_plugins}" ${charon_plugins}"])
AM_COND_IF([USE_CMD], [config_plugins=${config_plugins}" ${cmd_plugins}"])
AM_COND_IF([USE_NM], [config_plugins=${config_plugins}" ${nm_plugins}"])
AC_SUBST(config_plugins, [`echo -n "${config_plugins}" | tr ' ' '\n' | sort | uniq | tr '\n' ' '`])
strongswan_options= strongswan_options=
@@ -1967,6 +1975,7 @@ AM_COND_IF([USE_IMV_SWIMA], [strongswan_options=${strongswan_options}" sec-updat
AM_COND_IF([USE_LIBTNCCS], [strongswan_options=${strongswan_options}" tnc"]) AM_COND_IF([USE_LIBTNCCS], [strongswan_options=${strongswan_options}" tnc"])
AM_COND_IF([USE_MANAGER], [strongswan_options=${strongswan_options}" manager"]) AM_COND_IF([USE_MANAGER], [strongswan_options=${strongswan_options}" manager"])
AM_COND_IF([USE_MEDSRV], [strongswan_options=${strongswan_options}" medsrv"]) AM_COND_IF([USE_MEDSRV], [strongswan_options=${strongswan_options}" medsrv"])
AM_COND_IF([USE_CMD], [strongswan_options=${strongswan_options}" charon-cmd"])
AM_COND_IF([USE_NM], [strongswan_options=${strongswan_options}" charon-nm"]) AM_COND_IF([USE_NM], [strongswan_options=${strongswan_options}" charon-nm"])
AM_COND_IF([USE_PKI], [strongswan_options=${strongswan_options}" pki"]) AM_COND_IF([USE_PKI], [strongswan_options=${strongswan_options}" pki"])
AM_COND_IF([USE_SWANCTL], [strongswan_options=${strongswan_options}" swanctl"]) AM_COND_IF([USE_SWANCTL], [strongswan_options=${strongswan_options}" swanctl"])