cloudflare-gateway-pihole-scripts
cloudflare-gateway-pihole-scripts copied to clipboard
Continue if there is an SSL validation error with allow or block list download
Currently if an SSL validation error is detected the script seems to stop entirely. A temporary fix is to fallback to default values in personal configuration, otherwise the rest of the process fails. Ideally if this happens the script should used the cached allow or block list values and continue on presenting a warning. That would allow other files to continue updating. Though I'm unsure if a similar error would occur, if the site or page returns an error, a similar model of continuing would be ideal.
This would work around temporary SSL or server issues, or a defunct site, while still updating anything that can be updated, and using old cache if there is only one entry.
Example log output from a failure. This is a valid error with that domain currently.
> node download_lists.js
An error occurred while processing allowlist.txt:
TypeError: fetch failed
at node:internal/deps/undici/undici:13502:13
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async downloadFiles (file:///app/lib/utils.js:59:22)
at async downloadLists (file:///app/download_lists.js:27:5)
at async Promise.all (index 0)
at async file:///app/download_lists.js:55:5 {
[cause]: Error: self-signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
at TLSSocket.emit (node:events:518:28)
at TLSSocket._finishInit (node:_tls_wrap:1078:8)
at ssl.onhandshakedone (node:_tls_wrap:864:12) {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
}
URLs:
[ 'https://www.joinhoney.com/whitelist/honey-smart-shopping.txt' ]
node:internal/modules/run_main:122
triggerUncaughtException(
^
TypeError: fetch failed
at node:internal/deps/undici/undici:13502:13
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async downloadFiles (file:///app/lib/utils.js:59:22)
at async downloadLists (file:///app/download_lists.js:27:5)
at async Promise.all (index 0)
at async file:///app/download_lists.js:55:5 {
[cause]: Error: self-signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
at TLSSocket.emit (node:events:518:28)
at TLSSocket._finishInit (node:_tls_wrap:1078:8)
at ssl.onhandshakedone (node:_tls_wrap:864:12) {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
}