Skip to content

Instantly share code, notes, and snippets.

@deanet
Last active July 22, 2021 12:16
Show Gist options
  • Save deanet/aa937e4c6aa3187dff887e0288443d44 to your computer and use it in GitHub Desktop.
Save deanet/aa937e4c6aa3187dff887e0288443d44 to your computer and use it in GitHub Desktop.

Revisions

  1. deanet revised this gist Jul 22, 2021. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions acme-v01-to-v02.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,11 @@
    #!/bin/bash
    ## upgrade automatically /root/.acme.sh/ domain config on Le_API from https://acme-v01.api.letsencrypt.org/directory to https://acme-v02.api.letsencrypt.org/directory
    ## blog.dgprasetya.com

    ##upgrade acme.sh first


    "/root/.acme.sh"/acme.sh --upgrade

    cd /root/.acme.sh
    tar -cvf /root/backup-acme.sh-`date +%F_%H%M`.tar /root/.acme.sh
  2. deanet created this gist Jul 22, 2021.
    28 changes: 28 additions & 0 deletions acme-v01-to-v02.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/bin/bash
    ## upgrade automatically /root/.acme.sh/ domain config on Le_API from https://acme-v01.api.letsencrypt.org/directory to https://acme-v02.api.letsencrypt.org/directory


    cd /root/.acme.sh
    tar -cvf /root/backup-acme.sh-`date +%F_%H%M`.tar /root/.acme.sh

    ## https://community.centminmod.com/threads/acmev1-deprecated-and-shutdown-june-1st-2021.21586/#post-89505

    find /root/.acme.sh/ -type f -name "*.csr" | while read f;

    do

    configname=$(echo "$f" | sed -e 's|\.csr|\.conf|g');
    echo "$configname"; grep '\.api' "$configname";
    echo;
    if [ "$(grep "Le_API='https://acme-v01.api" $configname)" ];
    then
    echo "Update Le_API in $configname"; sed -i "s|Le_API='https:\/\/acme-v01.api|Le_API='https:\/\/acme-v02.api|" "$configname";
    grep 'Le_API=' "$configname";
    echo;

    fi;
    done

    ##run jobs
    "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh"
    service nginx reload