- introduced autotools
- first working version
- make dist should work
- things to do:
- UML testing!
- more cleanups
This commit is contained in:
-1095
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,178 @@
|
||||
# Makefile.am was ported from the old Makefile the most
|
||||
# painless way. Only the most important options are included,
|
||||
# further work may be necessary here...
|
||||
|
||||
ipsec_PROGRAMS = pluto _pluto_adns
|
||||
|
||||
pluto_SOURCES = \
|
||||
linux26/rtnetlink.h \
|
||||
linux26/xfrm.h \
|
||||
linux26/netlink.h \
|
||||
rsaref/pkcs11t.h \
|
||||
rsaref/pkcs11.h \
|
||||
rsaref/unix.h \
|
||||
rsaref/pkcs11f.h \
|
||||
alg/ike_alg_twofish.c \
|
||||
alg/ike_alg_aes.c \
|
||||
alg/ike_alg_blowfish.c \
|
||||
alg/ike_alg_sha2.c \
|
||||
alg/ike_alg_serpent.c \
|
||||
alg/ike_alginit.c \
|
||||
kernel_alg.c \
|
||||
kernel_alg.h \
|
||||
kernel_pfkey.h \
|
||||
kernel_pfkey.c \
|
||||
gcryptfix.c \
|
||||
gcryptfix.h \
|
||||
primegen.c \
|
||||
smallprime.c \
|
||||
ocsp.c \
|
||||
ocsp.h \
|
||||
pgp.c \
|
||||
ac.c \
|
||||
certs.c \
|
||||
connections.c \
|
||||
certs.h \
|
||||
virtual.c \
|
||||
connections.h \
|
||||
fetch.c \
|
||||
virtual.h \
|
||||
fetch.h \
|
||||
ipsec_doi.c \
|
||||
ipsec_doi.h \
|
||||
x509.c \
|
||||
kameipsec.h \
|
||||
cookie.c \
|
||||
x509.h \
|
||||
cookie.h \
|
||||
pgp.h \
|
||||
ac.h \
|
||||
sha1.c \
|
||||
sha1.h \
|
||||
constants.c \
|
||||
smartcard.c \
|
||||
kernel.c \
|
||||
constants.h \
|
||||
smartcard.h \
|
||||
kernel.h \
|
||||
dnskey.c \
|
||||
asn1.c \
|
||||
dnskey.h \
|
||||
elgamal.c \
|
||||
db_ops.c \
|
||||
asn1.h \
|
||||
elgamal.h \
|
||||
oid.c \
|
||||
db_ops.h \
|
||||
mp_defs.c \
|
||||
state.c \
|
||||
oid.h \
|
||||
mp_defs.h \
|
||||
ca.c \
|
||||
state.h \
|
||||
pkcs7.c \
|
||||
lex.c \
|
||||
ca.h \
|
||||
pkcs7.h \
|
||||
id.c \
|
||||
lex.h \
|
||||
id.h \
|
||||
keys.c \
|
||||
ike_alg.c \
|
||||
keys.h \
|
||||
md5.c \
|
||||
md5.h \
|
||||
kernel_noklips.c \
|
||||
ike_alg.h \
|
||||
rcv_whack.c \
|
||||
rcv_whack.h \
|
||||
alg_info.c \
|
||||
alg_info.h \
|
||||
pem.c \
|
||||
kernel_noklips.h \
|
||||
foodgroups.c \
|
||||
pem.h \
|
||||
kernel_netlink.c \
|
||||
foodgroups.h \
|
||||
vendor.c \
|
||||
vendor.h \
|
||||
packet.c \
|
||||
packet.h \
|
||||
crl.c \
|
||||
md2.c \
|
||||
rnd.c \
|
||||
crl.h \
|
||||
md2.h \
|
||||
spdb.c \
|
||||
rnd.h \
|
||||
spdb.h \
|
||||
modecfg.c \
|
||||
timer.h \
|
||||
nat_traversal.c \
|
||||
server.c \
|
||||
dsa.c \
|
||||
plutomain.c \
|
||||
modecfg.h \
|
||||
kernel_netlink.h \
|
||||
nat_traversal.h \
|
||||
server.h \
|
||||
dsa.h \
|
||||
timer.c \
|
||||
crypto.c \
|
||||
pkcs1.c \
|
||||
log.c \
|
||||
defs.c \
|
||||
demux.c \
|
||||
crypto.h \
|
||||
pkcs1.h \
|
||||
log.h \
|
||||
defs.h \
|
||||
demux.h
|
||||
|
||||
_pluto_adns_SOURCES = adns.c adns.h
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src/libfreeswan -I$(top_srcdir)/src/libcrypto -I$(top_srcdir)/src/whack
|
||||
AM_CFLAGS = -DIPSEC_DIR=\"${ipsecdir}\" -DIPSEC_CONFDIR=\"${confdir}\" -DIPSEC_PIDDIR=\"${piddir}\" \
|
||||
-DDEBUG -DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES -DNAT_TRAVERSAL -DVIRTUAL_IP -DPLUTO \
|
||||
-DVENDORID -DSHARED_SECRETS_FILE=\"${confdir}/ipsec.secrets\" -DTHREADS -DKLIPS
|
||||
pluto_LDADD = $(top_srcdir)/src/libfreeswan/libfreeswan.a $(top_srcdir)/src/libcrypto/libcrypto.a -lgmp -lresolv -lpthread
|
||||
_pluto_adns_LDADD = -lresolv $(top_srcdir)/src/libfreeswan/libfreeswan.a
|
||||
dist_man_MANS = pluto.8 ipsec.secrets.5
|
||||
EXTRA_DIST = oid.pl oid.txt
|
||||
|
||||
# TODO: get perl from ./configure
|
||||
PERL=perl
|
||||
|
||||
oid.c: oid.txt oid.pl
|
||||
$PERL oid.pl
|
||||
|
||||
oid.h: oid.txt oid.pl
|
||||
$PERL oid.pl
|
||||
|
||||
# This compile option activates dynamic URL fetching using libcurl
|
||||
if USE_LIBCURL
|
||||
pluto_LDADD += -lcurl
|
||||
endif
|
||||
|
||||
# This compile option activates dynamic LDAP CRL fetching
|
||||
if USE_LDAP
|
||||
pluto_LDADD += -lldap -llber
|
||||
endif
|
||||
|
||||
# This compile option activates smartcard support
|
||||
if USE_SMARTCARD
|
||||
AM_CFLAGS += -DSMARTCARD
|
||||
pluto_LDADD += -ldl
|
||||
endif
|
||||
|
||||
install-exec-local :
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/cacerts
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/ocspcerts
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/certs
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/acerts
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/aacerts
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/crls
|
||||
mkdir -p -m 755 $(confdir)/ipsec.d/reqs
|
||||
mkdir -p -m 700 $(confdir)/ipsec.d/private
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
## IKE algorithms config. for static linking into pluto
|
||||
## By now 3DES,MD5 and SHA1 are already present in pluto.
|
||||
##
|
||||
CONFIG_IKE_ALG_AES=y
|
||||
CONFIG_IKE_ALG_BLOWFISH=y
|
||||
CONFIG_IKE_ALG_SERPENT=y
|
||||
CONFIG_IKE_ALG_TWOFISH=y
|
||||
CONFIG_IKE_ALG_SHA2=y
|
||||
|
||||
Optional building of algorithms has not been ported to the
|
||||
new build system with autotools. As all the crypto stuff
|
||||
will go into libstrongswan soon, we willll provide this
|
||||
possibility there...
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
# pluto/alg Makefile
|
||||
# Author: JuanJo Ciarlante <[email protected]>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
#
|
||||
# $Id: Makefile,v 1.3 2004/06/23 04:45:20 as Exp $
|
||||
|
||||
Make.common: ../Makefile
|
||||
make -s -C .. showdefs > $@
|
||||
|
||||
-include Make.common
|
||||
include Config.ike_alg
|
||||
|
||||
LIBCRYPTO:=../../../lib/libcrypto
|
||||
ALLFLAGS=$(CPPFLAGS) $(CFLAGS) -I .. -I- -I ../../../linux/include -I $(LIBCRYPTO)
|
||||
LIBALG := libalg.o
|
||||
|
||||
all : $(LIBALG)
|
||||
|
||||
include $(wildcard Makefile.ike_alg_*)
|
||||
#include $(wildcard Makefile.ike_alg_[ab]*)
|
||||
|
||||
ALG_DIRS:=$(ALG_DIRS-y)
|
||||
ALG_LIBS:=$(ALG_LIBS-y)
|
||||
ALG_SRCS:=$(ALG_SRCS-y)
|
||||
ALG_OBJS:=$(ALG_OBJS-y)
|
||||
$(LIBALG): ike_alginit.o $(ALG_OBJS) $(ALG_LIBS)
|
||||
$(LD) -r -o $@ $^
|
||||
|
||||
# Search for IKE_ALG_INIT_NAME: in ike_alg_*.c to
|
||||
# build ike_alginit.c:ike_alginit()
|
||||
|
||||
ike_alginit.c: $(ALG_SRCS) Makefile Config.ike_alg
|
||||
@awk ' \
|
||||
BEGIN { print "extern int ike_alg_init(void); \
|
||||
int ike_alg_init(void) {" } \
|
||||
/IKE_ALG_INIT_NAME:/ \
|
||||
{ print "{ extern int " $$2" (void); " $$2 "();}" } \
|
||||
END { print "return 0;}" } \
|
||||
' $(ALG_SRCS) /dev/null > $@
|
||||
|
||||
clean :
|
||||
@for i in $(ALG_DIRS);do make -C $$i clean;done
|
||||
rm -f *.[oa] ike_alginit.c Make.common
|
||||
|
||||
gatherdeps:
|
||||
@ls $(ALG_SRCS) | grep '\.c' | sed -e 's/\(.*\)\.c$$/\1.o: \1.c/'
|
||||
@echo
|
||||
@ls $(ALG_SRCS) | grep '\.c' | xargs grep '^#[ ]*include[ ]*"' | \
|
||||
sed -n -e '/#include.*"lib/d' \
|
||||
-e 's/\.c:#[ ]*include[ ]*"/.o: ..\//' -e 's/".*//p'
|
||||
|
||||
# Dependencies generated by "make gatherdeps":
|
||||
|
||||
ike_alg_aes.o: ike_alg_aes.c
|
||||
ike_alg_blowfish.o: ike_alg_blowfish.c
|
||||
ike_alg_serpent.o: ike_alg_serpent.c
|
||||
ike_alg_sha2.o: ike_alg_sha2.c
|
||||
ike_alg_twofish.o: ike_alg_twofish.c
|
||||
|
||||
ike_alg_aes.o: ../constants.h
|
||||
ike_alg_aes.o: ../defs.h
|
||||
ike_alg_aes.o: ../log.h
|
||||
ike_alg_aes.o: ../alg_info.h
|
||||
ike_alg_aes.o: ../ike_alg.h
|
||||
ike_alg_blowfish.o: ../constants.h
|
||||
ike_alg_blowfish.o: ../defs.h
|
||||
ike_alg_blowfish.o: ../log.h
|
||||
ike_alg_blowfish.o: ../alg_info.h
|
||||
ike_alg_blowfish.o: ../ike_alg.h
|
||||
ike_alg_serpent.o: ../constants.h
|
||||
ike_alg_serpent.o: ../defs.h
|
||||
ike_alg_serpent.o: ../log.h
|
||||
ike_alg_serpent.o: ../alg_info.h
|
||||
ike_alg_serpent.o: ../ike_alg.h
|
||||
ike_alg_sha2.o: ../constants.h
|
||||
ike_alg_sha2.o: ../defs.h
|
||||
ike_alg_sha2.o: ../log.h
|
||||
ike_alg_sha2.o: ../alg_info.h
|
||||
ike_alg_sha2.o: ../ike_alg.h
|
||||
ike_alg_twofish.o: ../constants.h
|
||||
ike_alg_twofish.o: ../defs.h
|
||||
ike_alg_twofish.o: ../log.h
|
||||
ike_alg_twofish.o: ../alg_info.h
|
||||
ike_alg_twofish.o: ../ike_alg.h
|
||||
@@ -1,14 +0,0 @@
|
||||
ALG:=aes
|
||||
CONFIG_YES:=$(CONFIG_IKE_ALG_AES)
|
||||
DIR_AES:=$(LIBCRYPTO)/libaes
|
||||
|
||||
ALG_DIRS-$(CONFIG_YES) := $(ALG_DIRS-$(CONFIG_YES)) $(DIR_AES)
|
||||
ALG_LIBS-$(CONFIG_YES) := $(ALG_LIBS-$(CONFIG_YES)) $(DIR_AES)/libaes.a
|
||||
ALG_SRCS-$(CONFIG_YES) := $(ALG_SRCS-$(CONFIG_YES)) ike_alg_$(ALG).c
|
||||
ALG_OBJS-$(CONFIG_YES) := $(ALG_OBJS-$(CONFIG_YES)) ike_alg_$(ALG).o
|
||||
|
||||
$(DIR_AES)/libaes.a:
|
||||
make -C $(DIR_AES) CFLAGS="$(CFLAGS)" libaes.a
|
||||
|
||||
ike_alg_$(ALG).o: ike_alg_$(ALG).c
|
||||
$(CC) -I $(LIBCRYPTO) -I$(DIR_AES) $(COPTS) $(ALLFLAGS) -c $<
|
||||
@@ -1,13 +0,0 @@
|
||||
ALG:=blowfish
|
||||
CONFIG_YES:=$(CONFIG_IKE_ALG_BLOWFISH)
|
||||
DIR_BLOWFISH:=$(LIBCRYPTO)/libblowfish
|
||||
ALG_DIRS-$(CONFIG_YES) := $(ALG_DIRS-$(CONFIG_YES)) $(DIR_BLOWFISH)
|
||||
ALG_LIBS-$(CONFIG_YES) := $(ALG_LIBS-$(CONFIG_YES)) $(DIR_BLOWFISH)/libblowfish.a
|
||||
ALG_SRCS-$(CONFIG_YES) := $(ALG_SRCS-$(CONFIG_YES)) ike_alg_$(ALG).c
|
||||
ALG_OBJS-$(CONFIG_YES) := $(ALG_OBJS-$(CONFIG_YES)) ike_alg_$(ALG).o
|
||||
|
||||
$(DIR_BLOWFISH)/libblowfish.a:
|
||||
make -C $(DIR_BLOWFISH) CFLAGS="$(CFLAGS)" libblowfish.a
|
||||
|
||||
ike_alg_$(ALG).o: ike_alg_$(ALG).c
|
||||
$(CC) -I $(LIBCRYPTO) -I$(DIR_BLOWFISH) $(COPTS) $(ALLFLAGS) -c $<
|
||||
@@ -1,13 +0,0 @@
|
||||
ALG:=serpent
|
||||
CONFIG_YES:=$(CONFIG_IKE_ALG_SERPENT)
|
||||
DIR_SERPENT:=$(LIBCRYPTO)/libserpent
|
||||
ALG_DIRS-$(CONFIG_YES) := $(ALG_DIRS-$(CONFIG_YES)) $(DIR_SERPENT)
|
||||
ALG_LIBS-$(CONFIG_YES) := $(ALG_LIBS-$(CONFIG_YES)) $(DIR_SERPENT)/libserpent.a
|
||||
ALG_SRCS-$(CONFIG_YES) := $(ALG_SRCS-$(CONFIG_YES)) ike_alg_$(ALG).c
|
||||
ALG_OBJS-$(CONFIG_YES) := $(ALG_OBJS-$(CONFIG_YES)) ike_alg_$(ALG).o
|
||||
|
||||
$(DIR_SERPENT)/libserpent.a:
|
||||
make -C $(DIR_SERPENT) CFLAGS="$(CFLAGS)" libserpent.a
|
||||
|
||||
ike_alg_$(ALG).o: ike_alg_$(ALG).c
|
||||
$(CC) -I $(LIBCRYPTO) -I$(DIR_SERPENT) $(COPTS) $(ALLFLAGS) -c $<
|
||||
@@ -1,13 +0,0 @@
|
||||
ALG:=sha2
|
||||
CONFIG_YES:=$(CONFIG_IKE_ALG_SHA2)
|
||||
DIR_SHA2:=$(LIBCRYPTO)/libsha2
|
||||
ALG_DIRS-$(CONFIG_YES) := $(ALG_DIRS-$(CONFIG_YES)) $(DIR_SHA2)
|
||||
ALG_LIBS-$(CONFIG_YES) := $(ALG_LIBS-$(CONFIG_YES)) $(DIR_SHA2)/libsha2.a
|
||||
ALG_SRCS-$(CONFIG_YES) := $(ALG_SRCS-$(CONFIG_YES)) ike_alg_$(ALG).c
|
||||
ALG_OBJS-$(CONFIG_YES) := $(ALG_OBJS-$(CONFIG_YES)) ike_alg_$(ALG).o
|
||||
|
||||
$(DIR_SHA2)/libsha2.a:
|
||||
make -C $(DIR_SHA2) libsha2.a
|
||||
|
||||
ike_alg_$(ALG).o: ike_alg_$(ALG).c
|
||||
$(CC) -I $(LIBCRYPTO) -I$(DIR_SHA2) $(COPTS) $(ALLFLAGS) -c $<
|
||||
@@ -1,13 +0,0 @@
|
||||
ALG:=twofish
|
||||
CONFIG_YES:=$(CONFIG_IKE_ALG_TWOFISH)
|
||||
DIR_TWOFISH:=$(LIBCRYPTO)/libtwofish
|
||||
ALG_DIRS-$(CONFIG_YES) := $(ALG_DIRS-$(CONFIG_YES)) $(DIR_TWOFISH)
|
||||
ALG_LIBS-$(CONFIG_YES) := $(ALG_LIBS-$(CONFIG_YES)) $(DIR_TWOFISH)/libtwofish.a
|
||||
ALG_SRCS-$(CONFIG_YES) := $(ALG_SRCS-$(CONFIG_YES)) ike_alg_$(ALG).c
|
||||
ALG_OBJS-$(CONFIG_YES) := $(ALG_OBJS-$(CONFIG_YES)) ike_alg_$(ALG).o
|
||||
|
||||
$(DIR_TWOFISH)/libtwofish.a:
|
||||
make -C $(DIR_TWOFISH) CFLAGS="$(CFLAGS)" libtwofish.a
|
||||
|
||||
ike_alg_$(ALG).o: ike_alg_$(ALG).c
|
||||
$(CC) -I $(LIBCRYPTO) -I$(DIR_TWOFISH) $(COPTS) $(ALLFLAGS) -c $<
|
||||
@@ -0,0 +1,7 @@
|
||||
extern int ike_alg_init(void); int ike_alg_init(void) {
|
||||
{ extern int ike_alg_aes_init (void); ike_alg_aes_init();}
|
||||
{ extern int ike_alg_blowfish_init (void); ike_alg_blowfish_init();}
|
||||
{ extern int ike_alg_serpent_init (void); ike_alg_serpent_init();}
|
||||
{ extern int ike_alg_sha2_init (void); ike_alg_sha2_init();}
|
||||
{ extern int ike_alg_twofish_init (void); ike_alg_twofish_init();}
|
||||
return 0;}
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
#include <pfkeyv2.h>
|
||||
|
||||
#include "alg_info.h"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+8
-8
@@ -24,14 +24,14 @@
|
||||
/* path definitions for private keys, end certs,
|
||||
* cacerts, attribute certs and crls
|
||||
*/
|
||||
#define PRIVATE_KEY_PATH "/etc/ipsec.d/private"
|
||||
#define HOST_CERT_PATH "/etc/ipsec.d/certs"
|
||||
#define CA_CERT_PATH "/etc/ipsec.d/cacerts"
|
||||
#define A_CERT_PATH "/etc/ipsec.d/acerts"
|
||||
#define AA_CERT_PATH "/etc/ipsec.d/aacerts"
|
||||
#define OCSP_CERT_PATH "/etc/ipsec.d/ocspcerts"
|
||||
#define CRL_PATH "/etc/ipsec.d/crls"
|
||||
#define REQ_PATH "/etc/ipsec.d/reqs"
|
||||
#define PRIVATE_KEY_PATH IPSEC_CONFDIR "/ipsec.d/private"
|
||||
#define HOST_CERT_PATH IPSEC_CONFDIR "/ipsec.d/certs"
|
||||
#define CA_CERT_PATH IPSEC_CONFDIR "/ipsec.d/cacerts"
|
||||
#define A_CERT_PATH IPSEC_CONFDIR "/ipsec.d/acerts"
|
||||
#define AA_CERT_PATH IPSEC_CONFDIR "/ipsec.d/aacerts"
|
||||
#define OCSP_CERT_PATH IPSEC_CONFDIR "/ipsec.d/ocspcerts"
|
||||
#define CRL_PATH IPSEC_CONFDIR "/ipsec.d/crls"
|
||||
#define REQ_PATH IPSEC_CONFDIR "/ipsec.d/reqs"
|
||||
|
||||
/* advance warning of imminent expiry of
|
||||
* cacerts, public keys, and crls
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
#include "kameipsec.h"
|
||||
|
||||
#include "constants.h"
|
||||
@@ -58,7 +58,6 @@
|
||||
#include "whack.h"
|
||||
#include "alg_info.h"
|
||||
#include "ike_alg.h"
|
||||
#include "kernel_alg.h"
|
||||
#ifdef NAT_TRAVERSAL
|
||||
#include "nat_traversal.h"
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
@@ -63,9 +63,11 @@ typedef unsigned long long lset_t;
|
||||
#define LDISJOINT(a, b) (((a) & (b)) == LEMPTY)
|
||||
|
||||
/* Control and lock pathnames */
|
||||
|
||||
#ifndef IPSEC_PIDDIR
|
||||
# define IPSEC_PIDDIR "/var/run"
|
||||
#endif
|
||||
#ifndef DEFAULT_CTLBASE
|
||||
# define DEFAULT_CTLBASE "/var/run/pluto"
|
||||
# define DEFAULT_CTLBASE IPSEC_PIDDIR "/pluto"
|
||||
#endif
|
||||
|
||||
#define CTL_SUFFIX ".ctl" /* for UNIX domain socket pathname */
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <freeswan.h>
|
||||
#define HEADER_DES_LOCL_H /* stupid trick to force prototype decl in <des.h> */
|
||||
#include <crypto/des.h>
|
||||
#include <libdes/des.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "adns.h" /* needs <resolv.h> */
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/* Food group config files are found in directory fg_path */
|
||||
|
||||
#ifndef POLICYGROUPSDIR
|
||||
#define POLICYGROUPSDIR "/etc/ipsec.d/policies"
|
||||
#define POLICYGROUPSDIR IPSEC_CONFDIR "/ipsec.d/policies"
|
||||
#endif
|
||||
|
||||
const char *policygroups_dir = POLICYGROUPSDIR;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <sys/time.h> /* for gettimeofday */
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#ifdef KLIPS
|
||||
#include <signal.h>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <pfkey.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
#endif
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include "certs.h"
|
||||
|
||||
#ifndef SHARED_SECRETS_FILE
|
||||
# define SHARED_SECRETS_FILE "/etc/ipsec.secrets"
|
||||
# define SHARED_SECRETS_FILE IPSEC_CONFDIR "/ipsec.secrets"
|
||||
#endif
|
||||
|
||||
const char *shared_secrets_file;
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
|
||||
#define LOG_WIDTH 1024 /* roof of number of chars in log line */
|
||||
|
||||
#ifndef PERPERRLOGDIR
|
||||
#define PERPERRLOGDIR "/var/log/pluto/peer"
|
||||
#ifndef PERPEERLOGDIR
|
||||
#define PERPEERLOGDIR "/var/log/pluto/peer"
|
||||
#endif
|
||||
|
||||
/* our versions of assert: log result */
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
#include <pfkeyv2.h>
|
||||
#include <pfkey.h>
|
||||
#include "constants.h"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <freeswan.h>
|
||||
#define HEADER_DES_LOCL_H /* stupid trick to force prototype decl in <des.h> */
|
||||
#include <crypto/des.h>
|
||||
#include <libdes/des.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <crypto/des.h>
|
||||
#include <libdes/des.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
|
||||
|
||||
@@ -1,308 +0,0 @@
|
||||
/* info/policy communicating routines
|
||||
* Copyright (C) 2003 Michael Richardson <mcr@freeswan.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* RCSID $Id: rcv_info.c,v 1.2 2004/04/01 18:44:38 as Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <resolv.h>
|
||||
#include <arpa/nameser.h> /* missing from <resolv.h> on old systems */
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
#include "id.h"
|
||||
#include "connections.h"
|
||||
#include "foodgroups.h"
|
||||
#include "whack.h" /* needs connections.h */
|
||||
#include "packet.h"
|
||||
#include "demux.h" /* needs packet.h */
|
||||
#include "state.h"
|
||||
#include "ipsec_doi.h" /* needs demux.h and state.h */
|
||||
#include "kernel.h"
|
||||
#include "rcv_whack.h"
|
||||
#include "log.h"
|
||||
#include "keys.h"
|
||||
#include "adns.h" /* needs <resolv.h> */
|
||||
#include "dnskey.h" /* needs keys.h and adns.h */
|
||||
#include "server.h"
|
||||
|
||||
#include "freeswan/ipsec_policy.h"
|
||||
#include "rcv_info.h"
|
||||
|
||||
/* global */
|
||||
int info_fd = -1;
|
||||
|
||||
static void
|
||||
info_lookuphostpair(struct ipsec_policy_cmd_query *ipcq)
|
||||
{
|
||||
struct connection *c;
|
||||
struct state *p1st, *p2st;
|
||||
|
||||
|
||||
/* default result: no crypto */
|
||||
ipcq->strength = IPSEC_PRIVACY_NONE;
|
||||
ipcq->bandwidth = IPSEC_QOS_WIRESPEED;
|
||||
ipcq->credential_count = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
char sstr[ADDRTOT_BUF], dstr[ADDRTOT_BUF];
|
||||
|
||||
addrtot(&ipcq->query_local, 0, sstr, sizeof(sstr));
|
||||
addrtot(&ipcq->query_remote, 0, dstr, sizeof(dstr));
|
||||
DBG_log("info request for %s -> %s", sstr, dstr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* okay, look up what connection handles this ip pair */
|
||||
|
||||
c = find_connection_for_clients(NULL,
|
||||
&ipcq->query_local,
|
||||
&ipcq->query_remote);
|
||||
if (c == NULL)
|
||||
{
|
||||
/* try reversing it */
|
||||
c = find_connection_for_clients(NULL,
|
||||
&ipcq->query_remote,
|
||||
&ipcq->query_local);
|
||||
if (c != NULL)
|
||||
{
|
||||
ip_address tmp;
|
||||
tmp = ipcq->query_local;
|
||||
ipcq->query_local = ipcq->query_remote;
|
||||
ipcq->query_remote = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == NULL)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
DBG_log("no connection found");
|
||||
#endif
|
||||
return; /* no crypto */
|
||||
}
|
||||
|
||||
if (c->newest_ipsec_sa == SOS_NOBODY)
|
||||
{
|
||||
ip_subnet us, them;
|
||||
|
||||
DBG_log("connection %s found, no ipsec state, looking again", c->name);
|
||||
addrtosubnet(&ipcq->query_local, &us);
|
||||
addrtosubnet(&ipcq->query_remote, &them);
|
||||
c = find_client_connection(c, &us, &them);
|
||||
|
||||
if (c == NULL)
|
||||
return; /* no crypto */
|
||||
}
|
||||
|
||||
DBG_log("connection %s[%ld] with state %u"
|
||||
, c->name, c->instance_serial
|
||||
, (unsigned int)c->newest_ipsec_sa);
|
||||
|
||||
if (c->newest_ipsec_sa == SOS_NOBODY)
|
||||
return; /* no crypto */
|
||||
|
||||
/* we found a connection, try to lookup the state */
|
||||
p2st = state_with_serialno(c->newest_ipsec_sa);
|
||||
|
||||
p1st = find_phase1_state(c, ISAKMP_SA_ESTABLISHED_STATES);
|
||||
|
||||
if (p1st == NULL || p2st == NULL)
|
||||
{
|
||||
DBG_log("connection %s[%ld] has missing states %s %s"
|
||||
, c->name, c->instance_serial
|
||||
, (p1st ? "phase1" : "")
|
||||
, (p2st ? "phase1" : ""));
|
||||
return; /* no crypto */
|
||||
}
|
||||
|
||||
/* if we have AH present, then record minimal info */
|
||||
if (p2st->st_ah.present)
|
||||
{
|
||||
ipcq->strength = IPSEC_PRIVACY_INTEGRAL;
|
||||
ipcq->auth_detail = p2st->st_esp.attrs.auth;
|
||||
}
|
||||
|
||||
if (p2st->st_esp.present)
|
||||
{
|
||||
/*
|
||||
* XXX-mcr Please do not shout at me about relative strengths
|
||||
* here. I'm not a cryptographer. I just diddle bits.
|
||||
*/
|
||||
switch (p2st->st_esp.attrs.transid)
|
||||
{
|
||||
case ESP_NULL:
|
||||
/* actually, do not change it if we set it from AH */
|
||||
break;
|
||||
|
||||
case ESP_DES:
|
||||
case ESP_DES_IV64:
|
||||
case ESP_DES_IV32:
|
||||
case ESP_RC4:
|
||||
ipcq->strength = IPSEC_PRIVACY_ROT13;
|
||||
break;
|
||||
|
||||
case ESP_RC5:
|
||||
case ESP_IDEA:
|
||||
case ESP_CAST:
|
||||
case ESP_BLOWFISH:
|
||||
case ESP_3DES:
|
||||
ipcq->strength = IPSEC_PRIVACY_PRIVATE;
|
||||
ipcq->bandwidth = IPSEC_QOS_VOIP;
|
||||
break;
|
||||
|
||||
case ESP_3IDEA:
|
||||
ipcq->strength = IPSEC_PRIVACY_STRONG;
|
||||
ipcq->bandwidth = IPSEC_QOS_INTERACTIVE;
|
||||
break;
|
||||
|
||||
case ESP_AES:
|
||||
ipcq->strength = IPSEC_PRIVACY_STRONG;
|
||||
ipcq->bandwidth = IPSEC_QOS_FTP;
|
||||
break;
|
||||
}
|
||||
ipcq->esp_detail = p2st->st_esp.attrs.transid;
|
||||
}
|
||||
|
||||
if (p2st->st_ipcomp.present)
|
||||
ipcq->comp_detail = p2st->st_esp.attrs.transid;
|
||||
|
||||
/* now! the credentails that were used */
|
||||
/* for the moment we only have 1 credential, the DNS name,
|
||||
* because the DNS servers do not return the chain of SIGs yet
|
||||
*/
|
||||
|
||||
if(!c->spd.this.key_from_DNS_on_demand)
|
||||
{
|
||||
/* the key didn't come from the DNS in some way,
|
||||
* so it must have been loaded locally.
|
||||
*/
|
||||
ipcq->credential_count = 1;
|
||||
ipcq->credentials[0].ii_type = c->spd.this.id.kind;
|
||||
ipcq->credentials[0].ii_format = CERT_RAW_RSA;
|
||||
}
|
||||
|
||||
#if 0
|
||||
switch (c->spd.id.kind)
|
||||
{
|
||||
case ID_IPV4_ADDR:
|
||||
}
|
||||
if (c->gw_info == NULL)
|
||||
{
|
||||
plog("rcv_info: connection %s had NULL gw_info.", c->name);
|
||||
return
|
||||
}
|
||||
#endif
|
||||
|
||||
ipcq->credential_count = 1;
|
||||
|
||||
/* pull credentials out of gw_info */
|
||||
|
||||
switch (p1st->st_peer_pubkey->dns_auth_level)
|
||||
{
|
||||
case DAL_UNSIGNED:
|
||||
case DAL_NOTSEC:
|
||||
/* these seem to be the same for this purpose */
|
||||
ipcq->credentials[0].ii_type = p1st->st_peer_pubkey->id.kind;
|
||||
ipcq->credentials[0].ii_type = CERT_NONE;
|
||||
idtoa(&p1st->st_peer_pubkey->id
|
||||
, ipcq->credentials[0].ii_credential.ipsec_dns_signed.fqdn
|
||||
, sizeof(ipcq->credentials[0].ii_credential.ipsec_dns_signed.fqdn));
|
||||
break;
|
||||
|
||||
case DAL_SIGNED:
|
||||
ipcq->credentials[0].ii_type = p1st->st_peer_pubkey->id.kind;
|
||||
ipcq->credentials[0].ii_format = CERT_DNS_SIGNED_KEY;
|
||||
idtoa(&p1st->st_peer_pubkey->id
|
||||
, ipcq->credentials[0].ii_credential.ipsec_dns_signed.fqdn
|
||||
, sizeof(ipcq->credentials[0].ii_credential.ipsec_dns_signed.fqdn));
|
||||
|
||||
if (p1st->st_peer_pubkey->dns_sig != NULL)
|
||||
{
|
||||
strncat(ipcq->credentials[0].ii_credential.ipsec_dns_signed.dns_sig
|
||||
, p1st->st_peer_pubkey->dns_sig
|
||||
, sizeof(ipcq->credentials[0].ii_credential.ipsec_dns_signed.dns_sig));
|
||||
}
|
||||
break;
|
||||
|
||||
case DAL_LOCAL:
|
||||
ipcq->credentials[0].ii_type = p1st->st_peer_pubkey->id.kind;
|
||||
ipcq->credentials[0].ii_format = CERT_RAW_RSA;
|
||||
idtoa(&p1st->st_peer_pubkey->id
|
||||
, ipcq->credentials[0].ii_credential.ipsec_raw_key.id_name
|
||||
, sizeof(ipcq->credentials[0].ii_credential.ipsec_raw_key.id_name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle an info/policy request.
|
||||
*
|
||||
* For now, we close the socket after answering the request.
|
||||
*
|
||||
*/
|
||||
void
|
||||
info_handle(int infoctlfd)
|
||||
{
|
||||
struct sockaddr_un info_client_addr;
|
||||
int info_addr_len = sizeof(info_client_addr);
|
||||
/* Note: actual value in n should fit in int. To print, cast to int. */
|
||||
int infofd;
|
||||
err_t err;
|
||||
struct ipsec_policy_cmd_query ipcq;
|
||||
|
||||
infofd = accept(infoctlfd, (struct sockaddr *)&info_client_addr
|
||||
, &info_addr_len);
|
||||
|
||||
if (infofd < 0)
|
||||
{
|
||||
log_errno((e, "accept() failed in info_handle()"));
|
||||
return;
|
||||
}
|
||||
|
||||
err = ipsec_policy_readmsg(infofd, (unsigned char *)&ipcq, sizeof(ipcq));
|
||||
|
||||
if (err != NULL)
|
||||
{
|
||||
log_errno((e, "readmsg said: %s", err));
|
||||
close(infofd);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ipcq.head.ipm_msg_type)
|
||||
{
|
||||
case IPSEC_CMD_QUERY_HOSTPAIR:
|
||||
info_lookuphostpair(&ipcq);
|
||||
write(infofd, &ipcq, ipcq.head.ipm_msg_len);
|
||||
break;
|
||||
|
||||
default:
|
||||
plog("got unimplemented msg type: %d", ipcq.head.ipm_msg_type);
|
||||
break;
|
||||
}
|
||||
|
||||
/* for now, close the socket */
|
||||
close(infofd);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/* whack communicating routines
|
||||
* Copyright (C) 2003 Michael Richardson <mcr@freeswan.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* RCSID $Id: rcv_info.h,v 1.1 2004/03/15 20:35:29 as Exp $
|
||||
*/
|
||||
|
||||
#include "freeswan/ipsec_policy.h"
|
||||
extern void info_handle(int infoctlfd);
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "packet.h"
|
||||
#include "demux.h" /* needs packet.h */
|
||||
#include "rcv_whack.h"
|
||||
#include "rcv_info.h"
|
||||
#include "keys.h"
|
||||
#include "adns.h" /* needs <resolv.h> */
|
||||
#include "dnskey.h" /* needs keys.h and adns.h */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <freeswan.h>
|
||||
#include <freeswan/ipsec_policy.h>
|
||||
#include <ipsec_policy.h>
|
||||
|
||||
#include "constants.h"
|
||||
#include "defs.h"
|
||||
|
||||
Reference in New Issue
Block a user