1 /* $NetBSD: remoteconf.h,v 1.10 2009/03/13 04:49:16 tteras Exp $ */
3 /* Id: remoteconf.h,v 1.26 2006/05/06 15:52:44 manubsd Exp */
6 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the project nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 /* remote configuration */
39 #include <sys/queue.h>
42 #include "isakmp_var.h"
43 #include "isakmp_xauth.h"
54 /* ISAKMP SA specification */
68 int dh_group
; /* don't use it if aggressive mode */
69 struct dhgroup
*dhgrp
; /* don't use it if aggressive mode */
71 struct isakmpsa
*next
; /* next transform */
74 /* Certificate information */
76 vchar_t
*data
; /* certificate payload */
77 char *filename
; /* name of local file */
81 #define SCRIPT_PHASE1_UP 0
82 #define SCRIPT_PHASE1_DOWN 1
84 extern char *script_names
[SCRIPT_MAX
+ 1];
87 char *name
; /* remote configuration name */
88 struct sockaddr
*remote
; /* remote IP address */
89 /* if family is AF_UNSPEC, that is
90 * for anonymous configuration. */
92 struct etypes
*etypes
; /* exchange type list. the head
93 * is a type to be sent first. */
94 int doitype
; /* doi type */
95 int sittype
; /* situation type */
97 int idvtype
; /* my identifier type */
98 vchar_t
*idv
; /* my identifier */
99 vchar_t
*key
; /* my pre-shared key */
100 struct genlist
*idvl_p
; /* peer's identifiers list */
102 char *myprivfile
; /* file name of my private key file */
103 char *mycertfile
; /* file name of my certificate */
104 vchar_t
*mycert
; /* my certificate */
105 char *peerscertfile
; /* file name of peer's certifcate */
106 vchar_t
*peerscert
; /* peer's certificate */
107 char *cacertfile
; /* file name of CA */
108 vchar_t
*cacert
; /* CA certificate */
110 int send_cert
; /* send to CERT or not */
111 int send_cr
; /* send to CR or not */
112 int match_empty_cr
; /* does this match if CR is empty */
113 int verify_cert
; /* verify a CERT strictly */
114 int verify_identifier
; /* vefify the peer's identifier */
115 int nonce_size
; /* the number of bytes of nonce */
116 int passive
; /* never initiate */
117 int ike_frag
; /* IKE fragmentation */
118 int esp_frag
; /* ESP fragmentation */
119 int mode_cfg
; /* Gets config through mode config */
120 int support_proxy
; /* support mip6/proxy */
121 #define GENERATE_POLICY_NONE 0
122 #define GENERATE_POLICY_REQUIRE 1
123 #define GENERATE_POLICY_UNIQUE 2
124 int gen_policy
; /* generate policy if no policy found */
125 int ini_contact
; /* initial contact */
126 int pcheck_level
; /* level of propocl checking */
127 int nat_traversal
; /* NAT-Traversal */
128 vchar_t
*script
[SCRIPT_MAX
+ 1];/* script hooks paths */
129 int dh_group
; /* use it when only aggressive mode */
130 struct dhgroup
*dhgrp
; /* use it when only aggressive mode */
131 /* above two can't be defined by user*/
133 int dpd
; /* Negociate DPD support ? */
134 int dpd_retry
; /* in seconds */
135 int dpd_interval
; /* in seconds */
138 int rekey
; /* rekey ph1 when active ph2s? */
139 #define REKEY_OFF FALSE
140 #define REKEY_ON TRUE
141 #define REKEY_FORCE 2
143 int ph1id
; /* ph1id to be matched with sainfo sections */
145 int weak_phase1_check
; /* act on unencrypted deletions ? */
147 struct isakmpsa
*proposal
; /* proposal list */
148 struct remoteconf
*inherited_from
; /* the original rmconf
152 time_t lifetime
; /* for isakmp/ipsec */
153 int lifebyte
; /* for isakmp/ipsec */
154 struct secprotospec
*spspec
; /* the head is always current spec. */
156 struct genlist
*rsa_private
, /* lists of PlainRSA keys to use */
160 struct xauth_rmconf
*xauth
;
163 TAILQ_ENTRY(remoteconf
) chain
; /* next remote conf */
166 #define RMCONF_NONCE_SIZE(rmconf) \
167 (rmconf != NULL ? rmconf->nonce_size : DEFAULT_NONCE_SIZE)
172 int idtype
; /* identifier type */
173 vchar_t
*id
; /* identifier */
176 struct rmconfselector
{
178 struct sockaddr
*remote
;
180 struct isakmpsa
*approval
;
182 vchar_t
*certificate_request
;
185 extern void rmconf_selector_from_ph1
__P((struct rmconfselector
*rmsel
,
186 struct ph1handle
*iph1
));
187 extern int enumrmconf
__P((struct rmconfselector
*rmsel
,
188 int (* enum_func
)(struct remoteconf
*rmconf
, void *arg
),
191 #define GETRMCONF_F_NO_ANONYMOUS 0x0001
192 #define GETRMCONF_F_NO_PASSIVE 0x0002
194 #define RMCONF_ERR_MULTIPLE ((struct remoteconf *) -1)
196 extern int rmconf_match_identity
__P((struct remoteconf
*rmconf
,
198 extern struct remoteconf
*getrmconf
__P((struct sockaddr
*remote
, int flags
));
199 extern struct remoteconf
*getrmconf_by_ph1
__P((struct ph1handle
*iph1
));
200 extern struct remoteconf
*getrmconf_by_name
__P((const char *name
));
202 extern struct remoteconf
*newrmconf
__P((void));
203 extern struct remoteconf
*duprmconf
__P((struct remoteconf
*));
204 extern void delrmconf
__P((struct remoteconf
*));
205 extern void deletypes
__P((struct etypes
*));
206 extern struct etypes
* dupetypes
__P((struct etypes
*));
207 extern void insrmconf
__P((struct remoteconf
*));
208 extern void remrmconf
__P((struct remoteconf
*));
209 extern void flushrmconf
__P((void));
210 extern void initrmconf
__P((void));
211 extern void save_rmconf
__P((void));
212 extern void save_rmconf_flush
__P((void));
214 extern int check_etypeok
__P((struct remoteconf
*, void *));
216 extern struct isakmpsa
*newisakmpsa
__P((void));
217 extern struct isakmpsa
*dupisakmpsa
__P((struct isakmpsa
*));
218 extern void delisakmpsa
__P((struct isakmpsa
*));
219 extern void insisakmpsa
__P((struct isakmpsa
*, struct remoteconf
*));
221 extern int isakmpsa_switch_authmethod
__P((int authmethod
));
223 static inline int isakmpsa_switch_authmethod(int authmethod
)
228 extern struct isakmpsa
* checkisakmpsa
__P((int pcheck
,
229 struct isakmpsa
*proposal
,
230 struct isakmpsa
*acceptable
));
233 extern void dumprmconf
__P((void));
235 extern struct idspec
*newidspec
__P((void));
237 extern vchar_t
*script_path_add
__P((vchar_t
*));
239 #endif /* _REMOTECONF_H */