Skip to content

Instantly share code, notes, and snippets.

@coder4web
Last active September 19, 2022 13:39

Revisions

  1. coder4web revised this gist Apr 28, 2020. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions nginx_self_signed_ecc.sh
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,7 @@ openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo
    openssl req -x509 -sha256 -days 365 -key nginx.ec.key -in nginx.ec.csr -out nginx.ec.crt

    # nginx conf
    :SRC'
    ssl_certificate /etc/nginx/ssl/nginx.ec.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.ec.key;
    '
    #ssl_certificate /etc/nginx/ssl/nginx.ec.crt;
    #ssl_certificate_key /etc/nginx/ssl/nginx.ec.key;

    openssl s_client -connect site.domain:443
  2. coder4web revised this gist Apr 28, 2020. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions nginx_self_signed_ecc.sh
    Original file line number Diff line number Diff line change
    @@ -6,14 +6,12 @@ openssl ec -in nginx.ec.key -text -noout

    # CSR
    openssl req -new -sha256 -key nginx.ec.key -subj "/CN=devops/C=BM/ST=Bermudian/L=Bermudian/O=Org/OU=IT" -out nginx.ec.csr
    openssl req -in nginx.ec.csr -text -noout
    #openssl req -in nginx.ec.csr -text -noout
    openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well"

    # Certificate
    openssl req -x509 -sha256 -days 365 -key nginx.ec.key -in nginx.ec.csr -out nginx.ec.crt

    # Validation
    openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well"

    # nginx conf
    :SRC'
    ssl_certificate /etc/nginx/ssl/nginx.ec.crt;
  3. coder4web revised this gist Apr 28, 2020. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion nginx_self_signed_ecc.sh
    Original file line number Diff line number Diff line change
    @@ -6,11 +6,17 @@ openssl ec -in nginx.ec.key -text -noout

    # CSR
    openssl req -new -sha256 -key nginx.ec.key -subj "/CN=devops/C=BM/ST=Bermudian/L=Bermudian/O=Org/OU=IT" -out nginx.ec.csr
    openssl req -in nginx.ec.csr -noout -text
    openssl req -in nginx.ec.csr -text -noout

    # Certificate
    openssl req -x509 -sha256 -days 365 -key nginx.ec.key -in nginx.ec.csr -out nginx.ec.crt

    # Validation
    openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well"

    # nginx conf
    :SRC'
    ssl_certificate /etc/nginx/ssl/nginx.ec.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.ec.key;
    '
    openssl s_client -connect site.domain:443
  4. coder4web revised this gist Apr 28, 2020. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions nginx_self_signed_ecc.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,16 @@
    #!/bin/sh

    # Private key
    openssl ecparam -genkey -name secp384r1 -out nginx.ec.key
    openssl ec -in nginx.ec.key -text -noout

    # CSR
    openssl req -new -sha256 -key nginx.ec.key -subj "/CN=devops/C=BM/ST=Bermudian/L=Bermudian/O=Org/OU=IT" -out nginx.ec.csr
    openssl req -in nginx.ec.csr -noout -text

    # Certificate
    openssl req -x509 -sha256 -days 365 -key nginx.ec.key -in nginx.ec.csr -out nginx.ec.crt

    # Validation
    openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well"
    openssl s_client -connect site.domain:443
  5. coder4web created this gist Apr 28, 2020.
    4 changes: 4 additions & 0 deletions nginx_self_signed_ecc.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    openssl ecparam -genkey -name secp384r1 -out nginx.ec.key
    openssl req -new -sha256 -key nginx.ec.key -subj "/CN=devops/C=BM/ST=Bermudian/L=Bermudian/O=Org/OU=IT" -out nginx.ec.csr
    openssl req -x509 -sha256 -days 365 -key nginx.ec.key -in nginx.ec.csr -out nginx.ec.crt
    openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well"