Skip to content

Instantly share code, notes, and snippets.

@coffeesam
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save coffeesam/fc7b7b7ee080549ed54e to your computer and use it in GitHub Desktop.

Select an option

Save coffeesam/fc7b7b7ee080549ed54e to your computer and use it in GitHub Desktop.
#!/bin/sh
DOMAIN=`echo $1 | sed 's/https:\/\///' | sed -E 's/\/.*$//'`
URL="https://$DOMAIN"
if [ -z $URL ]; then
cat << EOF
Usage: ckrootca <url>
EOF
else
curl -c $DOMAIN.cookie -I -vs $URL 2>&1 | grep "Server certificate" -B1 | tail -n1
fi
@coffeesam
Copy link
Author

Prototype bash script to check root CA of any https url.
Basis for upcoming brew, Ruby gem or NPM package.

@coffeesam
Copy link
Author

Improved version where the script will prefix https:// if it is missing from the argument

@coffeesam
Copy link
Author

Updated script not to recursively follow redirects, just perform a check on the root URL
FIXME: should follow redirect if subsequent domain differs from requested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment