-
Notifications
You must be signed in to change notification settings - Fork 139
161 lines (142 loc) · 5.39 KB
/
ipa-acme-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: IPA ACME
on:
workflow_call:
inputs:
os:
required: true
type: string
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
SHARED: /tmp/workdir/pki
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Retrieve runner image
uses: actions/cache@v3
with:
key: ipa-runner-${{ inputs.os }}-${{ github.run_id }}
path: ipa-runner.tar
- name: Load runner image
run: docker load --input ipa-runner.tar
- name: Create network
run: docker network create example
- name: Run IPA container
run: |
tests/bin/runner-init.sh ipa
env:
IMAGE: ipa-runner
HOSTNAME: ipa.example.com
- name: Connect IPA container to network
run: docker network connect example ipa --alias ipa.example.com --alias ipa-ca.example.com
- name: Install IPA server in IPA container
run: |
docker exec ipa sysctl net.ipv6.conf.lo.disable_ipv6=0
docker exec ipa ipa-server-install \
-U \
--domain example.com \
-r EXAMPLE.COM \
-p Secret.123 \
-a Secret.123 \
--no-host-dns \
--no-ntp
docker exec ipa bash -c "echo Secret.123 | kinit admin"
docker exec ipa ipa ping
- name: Install KRA in IPA container
run: |
docker exec ipa ipa-kra-install -p Secret.123
docker exec ipa pki-server ca-config-find | grep ca.connector.KRA
- name: Verify CA admin in IPA container
run: |
docker exec ipa pki-server cert-export ca_signing --cert-file ca_signing.crt
docker exec ipa pki client-cert-import ca_signing --ca-cert ca_signing.crt
docker exec ipa pki client-cert-import \
--pkcs12 /root/ca-agent.p12 \
--pkcs12-password Secret.123
docker exec ipa pki -n ipa-ca-agent ca-user-show admin
- name: Enable ACME in IPA container
run: |
docker exec ipa ipa-acme-manage enable
docker exec ipa ipa-acme-manage status
echo "Available" > expected
docker exec ipa bash -c "pki acme-info | sed -n 's/\s*Status:\s\+\(\S\+\).*/\1/p' > ${SHARED}/actual"
diff expected actual
- name: Run client container
run: |
docker run \
--detach \
--name=client \
--hostname=client.example.com \
--privileged \
--tmpfs /tmp \
--tmpfs /run \
ipa-runner \
/usr/sbin/init
- name: Connect client container to network
run: docker network connect example client --alias client.example.com
- name: Install IPA client in client container
run: |
docker exec client sysctl net.ipv6.conf.lo.disable_ipv6=0
docker exec client ipa-client-install \
-U \
--server=ipa.example.com \
--domain=example.com \
--realm=EXAMPLE.COM \
-p admin \
-w Secret.123 \
--no-ntp
docker exec client bash -c "echo Secret.123 | kinit admin"
docker exec client klist
- name: Verify certbot in client container
run: |
docker exec client certbot register \
--server https://ipa-ca.example.com/acme/directory \
--email user1@example.com \
--agree-tos \
--non-interactive
docker exec client certbot certonly \
--server https://ipa-ca.example.com/acme/directory \
-d client.example.com \
--standalone \
--non-interactive
docker exec client certbot renew \
--server https://ipa-ca.example.com/acme/directory \
--cert-name client.example.com \
--force-renewal \
--non-interactive
docker exec client certbot revoke \
--server https://ipa-ca.example.com/acme/directory \
--cert-name client.example.com \
--non-interactive
docker exec client certbot update_account \
--server https://ipa-ca.example.com/acme/directory \
--email user2@example.com \
--non-interactive
docker exec client certbot unregister \
--server https://ipa-ca.example.com/acme/directory \
--non-interactive
- name: Disable ACME in IPA container
run: |
docker exec ipa ipa-acme-manage disable
docker exec ipa ipa-acme-manage status
echo "Unavailable" > expected
docker exec ipa bash -c "pki acme-info | sed -n 's/\s*Status:\s\+\(\S\+\).*/\1/p' > ${SHARED}/actual"
diff expected actual
- name: Gather artifacts from IPA container
if: always()
run: |
tests/bin/ds-artifacts-save.sh ipa --instance EXAMPLE-COM
tests/bin/pki-artifacts-save.sh ipa
tests/bin/ipa-artifacts-save.sh ipa
continue-on-error: true
- name: Remove IPA server from IPA container
run: docker exec ipa ipa-server-install --uninstall -U
- name: Upload artifacts from IPA container
if: always()
uses: actions/upload-artifact@v2
with:
name: ipa-acme-${{ inputs.os }}
path: |
/tmp/artifacts/ipa