echo '$$INCLUDE ' $(top_builddir)/share/dictionary.vqp >> dictionary; \
fi
-test.conf: dictionary
- @echo "# test configuration file. Do not install. Delete at any time." > test.conf
+test.conf: dictionary config/eap-test
+ @echo "# test configuration file. Do not install. Delete at any time." > $@
@if [ -n "$(LIB_PATH)" ]; then \
- echo "libdir =" $(LIB_PATH) >> test.conf; \
+ echo "libdir =" $(LIB_PATH) >> $@; \
fi
- @echo "testdir =" $(TEST_PATH) >> test.conf
- @echo 'logdir = $${testdir}' >> test.conf
- @echo "maindir =" $(RADDB_PATH) >> test.conf
- @echo 'radacctdir = $${testdir}' >> test.conf
- @echo 'pidfile = $${testdir}/radiusd.pid' >> test.conf
- @echo 'panic_action = "gdb -batch -x ${testdir}/panic.gdb %e %p > ${testdir}/gdb.log 2>&1; cat ${testdir}/gdb.log"' >> test.conf
+ @echo "testdir =" $(TEST_PATH) >> $@
+ @echo 'logdir = $${testdir}' >> $@
+ @echo "maindir =" $(RADDB_PATH) >> $@
+ @echo 'radacctdir = $${testdir}' >> $@
+ @echo 'pidfile = $${testdir}/radiusd.pid' >> $@
+ @echo 'panic_action = "gdb -batch -x ${testdir}/panic.gdb %e %p > ${testdir}/gdb.log 2>&1; cat ${testdir}/gdb.log"' >> $@
@echo 'security {' >> $@
@echo ' allow_vulnerable_openssl = yes' >> $@
@echo '}' >> $@
@echo 'modconfdir = $${maindir}mods-config' >> $@
@echo 'certdir = $${maindir}/certs' >> $@
@echo 'cadir = $${maindir}/certs' >> $@
- @echo '$$INCLUDE $${testdir}/config/' >> test.conf
- @echo '$$INCLUDE $${maindir}/radiusd.conf' >> test.conf
+ @echo '$$INCLUDE $${testdir}/config/' >> $@
+ @echo '$$INCLUDE $${maindir}/radiusd.conf' >> $@
+
+#
+# Rename "inner-tunnel", and ensure that it only uses the "eap-test" module.
+#
+config/eap-test-inner-tunnel: $(RADDB_PATH)sites-available/inner-tunnel
+ @sed 's/eap/eap-test/;s/server inner-tunnel/server eap-test-inner-tunnel/' < $< > $@
+
+#
+# Same as above, but enable caching, and set the persist_dir
+#
+config/eap-test: $(RADDB_PATH)mods-available/eap config/eap-test-inner-tunnel
+ @sed 's/eap {/eap eap-test {/;s/= inner-tunnel/= eap-test-inner-tunnel/;s/use_tunneled_reply = no/use_tunneled_reply = yes/;s/enable = no/enable = yes/;s/^\(.*\)persist_dir =/ persist_dir =/' < $< > $@
radiusd.pid: test.conf
- @rm -f $(TEST_PATH)/gdb.log $(TEST_PATH)/radius.log
+ @rm -rf $(TEST_PATH)/gdb.log $(TEST_PATH)/radius.log $(TEST_PATH)/tlscache
+ @mkdir -p $(TEST_PATH)/tlscache
@printf "Starting server... "
@if ! $(RADIUSD_BIN) -Pxxxxml $(TEST_PATH)/radius.log -d ${top_builddir}/src/tests -n test -i 127.0.0.1 -p $(PORT) -D $(DICT_PATH); then \
echo "failed"; \
.PHONY: clean.tests.eap
clean.tests.eap:
- @rm -rf $(BUILD_PATH)/tests/eap
+ @rm -rf $(BUILD_PATH)/tests/eap config/tlscache config/eap-test config/eap-test-inner-tunnel
+
$(BUILD_PATH)/tests/eap/%.ok: $(top_builddir)/src/tests/%.conf | $(BUILD_PATH)/tests/eap
@echo EAPOL_TEST $(notdir $(patsubst %.conf,%,$<))
@if $(EAPOL_TEST) -c $< -p $(PORT) -s $(SECRET) > $(patsubst %.ok,%,$@).log 2>&1; then \
$(BUILD_PATH)/tests/eap/${1}-${2}.ok: $(BUILD_PATH)/tests/eap/${1}-${2}.conf
@echo EAPOL_TEST $$(notdir $$(patsubst %.ok,%,$$@))
- @if $(EAPOL_TEST) -c $$< -p $(PORT) -s $(SECRET) > $$(patsubst %.ok,%,$$@).log 2>&1; then \
- if grep -q '^SSL: Using TLS version TLSv${2}$$$$' $$(patsubst %.ok,%,$$@).log; then \
- touch $$@; \
- else \
- echo FAILED - not using TLS version ${2}; \
- echo " " $(EAPOL_TEST) -c $$< -p $(PORT) -s $(SECRET); \
- fi \
- else \
+ @if ! $(EAPOL_TEST) -r 1 -c $$< -p $(PORT) -s $(SECRET) > $$(patsubst %.ok,%,$$@).log 2>&1; then \
echo FAILED; \
echo " " $(EAPOL_TEST) -c $$< -p $(PORT) -s $(SECRET); \
fi
-
-$(BUILD_PATH)/tests/eap/${1}-${2}-resumption.ok: $(BUILD_PATH)/tests/eap/${1}-${2}.conf
- @echo EAPOL_TEST $$(notdir $$(patsubst %.ok,%,$$@))
- @if $(EAPOL_TEST) -r 2 -c $$< -p $(PORT) -s $(SECRET) > $$@.log 2>&1; then \
- touch $$@; \
- else \
- echo FAILED; \
- echo " " $(EAPOL_TEST) -r 2 -c $$< -p $(PORT) -s $(SECRET); \
+ @if ! grep -q '^SSL: Using TLS version TLSv${2}$$$$' $$(patsubst %.ok,%,$$@).log; then \
+ echo " " FAILED - not using TLS version ${2}; \
+ echo " " $(EAPOL_TEST) -c $$< -p $(PORT) -s $(SECRET); \
+ exit 1; \
+ fi
+ @if ! grep -q '^OpenSSL: Handshake finished - resumed=1$$$$' $$(patsubst %.ok,%,$$@).log; then \
+ echo " " FAILED - did not use resumption; \
+ echo " " $(EAPOL_TEST) -r -c $$< -p $(PORT) -s $(SECRET); \
+ exit 1; \
fi
+ @touch $$@
EAP_TLS_VERSION_FILES += $(BUILD_PATH)/tests/eap/${1}-${2}.ok
endef