Skip to content

Instantly share code, notes, and snippets.

@beevelop
Forked from wolph/whitelist_ssl_certificates_chrome.sh
Last active November 29, 2017 18:28
Show Gist options
  • Select an option

  • Save beevelop/cf60f88292ad76b0e1bc37ed688c07b4 to your computer and use it in GitHub Desktop.

Select an option

Save beevelop/cf60f88292ad76b0e1bc37ed688c07b4 to your computer and use it in GitHub Desktop.

Revisions

  1. beevelop revised this gist Nov 29, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # Whitelist SSL
    > This script allows you to whitelist / accept / trust your self-signed / custom / invalid certificate by putting it into your Keychain. This is helpful to convince your favorite browser (Chrome or Opera) to not give a shit about its issuer, whatever.
    > This script allows you to whitelist / accept / trust your self-signed / custom / invalid certificate by putting it into your Keychain. This is helpful to convince your favorite browser (Chrome or Opera) to not give a shit about its issuer or whatever.
    ## Quick start
    ```sh
    @@ -25,6 +25,7 @@ This script has been successfully tested on
    - Opera Developer 51.0.2781.0
    - Should inform you about „reduced security due to a local, non-public certificate”.
    - Firefox Developer Edition 58.0b7 (64-bit) didn't gave a fuck about my Kechain.
    - See https://www.bounca.org/tutorials/install_root_certificate.html#browser-firefox

    ## Todo
    - [ ] Make the port configurable via `$2`.
  2. beevelop revised this gist Nov 29, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Whitelist SSL
    > This script allows you to whitelist / accept / trust your self-signed / custom / invalid certificate by putting it into your Keychain. This is helpful to convince your favorite browser (Chrome or Opera) to not give a shit about its issuer, whatever.
    ## Quick start
    ```sh
  3. beevelop revised this gist Nov 29, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -14,10 +14,10 @@ chmod +x whitelist_ssl.sh
    ./whitelist_ssl.sh <URL>
    ```

    ### Changes from Wolph's original implementation
    ## Changes from Wolph's original implementation
    - Use `trustAsRoot` (instead of `trustRoot`) in order to automatically enable Always trust.

    ### Should it work?
    ## Should it work?
    This script has been successfully tested on
    - macOS Sierra 10.12.6
    - Google Chrome Version 63.0.3239.59 (Official Build) beta (64-bit)
  4. beevelop revised this gist Nov 29, 2017. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,19 @@
    # Whitelist SSL

    ## Quick start
    ```sh
    git clone https://gist.github.com/beevelop/cf60f88292ad76b0e1bc37ed688c07b4 whiteliste_ssl
    cd whiteliste_ssl
    chmod +x whitelist_ssl.sh
    ./whitelist_ssl.sh https://my-self-signed-domain.foobar/whatever/
    ```

    ## Usage
    ```
    # URL gets sanitized and can contain the full path
    ./whitelist_ssl.sh <URL>
    ```

    ### Changes from Wolph's original implementation
    - Use `trustAsRoot` (instead of `trustRoot`) in order to automatically enable Always trust.

    @@ -9,4 +23,7 @@ This script has been successfully tested on
    - Google Chrome Version 63.0.3239.59 (Official Build) beta (64-bit)
    - Opera Developer 51.0.2781.0
    - Should inform you about „reduced security due to a local, non-public certificate”.
    - Firefox Developer Edition 58.0b7 (64-bit) didn't gave a fuck about my Kechain.
    - Firefox Developer Edition 58.0b7 (64-bit) didn't gave a fuck about my Kechain.

    ## Todo
    - [ ] Make the port configurable via `$2`.
  5. beevelop revised this gist Nov 29, 2017. 2 changed files with 13 additions and 1 deletion.
    12 changes: 12 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # Whitelist SSL

    ### Changes from Wolph's original implementation
    - Use `trustAsRoot` (instead of `trustRoot`) in order to automatically enable Always trust.

    ### Should it work?
    This script has been successfully tested on
    - macOS Sierra 10.12.6
    - Google Chrome Version 63.0.3239.59 (Official Build) beta (64-bit)
    - Opera Developer 51.0.2781.0
    - Should inform you about „reduced security due to a local, non-public certificate”.
    - Firefox Developer Edition 58.0b7 (64-bit) didn't gave a fuck about my Kechain.
    2 changes: 1 addition & 1 deletion whitelist_ssl_certificates_chrome.sh → whitelist_ssl.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ if [[ "$HOST" =~ .*\..* ]]; then
    echo -n | openssl s_client -connect $HOST:443 -servername $HOST \
    | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
    | tee "/tmp/$HOST.cert"
    sudo security add-trusted-cert -d -r trustRoot \
    sudo security add-trusted-cert -d -r trustAsRoot \
    -k "/Library/Keychains/System.keychain" "/tmp/$HOST.cert"
    rm -v "/tmp/$HOST.cert"
    else
  6. @wolph wolph revised this gist May 2, 2015. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions whitelist_ssl_certificates_chrome.sh
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,16 @@
    #!/usr/bin/env bash -e

    SERVERNAME=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//')
    echo "$SERVERNAME"
    HOST=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//')

    if [[ "$SERVERNAME" =~ .*\..* ]]; then
    echo "Adding certificate for $SERVERNAME"
    echo -n | openssl s_client -connect $SERVERNAME:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | tee /tmp/$SERVERNAME.cert
    sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" /tmp/$SERVERNAME.cert
    if [[ "$HOST" =~ .*\..* ]]; then
    echo "Adding certificate for $HOST"
    echo -n | openssl s_client -connect $HOST:443 -servername $HOST \
    | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
    | tee "/tmp/$HOST.cert"
    sudo security add-trusted-cert -d -r trustRoot \
    -k "/Library/Keychains/System.keychain" "/tmp/$HOST.cert"
    rm -v "/tmp/$HOST.cert"
    else
    echo "Usage: $0 www.site.name"
    echo "http:// and such will be stripped automatically"
    fi

  7. @wolph wolph created this gist Mar 1, 2015.
    14 changes: 14 additions & 0 deletions whitelist_ssl_certificates_chrome.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/usr/bin/env bash -e

    SERVERNAME=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//')
    echo "$SERVERNAME"

    if [[ "$SERVERNAME" =~ .*\..* ]]; then
    echo "Adding certificate for $SERVERNAME"
    echo -n | openssl s_client -connect $SERVERNAME:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | tee /tmp/$SERVERNAME.cert
    sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" /tmp/$SERVERNAME.cert
    else
    echo "Usage: $0 www.site.name"
    echo "http:// and such will be stripped automatically"
    fi