802.1x tests: Improve cleanup

This commit is contained in:
Till Maas 2020-06-02 20:19:44 +02:00
parent 7f222e5dbe
commit 371d6f4679
3 changed files with 34 additions and 5 deletions

View file

@ -156,5 +156,22 @@
state: down
ignore_errors: true
- include_tasks: tasks/cleanup_802_1x_server.yml
- name: Remove test certificates
file:
state: absent
path: "/etc/pki/tls/{{ item }}"
with_items:
- client.key
- client.key.nocrypt
- client.pem
- cacert.pem
- name: Remove test CA
file:
state: absent
path: "{{ item }}"
with_items:
- /etc/pki/ca-trust/source/anchors/cacert.pem
- name: Update ca trust
command: update-ca-trust
tags:
- "tests::cleanup"

View file

@ -9,3 +9,11 @@
- name: Kill hostapd process
shell: pkill hostapd
- name: Remove certs and config
file:
state: absent
path: "{{ item }}"
with_items:
- /etc/pki/tls/hostapd_test
- /etc/hostapd/wired.conf
- /etc/hostapd/hostapd.eap_user

View file

@ -14,10 +14,14 @@
name: hostapd
state: present
- name: Create directory for test certificates
file:
state: directory
path: /etc/pki/tls/hostapd_test
- name: Copy server certificates
copy:
src: "{{ item }}"
dest: "/etc/pki/tls/{{ item }}"
dest: "/etc/pki/tls/hostapd_test/{{ item }}"
with_items:
- server.key
- dh.pem
@ -61,10 +65,10 @@
eap_server=1
use_pae_group_addr=1
eap_user_file=/etc/hostapd/hostapd.eap_user
ca_cert=/etc/pki/tls/cacert.pem
dh_file=/etc/pki/tls/dh.pem
server_cert=/etc/pki/tls/server.pem
private_key=/etc/pki/tls/server.key
ca_cert=/etc/pki/tls/hostapd_test/cacert.pem
dh_file=/etc/pki/tls/hostapd_test/dh.pem
server_cert=/etc/pki/tls/hostapd_test/server.pem
private_key=/etc/pki/tls/hostapd_test/server.key
private_key_passwd=test
logger_syslog=-1
logger_syslog_level=0