Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
Last active June 12, 2016 20:59
Show Gist options
  • Save JanTvrdik/9ad909f81d37697e580d3c06d9365852 to your computer and use it in GitHub Desktop.
Save JanTvrdik/9ad909f81d37697e580d3c06d9365852 to your computer and use it in GitHub Desktop.
PHP CA bundle updater
#!/usr/bin/env bash
set -o errexit -o pipefail -o nounset
IFS=$'\n\t'
ROOT_CRT="$(dirname $0)/root/root.crt"
CA_BUNDLE="$(dirname $0)/ca-bundle.pem"
echo -n "Downloading CA bundle... "
wget -q -O "$CA_BUNDLE" https://curl.haxx.se/ca/cacert.pem
echo "done"
echo -n "Appending my own root CA... "
echo "" >> "$CA_BUNDLE"
echo "JanTvrdik's Root CA" >> "$CA_BUNDLE"
echo "===================" >> "$CA_BUNDLE"
cat "$ROOT_CRT" >> "$CA_BUNDLE"
echo "done"
echo ""
echo "Printing CA bundle header for visual confirmation"
echo ""
head "$CA_BUNDLE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment