| 1 |
# Makefile for miscellaneous programs |
| 2 |
# Copyright (C) 2002-2006 Michael Richardson <[email protected]> |
| 3 |
# |
| 4 |
# This program is free software; you can redistribute it and/or modify it |
| 5 |
# under the terms of the GNU General Public License as published by the |
| 6 |
# Free Software Foundation; either version 2 of the License, or (at your |
| 7 |
# option) any later version. See <https://www.gnu.org/licenses/gpl2.txt>. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, but |
| 10 |
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 11 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 |
# for more details. |
| 13 |
|
| 14 |
# the man page source is generated |
| 15 |
MANPAGES += ipsec.conf.5 |
| 16 |
MANPAGES += ipsec.secrets.5 |
| 17 |
|
| 18 |
XMLTO_FLAGS = --searchpath $(abs_srcdir)/d.ipsec.conf:$(abs_srcdir) |
| 19 |
|
| 20 |
# different mode |
| 21 |
ipsec.secrets.INSTFLAGS = -m 0600 |
| 22 |
|
| 23 |
CONFFILES += ipsec.conf |
| 24 |
CONFFILES += ipsec.secrets |
| 25 |
|
| 26 |
LOGROTATEDFILE += libreswan |
| 27 |
|
| 28 |
CONFDSUBDIR = policies |
| 29 |
CONFDSUBDIRFILES = clear clear-or-private private-or-clear private block portexcludes.conf |
| 30 |
|
| 31 |
ifndef top_srcdir |
| 32 |
include ../mk/dirs.mk |
| 33 |
endif |
| 34 |
include $(top_srcdir)/mk/config.mk |
| 35 |
include $(top_srcdir)/mk/targets.mk |
| 36 |
include $(top_srcdir)/mk/rules.mk |
| 37 |
include $(top_srcdir)/mk/manpages.mk |
| 38 |
include $(top_srcdir)/mk/install.mk |
| 39 |
|
| 40 |
local-base: $(CONFFILES) $(CONFDSUBDIRFILES) $(LOGROTATEDFILE) |
| 41 |
|
| 42 |
local-clean-base: |
| 43 |
rm -f $(foreach file, $(CONFFILES) $(CONFDSUBDIRFILES) $(LOGROTATEDFILE), $(builddir)/$(file)) |
| 44 |
|
| 45 |
# For each group of files; first copy to the examples directory and |
| 46 |
# then, optionally, install into /etc (but only when |
| 47 |
# INSTALL_CONFIGS=true, and only when not already present). |
| 48 |
|
| 49 |
local-install-base: $(CONFFILES) $(CONFDSUBDIRFILES) $(LOGROTATEDFILE) |
| 50 |
@: CONFDDIR - EXAMPLECONFDIR not EXAMPLECONFDDIR and sample suffix |
| 51 |
@set -eu ; $(call install-directory, $(DESTDIR)$(EXAMPLE_IPSEC_SYSCONFDIR)) |
| 52 |
@set -eu ; $(call install-file, $(INSTCONFFLAGS) $(ipsec.conf.INSTFLAGS), $(builddir)/ipsec.conf, $(DESTDIR)$(EXAMPLE_IPSEC_SYSCONFDIR)/$(notdir $(IPSEC_CONF))-sample) |
| 53 |
@set -eu ; $(call install-file, $(INSTCONFFLAGS) $(ipsec.secrets.INSTFLAGS), $(builddir)/ipsec.secrets, $(DESTDIR)$(EXAMPLE_IPSEC_SYSCONFDIR)/$(notdir $(IPSEC_SECRETS))-sample) |
| 54 |
ifeq ($(INSTALL_CONFIGS),true) |
| 55 |
@set -eu ; $(call install-directory, $(DESTDIR)$(IPSEC_CONFDDIR), 0700) |
| 56 |
@set -eu ; $(call install-missing-file, $(INSTCONFFLAGS) $(ipsec.conf.INSTFLAGS), $(builddir)/ipsec.conf, $(DESTDIR)$(IPSEC_CONF)) |
| 57 |
@set -eu ; $(call install-missing-file, $(INSTCONFFLAGS) $(ipsec.secrets.INSTFLAGS), $(builddir)/ipsec.secrets, $(DESTDIR)$(IPSEC_SECRETS)) |
| 58 |
endif |
| 59 |
@: CONFDSUBDIR |
| 60 |
@set -eu ; $(call install-directory, $(DESTDIR)$(EXAMPLE_IPSEC_CONFDDIR), 0700) |
| 61 |
@set -eu ; $(call install-directory, $(DESTDIR)$(EXAMPLE_IPSEC_CONFDDIR)/$(CONFDSUBDIR), 0700) |
| 62 |
@set -eu ; $(foreach file, $(CONFDSUBDIRFILES), \ |
| 63 |
$(call install-file, $(INSTCONFFLAGS), \ |
| 64 |
$(builddir)/$(file), $(DESTDIR)$(EXAMPLE_IPSEC_CONFDDIR)/$(CONFDSUBDIR)/$(file)) ; \ |
| 65 |
) |
| 66 |
ifeq ($(INSTALL_CONFIGS),true) |
| 67 |
@set -eu ; $(call install-directory, $(DESTDIR)$(IPSEC_CONFDDIR)/$(CONFDSUBDIR), 0700) |
| 68 |
@set -eu ; $(foreach file, $(CONFDSUBDIRFILES), \ |
| 69 |
$(call install-missing-file, $(INSTCONFFLAGS), \ |
| 70 |
$(DESTDIR)$(EXAMPLE_IPSEC_CONFDDIR)/$(CONFDSUBDIR)/$(file), $(DESTDIR)$(IPSEC_CONFDDIR)/$(CONFDSUBDIR)/$(file)) ; \ |
| 71 |
) |
| 72 |
endif |
| 73 |
@: LOGROTATED |
| 74 |
@set -eu ; $(call install-directory, $(DESTDIR)$(EXAMPLE_LOGROTATEDDIR)) |
| 75 |
@set -eu ; $(call install-file, $(INSTCONFFLAGS), \ |
| 76 |
$(builddir)/$(LOGROTATEDFILE), $(DESTDIR)$(EXAMPLE_LOGROTATEDDIR)/$(LOGROTATEDFILE)) |
| 77 |
ifeq ($(INSTALL_CONFIGS),true) |
| 78 |
@set -eu ; $(call install-directory, $(DESTDIR)$(LOGROTATEDDIR)) |
| 79 |
@set -eu ; $(call install-missing-file, $(INSTCONFFLAGS), \ |
| 80 |
$(builddir)/$(LOGROTATEDFILE), $(DESTDIR)$(LOGROTATEDDIR)/$(LOGROTATEDFILE)) |
| 81 |
endif |
| 82 |
@: NSSDIR install |
| 83 |
ifeq ($(INSTALL_CONFIGS),true) |
| 84 |
@set -eu ; $(call install-directory, $(DESTDIR)$(NSSDIR), 0700) |
| 85 |
endif |
| 86 |
ifeq ($(USE_AUTHPAM),true) |
| 87 |
@: PAM |
| 88 |
@set -eu ; $(call install-directory, $(DESTDIR)$(EXAMPLE_PAMCONFDIR)) |
| 89 |
@set -eu ; $(call install-file, $(INSTCONFFLAGS), \ |
| 90 |
pam.d/pluto, $(DESTDIR)$(EXAMPLE_PAMCONFDIR)/pluto) |
| 91 |
ifeq ($(INSTALL_CONFIGS),true) |
| 92 |
@set -eu ; $(call install-directory, $(DESTDIR)$(PAMCONFDIR)) |
| 93 |
@set -eu ; $(call install-missing-file, $(INSTCONFFLAGS), \ |
| 94 |
$(DESTDIR)$(EXAMPLE_PAMCONFDIR)/pluto, $(DESTDIR)$(PAMCONFDIR)/pluto) |
| 95 |
endif |
| 96 |
endif |
| 97 |
@: $(SELINUX) |
| 98 |
ifeq ($(INSTALL_CONFIGS),true) |
| 99 |
@if test -z "$(DESTDIR)" -a -x /usr/sbin/selinuxenabled -a $(DESTDIR)$(SBINDIR) != "$(DESTDIR)/usr/sbin" ; then \ |
| 100 |
if /usr/sbin/selinuxenabled ; then \ |
| 101 |
echo -e "\n************************** WARNING ***********************************" ; \ |
| 102 |
echo "SElinux is present on this system and the prefix path is not /usr." ; \ |
| 103 |
echo "This can cause software failures if selinux is running in Enforcing mode"; \ |
| 104 |
echo -e "unless selinux policies are updated manually to allow this.\n" ; \ |
| 105 |
echo "The following commands fix a common issue of /usr/local/ being mislabeled"; \ |
| 106 |
echo " sudo restorecon /usr/local/sbin -Rv"; \ |
| 107 |
echo " sudo restorecon /usr/local/libexec/ipsec -Rv"; \ |
| 108 |
if test -x /usr/sbin/getenforce ; then \ |
| 109 |
echo -e "\nSElinux is currently running in `/usr/sbin/getenforce` mode" ; \ |
| 110 |
fi ; \ |
| 111 |
echo -e "**********************************************************************\n" ; \ |
| 112 |
fi \ |
| 113 |
fi |
| 114 |
endif |
| 115 |
|
| 116 |
list-local-base: |
| 117 |
@set -eu ; $(foreach file, $(CONFFILES), \ |
| 118 |
echo $(DESTDIR)$(SYSCONFDIR)/$(file) ; \ |
| 119 |
) |
| 120 |
@set -eu ; $(foreach file, $(CONFFILES), \ |
| 121 |
echo $(DESTDIR)$(EXAMPLE_IPSEC_SYSCONFDIR)/$(file)-sample ; \ |
| 122 |
) |
| 123 |
@set -eu ; $(foreach file, $(CONFDSUBDIRFILES), \ |
| 124 |
echo $(DESTDIR)$(IPSEC_CONFDDIR)/$(CONFDSUBDIR)/$${file} ; \ |
| 125 |
) |
| 126 |
|
| 127 |
# Custom rules for ipsec.conf.5; manpages.mk should be updated to |
| 128 |
# mimic this behaviour. |
| 129 |
|
| 130 |
$(builddir)/ipsec.conf.5.man: $(srcdir)/ipsec.conf.5.xml $(srcdir)/d.ipsec.conf/*.xml |
| 131 |
$(builddir)/ipsec.conf.5.man: $(builddir)/ipsec.conf.5.ok |
| 132 |
$(builddir)/ipsec.conf.5.ok: $(srcdir)/d.ipsec.conf/*.xml |
| 133 |
: do all d.ipsec.conf/*.xml files appear in ipsec.conf.5.xml? |
| 134 |
for x in d.ipsec.conf/*.xml ; do \ |
| 135 |
b=$$(basename $${x} .xml) ; \ |
| 136 |
if ! grep '"'$${x}'"' ipsec.conf.5.xml > /dev/null ; then \ |
| 137 |
echo '"'$${x}'"' missing ; \ |
| 138 |
exit 1 ; \ |
| 139 |
fi ; \ |
| 140 |
if ! grep '&'$${b}';' ipsec.conf.5.xml > /dev/null ; then \ |
| 141 |
echo $${b} missing ; \ |
| 142 |
exit 1 ; \ |
| 143 |
fi ; \ |
| 144 |
done |
| 145 |
touch $@ |
| 146 |
|
| 147 |
$(top_builddir)/html/ipsec.conf.5.html: $(srcdir)/d.ipsec.conf/*.xml |