-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathx_sign_cert.sh
executable file
·37 lines (30 loc) · 1.06 KB
/
x_sign_cert.sh
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
# create new agent cert
puppet agent -t --certname example1
# check cert signing status
curl -X GET \
--tlsv1 \
--cert $(puppet config print hostcert) \
--key $(puppet config print hostprivkey) \
--cacert $(puppet config print localcacert) \
https://$(puppet config print server):8140/puppet-ca/v1/certificate_status/example1?environment=production
echo
# sign the cert
curl -X PUT -H 'Content-Type: application/json' \
--tlsv1 \
--data \
'{"desired_state":"signed"}' \
--cert $(puppet config print hostcert) \
--key $(puppet config print hostprivkey) \
--cacert $(puppet config print localcacert) \
https://$(puppet config print server):8140/puppet-ca/v1/certificate_status/example1?environment=production
echo
# check signing status again. Signed!
curl -X GET \
--tlsv1 \
--cert $(puppet config print hostcert) \
--key $(puppet config print hostprivkey) \
--cacert $(puppet config print localcacert) \
https://$(puppet config print server):8140/puppet-ca/v1/certificate_status/example1?environment=production
echo; echo
# clean up
puppet cert clean example1