3 conftest - an IKEv2 conformance testing framework
4 =================================================
10 conftest is a conformance testing framework for IKEv2 and related protocols,
11 based on the strongSwan IKEv2 daemon charon. It uses a specialized configuration
12 and control front-end, but links against the mainstream strongSwan IKEv2 stack.
14 The conftest framework can test other implementations of IKEv2 and related
15 standards. It can inject or mangle packets to test the behavior of other
16 implementations under certain conditions.
21 The framework can use different sets of conformance tests, called test suites.
22 Each test suite contains a global suite configuration file, usually named
23 suite.conf. It contains the global settings for all tests in this suite, mostly
24 credentials and connection definitions.
26 A test suite consists of several test cases. Each test has its own configuration
27 file, often called test.conf. The test configuration file may contain test
28 specific credentials and connection definitions, but primarily defines actions
29 and hooks. Actions trigger certain protocol specific operations, such as
30 initiating or terminating a tunnel. Hooks are used to change the behavior of
31 the IKE stack, most likely to stress some factors of the IKE protocol and
32 provoke unintended behavior in the tested platform.
34 3. Configuration syntax
35 -----------------------
37 Both the suite and the test specific configuration file use the same syntax.
38 It is the same as used by the strongswan.conf file used to configure the
39 strongSwan software suite.
41 The syntax is as follows:
43 settings := (section|keyvalue)*
44 section := name { settings }
45 keyvalue := key = value\n
47 Settings contain zero or more sub-sections or key/value pairs. A section
48 consists of a name, followed by curly open and close brackets. The value in the
49 key/value pair starts after the equal sign and is terminated by the end of the
52 The test specific configuration is merged to the suite configuration, resulting
53 in a unified configuration. Sections are merged, keys in the test configuration
54 overwrite existing identical keys in the suite configuration.
59 Logging verbosity can be controlled in the log section of a suite/test
60 configuration. The stdout subsection takes logging facility/verbosity key
61 value pairs, the different facility types are defined in debug_lower_names at
62 src/libstrongswan/debug.c.
63 Any other sub-section in the log section is considered as a file name to log
64 to. Each section takes the same facility/verbosity keys as the special stdout
70 Both the suite and test configuration may contain connection definitions under
71 the configs section. Each IKE_SA configuration has a sub-section. Each IKE_SA
72 sub-section contains one or more CHILD_SA configuration sub-sections:
86 Configuration names can be chosen arbitrary, but should be unique within the
89 The IKE_SA configuration uses the following options (as key/value pairs):
91 lhost: Address (IP or Hostname) of this host
92 rhost: Address (IP or Hostname) of tested host
93 lid: IKEv2 identifier of this host
94 rid: IKEv2 identifier of tested host
95 proposal: IKE_SA proposal list, comma separated, e.g.:
96 aes128-sha1-modp2048,3des-md5-sha1-modp1024-modp1536
97 Supported algorithm names are defined under
98 src/libstrongswan/crypt/proposal/proposal_keywords.txt
99 fake_nat: Fake the NAT_DETECTION_*_IP payloads to simulate a NAT
101 rsa_strength: connection requires a trustchain with RSA keys of given bits
102 ecdsa_strength: connection requires a trustchain with ECDSA keys of given bits
103 cert_policy: connection requries a certificate with the given OID policy
105 The following CHILD_SA specific configuration options are supported:
107 lts: Local side traffic selectors, comma separated CIDR subnets
108 rts: Remote side traffic selectors, comma separated CIDR subnets
109 transport: Propose IPsec transport mode instead of tunnel mode
110 tfc_padding: Inject Traffic Flow Confidentialty bytes to align packets to the
116 Credentials may be defined globally in the suite or locally in the test specific
117 configuration file. Certificates files are defined in the certs section, either
118 in the trusted or in the untrusted section. Trusted certificates are trust
119 anchors, usually root CA certificates. Untrusted certificates do not build a
120 trust anchor and usually contain intermediate or end entity certificates.
122 Certificates files are loaded relative to the configuration file path and may
123 be encoded either in plain ASN.1 DER or in PEM format. The prefix of the
124 key/value pair is used to specify the type of the certificate, usually x509 or
127 Private keys can be defined in the suite or test config file under the keys
128 section. The prefix of the key/value pair must be either rsa or ecdsa, the
129 specified file may be encoded in ASN.1 DER or unencrypted PEM.
136 x509-me = /path/to/cert.pem
137 crl-from-ca = /path/to/crl.pem
141 ecdsa-me = /path/to/key.pem
147 The actions section in the test specific configuration file defines
148 the IKEv2 protocol actions to trigger. Currently, the following actions
149 are supported and take these arguments (as key/value pairs):
151 initiate: Initiate an IKE- and CHILD_SA
152 config: name of the CHILD_SA configuration to initiate
153 delay: Delay to trigger action after startup
154 rekey_ike: Rekey an IKE_SA
155 config: name of originating IKE_SA configuration
156 delay: Delay to trigger action after startup
157 rekey_child: Rekey an CHILD_SA
158 config: name of originating CHILD_SA configuration
159 delay: Delay to trigger action after startup
160 liveness: Do a liveness check (DPD) on the IKE_SA
161 config: name of originating IKE_SA configuration
162 delay: Delay to trigger action after startup
163 close_ike: Close an IKE_SA
164 config: name of originating IKE_SA configuration
165 delay: Delay to trigger action after startup
166 close_child: Close a CHILD_SA
167 config: name of originating IKE_SA configuration
168 delay: Delay to trigger action after startup
170 To trigger the same action multiple times, the action sections must be named
171 uniquely. Append an arbitrary string to the action name. The following example
172 initiates a connection and rekeys it twice:
191 The hooks section section in the test configuration defines different hooks
192 to use to mangle packets or trigger other protocol modifications. These
193 hook functions are implemented in the hooks folder of conftest.
195 Currently, the following hooks are defined with the following options:
197 add_notify: Add a notify to a message
198 request: yes to include in request, no in response
199 id: IKEv2 message identifier of message to add notify
200 type: notify type to add, names defined in notify_type_names
201 under src/libcharon/encoding/payloads/notify_payload.c
202 data: notification data to add, prepend 0x to interpret the
204 spi: SPI to use in notify
205 esp: yes to send an ESP protocol notify, no for IKE
206 add_payload: Add an arbitrary payload to a message
207 request: yes to include in request, no in response
208 id: IKEv2 message identifier of message to add payload
209 type: type of the payload to add, names defined in
210 payload_type_short_names in payload.c
211 data: data to append after generic payload header, use 0x
212 prefix for hex encoded data
213 critical: yes to set payload critical bit
214 replace: yes to replace an existing payload of the same type
215 custom_proposal: set a custom proposal value in the SA payload
216 request: yes to include in request, no in response
217 id: IKEv2 message identifier of message to add notify
218 The hook takes subsections with numerical names, each
219 defining a proposal substructure. The substructure
220 takes key/value pairs, where key defines the type, value
221 the specific algorithm.
222 force_cookie: Reject IKE_SA_INIT requests with a COOKIE
223 ignore_message: Ignore a specific message, simulating packet loss
224 inbound: yes to ignore incoming, no for outgoing messages
225 request: yes to ignore requests, no for responses
226 id: IKEv2 message identifier of message to ignore
227 ike_auth_fill: Fill up IKE_AUTH message to a given size using a CERT
229 request: yes to fill requests messages, no for responses
230 id: IKEv2 message identifier of message to fill up
231 bytes: number of bytes the final IKE_AUTH message should have
232 log_id: Comfortably log received ID payload contents
233 log_ke: Comfortably log received KE payload DH groups
234 log_proposal: Comfortably log all proposals received in SA payloads
235 log_ts: Comfortably log all received TS payloads
236 pretend_auth: magically reconstruct IKE_AUTH response even if
237 AUTHENTICATION_FAILED received
238 rebuild_auth: rebuild AUTH payload, i.e. if ID payload changed
239 reset_seq: Reset sequence numbers of an ESP SA
240 delay: Seconds to delay reset after SA established
241 set_critical: Set critical bit on existing payloads:
242 request: yes to set in request, no in response
243 id: IKEv2 message identifier of message to mangle payloads
244 payloads: space separated payload list to set critical bit on
245 set_ike_initiator: toggle IKE initiator flag in IKE header
246 request: yes to set in request, no in response
247 id: IKEv2 message identifier of message to mangle
248 set_ike_request: toggle IKE request flag in IKE header
249 request: yes to set in request, no in response
250 id: IKEv2 message identifier of message to mangle
251 set_ike_spi: set the IKE SPIs in IKE header
252 request: yes to set in request, no in response
253 id: IKEv2 message identifier of message to mangle
254 spii: initiator SPI to set (as decimal integer)
255 spir: responder SPI to set
256 set_ike_version: set version fields in IKE header
257 request: yes to set in request, no in response
258 id: IKEv2 message identifier of message to mangle
259 major: major version to set
260 minor: minor version to set
261 higher: yes to set Higher Version Supported flag
262 set_length: set the length in a payload header
263 request: yes to set in request, no in response
264 id: IKEv2 message identifier of message to mangle
265 type: payload type to mangle
266 diff: difference to add/remove from real length (+1,-3 etc.)
267 set_proposal_number:Change the number of a proposal in a SA payload
268 request: yes to set in request, no in response
269 id: IKEv2 message identifier of message to mangle
270 from: proposal number to mangle
271 to: new porposal number to set instead of from
272 set_reserved: set arbitrary reserved bits/bytes in payloads
273 request: yes to set in request, no in response
274 id: IKEv2 message identifier of message to mangle
275 The hook takes a list of subsection, each named as payload
276 type. Each section takes a bits and a bytes key, the
277 value is a comma separated list of decimal numbers of
278 bits/bytes to mangle (1 is the first reserved bit/byte
279 in the payload). The byteval key defines to which value
280 set mangled bytes in the byte list.
281 unencrypted_notify: Send an unencrypted message with a notify after
282 establishing an IKE_SA
283 id: IKEv2 message identifier of message to send
284 type: notify type to add, names defined in notify_type_names
285 under src/libcharon/encoding/payloads/notify_payload.c
286 data: notification data to add, prepend 0x to interpret the
288 spi: SPI to use in notify
289 esp: yes to send an ESP protocol notify, no for IKE
290 unsort_message: reorder the payloads in a message
291 request: yes to reorder requests messages, no for responses
292 id: IKEv2 message identifier of message to reorder
293 order: payload order, space separated payload names as defined
294 in payload_type_short_names under
295 src/libcharon/encoding/payloads/payload.c
300 Compile time options required depend on the test suite. A minimalistic
301 strongSwan build with the OpenSSL crypto backend can be configured with:
303 ./configure --sysconfdir=/etc --disable-pluto --disable-scripts \
304 --disable-tools --disable-aes --disable-des --disable-md5 \
305 --disable-sha1 --disable-sha2 --disable-fips-prf --disable-gmp \
306 --disable-pubkey --disable-pgp --disable-dnskey --disable-updown \
307 --disable-attr --disable-resolve --enable-openssl --enable-conftest \
308 --enable-gcm --enable-ccm --enable-ctr
310 The conftest utility is installed by default under /usr/local/libexec/ipsec/,
311 but can be invoked with the ipsec helper script. It takes a suite specific
312 configuration file after the --suite option and a test specific file with
315 ipsec conftest --suite suite.conf --test 1.1.1/test.conf