aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-06-19 12:21:27 -0400
committerB Stack <bgstack15@gmail.com>2018-06-19 15:16:12 -0400
commit723bfdfd3febfbf0ba41966b1e77f9f4bd6f3a90 (patch)
tree1b1da5687f3f9a9a18f95dc343c904d85b307e3f
parentadd many actions: fetch, request... (diff)
downloadcertreq-723bfdfd3febfbf0ba41966b1e77f9f4bd6f3a90.tar.gz
certreq-723bfdfd3febfbf0ba41966b1e77f9f4bd6f3a90.tar.bz2
certreq-723bfdfd3febfbf0ba41966b1e77f9f4bd6f3a90.zip
fix the retrieval of the ca cert
Previously the code counted how many items were displayed in the list of CA certs. However, when the number of certs listed is different from the current renewal count, this can cause errors. I found this variable, "nRenewals" in the returned web page and it matches the current cacert to use.
-rwxr-xr-xfiles/certreq.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/files/certreq.sh b/files/certreq.sh
index ea645ac..5093f5d 100755
--- a/files/certreq.sh
+++ b/files/certreq.sh
@@ -10,13 +10,14 @@
# 2017-11-22 Add ca cert chain
# 2018-04-16 Add --list and --csr options
# 2018-05-07 Add actions for using a CA with manually-approved certs
+# 2018-06-19 Fix get number of ca cert
# Usage: in ansible role certreq
# Microsoft CA cert templates have permissions on them. A user must be able to "enroll" on the template.
# Reference: ftemplate.sh 2017-10-10x; framework.sh 2017-10-09a
# fundamental curl statements https://stackoverflow.com/questions/31283476/submitting-base64-csr-to-a-microsoft-ca-via-curl/39722983#39722983
# Improve:
fiversion="2017-10-10x"
-certreqversion="2018-05-07a"
+certreqversion="2018-06-19a"
usage() {
less -F >&2 <<ENDUSAGE
@@ -209,7 +210,7 @@ get_number_of_current_ca_cert() {
-H "Referer: ${this_ca}/certsrv/certrqxt.asp" \
-H 'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko' \
-H 'Content-Type: application/x-www-form-urlencoded' )"
- CURRENTNUM="$( echo "${RESPONSE}" | grep -cE 'Option' )"
+ CURRENTNUM="$( echo "${RESPONSE}" | grep -oE 'nRenewals=[0-9]+'| tr -dc '[0-9]' )"
}
bgstack15