Skip to content

Commit

Permalink
Provide methods to supply options for curl, fetch, and wget
Browse files Browse the repository at this point in the history
I wanted this to specify -4 on fetch calls. My host had an IPv6
address but no public IPv6 network access.  Supplying this option
specifies that only IP4 should be used on fetch.
  • Loading branch information
dlangille committed Nov 9, 2020
1 parent 98d57be commit 9c10df0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ USER_AGENT="--user-agent='anvil-cert-puller'"
FETCH="/usr/bin/fetch --mirror --quiet --user-agent=${USER_AGENT}'"
CURL="/usr/local/bin/curl --silent --user-agent '${USER_AGENT}' --remote-time"
WGET="/usr/local/bin/wget --quiet --user-agent='${USER_AGENT}'"
FETCH_OPTIONS="-4"
CURL_OPTIONS="-4"
WGET_OPTIONS="-4"
```

After getting new certs, services need to be restarted/reloaded.
Expand Down
6 changes: 3 additions & 3 deletions cert-puller
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ fetch_new_certs(){
case ${FETCH_TOOL} in
"wget")
${LOGGER} running: ${WGET} --output-document=${DOWNLOAD_DIR}/${file} ${CERT_SERVER}/${cert}/${file}
${WGET} --output-document=${DOWNLOAD_DIR}/${file} ${CERT_SERVER}/${cert}/${file}
${WGET} ${WGET_OPTIONS} --output-document=${DOWNLOAD_DIR}/${file} ${CERT_SERVER}/${cert}/${file}
;;
"curl")
${LOGGER} running: ${CURL} -o ${DOWNLOAD_DIR}/${file} ${CERT_SERVER}/${cert}/${file}
${CURL} -o ${DOWNLOAD_DIR}/${file} ${CERT_SERVER}/${cert}/${file}
${CURL} ${CURL_OPTIONS} -o ${DOWNLOAD_DIR}/${file} ${CERT_SERVER}/${cert}/${file}
;;
*)
${LOGGER} running: ${FETCH} -o ${DOWNLOAD_DIR} ${CERT_SERVER}/${cert}/${file}
${FETCH} -o ${DOWNLOAD_DIR} ${CERT_SERVER}/${cert}/${file}
${FETCH} ${FETCH_OPTIONS} -o ${DOWNLOAD_DIR} ${CERT_SERVER}/${cert}/${file}
;;
esac
RESULT=$?
Expand Down

0 comments on commit 9c10df0

Please sign in to comment.