Let's Encrypt on a Big-IP
Problem this snippet solves: It is now possible to make use of Let's Encrypt certificates and maintain them on the Big-IP. Code : http://wiki.lnxgeek.org/doku.php/howtos:let_s_encrypt_-_how_to_iss...
Published Dec 12, 2015
Version 1.0lnxgeek
MVP
Joined July 21, 2008
lnxgeek
MVP
Joined July 21, 2008
lnxgeek
Jul 17, 2018MVP
Hi Colin
Just re-tested your fine upload function and the skip chunks problem has been fixed. However you make one retraction too much when you run the curl command.
When you iterate over the file you have this calculation for the end range number: BYTES_END=$((${BYTES_START} + ${TMP_FILESIZE} - 1))
but then when you fire off the curl command you do it again:
OUT=$(/bin/bash -c "${CURL} -s --insecure -X POST --data-binary '@${TMP_FILE}' --user '${BIGIP_USERNAME}:${BIGIP_PASSWORD}' -H 'Content-Type: application/octet-stream' -H 'Content-Range: ${BYTES_START}-$((${BYTES_END} - 1))/${FILESIZE}' 'https://${BIGIP_DEVICE}/mgmt/shared/file-transfer/uploads/${2}'")
This causes the rest API to go mad:
[SEVERE][18286][17 Jul 2018 14:25:29 UTC][8100/shared/file-transfer/uploads FileTransferWorker] Transfer failed for /var/config/rest/downloads/file.txt with java.lang.IllegalStateException: Chunk byte count 499713 in Content-Range header different from received buffer length 499712
at com.f5.rest.common.RestFileReceiver.writeFileChunk(RestFileReceiver.java:350)
at com.f5.rest.common.RestFileReceiver.handleFileChunkWrite(RestFileReceiver.java:286)
at com.f5.rest.common.RestFileReceiver$1.run(RestFileReceiver.java:222)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
If I change it to this instead it works:
OUT=$(/bin/bash -c "${CURL} -s --insecure -X POST --data-binary '@${TMP_FILE}' --user '${BIGIP_USERNAME}:${BIGIP_PASSWORD}' -H 'Content-Type: application/octet-stream' -H 'Content-Range: ${BYTES_START}-$((${BYTES_END}))/${FILESIZE}' 'https://${BIGIP_DEVICE}/mgmt/shared/file-transfer/uploads/${2}'")