Full Code of acmesh-official/acme.sh for AI

master 5d158b164028 cached
275 files
1.6 MB
538.2k tokens
1 requests
Download .txt
Showing preview only (1,750K chars total). Download the full file or copy to clipboard to get everything.
Repository: acmesh-official/acme.sh
Branch: master
Commit: 5d158b164028
Files: 275
Total size: 1.6 MB

Directory structure:
gitextract_r8jn0t7t/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── copilot-instructions.md
│   └── workflows/
│       ├── DNS.yml
│       ├── DragonFlyBSD.yml
│       ├── FreeBSD.yml
│       ├── Haiku.yml
│       ├── Linux.yml
│       ├── MacOS.yml
│       ├── NetBSD.yml
│       ├── Omnios.yml
│       ├── OpenBSD.yml
│       ├── OpenIndiana.yml
│       ├── PebbleStrict.yml
│       ├── Solaris.yml
│       ├── Ubuntu.yml
│       ├── Windows.yml
│       ├── dockerhub.yml
│       ├── issue.yml
│       ├── pr_dns.yml
│       ├── pr_notify.yml
│       ├── shellcheck.yml
│       └── wiki-monitor.yml
├── Dockerfile
├── LICENSE.md
├── README.md
├── acme.sh
├── deploy/
│   ├── README.md
│   ├── ali_cdn.sh
│   ├── ali_dcdn.sh
│   ├── apache.sh
│   ├── cachefly.sh
│   ├── cleverreach.sh
│   ├── consul.sh
│   ├── cpanel_uapi.sh
│   ├── directadmin.sh
│   ├── docker.sh
│   ├── dovecot.sh
│   ├── edgio.sh
│   ├── exim4.sh
│   ├── fritzbox.sh
│   ├── gcore_cdn.sh
│   ├── gitlab.sh
│   ├── haproxy.sh
│   ├── kemplm.sh
│   ├── keychain.sh
│   ├── keyhelp.sh
│   ├── keyhelp_api.sh
│   ├── kong.sh
│   ├── lighttpd.sh
│   ├── localcopy.sh
│   ├── mailcow.sh
│   ├── multideploy.sh
│   ├── myapi.sh
│   ├── mydevil.sh
│   ├── mysqld.sh
│   ├── netlify.sh
│   ├── nginx.sh
│   ├── openmediavault.sh
│   ├── opensshd.sh
│   ├── openstack.sh
│   ├── panos.sh
│   ├── peplink.sh
│   ├── proxmoxbs.sh
│   ├── proxmoxve.sh
│   ├── pureftpd.sh
│   ├── qiniu.sh
│   ├── routeros.sh
│   ├── ruckus.sh
│   ├── ssh.sh
│   ├── strongswan.sh
│   ├── synology_dsm.sh
│   ├── truenas.sh
│   ├── truenas_ws.sh
│   ├── unifi.sh
│   ├── vault.sh
│   ├── vault_cli.sh
│   ├── vsftpd.sh
│   └── zyxel_gs1900.sh
├── dnsapi/
│   ├── README.md
│   ├── dns_1984hosting.sh
│   ├── dns_acmedns.sh
│   ├── dns_acmeproxy.sh
│   ├── dns_active24.sh
│   ├── dns_ad.sh
│   ├── dns_ali.sh
│   ├── dns_alviy.sh
│   ├── dns_anx.sh
│   ├── dns_artfiles.sh
│   ├── dns_arvan.sh
│   ├── dns_aurora.sh
│   ├── dns_autodns.sh
│   ├── dns_aws.sh
│   ├── dns_azion.sh
│   ├── dns_azure.sh
│   ├── dns_beget.sh
│   ├── dns_bookmyname.sh
│   ├── dns_bunny.sh
│   ├── dns_cf.sh
│   ├── dns_clouddns.sh
│   ├── dns_cloudns.sh
│   ├── dns_cn.sh
│   ├── dns_conoha.sh
│   ├── dns_constellix.sh
│   ├── dns_cpanel.sh
│   ├── dns_curanet.sh
│   ├── dns_cyon.sh
│   ├── dns_da.sh
│   ├── dns_ddnss.sh
│   ├── dns_desec.sh
│   ├── dns_df.sh
│   ├── dns_dgon.sh
│   ├── dns_dnsexit.sh
│   ├── dns_dnshome.sh
│   ├── dns_dnsimple.sh
│   ├── dns_dnsservices.sh
│   ├── dns_doapi.sh
│   ├── dns_domeneshop.sh
│   ├── dns_dp.sh
│   ├── dns_dpi.sh
│   ├── dns_dreamhost.sh
│   ├── dns_duckdns.sh
│   ├── dns_durabledns.sh
│   ├── dns_dyn.sh
│   ├── dns_dynu.sh
│   ├── dns_dynv6.sh
│   ├── dns_easydns.sh
│   ├── dns_edgecenter.sh
│   ├── dns_edgedns.sh
│   ├── dns_efficientip.sh
│   ├── dns_euserv.sh
│   ├── dns_exoscale.sh
│   ├── dns_fornex.sh
│   ├── dns_freedns.sh
│   ├── dns_freemyip.sh
│   ├── dns_gandi_livedns.sh
│   ├── dns_gcloud.sh
│   ├── dns_gcore.sh
│   ├── dns_gd.sh
│   ├── dns_geoscaling.sh
│   ├── dns_googledomains.sh
│   ├── dns_he.sh
│   ├── dns_he_ddns.sh
│   ├── dns_hetzner.sh
│   ├── dns_hetznercloud.sh
│   ├── dns_hexonet.sh
│   ├── dns_hostingde.sh
│   ├── dns_hostup.sh
│   ├── dns_huaweicloud.sh
│   ├── dns_infoblox.sh
│   ├── dns_infoblox_uddi.sh
│   ├── dns_infomaniak.sh
│   ├── dns_internetbs.sh
│   ├── dns_inwx.sh
│   ├── dns_ionos.sh
│   ├── dns_ionos_cloud.sh
│   ├── dns_ipv64.sh
│   ├── dns_ispconfig.sh
│   ├── dns_jd.sh
│   ├── dns_joker.sh
│   ├── dns_kappernet.sh
│   ├── dns_kas.sh
│   ├── dns_kinghost.sh
│   ├── dns_knot.sh
│   ├── dns_la.sh
│   ├── dns_leaseweb.sh
│   ├── dns_lexicon.sh
│   ├── dns_limacity.sh
│   ├── dns_linode.sh
│   ├── dns_linode_v4.sh
│   ├── dns_loopia.sh
│   ├── dns_lua.sh
│   ├── dns_maradns.sh
│   ├── dns_me.sh
│   ├── dns_mgwm.sh
│   ├── dns_miab.sh
│   ├── dns_mijnhost.sh
│   ├── dns_misaka.sh
│   ├── dns_myapi.sh
│   ├── dns_mydevil.sh
│   ├── dns_mydnsjp.sh
│   ├── dns_mythic_beasts.sh
│   ├── dns_namecheap.sh
│   ├── dns_namecom.sh
│   ├── dns_namesilo.sh
│   ├── dns_nanelo.sh
│   ├── dns_nederhost.sh
│   ├── dns_neodigit.sh
│   ├── dns_netcup.sh
│   ├── dns_netlify.sh
│   ├── dns_nic.sh
│   ├── dns_njalla.sh
│   ├── dns_nm.sh
│   ├── dns_nsd.sh
│   ├── dns_nsone.sh
│   ├── dns_nsupdate.sh
│   ├── dns_nw.sh
│   ├── dns_oci.sh
│   ├── dns_omglol.sh
│   ├── dns_one.sh
│   ├── dns_online.sh
│   ├── dns_openprovider.sh
│   ├── dns_openprovider_rest.sh
│   ├── dns_openstack.sh
│   ├── dns_opnsense.sh
│   ├── dns_opusdns.sh
│   ├── dns_ovh.sh
│   ├── dns_pdns.sh
│   ├── dns_pleskxml.sh
│   ├── dns_pointhq.sh
│   ├── dns_porkbun.sh
│   ├── dns_qc.sh
│   ├── dns_rackcorp.sh
│   ├── dns_rackspace.sh
│   ├── dns_rage4.sh
│   ├── dns_rcode0.sh
│   ├── dns_regru.sh
│   ├── dns_scaleway.sh
│   ├── dns_schlundtech.sh
│   ├── dns_selectel.sh
│   ├── dns_selfhost.sh
│   ├── dns_servercow.sh
│   ├── dns_simply.sh
│   ├── dns_sotoon.sh
│   ├── dns_spaceship.sh
│   ├── dns_technitium.sh
│   ├── dns_tele3.sh
│   ├── dns_tencent.sh
│   ├── dns_timeweb.sh
│   ├── dns_transip.sh
│   ├── dns_udr.sh
│   ├── dns_ultra.sh
│   ├── dns_unoeuro.sh
│   ├── dns_variomedia.sh
│   ├── dns_veesp.sh
│   ├── dns_vercel.sh
│   ├── dns_virakcloud.sh
│   ├── dns_vscale.sh
│   ├── dns_vultr.sh
│   ├── dns_websupport.sh
│   ├── dns_west_cn.sh
│   ├── dns_world4you.sh
│   ├── dns_yandex360.sh
│   ├── dns_yc.sh
│   ├── dns_zilore.sh
│   ├── dns_zone.sh
│   ├── dns_zoneedit.sh
│   └── dns_zonomi.sh
└── notify/
    ├── aws_ses.sh
    ├── bark.sh
    ├── callmebotWhatsApp.sh
    ├── cqhttp.sh
    ├── dingtalk.sh
    ├── discord.sh
    ├── feishu.sh
    ├── gotify.sh
    ├── ifttt.sh
    ├── mail.sh
    ├── mailgun.sh
    ├── mattermost.sh
    ├── ntfy.sh
    ├── opsgenie.sh
    ├── pop.sh
    ├── postmark.sh
    ├── pushbullet.sh
    ├── pushover.sh
    ├── sendgrid.sh
    ├── slack.sh
    ├── slack_app.sh
    ├── smtp.sh
    ├── teams.sh
    ├── telegram.sh
    ├── weixin_work.sh
    └── xmpp.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: acmesh
ko_fi: neilpang
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
<!--
我很忙, 每天可能只有 几秒钟 时间看你的 issue, 如果不按照我的要求写 issue, 你可能不会得到任何回复, 石沉大海.

请确保已经更新到最新的代码, 然后贴上来 `--debug 2` 的调试输出. 没有调试信息. 我做不了什么.
如何调试 https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh

If it is a bug report:
- make sure you are able to repro it on the latest released version.
You can install the latest version by: `acme.sh --upgrade`

- Search the existing issues.
- Refer to the [WIKI](https://wiki.acme.sh).
- Debug info [Debug](https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh).

-->

Steps to reproduce
------------------

Debug log
-----------------

```
acme.sh  --issue .....   --debug 2
```




================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
<!--
1. Do NOT send pull request to `master` branch.
Please send to `dev` branch instead.
Any PR to `master` branch will NOT be merged.

2. For dns api support, read this guide first: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-Guide
You will NOT get any review without passing this guide.  You also need to fix the CI errors.

-->

================================================
FILE: .github/copilot-instructions.md
================================================
# GitHub Copilot Shell Scripting (sh) Review Instructions

## 🎯 Overall Goal

Your role is to act as a rigorous yet helpful senior engineer, reviewing Shell script code (`.sh` files). Ensure the code exhibits the highest levels of robustness, security, and portability.
The review must focus on risks unique to Shell scripting, such as proper quoting, robust error handling, and the secure execution of external commands.

## 📝 Required Output Format

Please adhere to the previous format: organize the feedback into a single, structured report, using the three-level marking system:

1.  **🔴 Critical Issues (Must Fix Before Merge)**
2.  **🟡 Suggestions (Improvements to Consider)**
3.  **✅ Good Practices (Points to Commend)**

---

## 🔍 Focus Areas and Rules for Shell

### 1. Robustness and Error Handling

* **Shebang:** Check that the script starts with the correct Shebang, must be "#!/usr/bin/env sh".
* **Startup Options:** **(🔴 Critical)** Enforce the use of the following combination at the start of the script for safety and robustness:
    * `set -e`: Exit immediately if a command exits with a non-zero status.
    * `set -u`: Treat unset variables as an error and exit.
    * `set -o pipefail`: Ensure the whole pipeline fails if any command in the pipe fails.
* **Exit Codes:** Ensure functions and the main script use `exit 0` for success and a non-zero exit code upon failure.
* **Temporary Files:** Check for the use of `mktemp` when creating temporary files to prevent race conditions and security risks.

### 2. Security and Quoting

* **Variable Quoting:** **(🔴 Critical)** Check that all variable expansions (like `$VAR` and `$(COMMAND)`) are properly enclosed in **double quotes** (i.e., `"$VAR"` and `"$(COMMAND)"`) to prevent **Word Splitting** and **Globbing**.
* **Hardcoded Secrets:** **(🔴 Critical)** Find and flag any hardcoded passwords, keys, tokens, or authentication details.
* **Untrusted Input:** Verify that all user input, command-line arguments (`$1`, `$2`, etc.), or environment variables are rigorously validated and sanitized before use.
* **Avoid `eval`:** Warn against and suggest alternatives to using `eval`, as it can lead to arbitrary code execution.

### 3. Readability and Maintainability

* **Function Usage:** Recommend wrapping complex or reusable logic within clearly named functions.
* **Local Variables:** Check that variables inside functions are declared using the `local` keyword to avoid unintentionally modifying global state.
* **Naming Convention:** Variable names should use uppercase letters and underscores (e.g., `MY_VARIABLE`), or follow established project conventions.
* **Test Conditions:** Encourage the use of Bash's **double brackets `[[ ... ]]`** for conditional tests, as it is generally safer and more powerful (e.g., supports pattern matching and avoids Word Splitting) than single brackets `[ ... ]`.
* **Command Substitution:** Encourage using `$(command)` over backticks `` `command` `` for command substitution, as it is easier to nest and improves readability.

### 4. External Commands and Environment

* **`for` Loops:** Warn against patterns like `for i in $(cat file)` or `for i in $(ls)` and recommend the more robust `while IFS= read -r line` pattern for safely processing file contents or filenames that might contain spaces.
* **Use existing acme.sh functions whenever possible.** For example: do not use `tr '[:upper:]' '[:lower:]'`, use `_lower_case` instead.
* **Do not use `head -n`.** Use the `_head_n()` function instead.
* **Do not use `curl` or `wget`.** Use the `_post()` and `_get()` functions instead.

---

### 5. Review Rules for Files Under `dnsapi/`:

* **Each file must contain a `{filename}_add` function** for adding DNS TXT records. It should use `_readaccountconf_mutable` to read the API key and `_saveaccountconf_mutable` to save it. Do not use `_saveaccountconf` or `_readaccountconf`.


## ❌ Things to Avoid

* Do not comment on purely stylistic issues like spacing or indentation, which should be handled by tools like ShellCheck or Prettier.
* Do not be overly verbose unless a significant issue is found. Keep feedback concise and actionable.







================================================
FILE: .github/workflows/DNS.yml
================================================
name: DNS
on:
  workflow_dispatch:
  push:
    paths:
      - 'dnsapi/*.sh'
      - '.github/workflows/DNS.yml'
  pull_request:
    branches:
      - 'dev'
    paths:
      - 'dnsapi/*.sh'
      - '.github/workflows/DNS.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  CheckToken:
    runs-on: ubuntu-latest
    outputs:
      hasToken: ${{ steps.step_one.outputs.hasToken }}
    steps:
      - name: Set the value
        id: step_one
        run: |
          if [ "${{secrets.TokenName1}}" ] ; then
            echo "::set-output name=hasToken::true"
          else
            echo "::set-output name=hasToken::false"
          fi
      - name: Check the value
        run: echo ${{ steps.step_one.outputs.hasToken }}

  Fail:
    runs-on: ubuntu-latest
    needs: CheckToken
    if: "contains(needs.CheckToken.outputs.hasToken, 'false')"
    steps:
    - name: "Read this:   https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Test"
      run: |
        echo "Read this:   https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Test"
        if [ "${{github.repository_owner}}" != "acmesh-official" ]; then
          false
        fi

  Docker:
    runs-on: ubuntu-latest
    needs: CheckToken
    if: "contains(needs.CheckToken.outputs.hasToken, 'true')"
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - name: Set env file
      run: |
        cd ../acmetest
        if [ "${{ secrets.TokenName1}}" ] ; then
          echo "${{ secrets.TokenName1}}=${{ secrets.TokenValue1}}" >> docker.env
        fi
        if [ "${{ secrets.TokenName2}}" ] ; then
          echo "${{ secrets.TokenName2}}=${{ secrets.TokenValue2}}" >> docker.env
        fi
        if [ "${{ secrets.TokenName3}}" ] ; then
          echo "${{ secrets.TokenName3}}=${{ secrets.TokenValue3}}" >> docker.env
        fi
        if [ "${{ secrets.TokenName4}}" ] ; then
          echo "${{ secrets.TokenName4}}=${{ secrets.TokenValue4}}" >> docker.env
        fi
        if [ "${{ secrets.TokenName5}}" ] ; then
          echo "${{ secrets.TokenName5}}=${{ secrets.TokenValue5}}" >> docker.env
        fi

    - name: Run acmetest
      run: cd ../acmetest && ./rundocker.sh  testall




  MacOS:
    runs-on: macos-latest
    needs: Docker
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Install tools
      run:  brew install socat
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - name: Run acmetest
      run: |
        if [ "${{ secrets.TokenName1}}" ] ; then
          export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
        fi
        if [ "${{ secrets.TokenName2}}" ] ; then
          export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
        fi
        if [ "${{ secrets.TokenName3}}" ] ; then
          export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
        fi
        if [ "${{ secrets.TokenName4}}" ] ; then
          export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
        fi
        if [ "${{ secrets.TokenName5}}" ] ; then
          export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
        fi
        cd ../acmetest
        ./letest.sh




  Windows:
    runs-on: windows-latest
    needs: MacOS
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - name: Set git to use LF
      run: |
          git config --global core.autocrlf false
    - uses: actions/checkout@v6
    - name: Install cygwin base packages with chocolatey
      run: |
          choco config get cacheLocation
          choco install --no-progress cygwin
      shell: cmd
    - name: Install cygwin additional packages
      run: |
          C:\tools\cygwin\cygwinsetup.exe -qgnNdO -R C:/tools/cygwin -s https://mirrors.kernel.org/sourceware/cygwin/ -P socat,curl,cron,unzip,git
      shell: cmd
    - name: Set ENV
      shell: cmd
      run: |
          echo PATH=C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin >> %GITHUB_ENV%
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - name: Run acmetest
      shell: bash
      run: |
        if [ "${{ secrets.TokenName1}}" ] ; then
          export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
        fi
        if [ "${{ secrets.TokenName2}}" ] ; then
          export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
        fi
        if [ "${{ secrets.TokenName3}}" ] ; then
          export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
        fi
        if [ "${{ secrets.TokenName4}}" ] ; then
          export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
        fi
        if [ "${{ secrets.TokenName5}}" ] ; then
          export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
        fi
        cd ../acmetest
        ./letest.sh



  FreeBSD:
    runs-on: ubuntu-latest
    needs: Windows
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/freebsd-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        prepare: pkg install -y socat curl
        usesh: true
        sync: nfs
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



  OpenBSD:
    runs-on: ubuntu-latest
    needs: FreeBSD
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/openbsd-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        prepare: pkg_add socat curl libiconv
        usesh: true
        sync: nfs
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



  NetBSD:
    runs-on: ubuntu-latest
    needs: OpenBSD
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/netbsd-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        prepare: |
          /usr/sbin/pkg_add curl socat
        usesh: true
        sync: nfs
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



  DragonFlyBSD:
    runs-on: ubuntu-latest
    needs: NetBSD
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/dragonflybsd-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        prepare: |
          pkg install -y libnghttp2
          pkg install -y curl socat
        usesh: true
        sync: nfs
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"






  Solaris:
    runs-on: ubuntu-latest
    needs: DragonFlyBSD
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      HTTPS_INSECURE: 1 # always set to 1 to ignore https error, since Solaris doesn't accept the expired ISRG X1 root
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/solaris-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy HTTPS_INSECURE TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        sync: nfs
        prepare: |
          pkgutil -U
          pkgutil -y -i socat
        run: |
          pkg set-mediator -v -I default@1.1 openssl
          export PATH=/usr/gnu/bin:$PATH
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"


  Omnios:
    runs-on: ubuntu-latest
    needs: Solaris
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      HTTPS_INSECURE: 1 # always set to 1 to ignore https error, since Omnios doesn't accept the expired ISRG X1 root
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/omnios-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy HTTPS_INSECURE TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        sync: nfs
        prepare: pkg install socat
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



  OpenIndiana:
    runs-on: ubuntu-latest
    needs: Omnios
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      HTTPS_INSECURE: 1 # always set to 1 to ignore https error, since OpenIndiana doesn't accept the expired ISRG X1 root
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/openindiana-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy HTTPS_INSECURE TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        sync: nfs
        prepare: pkg install socat
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"


        
  Haiku:
    runs-on: ubuntu-latest
    needs: OpenIndiana
    env:
      TEST_DNS : ${{ secrets.TEST_DNS }}
      TestingDomain: ${{ secrets.TestingDomain }}
      TEST_DNS_NO_WILDCARD: ${{ secrets.TEST_DNS_NO_WILDCARD }}
      TEST_DNS_NO_SUBDOMAIN: ${{ secrets.TEST_DNS_NO_SUBDOMAIN }}
      TEST_DNS_SLEEP: ${{ secrets.TEST_DNS_SLEEP }}
      CASE: le_test_dnsapi
      TEST_LOCAL: 1
      DEBUG: ${{ secrets.DEBUG }}
      http_proxy: ${{ secrets.http_proxy }}
      https_proxy: ${{ secrets.https_proxy }}
      HTTPS_INSECURE: 1 # always set to 1 to ignore https error, since OpenIndiana doesn't accept the expired ISRG X1 root
      TokenName1: ${{ secrets.TokenName1}}
      TokenName2: ${{ secrets.TokenName2}}
      TokenName3: ${{ secrets.TokenName3}}
      TokenName4: ${{ secrets.TokenName4}}
      TokenName5: ${{ secrets.TokenName5}}
    steps:
    - uses: actions/checkout@v6
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/haiku-vm@v1
      with:
        envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy HTTPS_INSECURE TokenName1 TokenName2 TokenName3 TokenName4 TokenName5 ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
        sync: rsync
        copyback: false
        prepare: |
          mkdir -p /boot/home/.cache
          pkgman install -y cronie
          
        run: |
          if [ "${{ secrets.TokenName1}}" ] ; then
            export ${{ secrets.TokenName1}}="${{ secrets.TokenValue1}}"
          fi
          if [ "${{ secrets.TokenName2}}" ] ; then
            export ${{ secrets.TokenName2}}="${{ secrets.TokenValue2}}"
          fi
          if [ "${{ secrets.TokenName3}}" ] ; then
            export ${{ secrets.TokenName3}}="${{ secrets.TokenValue3}}"
          fi
          if [ "${{ secrets.TokenName4}}" ] ; then
            export ${{ secrets.TokenName4}}="${{ secrets.TokenValue4}}"
          fi
          if [ "${{ secrets.TokenName5}}" ] ; then
            export ${{ secrets.TokenName5}}="${{ secrets.TokenValue5}}"
          fi
          cd ../acmetest
          ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"





================================================
FILE: .github/workflows/DragonFlyBSD.yml
================================================
name: DragonFlyBSD
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/DragonFlyBSD.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/DragonFlyBSD.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  DragonFlyBSD:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/dragonflybsd-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: |
          pkg install -y libnghttp2
          pkg install -y curl socat
        usesh: true
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/FreeBSD.yml
================================================
name: FreeBSD
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/FreeBSD.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/FreeBSD.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  FreeBSD:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/freebsd-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: pkg install -y socat curl wget
        usesh: true
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/Haiku.yml
================================================
name: Haiku
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/Haiku.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/Haiku.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  Haiku:
    strategy:
      fail-fast: false
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/haiku-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: |
          mkdir -p /boot/home/.cache
          pkgman install -y cronie
        sync: rsync
        copyback: false
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/Linux.yml
================================================
name: Linux
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/Linux.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/Linux.yml'


concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true




jobs:
  Linux:
    strategy:
      matrix:
        os: ["ubuntu:latest", "debian:latest", "almalinux:latest", "fedora:latest", "opensuse/leap:latest", "alpine:latest", "oraclelinux:8", "kalilinux/kali", "archlinux:latest", "gentoo/stage3"]
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_PREFERRED_CHAIN: (STAGING)
      TEST_ACME_Server: "LetsEncrypt.org_test"
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 80
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: |
          cd .. \
          && git clone --depth=1 https://github.com/acmesh-official/acmetest.git \
          && cp -r acme.sh acmetest/
    - name: Run acmetest
      run: |
          cd ../acmetest \
          && ./rundocker.sh  testplat ${{ matrix.os }}





================================================
FILE: .github/workflows/MacOS.yml
================================================
name: MacOS
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/MacOS.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/MacOS.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  MacOS:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: macos-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
    steps:
    - uses: actions/checkout@v6
    - name: Install tools
      run:  brew install socat
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 80
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: |
          cd .. \
          && git clone --depth=1 https://github.com/acmesh-official/acmetest.git \
          && cp -r acme.sh acmetest/
    - name: Run acmetest
      run: |
          cd ../acmetest \
          && sudo --preserve-env ./letest.sh




================================================
FILE: .github/workflows/NetBSD.yml
================================================
name: NetBSD
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/NetBSD.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/NetBSD.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  NetBSD:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/netbsd-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: |
          /usr/sbin/pkg_add curl socat
        usesh: true
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"
        


================================================
FILE: .github/workflows/Omnios.yml
================================================
name: Omnios
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/Omnios.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/Omnios.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  Omnios:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/omnios-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: pkg install socat wget
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/OpenBSD.yml
================================================
name: OpenBSD
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/OpenBSD.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/OpenBSD.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  OpenBSD:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/openbsd-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: pkg_add socat curl wget libnghttp2
        usesh: true
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/OpenIndiana.yml
================================================
name: OpenIndiana
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/OpenIndiana.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/OpenIndiana.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  OpenIndiana:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/openindiana-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: pkg install socat curl
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/PebbleStrict.yml
================================================
name: PebbleStrict
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/PebbleStrict.yml'
  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/PebbleStrict.yml'


concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  PebbleStrict:
    runs-on: ubuntu-latest
    env:
      TestingDomain: example.com
      TestingAltDomains: www.example.com
      TEST_ACME_Server: https://localhost:14000/dir
      HTTPS_INSECURE: 1
      Le_HTTPPort: 5002
      TEST_LOCAL: 1
      TEST_CA: "Pebble Intermediate CA"

    steps:
    - uses: actions/checkout@v6
    - name: Install tools
      run: sudo apt-get install -y socat
    - name: Run Pebble
      run: cd .. && curl https://raw.githubusercontent.com/letsencrypt/pebble/master/docker-compose.yml >docker-compose.yml && docker compose up -d
    - name: Set up Pebble
      run: curl --request POST --data '{"ip":"10.30.50.1"}' http://localhost:8055/set-default-ipv4
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - name: Run acmetest
      run: cd ../acmetest && ./letest.sh

  PebbleStrict_IPCert:
    runs-on: ubuntu-latest
    env:
      TestingDomain: 1.23.45.67
      TEST_ACME_Server: https://localhost:14000/dir
      HTTPS_INSECURE: 1
      Le_HTTPPort: 5002
      Le_TLSPort: 5001
      TEST_LOCAL: 1
      TEST_CA: "Pebble Intermediate CA"
      TEST_IPCERT: 1

    steps:
    - uses: actions/checkout@v6
    - name: Install tools
      run: sudo apt-get install -y socat
    - name: Run Pebble
      run: |
        docker run --rm -itd --name=pebble \
        -e PEBBLE_VA_ALWAYS_VALID=1 \
        -p 14000:14000 -p 15000:15000   ghcr.io/letsencrypt/pebble:latest -config /test/config/pebble-config.json -strict
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - name: Run acmetest
      run: cd ../acmetest && ./letest.sh

================================================
FILE: .github/workflows/Solaris.yml
================================================
name: Solaris
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/Solaris.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/Solaris.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  Solaris:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 8080
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - uses: vmactions/solaris-vm@v1
      with:
        envs: 'TEST_LOCAL TestingDomain TEST_ACME_Server CA_ECDSA CA CA_EMAIL TEST_PREFERRED_CHAIN ACME_USE_WGET'
        nat: |
          "8080": "80"
        prepare: |
          pkgutil -U
          pkgutil -y -i socat curl wget
        sync: nfs
        run: |
          cd ../acmetest \
          && ./letest.sh
    - name: DebugOnError
      if: ${{ failure() }}
      run: |
        echo "See how to debug in VM:"
        echo "https://github.com/acmesh-official/acme.sh/wiki/debug-in-VM"



================================================
FILE: .github/workflows/Ubuntu.yml
================================================
name: Ubuntu
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/Ubuntu.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/Ubuntu.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true



jobs:
  Ubuntu:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
           ACME_USE_WGET: 1
         - TEST_ACME_Server: "ZeroSSL.com"
           CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
           CA: "ZeroSSL RSA Domain Secure Site CA"
           CA_EMAIL: "githubtest@acme.sh"
           TEST_PREFERRED_CHAIN: ""
         - TEST_ACME_Server: "https://localhost:9000/acme/acme/directory"
           CA_ECDSA: "Smallstep Intermediate CA"
           CA: "Smallstep Intermediate CA"
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: ""
           NO_REVOKE: 1
         - TEST_ACME_Server: "https://localhost:9000/acme/acme/directory"
           CA_ECDSA: "Smallstep Intermediate CA"
           CA: "Smallstep Intermediate CA"
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: ""
           NO_REVOKE: 1
           TEST_IPCERT: 1
           TestingDomain: "172.17.0.1"

    runs-on: ubuntu-latest
    env:
      TEST_LOCAL: 1
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      NO_ECC_384: ${{ matrix.NO_ECC_384 }}
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
      NO_REVOKE: ${{ matrix.NO_REVOKE }}
      TEST_IPCERT: ${{ matrix.TEST_IPCERT }}
      TestingDomain: ${{ matrix.TestingDomain }}
      ACME_USE_WGET: ${{ matrix.ACME_USE_WGET }}
    steps:
    - uses: actions/checkout@v6
    - name: Install tools
      run: sudo apt-get install -y socat wget
    - name: Start StepCA
      if: ${{ matrix.TEST_ACME_Server=='https://localhost:9000/acme/acme/directory' }}
      run: |
           docker run --rm -d \
            -p 9000:9000 \
            -e "DOCKER_STEPCA_INIT_NAME=Smallstep" \
            -e "DOCKER_STEPCA_INIT_DNS_NAMES=localhost,$(hostname -f)" \
            -e "DOCKER_STEPCA_INIT_REMOTE_MANAGEMENT=true" \
            -e "DOCKER_STEPCA_INIT_PASSWORD=test" \
            --name stepca \
            smallstep/step-ca:0.23.1

            sleep 5
            docker exec  stepca bash -c "echo test >test" \
            && docker exec stepca step ca provisioner add acme --type ACME --admin-subject  step --admin-password-file=/home/step/test \
            && docker exec  stepca kill -1 1 \
            && docker exec  stepca cat /home/step/certs/root_ca.crt | sudo bash -c "cat - >>/etc/ssl/certs/ca-certificates.crt"
    - name: Clone acmetest
      run: |
          cd .. \
          && git clone --depth=1 https://github.com/acmesh-official/acmetest.git \
          && cp -r acme.sh acmetest/
    - name: Run acmetest
      run: |
          cd ../acmetest \
          && sudo --preserve-env ./letest.sh




================================================
FILE: .github/workflows/Windows.yml
================================================
name: Windows
on:
  push:
    branches:
      - '*'
    paths:
      - '*.sh'
      - '.github/workflows/Windows.yml'

  pull_request:
    branches:
      - dev
    paths:
      - '*.sh'
      - '.github/workflows/Windows.yml'


concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true


jobs:
  Windows:
    strategy:
      matrix:
        include:
         - TEST_ACME_Server: "LetsEncrypt.org_test"
           CA_ECDSA: ""
           CA: ""
           CA_EMAIL: ""
           TEST_PREFERRED_CHAIN: (STAGING)
         #- TEST_ACME_Server: "ZeroSSL.com"
         #  CA_ECDSA: "ZeroSSL ECC Domain Secure Site CA"
         #  CA: "ZeroSSL RSA Domain Secure Site CA"
         #  CA_EMAIL: "githubtest@acme.sh"
         #  TEST_PREFERRED_CHAIN: ""
    runs-on: windows-latest
    env:
      TEST_ACME_Server: ${{ matrix.TEST_ACME_Server }}
      CA_ECDSA: ${{ matrix.CA_ECDSA }}
      CA: ${{ matrix.CA }}
      CA_EMAIL: ${{ matrix.CA_EMAIL }}
      TEST_LOCAL: 1
      #The 80 port is used by Windows server, we have to use a custom port, tunnel will also use this port.
      Le_HTTPPort: 8888
      TEST_PREFERRED_CHAIN: ${{ matrix.TEST_PREFERRED_CHAIN }}
    steps:
    - name: Set git to use LF
      run: |
          git config --global core.autocrlf false
    - uses: actions/checkout@v6
    - name: Install cygwin base packages with chocolatey
      run: |
          choco config get cacheLocation
          choco install --no-progress cygwin
      shell: cmd
    - name: Install cygwin additional packages
      run: |
          C:\tools\cygwin\cygwinsetup.exe -qgnNdO -R C:/tools/cygwin -s https://mirrors.kernel.org/sourceware/cygwin/ -P socat,curl,cron,unzip,git,xxd
      shell: cmd
    - name: Set ENV
      shell: cmd
      run: |
          echo PATH=C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin;%PATH% >> %GITHUB_ENV%
    - name: Check ENV
      shell: cmd
      run: |
          echo "PATH=%PATH%"
    - uses: anyvm-org/cf-tunnel@v0
      id: tunnel
      with:
        protocol: http
        port: 80
    - name: Set envs
      run: echo "TestingDomain=${{steps.tunnel.outputs.server}}" >> $GITHUB_ENV
    - name: Clone acmetest
      shell: cmd
      run: cd .. && git clone --depth=1 https://github.com/acmesh-official/acmetest.git  && cp -r acme.sh acmetest/
    - name: Run acmetest
      shell: cmd
      run: cd ../acmetest && bash.exe -c ./letest.sh





================================================
FILE: .github/workflows/dockerhub.yml
================================================

name: Build DockerHub
on:
  push:
    branches:
      - '*'
    tags:
      - '*'
    paths:
      - '**.sh'
      - "Dockerfile"
      - '.github/workflows/dockerhub.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  DOCKER_IMAGE: neilpang/acme.sh

jobs:
  CheckToken:
    runs-on: ubuntu-latest
    outputs:
      hasToken: ${{ steps.step_one.outputs.hasToken }}
    env: 
      DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
    steps:
      - name: Set the value
        id: step_one
        run: |
          if [ "$DOCKER_PASSWORD" ] ; then
            echo "hasToken=true" >>$GITHUB_OUTPUT
          else
            echo "hasToken=false" >>$GITHUB_OUTPUT
          fi
      - name: Check the value
        run: echo ${{ steps.step_one.outputs.hasToken }}
        
  build:
    runs-on: ubuntu-latest
    needs: CheckToken
    if: "contains(needs.CheckToken.outputs.hasToken, 'true')"
    steps:
      - name: checkout code
        uses: actions/checkout@v6
        with:
          persist-credentials: false
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Extract Docker metadata
        id: meta
        uses: docker/metadata-action@v6
        with:
          images: ${DOCKER_IMAGE}
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: login to docker hub
        run: |
          echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
      - name: build and push the image
        run: |
          if [[ $GITHUB_REF == refs/tags/* ]]; then
            DOCKER_IMAGE_TAG=${GITHUB_REF#refs/tags/}
          fi

          if [[ $GITHUB_REF == refs/heads/* ]]; then
            DOCKER_IMAGE_TAG=${GITHUB_REF#refs/heads/}

            if [[ $DOCKER_IMAGE_TAG == master ]]; then
              DOCKER_IMAGE_TAG=latest
              AUTO_UPGRADE=1
            fi
          fi

          DOCKER_LABELS=()
          while read -r label; do
            DOCKER_LABELS+=(--label "${label}")
          done <<<"${DOCKER_METADATA_OUTPUT_LABELS}"

          docker buildx build \
            --tag ${DOCKER_IMAGE}:${DOCKER_IMAGE_TAG} \
            "${DOCKER_LABELS[@]}" \
            --output "type=image,push=true" \
            --build-arg AUTO_UPGRADE=${AUTO_UPGRADE} \
            --platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386,linux/ppc64le,linux/s390x .


================================================
FILE: .github/workflows/issue.yml
================================================
name: "Update issues"
on:
  issues:
    types: [opened]

jobs:
  comment:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/github-script@v6
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: "Please upgrade to the latest code and try again first. Maybe it's already fixed.              ```acme.sh --upgrade```              If it's still not working, please provide the log with `--debug 2`, otherwise, nobody can help you."
              
            })

================================================
FILE: .github/workflows/pr_dns.yml
================================================
name: Check dns api

on:
  pull_request_target:
    types:
      - opened
    paths:
      - 'dnsapi/*.sh'


jobs:
  welcome:
    runs-on: ubuntu-latest
    if: github.actor != 'neilpang'
    steps:
      - uses: actions/github-script@v6
        with:
          script: |
            await github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `**Welcome**
                    READ ME !!!!!
                    Read me !!!!!!
                    First thing: don't send PR to the master branch, please send to the dev branch instead.
                    Please read the [DNS API Dev Guide](../wiki/DNS-API-Dev-Guide).
                    You MUST pass the [DNS-API-Test](../wiki/DNS-API-Test).
                    Then reply on this message, otherwise, your code will not be reviewed or merged.
                    Please also make sure to add/update the usage here: https://github.com/acmesh-official/acme.sh/wiki/dnsapi2
                    注意: 必须通过了 [DNS-API-Test](../wiki/DNS-API-Test) 才会被 review. 无论是修改, 还是新加的 dns api, 都必须确保通过这个测试.
                `
            })



================================================
FILE: .github/workflows/pr_notify.yml
================================================
name: Check notify api

on:
  pull_request_target:
    types:
      - opened
    branches:
      - 'dev'
    paths:
      - 'notify/*.sh'


jobs:
  welcome:
    runs-on: ubuntu-latest
    if: github.actor != 'neilpang'
    steps:
      - uses: actions/github-script@v6
        with:
          script: |
            await github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `**Welcome**
                Please make sure you've read our [Code-of-conduct](../wiki/Code-of-conduct) and  add the usage here: [notify](../wiki/notify).
                Then reply on this message, otherwise, your code will not be reviewed or merged.
                We look forward to reviewing your Pull request shortly ✨
                `
            })



================================================
FILE: .github/workflows/shellcheck.yml
================================================
name: Shellcheck
on:
  push:
    branches:
      - '*'
    paths:
      - '**.sh'
      - '.github/workflows/shellcheck.yml'
  pull_request:
    branches:
      - dev
    paths:
      - '**.sh'
      - '.github/workflows/shellcheck.yml'

concurrency: 
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true


jobs:
  ShellCheck:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - name: Install Shellcheck
      run: sudo apt-get install -y shellcheck
    - name: DoShellcheck
      run: shellcheck -V  && shellcheck -e SC2181 -e SC2089 **/*.sh && echo "shellcheck OK"

  shfmt:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    - name: Install shfmt
      run: curl -sSL https://github.com/mvdan/sh/releases/download/v3.1.2/shfmt_v3.1.2_linux_amd64 -o ~/shfmt && chmod +x ~/shfmt
    - name: shfmt
      run: ~/shfmt -l -w -i 2 . ; git diff --exit-code && echo "shfmt OK"


================================================
FILE: .github/workflows/wiki-monitor.yml
================================================
name: Notify via Issue on Wiki Edit

on:
  gollum:

jobs:
  notify:
    runs-on: ubuntu-latest
    if: github.actor != 'neilpang'
    steps:
      - name: Checkout wiki repository
        uses: actions/checkout@v6
        with:
          repository: ${{ github.repository }}.wiki
          path: wiki
          fetch-depth: 0

      - name: Generate wiki change message
        run: |
            actor="${{ github.actor }}"
            sender_url=$(jq -r '.sender.html_url' "$GITHUB_EVENT_PATH")
            page_name=$(jq -r '.pages[0].page_name' "$GITHUB_EVENT_PATH")
            page_sha=$(jq -r '.pages[0].sha' "$GITHUB_EVENT_PATH")
            page_url=$(jq -r '.pages[0].html_url' "$GITHUB_EVENT_PATH")
            page_action=$(jq -r '.pages[0].action' "$GITHUB_EVENT_PATH")
            page_summary=$(jq -r '.pages[0].summary' "$GITHUB_EVENT_PATH")
            now="$(date '+%Y-%m-%d %H:%M:%S')"

            cd wiki
            prev_sha=$(git rev-list $page_sha^ -- "$page_name.md" | head -n 1)
            if [ -n "$prev_sha" ]; then
                git diff $prev_sha $page_sha -- "$page_name.md" > ../wiki.diff || echo "(No diff found)" > ../wiki.diff
            else
                echo "(no diff)" > ../wiki.diff
            fi
            cd ..
            {
            echo "Wiki edited"
            echo -n "User: "
            echo "@$actor [$actor]($sender_url)"
            echo "Time: $now"
            echo "Page: [$page_name]($page_url) (Action: $page_action)"
            echo "Comment: $page_summary"
            echo "[Click here to Revert](${page_url}/_history)"
            echo ""
            echo "----"
            echo "###  diff:"
            echo '```diff'
            cat wiki.diff
            echo '```'
            } > wiki-change-msg.txt

      - name: Create issue to notify Neilpang
        uses: peter-evans/create-issue-from-file@v5
        with:
          title: "Wiki edited"
          content-filepath: ./wiki-change-msg.txt
          assignees: Neilpang
        env:
          TZ: Asia/Shanghai








================================================
FILE: Dockerfile
================================================
FROM alpine:3.22

RUN apk --no-cache add -f \
  openssl \
  openssh-client \
  coreutils \
  bind-tools \
  curl \
  sed \
  socat \
  tzdata \
  oath-toolkit-oathtool \
  tar \
  libidn \
  jq \
  yq-go \
  supercronic

ENV LE_WORKING_DIR=/acmebin

ENV LE_CONFIG_HOME=/acme.sh

ENV HOME=/acme.sh

ARG AUTO_UPGRADE=1

ENV AUTO_UPGRADE=$AUTO_UPGRADE

#Install
COPY ./acme.sh /install_acme.sh/acme.sh
COPY ./deploy /install_acme.sh/deploy
COPY ./dnsapi /install_acme.sh/dnsapi
COPY ./notify /install_acme.sh/notify

RUN addgroup -g 1000 acme && adduser -h $LE_CONFIG_HOME -s /bin/sh -G acme -D -H -u 1000 acme

RUN cd /install_acme.sh && ([ -f /install_acme.sh/acme.sh ] && /install_acme.sh/acme.sh --install || curl https://get.acme.sh | sh) && rm -rf /install_acme.sh/

RUN ln -s $LE_WORKING_DIR/acme.sh /usr/local/bin/acme.sh

RUN chown -R acme:acme $LE_CONFIG_HOME

RUN for verb in help \
  version \
  install \
  uninstall \
  upgrade \
  issue \
  signcsr \
  deploy \
  install-cert \
  renew \
  renew-all \
  revoke \
  remove \
  list \
  info \
  showcsr \
  install-cronjob \
  uninstall-cronjob \
  cron \
  toPkcs \
  toPkcs8 \
  update-account \
  register-account \
  create-account-key \
  create-domain-key \
  createCSR \
  deactivate \
  deactivate-account \
  set-notify \
  set-default-ca \
  set-default-chain \
  ; do \
    printf -- "%b" "#!/usr/bin/env sh\n$LE_WORKING_DIR/acme.sh --${verb} --config-home $LE_CONFIG_HOME \"\$@\"" >/usr/local/bin/--${verb} && chmod +x /usr/local/bin/--${verb} \
  ; done

RUN printf "%b" '#!'"/usr/bin/env sh\n \
if [ \"\$1\" = \"daemon\" ];  then \n \
  if [ ! -f \"\$LE_CONFIG_HOME/crontab\" ]; then \n \
     echo \"\$LE_CONFIG_HOME/crontab not found, generating one\" \n \
     time=\$(date -u \"+%s\") \n \
     random_minute=\$((\$time % 60)) \n \
     random_hour=\$((\$time / 60 % 24)) \n \
     echo \"\$random_minute \$random_hour * * * \\\"\$LE_WORKING_DIR\\\"/acme.sh --cron --home \\\"\$LE_WORKING_DIR\\\" --config-home \\\"\$LE_CONFIG_HOME\\\"\" > \"\$LE_CONFIG_HOME\"/crontab \n \
  fi \n \
  echo \"Running Supercronic using crontab at \$LE_CONFIG_HOME/crontab\" \n \
  exec -- /usr/bin/supercronic \"\$LE_CONFIG_HOME/crontab\" \n \
else \n \
 exec -- \"\$@\"\n \
fi\n" >/entry.sh && chmod +x /entry.sh && chmod -R o+rwx $LE_WORKING_DIR && chmod -R o+rwx $LE_CONFIG_HOME

VOLUME /acme.sh

ENTRYPOINT ["/entry.sh"]
CMD ["--help"]


================================================
FILE: LICENSE.md
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.


================================================
FILE: README.md
================================================
<p align="center">
  <a href="https://zerossl.com/?fromacme.sh">
    <img src="https://github.com/user-attachments/assets/7531085e-399b-4ac2-82a2-90d14a0b7f05" alt="zerossl.com">
  </a>
</p>

<h1 align="center">🔐 acme.sh</h1>
<h3 align="center">An ACME Protocol Client Written Purely in Shell</h3>

<p align="center">
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/FreeBSD.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/FreeBSD.yml/badge.svg" alt="FreeBSD"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/OpenBSD.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/OpenBSD.yml/badge.svg" alt="OpenBSD"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/NetBSD.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/NetBSD.yml/badge.svg" alt="NetBSD"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/MacOS.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/MacOS.yml/badge.svg" alt="MacOS"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/Ubuntu.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/Ubuntu.yml/badge.svg" alt="Ubuntu"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/Windows.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/Windows.yml/badge.svg" alt="Windows"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/Solaris.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/Solaris.yml/badge.svg" alt="Solaris"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/DragonFlyBSD.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/DragonFlyBSD.yml/badge.svg" alt="DragonFlyBSD"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/Omnios.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/Omnios.yml/badge.svg" alt="Omnios"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/OpenIndiana.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/OpenIndiana.yml/badge.svg" alt="OpenIndiana"></a>
  <a href="https://github.com/acmesh-official/acme.sh/actions/workflows/Haiku.yml"><img src="https://github.com/acmesh-official/acme.sh/actions/workflows/Haiku.yml/badge.svg" alt="Haiku"></a>
</p>

<p align="center">
  <img src="https://github.com/acmesh-official/acme.sh/workflows/Shellcheck/badge.svg" alt="Shellcheck">
  <img src="https://github.com/acmesh-official/acme.sh/workflows/PebbleStrict/badge.svg" alt="PebbleStrict">
  <img src="https://github.com/acmesh-official/acme.sh/workflows/Build%20DockerHub/badge.svg" alt="DockerHub">
</p>

<p align="center">
  <a href="https://opencollective.com/acmesh"><img src="https://opencollective.com/acmesh/all/badge.svg?label=financial+contributors" alt="Financial Contributors on Open Collective"></a>
  <a href="https://gitter.im/acme-sh/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/acme-sh/Lobby.svg" alt="Join the chat at Gitter"></a>
  <a href="https://hub.docker.com/r/neilpang/acme.sh" title="Click to view the image on Docker Hub"><img src="https://img.shields.io/docker/stars/neilpang/acme.sh.svg" alt="Docker stars"></a>
  <a href="https://hub.docker.com/r/neilpang/acme.sh" title="Click to view the image on Docker Hub"><img src="https://img.shields.io/docker/pulls/neilpang/acme.sh.svg" alt="Docker pulls"></a>
</p>


---

## ✨ Features

- 🐚 An ACME protocol client written **purely in Shell** (Unix shell) language
- 📜 Full ACME protocol implementation
- 🔑 Support **ECDSA** certificates
- 🌐 Support **SAN** and **wildcard** certificates
- ⚡ Simple, powerful and very easy to use — only **3 minutes** to learn!
- 🔧 Compatible with **Bash**, **dash** and **sh**
- 🚫 No dependencies on Python
- 🔄 One script to issue, renew and install your certificates automatically
- 👤 **DOES NOT** require `root/sudoer` access
- 🐳 Docker ready
- 🌍 IPv6 ready
- 📧 Cron job notifications for renewal or error

> 💡 It's probably the **easiest & smartest** shell script to automatically issue & renew free certificates.

<p align="center">
  <a href="https://github.com/acmesh-official/acme.sh/wiki"><strong>📚 Wiki</strong></a> •
  <a href="https://github.com/acmesh-official/acme.sh/wiki/Run-acme.sh-in-docker"><strong>🐳 Docker Guide</strong></a> •
  <a href="https://twitter.com/neilpangxa"><strong>🐦 Twitter</strong></a>
</p>

---

## 🌏 [中文说明](https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E)

---

## 🏆 Who Uses acme.sh?
- [FreeBSD.org](https://blog.crashed.org/letsencrypt-in-freebsd-org/)
- [ruby-china.org](https://ruby-china.org/topics/31983)
- [Proxmox](https://pve.proxmox.com/wiki/Certificate_Management)
- [pfsense](https://github.com/pfsense/FreeBSD-ports/pull/89)
- [Loadbalancer.org](https://www.loadbalancer.org/blog/loadbalancer-org-with-lets-encrypt-quick-and-dirty)
- [discourse.org](https://meta.discourse.org/t/setting-up-lets-encrypt/40709)
- [Centminmod](https://centminmod.com/letsencrypt-acmetool-https.html)
- [splynx](https://forum.splynx.com/t/free-ssl-cert-for-splynx-lets-encrypt/297)
- [opnsense.org](https://github.com/opnsense/plugins/tree/master/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient)
- [CentOS Web Panel](https://control-webpanel.com)
- [lnmp.org](https://lnmp.org/)
- [more...](https://github.com/acmesh-official/acme.sh/wiki/Blogs-and-tutorials)

---

## 🖥️ Tested OS

| NO | Status| Platform|
|----|-------|---------|
|1|[![MacOS](https://github.com/acmesh-official/acme.sh/actions/workflows/MacOS.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/MacOS.yml)|Mac OSX
|2|[![Windows](https://github.com/acmesh-official/acme.sh/actions/workflows/Windows.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Windows.yml)|Windows (cygwin with curl, openssl and crontab included)
|3|[![FreeBSD](https://github.com/acmesh-official/acme.sh/actions/workflows/FreeBSD.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/FreeBSD.yml)|FreeBSD
|4|[![Solaris](https://github.com/acmesh-official/acme.sh/actions/workflows/Solaris.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Solaris.yml)|Solaris
|5|[![Ubuntu](https://github.com/acmesh-official/acme.sh/actions/workflows/Ubuntu.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Ubuntu.yml)| Ubuntu
|6|NA|pfsense
|7|[![OpenBSD](https://github.com/acmesh-official/acme.sh/actions/workflows/OpenBSD.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/OpenBSD.yml)|OpenBSD
|8|[![NetBSD](https://github.com/acmesh-official/acme.sh/actions/workflows/NetBSD.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/NetBSD.yml)|NetBSD
|9|[![DragonFlyBSD](https://github.com/acmesh-official/acme.sh/actions/workflows/DragonFlyBSD.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/DragonFlyBSD.yml)|DragonFlyBSD
|10|[![Omnios](https://github.com/acmesh-official/acme.sh/actions/workflows/Omnios.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Omnios.yml)|Omnios
|11|[![OpenIndiana](https://github.com/acmesh-official/acme.sh/actions/workflows/OpenIndiana.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/OpenIndiana.yml)|OpenIndiana
|12|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)| Debian
|13|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|openSUSE
|14|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|Alpine Linux (with curl)
|15|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|Archlinux
|16|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|fedora
|17|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|Kali Linux
|18|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|Oracle Linux
|19|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|Mageia
|20|[![Linux](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Linux.yml)|Gentoo Linux
|21|-----| Cloud Linux  https://github.com/acmesh-official/acme.sh/issues/111
|22|-----| OpenWRT: Tested and working. See [wiki page](https://github.com/acmesh-official/acme.sh/wiki/How-to-run-on-OpenWRT)
|23|[![](https://acmesh-official.github.io/acmetest/status/proxmox.svg)](https://github.com/acmesh-official/letest#here-are-the-latest-status)| Proxmox: See Proxmox VE Wiki. Version [4.x, 5.0, 5.1](https://pve.proxmox.com/wiki/HTTPS_Certificate_Configuration_(Version_4.x,_5.0_and_5.1)#Let.27s_Encrypt_using_acme.sh), version [5.2 and up](https://pve.proxmox.com/wiki/Certificate_Management)
|24|[![Haiku](https://github.com/acmesh-official/acme.sh/actions/workflows/Haiku.yml/badge.svg)](https://github.com/acmesh-official/acme.sh/actions/workflows/Haiku.yml)|Haiku OS


> 🧪 Check our [testing project](https://github.com/acmesh-official/acmetest)
>
> 🖥️ The testing VMs are supported by [vmactions.org](https://vmactions.org)

---

## 🏛️ Supported CA

| CA | Status |
|---|---|
| [ZeroSSL.com CA](https://github.com/acmesh-official/acme.sh/wiki/ZeroSSL.com-CA) | ⭐ **Default** |
| Letsencrypt.org CA | ✅ Supported |
| [SSL.com CA](https://github.com/acmesh-official/acme.sh/wiki/SSL.com-CA) | ✅ Supported |
| [Google.com Public CA](https://github.com/acmesh-official/acme.sh/wiki/Google-Public-CA) | ✅ Supported |
| [Actalis.com CA](https://github.com/acmesh-official/acme.sh/wiki/Actalis.com-CA) | ✅ Supported |
| [Pebble strict Mode](https://github.com/letsencrypt/pebble) | ✅ Supported |
| Any [RFC8555](https://tools.ietf.org/html/rfc8555)-compliant CA | ✅ Supported |

---

## ⚙️ Supported Modes

| Mode | Description |
|------|-------------|
| 📁 Webroot mode | Use existing webroot directory |
| 🖥️ Standalone mode | Built-in webserver on port 80 |
| 🔐 Standalone tls-alpn mode | Built-in webserver on port 443 |
| 🪶 Apache mode | Use Apache for verification |
| ⚡ Nginx mode | Use Nginx for verification |
| 🌐 DNS mode | Use DNS TXT records |
| 🔗 [DNS alias mode](https://github.com/acmesh-official/acme.sh/wiki/DNS-alias-mode) | Use DNS alias for verification |
| 📡 [Stateless mode](https://github.com/acmesh-official/acme.sh/wiki/Stateless-Mode) | Stateless verification |

---

## 📖 Usage Guide

### 1️⃣ How to Install

#### 📥 Install Online

> Check this project: https://github.com/acmesh-official/get.acme.sh

```bash
curl https://get.acme.sh | sh -s email=my@example.com
```

**Or:**

```bash
wget -O -  https://get.acme.sh | sh -s email=my@example.com
```

#### 📦 Install from Git

Clone this project and launch installation:

```bash
git clone https://github.com/acmesh-official/acme.sh.git
cd ./acme.sh
./acme.sh --install -m my@example.com
```

> 💡 You `don't have to be root` then, although `it is recommended`.

📚 **Advanced Installation:** https://github.com/acmesh-official/acme.sh/wiki/How-to-install

**The installer will perform 3 actions:**

1. Create and copy `acme.sh` to your home dir (`$HOME`): `~/.acme.sh/`.
All certs will be placed in this folder too.
2. Create alias for: `acme.sh=~/.acme.sh/acme.sh`.
3. Create daily cron job to check and renew the certs if needed.

Cron entry example:

```bash
0 0 * * * "/home/user/.acme.sh"/acme.sh --cron --home "/home/user/.acme.sh" > /dev/null
```

> ⚠️ After the installation, you must close the current terminal and reopen it to make the alias take effect.

✅ **You are ready to issue certs now!**

**Show help message:**

```sh
acme.sh -h
```

---

### 2️⃣ Issue a Certificate

**Example 1:** Single domain.

```bash
acme.sh --issue -d example.com -w /home/wwwroot/example.com
```

or:

```bash
acme.sh --issue -d example.com -w /home/username/public_html
```

or:

```bash
acme.sh --issue -d example.com -w /var/www/html
```

**Example 2:** Multiple domains in the same cert.

```bash
acme.sh --issue -d example.com -d www.example.com -d cp.example.com -w /home/wwwroot/example.com
```

The parameter `/home/wwwroot/example.com` or `/home/username/public_html` or `/var/www/html` is the web root folder where you host your website files. You **MUST** have `write access` to this folder.

Second argument **"example.com"** is the main domain you want to issue the cert for.
You must have at least one domain there.

You must point and bind all the domains to the same webroot dir: `/home/wwwroot/example.com`.

The certs will be placed in `~/.acme.sh/example.com/`

> 🔄 The certs will be renewed automatically every **30** days.

> 🔐 The certs will default to **ECC** certificates.

📚 **More examples:** https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert

---

### 3️⃣ Install the Certificate to Apache/Nginx

After the cert is generated, you probably want to install/copy the cert to your Apache/Nginx or other servers.

> ⚠️ **IMPORTANT:** You **MUST** use this command to copy the certs to the target files. **DO NOT** use the certs files in `~/.acme.sh/` folder — they are for internal use only, the folder structure may change in the future.

#### 🪶 Apache Example:
```bash
acme.sh --install-cert -d example.com \
--cert-file      /path/to/certfile/in/apache/cert.pem  \
--key-file       /path/to/keyfile/in/apache/key.pem  \
--fullchain-file /path/to/fullchain/certfile/apache/fullchain.pem \
--reloadcmd     "service apache2 force-reload"
```

#### ⚡ Nginx Example:
```bash
acme.sh --install-cert -d example.com \
--key-file       /path/to/keyfile/in/nginx/key.pem  \
--fullchain-file /path/to/fullchain/nginx/cert.pem \
--reloadcmd     "service nginx force-reload"
```

Only the domain is required, all the other parameters are optional.

The ownership and permission info of existing files are preserved. You can pre-create the files to define the ownership and permission.

Install/copy the cert/key to the production Apache or Nginx path.

> 🔄 The cert will be renewed every **30** days by default (configurable). Once renewed, the Apache/Nginx service will be reloaded automatically.

> ⚠️ **IMPORTANT:** The `reloadcmd` is very important. The cert can be automatically renewed, but without a correct `reloadcmd`, the cert may not be flushed to your server (like nginx or apache), then your website will not be able to show the renewed cert.

---

### 4️⃣ Use Standalone Server to Issue Certificate

> 🔐 Requires root/sudoer or permission to listen on port **80** (TCP)

> ⚠️ Port `80` (TCP) **MUST** be free to listen on, otherwise you will be prompted to free it and try again.

```bash
acme.sh --issue --standalone -d example.com -d www.example.com -d cp.example.com
```

📚 **More examples:** https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert

---

### 5️⃣ Use Standalone TLS Server to Issue Certificate

> 🔐 Requires root/sudoer or permission to listen on port **443** (TCP)

> ⚠️ Port `443` (TCP) **MUST** be free to listen on, otherwise you will be prompted to free it and try again.

```bash
acme.sh --issue --alpn -d example.com -d www.example.com -d cp.example.com
```

📚 **More examples:** https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert

---

### 6️⃣ Use Apache Mode

> 🔐 Requires root/sudoer to interact with Apache server

If you are running a web server, it is recommended to use the `Webroot mode`.

Particularly, if you are running an Apache server, you can use Apache mode instead. This mode doesn't write any files to your web root folder.

```sh
acme.sh --issue --apache -d example.com -d www.example.com -d cp.example.com
```

> 💡 **Note:** This Apache mode is only to issue the cert, it will **not** change your Apache config files. You will need to configure your website config files to use the cert by yourself. We don't want to mess with your Apache server, don't worry!

📚 **More examples:** https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert

---

### 7️⃣ Use Nginx Mode

> 🔐 Requires root/sudoer to interact with Nginx server

If you are running a web server, it is recommended to use the `Webroot mode`.

Particularly, if you are running an Nginx server, you can use Nginx mode instead. This mode doesn't write any files to your web root folder.

It will configure Nginx server automatically to verify the domain and then restore the Nginx config to the original version. So, the config is not changed.

```sh
acme.sh --issue --nginx -d example.com -d www.example.com -d cp.example.com
```

> 💡 **Note:** This Nginx mode is only to issue the cert, it will **not** change your Nginx config files. You will need to configure your website config files to use the cert by yourself. We don't want to mess with your Nginx server, don't worry!

📚 **More examples:** https://github.com/acmesh-official/acme.sh/wiki/How-to-issue-a-cert

---

### 8️⃣ Automatic DNS API Integration

If your DNS provider supports API access, we can use that API to automatically issue the certs.

> ✨ **You don't have to do anything manually!**

📚 **Currently acme.sh supports most DNS providers:** https://github.com/acmesh-official/acme.sh/wiki/dnsapi

---

### 9️⃣ Use DNS Manual Mode

See: https://github.com/acmesh-official/acme.sh/wiki/dns-manual-mode first.

If your dns provider doesn't support any api access, you can add the txt record by hand.

```bash
acme.sh --issue --dns -d example.com -d www.example.com -d cp.example.com
```

You should get an output like below:

```sh
Add the following txt record:
Domain:_acme-challenge.example.com
Txt value:9ihDbjYfTExAYeDs4DBUeuTo18KBzwvTEjUnSwd32-c

Add the following txt record:
Domain:_acme-challenge.www.example.com
Txt value:9ihDbjxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Please add those txt records to the domains. Waiting for the dns to take effect.
```

Then just rerun with `renew` argument:

```bash
acme.sh --renew -d example.com
```

✅ **Done!**

> ⚠️ **WARNING:** This is DNS manual mode — it **cannot** be renewed automatically. You will have to add a new TXT record to your domain manually when you renew your cert. **Please use DNS API mode instead.**

---

### 🔟 Issue Certificates of Different Key Types (ECC or RSA)

Just set the `keylength` to a valid, supported value.

**Valid values for the `keylength` parameter:**

| Key Length | Description |
|------------|-------------|
| `ec-256` | prime256v1, "ECDSA P-256" ⭐ **Default** |
| `ec-384` | secp384r1, "ECDSA P-384" |
| `ec-521` | secp521r1, "ECDSA P-521" ⚠️ Not supported by Let's Encrypt yet |
| `2048` | RSA 2048-bit |
| `3072` | RSA 3072-bit |
| `4096` | RSA 4096-bit |

**Examples:**

#### Single domain with ECDSA P-384 certificate

```bash
acme.sh --issue -w /home/wwwroot/example.com -d example.com --keylength ec-384
```

#### SAN multi domain with RSA4096 certificate

```bash
acme.sh --issue -w /home/wwwroot/example.com -d example.com -d www.example.com --keylength 4096
```

---

### 1️⃣1️⃣ Issue Wildcard Certificates

It's simple! Just give a wildcard domain as the `-d` parameter:

```sh
acme.sh --issue -d example.com -d '*.example.com' --dns dns_cf
```



---

### 1️⃣2️⃣ How to Renew Certificates

> 🔄 No need to renew manually! All certs will be renewed automatically every **30** days.

However, you can force a renewal:

```sh
acme.sh --renew -d example.com --force
```

**For ECC cert:**

```sh
acme.sh --renew -d example.com --force --ecc
```

---

### 1️⃣3️⃣ How to Stop Certificate Renewal

To stop renewal of a cert, you can execute the following to remove the cert from the renewal list:

```sh
acme.sh --remove -d example.com [--ecc]
```

The cert/key file is not removed from the disk.

> 💡 You can remove the respective directory (e.g. `~/.acme.sh/example.com`) manually.

---

### 1️⃣4️⃣ How to Upgrade acme.sh

> 🚀 acme.sh is in constant development — it's strongly recommended to use the latest code.

**Update to latest:**

```sh
acme.sh --upgrade
```

**Enable auto upgrade:**

```sh
acme.sh --upgrade --auto-upgrade
```

**Disable auto upgrade:**

```sh
acme.sh --upgrade --auto-upgrade 0
```

---

### 1️⃣5️⃣ Issue a Certificate from an Existing CSR

📚 https://github.com/acmesh-official/acme.sh/wiki/Issue-a-cert-from-existing-CSR

---

### 1️⃣6️⃣ Send Notifications in Cronjob

📚 https://github.com/acmesh-official/acme.sh/wiki/notify

---

### 1️⃣7️⃣ Under the Hood

> 🔧 Speak ACME language using shell, directly to "Let's Encrypt".

---

### 1️⃣8️⃣ Acknowledgments

| Project | Link |
|---------|------|
| 🙏 Acme-tiny | https://github.com/diafygi/acme-tiny |
| 📜 ACME protocol | https://github.com/ietf-wg-acme/acme |

---

## 👥 Contributors

### 💻 Code Contributors

This project exists thanks to all the people who contribute.

<a href="https://github.com/acmesh-official/acme.sh/graphs/contributors"><img src="https://opencollective.com/acmesh/contributors.svg?width=890&button=false" /></a>

### 💰 Financial Contributors

Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/acmesh/contribute)]

#### 👤 Individuals

<a href="https://opencollective.com/acmesh"><img src="https://opencollective.com/acmesh/individuals.svg?width=890"></a>

#### 🏢 Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/acmesh/contribute)]

<a href="https://opencollective.com/acmesh/organization/0/website"><img src="https://opencollective.com/acmesh/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/1/website"><img src="https://opencollective.com/acmesh/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/2/website"><img src="https://opencollective.com/acmesh/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/3/website"><img src="https://opencollective.com/acmesh/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/4/website"><img src="https://opencollective.com/acmesh/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/5/website"><img src="https://opencollective.com/acmesh/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/6/website"><img src="https://opencollective.com/acmesh/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/7/website"><img src="https://opencollective.com/acmesh/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/8/website"><img src="https://opencollective.com/acmesh/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/acmesh/organization/9/website"><img src="https://opencollective.com/acmesh/organization/9/avatar.svg"></a>

---

### 1️⃣9️⃣ License & Others

📄 **License:** GPLv3

⭐ Please **Star** and **Fork** this project!

🐛 [Issues](https://github.com/acmesh-official/acme.sh/issues) and 🔀 [Pull Requests](https://github.com/acmesh-official/acme.sh/pulls) are welcome.

---

### 2️⃣0️⃣ Donate

> 💝 Your donation makes **acme.sh** better!

| Method | Link |
|--------|------|
| PayPal / Alipay(支付宝) / Wechat(微信) | [https://donate.acme.sh/](https://donate.acme.sh/) |

📜 [Donate List](https://github.com/acmesh-official/acme.sh/wiki/Donate-list)

---

### 2️⃣1️⃣ About This Repository

> [!NOTE]
> This repository is officially maintained by <strong>ZeroSSL</strong> as part of our commitment to providing secure and reliable SSL/TLS solutions. We welcome contributions and feedback from the community!  
> For more information about our services, including free and paid SSL/TLS certificates, visit https://zerossl.com.
>   
> All donations made through this repository go directly to the original independent maintainer (Neil Pang), not to ZeroSSL.
<p align="center">
	<a href="https://zerossl.com">
		<picture>
			<source media="(prefers-color-scheme: dark)" srcset="https://zerossl.com/assets/images/zerossl_logo_white.svg">
			<source media="(prefers-color-scheme: light)" srcset="https://zerossl.com/assets/images/zerossl_logo.svg">
			<img src="https://zerossl.com/assets/images/zerossl_logo.svg" alt="ZeroSSL" width="256">
		</picture>
	</a>
</p>


================================================
FILE: acme.sh
================================================
#!/usr/bin/env sh

VER=3.1.3

PROJECT_NAME="acme.sh"

PROJECT_ENTRY="acme.sh"

PROJECT="https://github.com/acmesh-official/$PROJECT_NAME"

DEFAULT_INSTALL_HOME="$HOME/.$PROJECT_NAME"

_WINDOWS_SCHEDULER_NAME="$PROJECT_NAME.cron"

_SCRIPT_="$0"

_SUB_FOLDER_NOTIFY="notify"
_SUB_FOLDER_DNSAPI="dnsapi"
_SUB_FOLDER_DEPLOY="deploy"

_SUB_FOLDERS="$_SUB_FOLDER_DNSAPI $_SUB_FOLDER_DEPLOY $_SUB_FOLDER_NOTIFY"

CA_LETSENCRYPT_V2="https://acme-v02.api.letsencrypt.org/directory"
CA_LETSENCRYPT_V2_TEST="https://acme-staging-v02.api.letsencrypt.org/directory"

CA_ZEROSSL="https://acme.zerossl.com/v2/DV90"
_ZERO_EAB_ENDPOINT="https://api.zerossl.com/acme/eab-credentials-email"

CA_SSLCOM_RSA="https://acme.ssl.com/sslcom-dv-rsa"
CA_SSLCOM_ECC="https://acme.ssl.com/sslcom-dv-ecc"

CA_GOOGLE="https://dv.acme-v02.api.pki.goog/directory"
CA_GOOGLE_TEST="https://dv.acme-v02.test-api.pki.goog/directory"

CA_ACTALIS="https://acme-api.actalis.com/acme/directory"

DEFAULT_CA=$CA_ZEROSSL
DEFAULT_STAGING_CA=$CA_LETSENCRYPT_V2_TEST

CA_NAMES="
ZeroSSL.com,zerossl
LetsEncrypt.org,letsencrypt
LetsEncrypt.org_test,letsencrypt_test,letsencrypttest
SSL.com,sslcom
Google.com,google
Google.com_test,googletest,google_test
Actalis.com,actalis.com,actalis
"

CA_SERVERS="$CA_ZEROSSL,$CA_LETSENCRYPT_V2,$CA_LETSENCRYPT_V2_TEST,$CA_SSLCOM_RSA,$CA_GOOGLE,$CA_GOOGLE_TEST,$CA_ACTALIS"

DEFAULT_USER_AGENT="$PROJECT_NAME/$VER ($PROJECT)"

DEFAULT_ACCOUNT_KEY_LENGTH=ec-256
DEFAULT_DOMAIN_KEY_LENGTH=ec-256

DEFAULT_OPENSSL_BIN="openssl"

VTYPE_HTTP="http-01"
VTYPE_DNS="dns-01"
VTYPE_ALPN="tls-alpn-01"

ID_TYPE_DNS="dns"
ID_TYPE_IP="ip"

LOCAL_ANY_ADDRESS="0.0.0.0"

DEFAULT_RENEW=30

NO_VALUE="no"

W_DNS="dns"
W_ALPN="alpn"
DNS_ALIAS_PREFIX="="

MODE_STATELESS="stateless"

STATE_VERIFIED="verified_ok"

NGINX="nginx:"
NGINX_START="#ACME_NGINX_START"
NGINX_END="#ACME_NGINX_END"

BEGIN_CSR="-----BEGIN [NEW ]\{0,4\}CERTIFICATE REQUEST-----"
END_CSR="-----END [NEW ]\{0,4\}CERTIFICATE REQUEST-----"

BEGIN_CERT="-----BEGIN CERTIFICATE-----"
END_CERT="-----END CERTIFICATE-----"

CONTENT_TYPE_JSON="application/jose+json"
RENEW_SKIP=2
CODE_DNS_MANUAL=3

B64CONF_START="__ACME_BASE64__START_"
B64CONF_END="__ACME_BASE64__END_"

ECC_SEP="_"
ECC_SUFFIX="${ECC_SEP}ecc"

LOG_LEVEL_1=1
LOG_LEVEL_2=2
LOG_LEVEL_3=3
DEFAULT_LOG_LEVEL="$LOG_LEVEL_2"

DEBUG_LEVEL_1=1
DEBUG_LEVEL_2=2
DEBUG_LEVEL_3=3
DEBUG_LEVEL_DEFAULT=$DEBUG_LEVEL_2
DEBUG_LEVEL_NONE=0

DOH_CLOUDFLARE=1
DOH_GOOGLE=2
DOH_ALI=3
DOH_DP=4

HIDDEN_VALUE="[hidden](please add '--output-insecure' to see this value)"

SYSLOG_ERROR="user.error"
SYSLOG_INFO="user.info"
SYSLOG_DEBUG="user.debug"

#error
SYSLOG_LEVEL_ERROR=3
#info
SYSLOG_LEVEL_INFO=6
#debug
SYSLOG_LEVEL_DEBUG=7
#debug2
SYSLOG_LEVEL_DEBUG_2=8
#debug3
SYSLOG_LEVEL_DEBUG_3=9

SYSLOG_LEVEL_DEFAULT=$SYSLOG_LEVEL_ERROR
#none
SYSLOG_LEVEL_NONE=0

NOTIFY_LEVEL_DISABLE=0
NOTIFY_LEVEL_ERROR=1
NOTIFY_LEVEL_RENEW=2
NOTIFY_LEVEL_SKIP=3

NOTIFY_LEVEL_DEFAULT=$NOTIFY_LEVEL_RENEW

NOTIFY_MODE_BULK=0
NOTIFY_MODE_CERT=1

NOTIFY_MODE_DEFAULT=$NOTIFY_MODE_BULK

_BASE64_ENCODED_CFGS="Le_PreHook Le_PostHook Le_RenewHook Le_Preferred_Chain Le_ReloadCmd"

_DEBUG_WIKI="https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh"

_PREPARE_LINK="https://github.com/acmesh-official/acme.sh/wiki/Install-preparations"

_STATELESS_WIKI="https://github.com/acmesh-official/acme.sh/wiki/Stateless-Mode"

_DNS_ALIAS_WIKI="https://github.com/acmesh-official/acme.sh/wiki/DNS-alias-mode"

_DNS_MANUAL_WIKI="https://github.com/acmesh-official/acme.sh/wiki/dns-manual-mode"

_DNS_API_WIKI="https://github.com/acmesh-official/acme.sh/wiki/dnsapi"

_NOTIFY_WIKI="https://github.com/acmesh-official/acme.sh/wiki/notify"

_SUDO_WIKI="https://github.com/acmesh-official/acme.sh/wiki/sudo"

_REVOKE_WIKI="https://github.com/acmesh-official/acme.sh/wiki/revokecert"

_ZEROSSL_WIKI="https://github.com/acmesh-official/acme.sh/wiki/ZeroSSL.com-CA"

_SSLCOM_WIKI="https://github.com/acmesh-official/acme.sh/wiki/SSL.com-CA"

_SERVER_WIKI="https://github.com/acmesh-official/acme.sh/wiki/Server"

_PREFERRED_CHAIN_WIKI="https://github.com/acmesh-official/acme.sh/wiki/Preferred-Chain"

_VALIDITY_WIKI="https://github.com/acmesh-official/acme.sh/wiki/Validity"

_DNSCHECK_WIKI="https://github.com/acmesh-official/acme.sh/wiki/dnscheck"

_PROFILESELECTION_WIKI="https://github.com/acmesh-official/acme.sh/wiki/Profile-selection"

_DNS_MANUAL_ERR="The dns manual mode can not renew automatically, you must issue it again manually. You'd better use the other modes instead."

_DNS_MANUAL_WARN="It seems that you are using dns manual mode. please take care: $_DNS_MANUAL_ERR"

_DNS_MANUAL_ERROR="It seems that you are using dns manual mode. Read this link first: $_DNS_MANUAL_WIKI"

__INTERACTIVE=""
if [ -t 1 ]; then
  __INTERACTIVE="1"
fi

__green() {
  if [ "${__INTERACTIVE}${ACME_NO_COLOR:-0}" = "10" -o "${ACME_FORCE_COLOR}" = "1" ]; then
    printf '\33[1;32m%b\33[0m' "$1"
    return
  fi
  printf -- "%b" "$1"
}

__red() {
  if [ "${__INTERACTIVE}${ACME_NO_COLOR:-0}" = "10" -o "${ACME_FORCE_COLOR}" = "1" ]; then
    printf '\33[1;31m%b\33[0m' "$1"
    return
  fi
  printf -- "%b" "$1"
}

_printargs() {
  _exitstatus="$?"
  if [ -z "$NO_TIMESTAMP" ] || [ "$NO_TIMESTAMP" = "0" ]; then
    printf -- "%s" "[$(date)] "
  fi
  if [ -z "$2" ]; then
    printf -- "%s" "$1"
  else
    printf -- "%s" "$1='$2'"
  fi
  printf "\n"
  # return the saved exit status
  return "$_exitstatus"
}

_dlg_versions() {
  echo "Diagnosis versions: "
  echo "openssl:$ACME_OPENSSL_BIN"
  if _exists "${ACME_OPENSSL_BIN:-openssl}"; then
    ${ACME_OPENSSL_BIN:-openssl} version 2>&1
  else
    echo "$ACME_OPENSSL_BIN doesn't exist."
  fi

  echo "Apache:"
  if [ "$_APACHECTL" ] && _exists "$_APACHECTL"; then
    $_APACHECTL -V 2>&1
  else
    echo "Apache doesn't exist."
  fi

  echo "nginx:"
  if _exists "nginx"; then
    nginx -V 2>&1
  else
    echo "nginx doesn't exist."
  fi

  echo "socat:"
  if _exists "socat"; then
    socat -V 2>&1
  else
    _debug "socat doesn't exist."
    if _exists "python3"; then
      python3 -V 2>&1
    elif _exists "python2"; then
      python2 -V 2>&1
    elif _exists "python"; then
      python -V 2>&1
    fi
  fi
}

#class
_syslog() {
  _exitstatus="$?"
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" = "$SYSLOG_LEVEL_NONE" ]; then
    return
  fi
  _logclass="$1"
  shift
  if [ -z "$__logger_i" ]; then
    if _contains "$(logger --help 2>&1)" "-i"; then
      __logger_i="logger -i"
    else
      __logger_i="logger"
    fi
  fi
  $__logger_i -t "$PROJECT_NAME" -p "$_logclass" "$(_printargs "$@")" >/dev/null 2>&1
  return "$_exitstatus"
}

_log() {
  [ -z "$LOG_FILE" ] && return
  _printargs "$@" >>"$LOG_FILE"
}

_info() {
  _log "$@"
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_INFO" ]; then
    _syslog "$SYSLOG_INFO" "$@"
  fi
  _printargs "$@"
}

_err() {
  _syslog "$SYSLOG_ERROR" "$@"
  _log "$@"
  if [ -z "$NO_TIMESTAMP" ] || [ "$NO_TIMESTAMP" = "0" ]; then
    printf -- "%s" "[$(date)] " >&2
  fi
  if [ -z "$2" ]; then
    __red "$1" >&2
  else
    __red "$1='$2'" >&2
  fi
  printf "\n" >&2
  return 1
}

_usage() {
  __red "$@" >&2
  printf "\n" >&2
}

__debug_bash_helper() {
  # At this point only do for --debug 3
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -lt "$DEBUG_LEVEL_3" ]; then
    return
  fi
  # Return extra debug info when running with bash, otherwise return empty
  # string.
  if [ -z "${BASH_VERSION}" ]; then
    return
  fi
  # We are a bash shell at this point, return the filename, function name, and
  # line number as a string
  _dbh_saveIFS=$IFS
  IFS=" "
  # Must use eval or syntax error happens under dash. The eval should use
  # single quotes as older versions of busybox had a bug with double quotes and
  # eval.
  # Use 'caller 1' as we want one level up the stack as we should be called
  # by one of the _debug* functions
  eval '_dbh_called=($(caller 1))'
  IFS=$_dbh_saveIFS
  eval '_dbh_file=${_dbh_called[2]}'
  if [ -n "${_script_home}" ]; then
    # Trim off the _script_home directory name
    eval '_dbh_file=${_dbh_file#$_script_home/}'
  fi
  eval '_dbh_function=${_dbh_called[1]}'
  eval '_dbh_lineno=${_dbh_called[0]}'
  printf "%-40s " "$_dbh_file:${_dbh_function}:${_dbh_lineno}"
}

_debug() {
  if [ "${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}" -ge "$LOG_LEVEL_1" ]; then
    _log "$@"
  fi
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_DEBUG" ]; then
    _syslog "$SYSLOG_DEBUG" "$@"
  fi
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -ge "$DEBUG_LEVEL_1" ]; then
    _bash_debug=$(__debug_bash_helper)
    _printargs "${_bash_debug}$@" >&2
  fi
}

#output the sensitive messages
_secure_debug() {
  if [ "${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}" -ge "$LOG_LEVEL_1" ]; then
    if [ "$OUTPUT_INSECURE" = "1" ]; then
      _log "$@"
    else
      _log "$1" "$HIDDEN_VALUE"
    fi
  fi
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_DEBUG" ]; then
    _syslog "$SYSLOG_DEBUG" "$1" "$HIDDEN_VALUE"
  fi
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -ge "$DEBUG_LEVEL_1" ]; then
    if [ "$OUTPUT_INSECURE" = "1" ]; then
      _printargs "$@" >&2
    else
      _printargs "$1" "$HIDDEN_VALUE" >&2
    fi
  fi
}

_debug2() {
  if [ "${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}" -ge "$LOG_LEVEL_2" ]; then
    _log "$@"
  fi
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_DEBUG_2" ]; then
    _syslog "$SYSLOG_DEBUG" "$@"
  fi
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -ge "$DEBUG_LEVEL_2" ]; then
    _bash_debug=$(__debug_bash_helper)
    _printargs "${_bash_debug}$@" >&2
  fi
}

_secure_debug2() {
  if [ "${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}" -ge "$LOG_LEVEL_2" ]; then
    if [ "$OUTPUT_INSECURE" = "1" ]; then
      _log "$@"
    else
      _log "$1" "$HIDDEN_VALUE"
    fi
  fi
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_DEBUG_2" ]; then
    _syslog "$SYSLOG_DEBUG" "$1" "$HIDDEN_VALUE"
  fi
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -ge "$DEBUG_LEVEL_2" ]; then
    if [ "$OUTPUT_INSECURE" = "1" ]; then
      _printargs "$@" >&2
    else
      _printargs "$1" "$HIDDEN_VALUE" >&2
    fi
  fi
}

_debug3() {
  if [ "${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}" -ge "$LOG_LEVEL_3" ]; then
    _log "$@"
  fi
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_DEBUG_3" ]; then
    _syslog "$SYSLOG_DEBUG" "$@"
  fi
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -ge "$DEBUG_LEVEL_3" ]; then
    _bash_debug=$(__debug_bash_helper)
    _printargs "${_bash_debug}$@" >&2
  fi
}

_secure_debug3() {
  if [ "${LOG_LEVEL:-$DEFAULT_LOG_LEVEL}" -ge "$LOG_LEVEL_3" ]; then
    if [ "$OUTPUT_INSECURE" = "1" ]; then
      _log "$@"
    else
      _log "$1" "$HIDDEN_VALUE"
    fi
  fi
  if [ "${SYS_LOG:-$SYSLOG_LEVEL_NONE}" -ge "$SYSLOG_LEVEL_DEBUG_3" ]; then
    _syslog "$SYSLOG_DEBUG" "$1" "$HIDDEN_VALUE"
  fi
  if [ "${DEBUG:-$DEBUG_LEVEL_NONE}" -ge "$DEBUG_LEVEL_3" ]; then
    if [ "$OUTPUT_INSECURE" = "1" ]; then
      _printargs "$@" >&2
    else
      _printargs "$1" "$HIDDEN_VALUE" >&2
    fi
  fi
}

__USE_TR_TAG=""
if [ "$(echo "abc" | LANG=C tr a-z A-Z 2>/dev/null)" != "ABC" ]; then
  __USE_TR_TAG="1"
fi
export __USE_TR_TAG

_upper_case() {
  if [ "$__USE_TR_TAG" ]; then
    LANG=C tr '[:lower:]' '[:upper:]'
  else
    # shellcheck disable=SC2018,SC2019
    LANG=C tr '[a-z]' '[A-Z]'
  fi
}

_lower_case() {
  if [ "$__USE_TR_TAG" ]; then
    LANG=C tr '[:upper:]' '[:lower:]'
  else
    # shellcheck disable=SC2018,SC2019
    LANG=C tr '[A-Z]' '[a-z]'
  fi
}

_startswith() {
  _str="$1"
  _sub="$2"
  echo "$_str" | grep -- "^$_sub" >/dev/null 2>&1
}

_endswith() {
  _str="$1"
  _sub="$2"
  echo "$_str" | grep -- "$_sub\$" >/dev/null 2>&1
}

_contains() {
  _str="$1"
  _sub="$2"
  echo "$_str" | grep -- "$_sub" >/dev/null 2>&1
}

_hasfield() {
  _str="$1"
  _field="$2"
  _sep="$3"
  if [ -z "$_field" ]; then
    _usage "Usage: str field  [sep]"
    return 1
  fi

  if [ -z "$_sep" ]; then
    _sep=","
  fi

  for f in $(echo "$_str" | tr "$_sep" ' '); do
    if [ "$f" = "$_field" ]; then
      _debug2 "'$_str' contains '$_field'"
      return 0 #contains ok
    fi
  done
  _debug2 "'$_str' does not contain '$_field'"
  return 1 #not contains
}

# str index [sep]
_getfield() {
  _str="$1"
  _findex="$2"
  _sep="$3"

  if [ -z "$_findex" ]; then
    _usage "Usage: str field  [sep]"
    return 1
  fi

  if [ -z "$_sep" ]; then
    _sep=","
  fi

  _ffi="$_findex"
  while [ "$_ffi" -gt "0" ]; do
    _fv="$(echo "$_str" | cut -d "$_sep" -f "$_ffi")"
    if [ "$_fv" ]; then
      printf -- "%s" "$_fv"
      return 0
    fi
    _ffi="$(_math "$_ffi" - 1)"
  done

  printf -- "%s" "$_str"

}

_exists() {
  cmd="$1"
  if [ -z "$cmd" ]; then
    _usage "Usage: _exists cmd"
    return 1
  fi

  if eval type type >/dev/null 2>&1; then
    eval type "$cmd" >/dev/null 2>&1
  elif command >/dev/null 2>&1; then
    command -v "$cmd" >/dev/null 2>&1
  else
    which "$cmd" >/dev/null 2>&1
  fi
  ret="$?"
  _debug3 "$cmd exists=$ret"
  return $ret
}

#a + b
_math() {
  _m_opts="$@"
  printf "%s" "$(($_m_opts))"
}

_h_char_2_dec() {
  _ch=$1
  case "${_ch}" in
  a | A)
    printf "10"
    ;;
  b | B)
    printf "11"
    ;;
  c | C)
    printf "12"
    ;;
  d | D)
    printf "13"
    ;;
  e | E)
    printf "14"
    ;;
  f | F)
    printf "15"
    ;;
  *)
    printf "%s" "$_ch"
    ;;
  esac

}

_URGLY_PRINTF=""
if [ "$(printf '\x41')" != 'A' ]; then
  _URGLY_PRINTF=1
fi

_h2b() {
  if _exists xxd; then
    if _contains "$(xxd --help 2>&1)" "assumes -c30"; then
      if xxd -r -p -c 9999 2>/dev/null; then
        return
      fi
    else
      if xxd -r -p 2>/dev/null; then
        return
      fi
    fi
  fi

  hex=$(cat)
  ic=""
  jc=""
  _debug2 _URGLY_PRINTF "$_URGLY_PRINTF"
  if [ -z "$_URGLY_PRINTF" ]; then
    # shellcheck disable=SC2059
    printf "$(echo "$hex" | _upper_case | sed 's/\([0-9A-F]\{2\}\)/\\x\1/g')"
  else
    for c in $(echo "$hex" | _upper_case | sed 's/\([0-9A-F]\)/ \1/g'); do
      if [ -z "$ic" ]; then
        ic=$c
        continue
      fi
      jc=$c
      ic="$(_h_char_2_dec "$ic")"
      jc="$(_h_char_2_dec "$jc")"
      printf '\'"$(printf "%o" "$(_math "$ic" \* 16 + $jc)")""%s"
      ic=""
      jc=""
    done
  fi

}

_is_solaris() {
  _contains "${__OS__:=$(uname -a)}" "solaris" || _contains "${__OS__:=$(uname -a)}" "SunOS"
}

#_ascii_hex str
#this can only process ascii chars, should only be used when od command is missing as a backup way.
_ascii_hex() {
  _debug2 "Using _ascii_hex"
  _str="$1"
  _str_len=${#_str}
  _h_i=1
  while [ "$_h_i" -le "$_str_len" ]; do
    _str_c="$(printf "%s" "$_str" | cut -c "$_h_i")"
    printf " %02x" "'$_str_c"
    _h_i="$(_math "$_h_i" + 1)"
  done
}

#stdin  output hexstr splited by one space
#input:"abc"
#output: " 61 62 63"
_hex_dump() {
  if _exists od; then
    od -A n -v -t x1 | tr -s " " | sed 's/ $//' | tr -d "\r\t\n"
  elif _exists hexdump; then
    _debug3 "using hexdump"
    hexdump -v -e '/1 ""' -e '/1 " %02x" ""'
  elif _exists xxd; then
    _debug3 "using xxd"
    xxd -ps -c 20 -i | sed "s/ 0x/ /g" | tr -d ",\n" | tr -s " "
  else
    _debug3 "using _ascii_hex"
    str=$(cat)
    _ascii_hex "$str"
  fi
}

#url encode, no-preserved chars
#A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z
#41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a

#a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
#61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a

#0  1  2  3  4  5  6  7  8  9  -  _  .  ~
#30 31 32 33 34 35 36 37 38 39 2d 5f 2e 7e

#_url_encode [upper-hex]  the encoded hex will be upper-case if the argument upper-hex is followed
#stdin stdout
_url_encode() {
  _upper_hex=$1
  _hex_str=$(_hex_dump)
  _debug3 "_url_encode"
  _debug3 "_hex_str" "$_hex_str"
  for _hex_code in $_hex_str; do
    #upper case
    case "${_hex_code}" in
    "41")
      printf "%s" "A"
      ;;
    "42")
      printf "%s" "B"
      ;;
    "43")
      printf "%s" "C"
      ;;
    "44")
      printf "%s" "D"
      ;;
    "45")
      printf "%s" "E"
      ;;
    "46")
      printf "%s" "F"
      ;;
    "47")
      printf "%s" "G"
      ;;
    "48")
      printf "%s" "H"
      ;;
    "49")
      printf "%s" "I"
      ;;
    "4a")
      printf "%s" "J"
      ;;
    "4b")
      printf "%s" "K"
      ;;
    "4c")
      printf "%s" "L"
      ;;
    "4d")
      printf "%s" "M"
      ;;
    "4e")
      printf "%s" "N"
      ;;
    "4f")
      printf "%s" "O"
      ;;
    "50")
      printf "%s" "P"
      ;;
    "51")
      printf "%s" "Q"
      ;;
    "52")
      printf "%s" "R"
      ;;
    "53")
      printf "%s" "S"
      ;;
    "54")
      printf "%s" "T"
      ;;
    "55")
      printf "%s" "U"
      ;;
    "56")
      printf "%s" "V"
      ;;
    "57")
      printf "%s" "W"
      ;;
    "58")
      printf "%s" "X"
      ;;
    "59")
      printf "%s" "Y"
      ;;
    "5a")
      printf "%s" "Z"
      ;;

      #lower case
    "61")
      printf "%s" "a"
      ;;
    "62")
      printf "%s" "b"
      ;;
    "63")
      printf "%s" "c"
      ;;
    "64")
      printf "%s" "d"
      ;;
    "65")
      printf "%s" "e"
      ;;
    "66")
      printf "%s" "f"
      ;;
    "67")
      printf "%s" "g"
      ;;
    "68")
      printf "%s" "h"
      ;;
    "69")
      printf "%s" "i"
      ;;
    "6a")
      printf "%s" "j"
      ;;
    "6b")
      printf "%s" "k"
      ;;
    "6c")
      printf "%s" "l"
      ;;
    "6d")
      printf "%s" "m"
      ;;
    "6e")
      printf "%s" "n"
      ;;
    "6f")
      printf "%s" "o"
      ;;
    "70")
      printf "%s" "p"
      ;;
    "71")
      printf "%s" "q"
      ;;
    "72")
      printf "%s" "r"
      ;;
    "73")
      printf "%s" "s"
      ;;
    "74")
      printf "%s" "t"
      ;;
    "75")
      printf "%s" "u"
      ;;
    "76")
      printf "%s" "v"
      ;;
    "77")
      printf "%s" "w"
      ;;
    "78")
      printf "%s" "x"
      ;;
    "79")
      printf "%s" "y"
      ;;
    "7a")
      printf "%s" "z"
      ;;
      #numbers
    "30")
      printf "%s" "0"
      ;;
    "31")
      printf "%s" "1"
      ;;
    "32")
      printf "%s" "2"
      ;;
    "33")
      printf "%s" "3"
      ;;
    "34")
      printf "%s" "4"
      ;;
    "35")
      printf "%s" "5"
      ;;
    "36")
      printf "%s" "6"
      ;;
    "37")
      printf "%s" "7"
      ;;
    "38")
      printf "%s" "8"
      ;;
    "39")
      printf "%s" "9"
      ;;
    "2d")
      printf "%s" "-"
      ;;
    "5f")
      printf "%s" "_"
      ;;
    "2e")
      printf "%s" "."
      ;;
    "7e")
      printf "%s" "~"
      ;;
    #other hex
    *)
      if [ "$_upper_hex" = "upper-hex" ]; then
        _hex_code=$(printf "%s" "$_hex_code" | _upper_case)
      fi
      printf '%%%s' "$_hex_code"
      ;;
    esac
  done
}

_json_encode() {
  _j_str="$(sed 's/"/\\"/g' | sed "s/\r/\\r/g")"
  _debug3 "_json_encode"
  _debug3 "_j_str" "$_j_str"
  echo "$_j_str" | _hex_dump | _lower_case | sed 's/0a/5c 6e/g' | tr -d ' ' | _h2b | tr -d "\r\n"
}

#from: http:\/\/  to http://
_json_decode() {
  _j_str="$(sed 's#\\/#/#g')"
  _debug3 "_json_decode"
  _debug3 "_j_str" "$_j_str"
  echo "$_j_str"
}

#options file
_sed_i() {
  options="$1"
  filename="$2"
  if [ -z "$filename" ]; then
    _usage "Usage:_sed_i options filename"
    return 1
  fi
  _debug2 options "$options"
  if sed -h 2>&1 | grep "\-i\[SUFFIX]" >/dev/null 2>&1; then
    _debug "Using sed  -i"
    sed -i "$options" "$filename"
  elif sed -h 2>&1 | grep "\-i extension" >/dev/null 2>&1; then
    _debug "Using FreeBSD sed -i"
    sed -i "" "$options" "$filename"
  else
    _debug "No -i support in sed"
    text="$(cat "$filename")"
    echo "$text" | sed "$options" >"$filename"
  fi
}

if [ "$(echo abc | egrep -o b 2>/dev/null)" = "b" ]; then
  __USE_EGREP=1
else
  __USE_EGREP=""
fi

_egrep_o() {
  if [ "$__USE_EGREP" ]; then
    egrep -o -- "$1" 2>/dev/null
  else
    sed -n 's/.*\('"$1"'\).*/\1/p'
  fi
}

#Usage: file startline endline
_getfile() {
  filename="$1"
  startline="$2"
  endline="$3"
  if [ -z "$endline" ]; then
    _usage "Usage: file startline endline"
    return 1
  fi

  i="$(grep -n -- "$startline" "$filename" | cut -d : -f 1)"
  if [ -z "$i" ]; then
    _err "Cannot find start line: $startline"
    return 1
  fi
  i="$(_math "$i" + 1)"
  _debug i "$i"

  j="$(grep -n -- "$endline" "$filename" | cut -d : -f 1)"
  if [ -z "$j" ]; then
    _err "Cannot find end line: $endline"
    return 1
  fi
  j="$(_math "$j" - 1)"
  _debug j "$j"

  sed -n "$i,${j}p" "$filename"

}

#Usage: multiline
_base64() {
  [ "" ] #urgly
  if [ "$1" ]; then
    _debug3 "base64 multiline:'$1'"
    ${ACME_OPENSSL_BIN:-openssl} base64 -e
  else
    _debug3 "base64 single line."
    ${ACME_OPENSSL_BIN:-openssl} base64 -e | tr -d '\r\n'
  fi
}

#Usage: multiline
_dbase64() {
  if [ "$1" ]; then
    ${ACME_OPENSSL_BIN:-openssl} base64 -d
  else
    ${ACME_OPENSSL_BIN:-openssl} base64 -d -A
  fi
}

#file
_checkcert() {
  _cf="$1"
  if [ "$DEBUG" ]; then
    ${ACME_OPENSSL_BIN:-openssl} x509 -noout -text -in "$_cf"
  else
    ${ACME_OPENSSL_BIN:-openssl} x509 -noout -text -in "$_cf" >/dev/null 2>&1
  fi
}

#Usage: hashalg  [outputhex]
#Output Base64-encoded digest
_digest() {
  alg="$1"
  if [ -z "$alg" ]; then
    _usage "Usage: _digest hashalg"
    return 1
  fi

  outputhex="$2"

  if [ "$alg" = "sha3-256" ] || [ "$alg" = "sha256" ] || [ "$alg" = "sha1" ] || [ "$alg" = "md5" ]; then
    if [ "$outputhex" ]; then
      ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -hex | cut -d = -f 2 | tr -d ' '
    else
      ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -binary | _base64
    fi
  else
    _err "$alg is not supported yet"
    return 1
  fi

}

#Usage: hashalg  secret_hex  [outputhex]
#Output binary hmac
_hmac() {
  alg="$1"
  secret_hex="$2"
  outputhex="$3"

  if [ -z "$secret_hex" ]; then
    _usage "Usage: _hmac hashalg secret [outputhex]"
    return 1
  fi

  if [ "$alg" = "sha256" ] || [ "$alg" = "sha1" ]; then
    if [ "$outputhex" ]; then
      (${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -mac HMAC -macopt "hexkey:$secret_hex" 2>/dev/null || ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -hmac "$(printf "%s" "$secret_hex" | _h2b)") | cut -d = -f 2 | tr -d ' '
    else
      ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -mac HMAC -macopt "hexkey:$secret_hex" -binary 2>/dev/null || ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -hmac "$(printf "%s" "$secret_hex" | _h2b)" -binary
    fi
  else
    _err "$alg is not supported yet"
    return 1
  fi

}

#Usage: keyfile hashalg
#Output: Base64-encoded signature value
_sign() {
  keyfile="$1"
  alg="$2"
  if [ -z "$alg" ]; then
    _usage "Usage: _sign keyfile hashalg"
    return 1
  fi

  _sign_openssl="${ACME_OPENSSL_BIN:-openssl} dgst -sign $keyfile "

  if _isRSA "$keyfile" >/dev/null 2>&1; then
    $_sign_openssl -$alg | _base64
  elif _isEcc "$keyfile" >/dev/null 2>&1; then
    if ! _signedECText="$($_sign_openssl -sha$__ECC_KEY_LEN | ${ACME_OPENSSL_BIN:-openssl} asn1parse -inform DER)"; then
      _err "Sign failed: $_sign_openssl"
      _err "Key file: $keyfile"
      _err "Key content: $(wc -l <"$keyfile") lines"
      return 1
    fi
    _debug3 "_signedECText" "$_signedECText"
    _ec_r="$(echo "$_signedECText" | _head_n 2 | _tail_n 1 | cut -d : -f 4 | tr -d "\r\n")"
    _ec_s="$(echo "$_signedECText" | _head_n 3 | _tail_n 1 | cut -d : -f 4 | tr -d "\r\n")"
    if [ "$__ECC_KEY_LEN" -eq "256" ]; then
      while [ "${#_ec_r}" -lt "64" ]; do
        _ec_r="0${_ec_r}"
      done
      while [ "${#_ec_s}" -lt "64" ]; do
        _ec_s="0${_ec_s}"
      done
    fi
    if [ "$__ECC_KEY_LEN" -eq "384" ]; then
      while [ "${#_ec_r}" -lt "96" ]; do
        _ec_r="0${_ec_r}"
      done
      while [ "${#_ec_s}" -lt "96" ]; do
        _ec_s="0${_ec_s}"
      done
    fi
    if [ "$__ECC_KEY_LEN" -eq "512" ]; then
      while [ "${#_ec_r}" -lt "132" ]; do
        _ec_r="0${_ec_r}"
      done
      while [ "${#_ec_s}" -lt "132" ]; do
        _ec_s="0${_ec_s}"
      done
    fi
    _debug3 "_ec_r" "$_ec_r"
    _debug3 "_ec_s" "$_ec_s"
    printf "%s" "$_ec_r$_ec_s" | _h2b | _base64
  else
    _err "Unknown key file format."
    return 1
  fi

}

#keylength or isEcc flag (empty str => not ecc)
_isEccKey() {
  _length="$1"

  if [ -z "$_length" ]; then
    return 1
  fi

  [ "$_length" != "1024" ] &&
    [ "$_length" != "2048" ] &&
    [ "$_length" != "3072" ] &&
    [ "$_length" != "4096" ] &&
    [ "$_length" != "8192" ]
}

# _createkey  2048|ec-256   file
_createkey() {
  length="$1"
  f="$2"
  _debug2 "_createkey for file:$f"
  eccname="$length"
  if _startswith "$length" "ec-"; then
    length=$(printf "%s" "$length" | cut -d '-' -f 2-100)

    if [ "$length" = "256" ]; then
      eccname="prime256v1"
    fi
    if [ "$length" = "384" ]; then
      eccname="secp384r1"
    fi
    if [ "$length" = "521" ]; then
      eccname="secp521r1"
    fi

  fi

  if [ -z "$length" ]; then
    length=2048
  fi

  _debug "Using length $length"

  if ! [ -e "$f" ]; then
    if ! touch "$f" >/dev/null 2>&1; then
      _f_path="$(dirname "$f")"
      _debug _f_path "$_f_path"
      if ! mkdir -p "$_f_path"; then
        _err "Cannot create path: $_f_path"
        return 1
      fi
    fi
    if ! touch "$f" >/dev/null 2>&1; then
      return 1
    fi
    chmod 600 "$f"
  fi

  if _isEccKey "$length"; then
    _debug "Using EC name: $eccname"
    if _opkey="$(${ACME_OPENSSL_BIN:-openssl} ecparam -name "$eccname" -noout -genkey 2>/dev/null)"; then
      echo "$_opkey" >"$f"
    else
      _err "Error encountered for ECC key named $eccname"
      return 1
    fi
  else
    _debug "Using RSA: $length"
    __traditional=""
    if _contains "$(${ACME_OPENSSL_BIN:-openssl} help genrsa 2>&1)" "-traditional"; then
      __traditional="-traditional"
    fi
    if _opkey="$(${ACME_OPENSSL_BIN:-openssl} genrsa $__traditional "$length" 2>/dev/null)"; then
      echo "$_opkey" >"$f"
    else
      _err "Error encountered for RSA key of length $length"
      return 1
    fi
  fi

  if [ "$?" != "0" ]; then
    _err "Key creation error."
    return 1
  fi
}

#domain
_is_idn() {
  _is_idn_d="$1"
  _debug2 _is_idn_d "$_is_idn_d"
  _idn_temp=$(printf "%s" "$_is_idn_d" | tr -d '[0-9]' | tr -d '[a-z]' | tr -d '[A-Z]' | tr -d '*.,-_')
  _debug2 _idn_temp "$_idn_temp"
  [ "$_idn_temp" ]
}

#aa.com
#aa.com,bb.com,cc.com
_idn() {
  __idn_d="$1"
  if ! _is_idn "$__idn_d"; then
    printf "%s" "$__idn_d"
    return 0
  fi

  if _exists idn; then
    if _contains "$__idn_d" ','; then
      _i_first="1"
      for f in $(echo "$__idn_d" | tr ',' ' '); do
        [ -z "$f" ] && continue
        if [ -z "$_i_first" ]; then
          printf "%s" ","
        else
          _i_first=""
        fi
        idn --quiet "$f" | tr -d "\r\n"
      done
    else
      idn "$__idn_d" | tr -d "\r\n"
    fi
  else
    _err "Please install idn to process IDN names."
  fi
}

#_createcsr  cn  san_list  keyfile csrfile conf acmeValidationv1 extendedUsage
_createcsr() {
  _debug _createcsr
  domain="$1"
  domainlist="$2"
  csrkey="$3"
  csr="$4"
  csrconf="$5"
  acmeValidationv1="$6"
  extusage="$7"
  _debug2 domain "$domain"
  _debug2 domainlist "$domainlist"
  _debug2 csrkey "$csrkey"
  _debug2 csr "$csr"
  _debug2 csrconf "$csrconf"

  printf "[ req_distinguished_name ]\n[ req ]\ndistinguished_name = req_distinguished_name\nreq_extensions = v3_req\n[ v3_req ]" >"$csrconf"

  if [ "$extusage" ]; then
    printf "\nextendedKeyUsage=$extusage\n" >>"$csrconf"
  else
    printf "\nextendedKeyUsage=serverAuth,clientAuth\n" >>"$csrconf"
  fi

  if [ "$acmeValidationv1" ]; then
    domainlist="$(_idn "$domainlist")"
    _debug2 domainlist "$domainlist"
    alt=""
    for dl in $(echo "$domainlist" | tr "," ' '); do
      if [ "$alt" ]; then
        alt="$alt,$(_getIdType "$dl" | _upper_case):$dl"
      else
        alt="$(_getIdType "$dl" | _upper_case):$dl"
      fi
    done
    printf -- "\nsubjectAltName=$alt" >>"$csrconf"
  elif [ -z "$domainlist" ] || [ "$domainlist" = "$NO_VALUE" ]; then
    #single domain
    _info "Single domain" "$domain"
    printf -- "\nsubjectAltName=$(_getIdType "$domain" | _upper_case):$(_idn "$domain")" >>"$csrconf"
  else
    domainlist="$(_idn "$domainlist")"
    _debug2 domainlist "$domainlist"
    alt="$(_getIdType "$domain" | _upper_case):$(_idn "$domain")"
    for dl in $(echo "'$domainlist'" | sed "s/,/' '/g"); do
      dl=$(echo "$dl" | tr -d "'")
      alt="$alt,$(_getIdType "$dl" | _upper_case):$dl"
    done
    #multi
    _info "Multi domain" "$alt"
    printf -- "\nsubjectAltName=$alt" >>"$csrconf"
  fi
  if [ "$Le_OCSP_Staple" = "1" ]; then
    _savedomainconf Le_OCSP_Staple "$Le_OCSP_Staple"
    printf -- "\nbasicConstraints = CA:FALSE\n1.3.6.1.5.5.7.1.24=DER:30:03:02:01:05" >>"$csrconf"
  fi

  if [ "$acmeValidationv1" ]; then
    printf "\n1.3.6.1.5.5.7.1.31=critical,DER:04:20:${acmeValidationv1}" >>"${csrconf}"
  fi

  _csr_cn="$(_idn "$domain")"
  _debug2 _csr_cn "$_csr_cn"
  if _contains "$(uname -a)" "MINGW"; then
    if _isIP "$_csr_cn"; then
      ${ACME_OPENSSL_BIN:-openssl} req -new -sha256 -key "$csrkey" -subj "//O=$PROJECT_NAME" -config "$csrconf" -out "$csr"
    else
      ${ACME_OPENSSL_BIN:-openssl} req -new -sha256 -key "$csrkey" -subj "//CN=$_csr_cn" -config "$csrconf" -out "$csr"
    fi
  else
    if _isIP "$_csr_cn"; then
      ${ACME_OPENSSL_BIN:-openssl} req -new -sha256 -key "$csrkey" -subj "/O=$PROJECT_NAME" -config "$csrconf" -out "$csr"
    else
      ${ACME_OPENSSL_BIN:-openssl} req -new -sha256 -key "$csrkey" -subj "/CN=$_csr_cn" -config "$csrconf" -out "$csr"
    fi
  fi
}

#_signcsr key  csr  conf cert
_signcsr() {
  key="$1"
  csr="$2"
  conf="$3"
  cert="$4"
  _debug "_signcsr"

  _msg="$(${ACME_OPENSSL_BIN:-openssl} x509 -req -days 365 -in "$csr" -signkey "$key" -extensions v3_req -extfile "$conf" -out "$cert" 2>&1)"
  _ret="$?"
  _debug "$_msg"
  return $_ret
}

#_csrfile
_readSubjectFromCSR() {
  _csrfile="$1"
  if [ -z "$_csrfile" ]; then
    _usage "_readSubjectFromCSR mycsr.csr"
    return 1
  fi
  ${ACME_OPENSSL_BIN:-openssl} req -noout -in "$_csrfile" -subject | tr ',' "\n" | _egrep_o "CN *=.*" | cut -d = -f 2 | cut -d / -f 1 | tr -d ' \n'
}

#_csrfile
#echo comma separated domain list
_readSubjectAltNamesFromCSR() {
  _csrfile="$1"
  if [ -z "$_csrfile" ]; then
    _usage "_readSubjectAltNamesFromCSR mycsr.csr"
    return 1
  fi

  _csrsubj="$(_readSubjectFromCSR "$_csrfile")"
  _debug _csrsubj "$_csrsubj"

  _dnsAltnames="$(${ACME_OPENSSL_BIN:-openssl} req -noout -text -in "$_csrfile" | grep "^ *DNS:.*" | tr -d ' \n')"
  _debug _dnsAltnames "$_dnsAltnames"

  if _contains "$_dnsAltnames," "DNS:$_csrsubj,"; then
    _debug "AltNames contains subject"
    _excapedAlgnames="$(echo "$_dnsAltnames" | tr '*' '#')"
    _debug _excapedAlgnames "$_excapedAlgnames"
    _escapedSubject="$(echo "$_csrsubj" | tr '*' '#')"
    _debug _escapedSubject "$_escapedSubject"
    _dnsAltnames="$(echo "$_excapedAlgnames," | sed "s/DNS:$_escapedSubject,//g" | tr '#' '*' | sed "s/,\$//g")"
    _debug _dnsAltnames "$_dnsAltnames"
  else
    _debug "AltNames doesn't contain subject"
  fi

  echo "$_dnsAltnames" | sed "s/DNS://g"
}

#_csrfile
_readKeyLengthFromCSR() {
  _csrfile="$1"
  if [ -z "$_csrfile" ]; then
    _usage "_readKeyLengthFromCSR mycsr.csr"
    return 1
  fi

  _outcsr="$(${ACME_OPENSSL_BIN:-openssl} req -noout -text -in "$_csrfile")"
  _debug2 _outcsr "$_outcsr"
  if _contains "$_outcsr" "Public Key Algorithm: id-ecPublicKey"; then
    _debug "ECC CSR"
    echo "$_outcsr" | tr "\t" " " | _egrep_o "^ *ASN1 OID:.*" | cut -d ':' -f 2 | tr -d ' '
  else
    _debug "RSA CSR"
    _rkl="$(echo "$_outcsr" | tr "\t" " " | _egrep_o "^ *Public.Key:.*" | cut -d '(' -f 2 | cut -d ' ' -f 1)"
    if [ "$_rkl" ]; then
      echo "$_rkl"
    else
      echo "$_outcsr" | tr "\t" " " | _egrep_o "RSA Public.Key:.*" | cut -d '(' -f 2 | cut -d ' ' -f 1
    fi
  fi
}

_ss() {
  _port="$1"

  if _exists "ss"; then
    _debug "Using: ss"
    ss -ntpl 2>/dev/null | grep ":$_port "
    return 0
  fi

  if [ "$(uname)" = "AIX" ]; then
    _debug "Using: AIX netstat"
    netstat -an | grep "^tcp" | grep "LISTEN" | grep "\.$_port "
    return 0
  fi

  if _exists "netstat"; then
    _debug "Using: netstat"
    if netstat -help 2>&1 | grep "\-p proto" >/dev/null; then
      #for windows version netstat tool
      netstat -an -p tcp | grep "LISTENING" | grep ":$_port "
    else
      if netstat -help 2>&1 | grep "\-p protocol" >/dev/null; then
        netstat -an -p tcp | grep LISTEN | grep ":$_port "
      elif netstat -help 2>&1 | grep -- '-P protocol' >/dev/null; then
        #for solaris
        netstat -an -P tcp | grep "\.$_port " | grep "LISTEN"
      elif netstat -help 2>&1 | grep "\-p" >/dev/null; then
        #for full linux
        netstat -ntpl | grep ":$_port "
      else
        #for busybox (embedded linux; no pid support)
        netstat -ntl 2>/dev/null | grep ":$_port "
      fi
    fi
    return 0
  fi

  return 1
}

#outfile key cert cacert [password [name [caname]]]
_toPkcs() {
  _cpfx="$1"
  _ckey="$2"
  _ccert="$3"
  _cca="$4"
  pfxPassword="$5"
  pfxName="$6"
  pfxCaname="$7"

  if [ "$pfxCaname" ]; then
    ${ACME_OPENSSL_BIN:-openssl} pkcs12 -export -out "$_cpfx" -inkey "$_ckey" -in "$_ccert" -certfile "$_cca" -password "pass:$pfxPassword" -name "$pfxName" -caname "$pfxCaname"
  elif [ "$pfxName" ]; then
    ${ACME_OPENSSL_BIN:-openssl} pkcs12 -export -out "$_cpfx" -inkey "$_ckey" -in "$_ccert" -certfile "$_cca" -password "pass:$pfxPassword" -name "$pfxName"
  elif [ "$pfxPassword" ]; then
    ${ACME_OPENSSL_BIN:-openssl} pkcs12 -export -out "$_cpfx" -inkey "$_ckey" -in "$_ccert" -certfile "$_cca" -password "pass:$pfxPassword"
  else
    ${ACME_OPENSSL_BIN:-openssl} pkcs12 -export -out "$_cpfx" -inkey "$_ckey" -in "$_ccert" -certfile "$_cca"
  fi
  if [ "$?" = "0" ]; then
    _savedomainconf "Le_PFXPassword" "$pfxPassword" "base64"
  fi

}

#domain [password] [isEcc]
toPkcs() {
  domain="$1"
  pfxPassword="$2"
  if [ -z "$domain" ]; then
    _usage "Usage: $PROJECT_ENTRY --to-pkcs12 --domain <domain.tld> [--password <password>] [--ecc]"
    return 1
  fi

  _isEcc="$3"

  _initpath "$domain" "$_isEcc"

  _toPkcs "$CERT_PFX_PATH" "$CERT_KEY_PATH" "$CERT_PATH" "$CA_CERT_PATH" "$pfxPassword"

  if [ "$?" = "0" ]; then
    _info "Success, PFX has been exported to: $CERT_PFX_PATH"
  fi

}

#domain [isEcc]
toPkcs8() {
  domain="$1"

  if [ -z "$domain" ]; then
    _usage "Usage: $PROJECT_ENTRY --to-pkcs8 --domain <domain.tld> [--ecc]"
    return 1
  fi

  _isEcc="$2"

  _initpath "$domain" "$_isEcc"

  ${ACME_OPENSSL_BIN:-openssl} pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in "$CERT_KEY_PATH" -out "$CERT_PKCS8_PATH"

  if [ "$?" = "0" ]; then
    _info "Success, $CERT_PKCS8_PATH"
  fi

}

#[2048]
createAccountKey() {
  _info "Creating account key"
  if [ -z "$1" ]; then
    _usage "Usage: $PROJECT_ENTRY --create-account-key [--accountkeylength <bits>]"
    return
  fi

  length=$1
  _create_account_key "$length"

}

_create_account_key() {

  length=$1

  if [ -z "$length" ] || [ "$length" = "$NO_VALUE" ]; then
    _debug "Using default length $DEFAULT_ACCOUNT_KEY_LENGTH"
    length="$DEFAULT_ACCOUNT_KEY_LENGTH"
  fi

  _debug length "$length"
  _initpath

  mkdir -p "$CA_DIR"
  if [ -s "$ACCOUNT_KEY_PATH" ]; then
    _info "Account key exists, skipping"
    return 0
  else
    #generate account key
    if _createkey "$length" "$ACCOUNT_KEY_PATH"; then
      _info "Account key creation OK."
      return 0
    else
      _err "Account key creation error."
      return 1
    fi
  fi

}

#domain [length]
createDomainKey() {
  _info "Creating domain key"
  if [ -z "$1" ]; then
    _usage "Usage: $PROJECT_ENTRY --create-domain-key --domain <domain.tld> [--keylength <bits>]"
    return
  fi

  domain=$1
  _cdl=$2

  if [ -z "$_cdl" ]; then
    _debug "Using DEFAULT_DOMAIN_KEY_LENGTH=$DEFAULT_DOMAIN_KEY_LENGTH"
    _cdl="$DEFAULT_DOMAIN_KEY_LENGTH"
  fi

  _initpath "$domain" "$_cdl"

  if [ ! -f "$CERT_KEY_PATH" ] || [ ! -s "$CERT_KEY_PATH" ] || ([ "$FORCE" ] && ! [ "$_ACME_IS_RENEW" ]) || [ "$Le_ForceNewDomainKey" = "1" ]; then
    if _createkey "$_cdl" "$CERT_KEY_PATH"; then
      _savedomainconf Le_Keylength "$_cdl"
      _info "The domain key is here: $(__green $CERT_KEY_PATH)"
      return 0
    else
      _err "Cannot create domain key"
      return 1
    fi
  else
    if [ "$_ACME_IS_RENEW" ]; then
      _info "Domain key exists, skipping"
      return 0
    else
      _err "Domain key exists, do you want to overwrite it?"
      _err "If so, add '--force' and try again."
      return 1
    fi
  fi

}

# domain  domainlist isEcc
createCSR() {
  _info "Creating CSR"
  if [ -z "$1" ]; then
    _usage "Usage: $PROJECT_ENTRY --create-csr --domain <domain.tld> [--domain <domain2.tld> ...] [--ecc]"
    return
  fi

  domain="$1"
  domainlist="$2"
  _isEcc="$3"

  _initpath "$domain" "$_isEcc"

  if [ -f "$CSR_PATH" ] && [ "$_ACME_IS_RENEW" ] && [ -z "$FORCE" ]; then
    _info "CSR exists, skipping"
    return
  fi

  if [ ! -f "$CERT_KEY_PATH" ]; then
    _err "This key file was not found: $CERT_KEY_PATH"
    _err "Please create it first."
    return 1
  fi
  _createcsr "$domain" "$domainlist" "$CERT_KEY_PATH" "$CSR_PATH" "$DOMAIN_SSL_CONF"

}

_url_replace() {
  tr '/+' '_-' | tr -d '= '
}

#base64 string
_durl_replace_base64() {
  _l=$((${#1} % 4))
  if [ $_l -eq 2 ]; then
    _s="$1"'=='
  elif [ $_l -eq 3 ]; then
    _s="$1"'='
  else
    _s="$1"
  fi
  echo "$_s" | tr '_-' '/+'
}

_time2str() {
  #BSD
  if date -u -r "$1" -j "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null; then
    return
  fi

  #Linux
  if date -u --date=@"$1" "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null; then
    return
  fi

  #Omnios
  if date -u -r "$1" +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null; then
    return
  fi

  #Solaris
  if printf "%(%Y-%m-%dT%H:%M:%SZ)T\n" $1 2>/dev/null; then
    return
  fi

  #Busybox
  if echo "$1" | awk '{ print strftime("%Y-%m-%dT%H:%M:%SZ", $0); }' 2>/dev/null; then
    return
  fi
}

_normalizeJson() {
  sed "s/\" *: *\([\"{\[]\)/\":\1/g" | sed "s/^ *\([^ ]\)/\1/" | tr -d "\r\n"
}

_stat() {
  #Linux
  if stat -c '%U:%G' "$1" 2>/dev/null; then
    return
  fi

  #BSD
  if stat -f '%Su:%Sg' "$1" 2>/dev/null; then
    return
  fi

  return 1 #error, 'stat' not found
}

#keyfile
_isRSA() {
  keyfile=$1
  if grep "BEGIN RSA PRIVATE KEY" "$keyfile" >/dev/null 2>&1 || ${ACME_OPENSSL_BIN:-openssl} rsa -in "$keyfile" -noout -text 2>&1 | grep "^publicExponent:" 2>&1 >/dev/null; then
    return 0
  fi
  return 1
}

#keyfile
_isEcc() {
  keyfile=$1
  if grep "BEGIN EC PRIVATE KEY" "$keyfile" >/dev/null 2>&1 || ${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^NIST CURVE:" 2>&1 >/dev/null; then
    return 0
  fi
  return 1
}

#keyfile
_calcjwk() {
  keyfile="$1"
  if [ -z "$keyfile" ]; then
    _usage "Usage: _calcjwk keyfile"
    return 1
  fi

  if [ "$JWK_HEADER" ] && [ "$__CACHED_JWK_KEY_FILE" = "$keyfile" ]; then
    _debug2 "Use cached jwk for file: $__CACHED_JWK_KEY_FILE"
    return 0
  fi

  if _isRSA "$keyfile"; then
    _debug "RSA key"
    pub_exp=$(${ACME_OPENSSL_BIN:-openssl} rsa -in "$keyfile" -noout -text | grep "^publicExponent:" | cut -d '(' -f 2 | cut -d 'x' -f 2 | cut -d ')' -f 1)
    if [ "${#pub_exp}" = "5" ]; then
      pub_exp=0$pub_exp
    fi
    _debug3 pub_exp "$pub_exp"

    e=$(echo "$pub_exp" | _h2b | _base64)
    _debug3 e "$e"

    modulus=$(${ACME_OPENSSL_BIN:-openssl} rsa -in "$keyfile" -modulus -noout | cut -d '=' -f 2)
    _debug3 modulus "$modulus"
    n="$(printf "%s" "$modulus" | _h2b | _base64 | _url_replace)"
    _debug3 n "$n"

    jwk='{"e": "'$e'", "kty": "RSA", "n": "'$n'"}'
    _debug3 jwk "$jwk"

    JWK_HEADER='{"alg": "RS256", "jwk": '$jwk'}'
    JWK_HEADERPLACE_PART1='{"nonce": "'
    JWK_HEADERPLACE_PART2='", "alg": "RS256"'
  elif _isEcc "$keyfile"; then
    _debug "EC key"
    crv="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^NIST CURVE:" | cut -d ":" -f 2 | tr -d " \r\n")"
    _debug3 crv "$crv"
    __ECC_KEY_LEN=$(echo "$crv" | cut -d "-" -f 2)
    if [ "$__ECC_KEY_LEN" = "521" ]; then
      __ECC_KEY_LEN=512
    fi
    _debug3 __ECC_KEY_LEN "$__ECC_KEY_LEN"
    if [ -z "$crv" ]; then
      _debug "Let's try ASN1 OID"
      crv_oid="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^ASN1 OID:" | cut -d ":" -f 2 | tr -d " \r\n")"
      _debug3 crv_oid "$crv_oid"
      case "${crv_oid}" in
      "prime256v1")
        crv="P-256"
        __ECC_KEY_LEN=256
        ;;
      "secp384r1")
        crv="P-384"
        __ECC_KEY_LEN=384
        ;;
      "secp521r1")
        crv="P-521"
        __ECC_KEY_LEN=512
        ;;
      *)
        _err "ECC oid: $crv_oid"
        return 1
        ;;
      esac
      _debug3 crv "$crv"
    fi

    pubi="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep -n pub: | cut -d : -f 1)"
    pubi=$(_math "$pubi" + 1)
    _debug3 pubi "$pubi"

    pubj="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep -n "ASN1 OID:" | cut -d : -f 1)"
    pubj=$(_math "$pubj" - 1)
    _debug3 pubj "$pubj"

    pubtext="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | sed -n "$pubi,${pubj}p" | tr -d " \n\r")"
    _debug3 pubtext "$pubtext"

    xlen="$(printf "%s" "$pubtext" | tr -d ':' | wc -c)"
    xlen=$(_math "$xlen" / 4)
    _debug3 xlen "$xlen"

    xend=$(_math "$xlen" + 1)
    x="$(printf "%s" "$pubtext" | cut -d : -f 2-"$xend")"
    _debug3 x "$x"

    x64="$(printf "%s" "$x" | tr -d : | _h2b | _base64 | _url_replace)"
    _debug3 x64 "$x64"

    xend=$(_math "$xend" + 1)
    y="$(printf "%s" "$pubtext" | cut -d : -f "$xend"-2048)"
    _debug3 y "$y"

    y64="$(printf "%s" "$y" | tr -d : | _h2b | _base64 | _url_replace)"
    _debug3 y64 "$y64"

    jwk='{"crv": "'$crv'", "kty": "EC", "x": "'$x64'", "y": "'$y64'"}'
    _debug3 jwk "$jwk"

    JWK_HEADER='{"alg": "ES'$__ECC_KEY_LEN'", "jwk": '$jwk'}'
    JWK_HEADERPLACE_PART1='{"nonce": "'
    JWK_HEADERPLACE_PART2='", "alg": "ES'$__ECC_KEY_LEN'"'
  else
    _err "Only RSA or EC keys are supported. keyfile=$keyfile"
    _debug2 "$(cat "$keyfile")"
    return 1
  fi

  _debug3 JWK_HEADER "$JWK_HEADER"
  __CACHED_JWK_KEY_FILE="$keyfile"
}

_time() {
  date -u "+%s"
}

#support 2 formats:
#    2022-04-01 08:10:33   to   1648800633
#or  2022-04-01T08:10:33Z  to   1648800633
_date2time() {
  #Mac/BSD
  if date -u -j -f "%Y-%m-%d %H:%M:%S" "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
    return
  fi
  #Linux
  if date -u -d "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
    return
  fi

  #Solaris
  if gdate -u -d "$(echo "$1" | tr -d "Z" | tr "T" ' ')" +"%s" 2>/dev/null; then
    return
  fi
  #Omnios
  if python3 -c "import datetime; print(int(datetime.datetime.strptime(\"$1\", \"%Y-%m-%d %H:%M:%S\").replace(tzinfo=datetime.timezone.utc).timestamp()))" 2>/dev/null; then
    return
  fi
  #Omnios
  if python3 -c "import datetime; print(int(datetime.datetime.strptime(\"$1\", \"%Y-%m-%dT%H:%M:%SZ\").replace(tzinfo=datetime.timezone.utc).timestamp()))" 2>/dev/null; then
    return
  fi
  _err "Cannot parse _date2time $1"
  return 1
}

_utc_date() {
  date -u "+%Y-%m-%d %H:%M:%S"
}

_mktemp() {
  if _exists mktemp; then
    if mktemp 2>/dev/null; then
      return 0
    elif _contains "$(mktemp 2>&1)" "-t prefix" && mktemp -t "$PROJECT_NAME" 2>/dev/null; then
      #for Mac osx
      return 0
    fi
  fi
  if [ -d "/tmp" ]; then
    echo "/tmp/${PROJECT_NAME}wefADf24sf.$(_time).tmp"
    return 0
  elif [ "$LE_TEMP_DIR" ] && mkdir -p "$LE_TEMP_DIR"; then
    echo "/$LE_TEMP_DIR/wefADf24sf.$(_time).tmp"
    return 0
  fi
  _err "Cannot create temp file."
}

#clear all the https envs to cause _inithttp() to run next time.
_resethttp() {
  __HTTP_INITIALIZED=""
  _ACME_CURL=""
  _ACME_WGET=""
  ACME_HTTP_NO_REDIRECTS=""
}

_inithttp() {

  if [ -z "$HTTP_HEADER" ] || ! touch "$HTTP_HEADER"; then
    HTTP_HEADER="$(_mktemp)"
    _debug2 HTTP_HEADER "$HTTP_HEADER"
  fi

  if [ "$__HTTP_INITIALIZED" ]; then
    if [ "$_ACME_CURL$_ACME_WGET" ]; then
      _debug2 "Http already initialized."
      return 0
    fi
  fi

  if [ -z "$_ACME_CURL" ] && _exists "curl"; then
    _ACME_CURL="curl --silent --dump-header $HTTP_HEADER "
    if [ "$ACME_USE_IPV6_REQUESTS" ]; then
      _ACME_CURL="$_ACME_CURL --ipv6 "
    elif [ "$ACME_USE_IPV4_REQUESTS" ]; then
      _ACME_CURL="$_ACME_CURL --ipv4 "
    fi
    if [ -z "$ACME_HTTP_NO_REDIRECTS" ]; then
      _ACME_CURL="$_ACME_CURL -L "
    fi
    if [ "$DEBUG" ] && [ "$DEBUG" -ge 2 ]; then
      _CURL_DUMP="$(_mktemp)"
      _ACME_CURL="$_ACME_CURL --trace-ascii $_CURL_DUMP "
    fi

    if [ "$CA_PATH" ]; then
      _ACME_CURL="$_ACME_CURL --capath $CA_PATH "
    elif [ "$CA_BUNDLE" ]; then
      _ACME_CURL="$_ACME_CURL --cacert $CA_BUNDLE "
    fi

    if _contains "$(curl --help 2>&1)" "--globoff" || _contains "$(curl --help curl 2>&1)" "--globoff"; then
      _ACME_CURL="$_ACME_CURL -g "
    fi

    #don't use --fail-with-body
    ##from curl 7.76: return fail on HTTP errors but keep the body
    #if _contains "$(curl --help http 2>&1)" "--fail-with-body"; then
    #  _ACME_CURL="$_ACME_CURL --fail-with-body "
    #fi
  fi

  if [ -z "$_ACME_WGET" ] && _exists "wget"; then
    _ACME_WGET="wget -q"
    if [ "$ACME_USE_IPV6_REQUESTS" ]; then
      _ACME_WGET="$_ACME_WGET --inet6-only "
    elif [ "$ACME_USE_IPV4_REQUESTS" ]; then
      _ACME_WGET="$_ACME_WGET --inet4-only "
    fi
    if [ "$ACME_HTTP_NO_REDIRECTS" ]; then
      _ACME_WGET="$_ACME_WGET --max-redirect 0 "
    fi
    if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
      if [ "$_ACME_WGET" ] && _contains "$($_ACME_WGET --help 2>&1)" "--debug"; then
        _ACME_WGET="$_ACME_WGET -d "
      fi
    fi
    if [ "$CA_PATH" ]; then
      _ACME_WGET="$_ACME_WGET --ca-directory=$CA_PATH "
    elif [ "$CA_BUNDLE" ]; then
      _ACME_WGET="$_ACME_WGET --ca-certificate=$CA_BUNDLE "
    fi

    #from wget 1.14: do not skip body on 404 error
    if _contains "$(wget --help 2>&1)" "--content-on-error"; then
      _ACME_WGET="$_ACME_WGET --content-on-error "
    fi
  fi

  __HTTP_INITIALIZED=1

}

# body  url [needbase64] [POST|PUT|DELETE] [ContentType]
_post() {
  body="$1"
  _post_url="$2"
  needbase64="$3"
  httpmethod="$4"
  _postContentType="$5"

  if [ -z "$httpmethod" ]; then
    httpmethod="POST"
  fi
  _debug $httpmethod
  _debug "_post_url" "$_post_url"
  _debug2 "body" "$body"
  _debug2 "_postContentType" "$_postContentType"

  _inithttp

  if [ "$_ACME_CURL" ] && [ "${ACME_USE_WGET:-0}" = "0" ]; then
    _CURL="$_ACME_CURL"
    if [ "$HTTPS_INSECURE" ]; then
      _CURL="$_CURL --insecure  "
    fi
    if [ "$httpmethod" = "HEAD" ]; then
      _CURL="$_CURL -I  "
    fi
    _debug "_CURL" "$_CURL"
    if [ "$needbase64" ]; then
      if [ "$body" ]; then
        if [ "$_postContentType" ]; then
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "Content-Type: $_postContentType" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" --data "$body" "$_post_url" | _base64)"
        else
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" --data "$body" "$_post_url" | _base64)"
        fi
      else
        if [ "$_postContentType" ]; then
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "Content-Type: $_postContentType" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$_post_url" | _base64)"
        else
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$_post_url" | _base64)"
        fi
      fi
    else
      if [ "$body" ]; then
        if [ "$_postContentType" ]; then
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "Content-Type: $_postContentType" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" --data "$body" "$_post_url")"
        else
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" --data "$body" "$_post_url")"
        fi
      else
        if [ "$_postContentType" ]; then
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "Content-Type: $_postContentType" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$_post_url")"
        else
          response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$_post_url")"
        fi
      fi
    fi
    _ret="$?"
    if [ "$_ret" != "0" ]; then
      _err "Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: $_ret"
      if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
        _err "Here is the curl dump log:"
        _err "$(cat "$_CURL_DUMP")"
      fi
    fi
  elif [ "$_ACME_WGET" ]; then
    _WGET="$_ACME_WGET"
    if [ "$HTTPS_INSECURE" ]; then
      _WGET="$_WGET --no-check-certificate "
    fi
    if [ "$httpmethod" = "HEAD" ]; then
      _WGET="$_WGET --read-timeout=3.0  --tries=2  "
    fi
    _debug "_WGET" "$_WGET"
    if [ "$needbase64" ]; then
      if [ "$httpmethod" = "POST" ]; then
        if [ "$_postContentType" ]; then
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --header "Content-Type: $_postContentType" --post-data="$body" "$_post_url" 2>"$HTTP_HEADER" | _base64)"
        else
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --post-data="$body" "$_post_url" 2>"$HTTP_HEADER" | _base64)"
        fi
      else
        if [ "$_postContentType" ]; then
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --header "Content-Type: $_postContentType" --method $httpmethod --body-data="$body" "$_post_url" 2>"$HTTP_HEADER" | _base64)"
        else
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --method $httpmethod --body-data="$body" "$_post_url" 2>"$HTTP_HEADER" | _base64)"
        fi
      fi
    else
      if [ "$httpmethod" = "POST" ]; then
        if [ "$_postContentType" ]; then
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --header "Content-Type: $_postContentType" --post-data="$body" "$_post_url" 2>"$HTTP_HEADER")"
        else
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --post-data="$body" "$_post_url" 2>"$HTTP_HEADER")"
        fi
      elif [ "$httpmethod" = "HEAD" ]; then
        if [ "$_postContentType" ]; then
          response="$($_WGET --spider -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --header "Content-Type: $_postContentType" --post-data="$body" "$_post_url" 2>"$HTTP_HEADER")"
        else
          response="$($_WGET --spider -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --post-data="$body" "$_post_url" 2>"$HTTP_HEADER")"
        fi
      else
        if [ "$_postContentType" ]; then
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --header "Content-Type: $_postContentType" --method $httpmethod --body-data="$body" "$_post_url" 2>"$HTTP_HEADER")"
        else
          response="$($_WGET -S -O - --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" --method $httpmethod --body-data="$body" "$_post_url" 2>"$HTTP_HEADER")"
        fi
      fi
    fi
    _ret="$?"
    if [ "$_ret" = "8" ]; then
      _ret=0
      _debug "wget returned 8 as the server returned a 'Bad Request' response. Let's process the response later."
    fi
    if [ "$_ret" != "0" ]; then
      _err "Please refer to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html for error code: $_ret"
    fi
    if _contains "$_WGET" " -d "; then
      # Demultiplex wget debug output
      cat "$HTTP_HEADER" >&2
      _sed_i '/^[^ ][^ ]/d; /^ *$/d' "$HTTP_HEADER"
    fi
    # remove leading whitespaces from header to match curl format
    _sed_i 's/^  //g' "$HTTP_HEADER"
  else
    _ret="$?"
    _err "Neither curl nor wget have been found, cannot make $httpmethod request."
  fi
  _debug "_ret" "$_ret"
  printf "%s" "$response"
  return $_ret
}

# url getheader timeout
_get() {
  _debug GET
  url="$1"
  onlyheader="$2"
  t="$3"
  _debug url "$url"
  _debug "timeout=$t"

  _inithttp

  if [ "$_ACME_CURL" ] && [ "${ACME_USE_WGET:-0}" = "0" ]; then
    _CURL="$_ACME_CURL"
    if [ "$HTTPS_INSECURE" ]; then
      _CURL="$_CURL --insecure  "
    fi
    if [ "$t" ]; then
      _CURL="$_CURL --connect-timeout $t"
    fi
    _debug "_CURL" "$_CURL"
    if [ "$onlyheader" ]; then
      $_CURL -I --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url"
    else
      $_CURL --user-agent "$USER_AGENT" -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" "$url"
    fi
    ret=$?
    if [ "$ret" != "0" ]; then
      _err "Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: $ret"
      if [ "$DEBUG" ] && [ "$DEBUG" -ge "2" ]; then
        _err "Here is the curl dump log:"
        _err "$(cat "$_CURL_DUMP")"
      fi
    fi
  elif [ "$_ACME_WGET" ]; then
    _WGET="$_ACME_WGET"
    if [ "$HTTPS_INSECURE" ]; then
      _WGET="$_WGET --no-check-certificate "
    fi
    if [ "$t" ]; then
      _WGET="$_WGET --timeout=$t"
    fi
    _debug "_WGET" "$_WGET"
    if [ "$onlyheader" ]; then
      _wget_out="$($_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O /dev/null "$url" 2>&1)"
      if _contains "$_WGET" " -d "; then
        # Demultiplex wget debug output
        echo "$_wget_out" >&2
        echo "$_wget_out" | sed '/^[^ ][^ ]/d; /^ *$/d; s/^  //g' -
      fi
    else
      $_WGET --user-agent="$USER_AGENT" --header "$_H5" --header "$_H4" --header "$_H3" --header "$_H2" --header "$_H1" -S -O - "$url" 2>"$HTTP_HEADER"
      if _contains "$_WGET" " -d "; then
        # Demultiplex wget debug output
        cat "$HTTP_HEADER" >&2
        _sed_i '/^[^ ][^ ]/d; /^ *$/d' "$HTTP_HEADER"
      fi
      # remove leading whitespaces from header to match curl format
      _sed_i 's/^  //g' "$HTTP_HEADER"
    fi
    ret=$?
    if [ "$ret" = "8" ]; then
      ret=0
      _debug "wget returned 8 as the server returned a 'Bad Request' response. Let's process the response later."
    fi
    if [ "$ret" != "0" ]; then
      _err "Please refer to https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html for error code: $ret"
    fi
  else
    ret=$?
    _err "Neither curl nor wget have been found, cannot make GET request."
  fi
  _debug "ret" "$ret"
  return $ret
}

_head_n() {
  head -n "$1"
}

_tail_n() {
  if _is_solaris; then
    #fix for solaris
    tail -"$1"
  else
    tail -n "$1"
  fi
}

_tail_c() {
  tail -c "$1" 2>/dev/null || tail -"$1"c
}

# url  payload needbase64  keyfile
_send_signed_request() {
  url=$1
  payload=$2
  needbase64=$3
  keyfile=$4
  if [ -z "$keyfile" ]; then
    keyfile="$ACCOUNT_KEY_PATH"
  fi
  _debug "=======Sending Signed Request======="
  _debug url "$url"
  _debug payload "$payload"

  if ! _calcjwk "$keyfile"; then
    return 1
  fi

  __request_conent_type="$CONTENT_TYPE_JSON"

  payload64=$(printf "%s" "$payload" | _base64 | _url_replace)
  _debug3 payload64 "$payload64"

  MAX_REQUEST_RETRY_TIMES=20
  _sleep_retry_sec=1
  _request_retry_times=0
  while [ "${_request_retry_times}" -lt "$MAX_REQUEST_RETRY_TIMES" ]; do
    _request_retry_times=$(_math "$_request_retry_times" + 1)
    _debug3 _request_retry_times "$_request_retry_times"
    if [ -z "$_CACHED_NONCE" ]; then
      _headers=""
      if [ "$ACME_NEW_NONCE" ]; then
        _debug2 "Get nonce with HEAD. ACME_NEW_NONCE" "$ACME_NEW_NONCE"
        nonceurl="$ACME_NEW_NONCE"
        if _post "" "$nonceurl" "" "HEAD" "$__request_conent_type" >/dev/null; then
          _headers="$(cat "$HTTP_HEADER")"
          _debug2 _headers "$_headers"
          _CACHED_NONCE="$(echo "$_headers" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2 | cut -d , -f 1)"
        fi
      fi
      if [ -z "$_CACHED_NONCE" ]; then
        _debug2 "Get nonce with GET. ACME_DIRECTORY" "$ACME_DIRECTORY"
        nonceurl="$ACME_DIRECTORY"
        _headers="$(_get "$nonceurl" "onlyheader")"
        _debug2 _headers "$_headers"
        _CACHED_NONCE="$(echo "$_headers" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2)"
      fi
      if [ -z "$_CACHED_NONCE" ] && [ "$ACME_NEW_NONCE" ]; then
        _debug2 "Get nonce with GET. ACME_NEW_NONCE" "$ACME_NEW_NONCE"
        nonceurl="$ACME_NEW_NONCE"
        _headers="$(_get "$nonceurl" "onlyheader")"
        _debug2 _headers "$_headers"
        _CACHED_NONCE="$(echo "$_headers" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2)"
      fi
      if [ "$?" != "0" ]; then
        _err "Cannot connect to $nonceurl to get nonce."
        return 1
      fi
    else
      _debug2 "Use _CACHED_NONCE" "$_CACHED_NONCE"
    fi
    nonce="$_CACHED_NONCE"
    _debug2 nonce "$nonce"
    if [ -z "$nonce" ]; then
      _info "Could not get nonce, let's try again."
      _sleep 2
      continue
    fi

    if [ "$url" = "$ACME_NEW_ACCOUNT" ]; then
      protected="$JWK_HEADERPLACE_PART1$nonce\", \"url\": \"${url}$JWK_HEADERPLACE_PART2, \"jwk\": $jwk"'}'
    elif [ "$url" = "$ACME_REVOKE_CERT" ] && [ "$keyfile" != "$ACCOUNT_KEY_PATH" ]; then
      protected="$JWK_HEADERPLACE_PART1$nonce\", \"url\": \"${url}$JWK_HEADERPLACE_PART2, \"jwk\": $jwk"'}'
    else
      protected="$JWK_HEADERPLACE_PART1$nonce\", \"url\": \"${url}$JWK_HEADERPLACE_PART2, \"kid\": \"${ACCOUNT_URL}\""'}'
    fi

    _debug3 protected "$protected"

    protected64="$(printf "%s" "$protected" | _base64 | _url_replace)"
    _debug3 protected64 "$protected64"

    if ! _sig_t="$(printf "%s" "$protected64.$payload64" | _sign "$keyfile" "sha256")"; then
      _err "Sign request failed."
      return 1
    fi
    _debug3 _sig_t "$_sig_t"

    sig="$(printf "%s" "$_sig_t" | _url_replace)"
    _debug3 sig "$sig"

    body="{\"protected\": \"$protected64\", \"payload\": \"$payload64\", \"signature\": \"$sig\"}"
    _debug3 body "$body"

    response="$(_post "$body" "$url" "$needbase64" "POST" "$__request_conent_type")"
    _CACHED_NONCE=""

    if [ "$?" != "0" ]; then
      _err "Cannot make POST request to $url"
      return 1
    fi

    responseHeaders="$(cat "$HTTP_HEADER")"
    _debug2 responseHeaders "$responseHeaders"

    code="$(grep "^HTTP" "$HTTP_HEADER" | _tail_n 1 | cut -d " " -f 2 | tr -d "\r\n")"
    _debug code "$code"

    _debug2 original "$response"
    if echo "$responseHeaders" | grep -i "Content-Type: *application/json" >/dev/null 2>&1; then
      response="$(echo "$response" | _json_decode | _normalizeJson)"
    fi
    _debug2 response "$response"

    _CACHED_NONCE="$(echo "$responseHeaders" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2 | cut -d , -f 1)"

    if ! _startswith "$code" "2"; then
      _body="$response"
      if [ "$needbase64" ]; then
        _body="$(echo "$_body" | _dbase64 multiline)"
        _debug3 _body "$_body"
      fi

      _retryafter=$(echo "$responseHeaders" | grep -i "^Retry-After *: *[0-9]\+ *" | cut -d : -f 2 | tr -d ' ' | tr -d '\r')
      if [ "$code" = '503' ]; then
        _sleep_overload_retry_sec=$_retryafter
        if [ -z "$_sleep_overload_retry_sec" ]; then
          _sleep_overload_retry_sec=5
        fi
        if [ $_sleep_overload_retry_sec -le 600 ]; then
          _info "It seems the CA server is currently overloaded, let's wait and retry. Sleeping for $_sleep_overload_retry_sec seconds."
          _sleep $_sleep_overload_retry_sec
          continue
        else
          _info "The retryafter=$_retryafter value is too large (> 600), will not retry anymore."
        fi
      fi
      if _contains "$_body" "JWS has invalid anti-replay nonce" || _contains "$_body" "JWS has an invalid anti-replay nonce"; then
        _info "It seems the CA server is busy now, let's wait and retry. Sleeping for $_sleep_retry_sec seconds."
        _CACHED_NONCE=""
        _sleep $_sleep_retry_sec
        continue
      fi
      if _contains "$_body" "The Replay Nonce is not recognized"; then
        _info "The replay nonce is not valid, let's get a new one. Sleeping for $_sleep_retry_sec seconds."
        _CACHED_NONCE=""
        _sleep $_sleep_retry_sec
        continue
      fi
    fi
    return 0
  done
  _info "Giving up sending to CA server after $MAX_REQUEST_RETRY_TIMES retries."
  return 1

}

#setopt "file"  "opt"  "="  "value" [";"]
_setopt() {
  __conf="$1"
  __opt="$2"
  __sep="$3"
  __val="$4"
  __end="$5"
  if [ -z "$__opt" ]; then
    _usage usage: _setopt '"file"  "opt"  "="  "value" [";"]'
    return
  fi
  if [ ! -f "$__conf" ]; then
    touch "$__conf"
    chmod 600 "$__conf"
  fi
  if [ -n "$(_tail_c 1 <"$__conf")" ]; then
    echo >>"$__conf"
  fi

  if grep -n "^$__opt$__sep" "$__conf" >/dev/null; then
    _debug3 OK
    if _contains "$__val" "&"; then
      __val="$(echo "$__val" | sed 's/&/\\&/g')"
    fi
    if _contains "$__val" "|"; then
      __val="$(echo "$__val" | sed 's/|/\\|/g')"
    fi
    text="$(cat "$__conf")"
    printf -- "%s\n" "$text" | sed "s|^$__opt$__sep.*$|$__opt$__sep$__val$__end|" >"$__conf"

  elif grep -n "^#$__opt$__sep" "$__conf" >/dev/null; then
    if _contains "$__val" "&"; then
      __val="$(echo "$__val" | sed 's/&/\\&/g')"
    fi
    if _contains "$__val" "|"; then
      __val="$(echo "$__val" | sed 's/|/\\|/g')"
    fi
    text="$(cat "$__conf")"
    printf -- "%s\n" "$text" | sed "s|^#$__opt$__sep.*$|$__opt$__sep$__val$__end|" >"$__conf"

  else
    _debug3 APP
    echo "$__opt$__sep$__val$__end" >>"$__conf"
  fi
  _debug3 "$(grep -n "^$__opt$__sep" "$__conf")"
}

#_save_conf  file key  value base64encode
#save to conf
_save_conf() {
  _s_c_f="$1"
  _sdkey="$2"
  _sdvalue="$3"
  _b64encode="$4"
  if [ "$_sdvalue" ] && [ "$_b64encode" ]; then
    _sdvalue="${B64CONF_START}$(printf "%s" "${_sdvalue}" | _base64)${B64CONF_END}"
  fi
  if [ "$_s_c_f" ]; then
    _setopt "$_s_c_f" "$_sdkey" "=" "'$_sdvalue'"
  else
    _err "Config file is empty, cannot save $_sdkey=$_sdvalue"
  fi
}

#_clear_conf file  key
_clear_conf() {
  _c_c_f="$1"
  _sdkey="$2"
  if [ "$_c_c_f" ]; then
    _conf_data="$(cat "$_c_c_f")"
    echo "$_conf_data" | sed "/^$_sdkey *=.*$/d" >"$_c_c_f"
  else
    _err "Config file is empty, cannot clear"
  fi
}

#_read_conf file  key
_read_conf() {
  _r_c_f="$1"
  _sdkey="$2"
  if [ -f "$_r_c_f" ]; then
    _sdv="$(
      eval "$(grep "^$_sdkey *=" "$_r_c_f")"
      eval "printf \"%s\" \"\$$_sdkey\""
    )"
    if _startswith "$_sdv" "${B64CONF_START}" && _endswith "$_sdv" "${B64CONF_END}"; then
      _sdv="$(echo "$_sdv" | sed "s/${B64CONF_START}//" | sed "s/${B64CONF_END}//" | _dbase64)"
    fi
    printf "%s" "$_sdv"
  else
    _debug "Config file is empty, cannot read $_sdkey"
  fi
}

#_savedomainconf   key  value  base64encode
#save to domain.conf
_savedomainconf() {
  _save_conf "$DOMAIN_CONF" "$@"
}

#_cleardomainconf   key
_cleardomainconf() {
  _clear_conf "$DOMAIN_CONF" "$1"
}

#_readdomainconf   key
_readdomainconf() {
  _read_conf "$DOMAIN_CONF" "$1"
}

#_migratedomainconf   oldkey  newkey  base64encode
_migratedomainconf() {
  _old_key="$1"
  _new_key="$2"
  _b64encode="$3"
  _old_value=$(_readdomainconf "$_old_key")
  _cleardomainconf "$_old_key"
  if [ -z "$_old_value" ]; then
    return 1 # migrated failed: old value is empty
  fi
  _new_value=$(_readdomainconf "$_new_key")
  if [ -n "$_new_value" ]; then
    _debug "Domain config new key exists, ol
Download .txt
gitextract_r8jn0t7t/

├── .github/
│   ├── FUNDING.yml
│   ├── ISSUE_TEMPLATE.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── copilot-instructions.md
│   └── workflows/
│       ├── DNS.yml
│       ├── DragonFlyBSD.yml
│       ├── FreeBSD.yml
│       ├── Haiku.yml
│       ├── Linux.yml
│       ├── MacOS.yml
│       ├── NetBSD.yml
│       ├── Omnios.yml
│       ├── OpenBSD.yml
│       ├── OpenIndiana.yml
│       ├── PebbleStrict.yml
│       ├── Solaris.yml
│       ├── Ubuntu.yml
│       ├── Windows.yml
│       ├── dockerhub.yml
│       ├── issue.yml
│       ├── pr_dns.yml
│       ├── pr_notify.yml
│       ├── shellcheck.yml
│       └── wiki-monitor.yml
├── Dockerfile
├── LICENSE.md
├── README.md
├── acme.sh
├── deploy/
│   ├── README.md
│   ├── ali_cdn.sh
│   ├── ali_dcdn.sh
│   ├── apache.sh
│   ├── cachefly.sh
│   ├── cleverreach.sh
│   ├── consul.sh
│   ├── cpanel_uapi.sh
│   ├── directadmin.sh
│   ├── docker.sh
│   ├── dovecot.sh
│   ├── edgio.sh
│   ├── exim4.sh
│   ├── fritzbox.sh
│   ├── gcore_cdn.sh
│   ├── gitlab.sh
│   ├── haproxy.sh
│   ├── kemplm.sh
│   ├── keychain.sh
│   ├── keyhelp.sh
│   ├── keyhelp_api.sh
│   ├── kong.sh
│   ├── lighttpd.sh
│   ├── localcopy.sh
│   ├── mailcow.sh
│   ├── multideploy.sh
│   ├── myapi.sh
│   ├── mydevil.sh
│   ├── mysqld.sh
│   ├── netlify.sh
│   ├── nginx.sh
│   ├── openmediavault.sh
│   ├── opensshd.sh
│   ├── openstack.sh
│   ├── panos.sh
│   ├── peplink.sh
│   ├── proxmoxbs.sh
│   ├── proxmoxve.sh
│   ├── pureftpd.sh
│   ├── qiniu.sh
│   ├── routeros.sh
│   ├── ruckus.sh
│   ├── ssh.sh
│   ├── strongswan.sh
│   ├── synology_dsm.sh
│   ├── truenas.sh
│   ├── truenas_ws.sh
│   ├── unifi.sh
│   ├── vault.sh
│   ├── vault_cli.sh
│   ├── vsftpd.sh
│   └── zyxel_gs1900.sh
├── dnsapi/
│   ├── README.md
│   ├── dns_1984hosting.sh
│   ├── dns_acmedns.sh
│   ├── dns_acmeproxy.sh
│   ├── dns_active24.sh
│   ├── dns_ad.sh
│   ├── dns_ali.sh
│   ├── dns_alviy.sh
│   ├── dns_anx.sh
│   ├── dns_artfiles.sh
│   ├── dns_arvan.sh
│   ├── dns_aurora.sh
│   ├── dns_autodns.sh
│   ├── dns_aws.sh
│   ├── dns_azion.sh
│   ├── dns_azure.sh
│   ├── dns_beget.sh
│   ├── dns_bookmyname.sh
│   ├── dns_bunny.sh
│   ├── dns_cf.sh
│   ├── dns_clouddns.sh
│   ├── dns_cloudns.sh
│   ├── dns_cn.sh
│   ├── dns_conoha.sh
│   ├── dns_constellix.sh
│   ├── dns_cpanel.sh
│   ├── dns_curanet.sh
│   ├── dns_cyon.sh
│   ├── dns_da.sh
│   ├── dns_ddnss.sh
│   ├── dns_desec.sh
│   ├── dns_df.sh
│   ├── dns_dgon.sh
│   ├── dns_dnsexit.sh
│   ├── dns_dnshome.sh
│   ├── dns_dnsimple.sh
│   ├── dns_dnsservices.sh
│   ├── dns_doapi.sh
│   ├── dns_domeneshop.sh
│   ├── dns_dp.sh
│   ├── dns_dpi.sh
│   ├── dns_dreamhost.sh
│   ├── dns_duckdns.sh
│   ├── dns_durabledns.sh
│   ├── dns_dyn.sh
│   ├── dns_dynu.sh
│   ├── dns_dynv6.sh
│   ├── dns_easydns.sh
│   ├── dns_edgecenter.sh
│   ├── dns_edgedns.sh
│   ├── dns_efficientip.sh
│   ├── dns_euserv.sh
│   ├── dns_exoscale.sh
│   ├── dns_fornex.sh
│   ├── dns_freedns.sh
│   ├── dns_freemyip.sh
│   ├── dns_gandi_livedns.sh
│   ├── dns_gcloud.sh
│   ├── dns_gcore.sh
│   ├── dns_gd.sh
│   ├── dns_geoscaling.sh
│   ├── dns_googledomains.sh
│   ├── dns_he.sh
│   ├── dns_he_ddns.sh
│   ├── dns_hetzner.sh
│   ├── dns_hetznercloud.sh
│   ├── dns_hexonet.sh
│   ├── dns_hostingde.sh
│   ├── dns_hostup.sh
│   ├── dns_huaweicloud.sh
│   ├── dns_infoblox.sh
│   ├── dns_infoblox_uddi.sh
│   ├── dns_infomaniak.sh
│   ├── dns_internetbs.sh
│   ├── dns_inwx.sh
│   ├── dns_ionos.sh
│   ├── dns_ionos_cloud.sh
│   ├── dns_ipv64.sh
│   ├── dns_ispconfig.sh
│   ├── dns_jd.sh
│   ├── dns_joker.sh
│   ├── dns_kappernet.sh
│   ├── dns_kas.sh
│   ├── dns_kinghost.sh
│   ├── dns_knot.sh
│   ├── dns_la.sh
│   ├── dns_leaseweb.sh
│   ├── dns_lexicon.sh
│   ├── dns_limacity.sh
│   ├── dns_linode.sh
│   ├── dns_linode_v4.sh
│   ├── dns_loopia.sh
│   ├── dns_lua.sh
│   ├── dns_maradns.sh
│   ├── dns_me.sh
│   ├── dns_mgwm.sh
│   ├── dns_miab.sh
│   ├── dns_mijnhost.sh
│   ├── dns_misaka.sh
│   ├── dns_myapi.sh
│   ├── dns_mydevil.sh
│   ├── dns_mydnsjp.sh
│   ├── dns_mythic_beasts.sh
│   ├── dns_namecheap.sh
│   ├── dns_namecom.sh
│   ├── dns_namesilo.sh
│   ├── dns_nanelo.sh
│   ├── dns_nederhost.sh
│   ├── dns_neodigit.sh
│   ├── dns_netcup.sh
│   ├── dns_netlify.sh
│   ├── dns_nic.sh
│   ├── dns_njalla.sh
│   ├── dns_nm.sh
│   ├── dns_nsd.sh
│   ├── dns_nsone.sh
│   ├── dns_nsupdate.sh
│   ├── dns_nw.sh
│   ├── dns_oci.sh
│   ├── dns_omglol.sh
│   ├── dns_one.sh
│   ├── dns_online.sh
│   ├── dns_openprovider.sh
│   ├── dns_openprovider_rest.sh
│   ├── dns_openstack.sh
│   ├── dns_opnsense.sh
│   ├── dns_opusdns.sh
│   ├── dns_ovh.sh
│   ├── dns_pdns.sh
│   ├── dns_pleskxml.sh
│   ├── dns_pointhq.sh
│   ├── dns_porkbun.sh
│   ├── dns_qc.sh
│   ├── dns_rackcorp.sh
│   ├── dns_rackspace.sh
│   ├── dns_rage4.sh
│   ├── dns_rcode0.sh
│   ├── dns_regru.sh
│   ├── dns_scaleway.sh
│   ├── dns_schlundtech.sh
│   ├── dns_selectel.sh
│   ├── dns_selfhost.sh
│   ├── dns_servercow.sh
│   ├── dns_simply.sh
│   ├── dns_sotoon.sh
│   ├── dns_spaceship.sh
│   ├── dns_technitium.sh
│   ├── dns_tele3.sh
│   ├── dns_tencent.sh
│   ├── dns_timeweb.sh
│   ├── dns_transip.sh
│   ├── dns_udr.sh
│   ├── dns_ultra.sh
│   ├── dns_unoeuro.sh
│   ├── dns_variomedia.sh
│   ├── dns_veesp.sh
│   ├── dns_vercel.sh
│   ├── dns_virakcloud.sh
│   ├── dns_vscale.sh
│   ├── dns_vultr.sh
│   ├── dns_websupport.sh
│   ├── dns_west_cn.sh
│   ├── dns_world4you.sh
│   ├── dns_yandex360.sh
│   ├── dns_yc.sh
│   ├── dns_zilore.sh
│   ├── dns_zone.sh
│   ├── dns_zoneedit.sh
│   └── dns_zonomi.sh
└── notify/
    ├── aws_ses.sh
    ├── bark.sh
    ├── callmebotWhatsApp.sh
    ├── cqhttp.sh
    ├── dingtalk.sh
    ├── discord.sh
    ├── feishu.sh
    ├── gotify.sh
    ├── ifttt.sh
    ├── mail.sh
    ├── mailgun.sh
    ├── mattermost.sh
    ├── ntfy.sh
    ├── opsgenie.sh
    ├── pop.sh
    ├── postmark.sh
    ├── pushbullet.sh
    ├── pushover.sh
    ├── sendgrid.sh
    ├── slack.sh
    ├── slack_app.sh
    ├── smtp.sh
    ├── teams.sh
    ├── telegram.sh
    ├── weixin_work.sh
    └── xmpp.sh
Condensed preview — 275 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,860K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 639,
    "preview": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [u"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 668,
    "preview": "<!--\r\n我很忙, 每天可能只有 几秒钟 时间看你的 issue, 如果不按照我的要求写 issue, 你可能不会得到任何回复, 石沉大海.\r\n\r\n请确保已经更新到最新的代码, 然后贴上来 `--debug 2` 的调试输出. 没有调试信"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 355,
    "preview": "<!--\r\n1. Do NOT send pull request to `master` branch.\r\nPlease send to `dev` branch instead.\r\nAny PR to `master` branch w"
  },
  {
    "path": ".github/copilot-instructions.md",
    "chars": 4234,
    "preview": "# GitHub Copilot Shell Scripting (sh) Review Instructions\r\n\r\n## 🎯 Overall Goal\r\n\r\nYour role is to act as a rigorous yet "
  },
  {
    "path": ".github/workflows/DNS.yml",
    "chars": 26044,
    "preview": "name: DNS\non:\n  workflow_dispatch:\n  push:\n    paths:\n      - 'dnsapi/*.sh'\n      - '.github/workflows/DNS.yml'\n  pull_r"
  },
  {
    "path": ".github/workflows/DragonFlyBSD.yml",
    "chars": 2101,
    "preview": "name: DragonFlyBSD\non:\n  push:\n    branches:\n      - '*'\n    paths:\n      - '*.sh'\n      - '.github/workflows/DragonFlyB"
  },
  {
    "path": ".github/workflows/FreeBSD.yml",
    "chars": 2302,
    "preview": "name: FreeBSD\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/FreeBSD."
  },
  {
    "path": ".github/workflows/Haiku.yml",
    "chars": 2284,
    "preview": "name: Haiku\non:\n  push:\n    branches:\n      - '*'\n    paths:\n      - '*.sh'\n      - '.github/workflows/Haiku.yml'\n\n  pul"
  },
  {
    "path": ".github/workflows/Linux.yml",
    "chars": 1303,
    "preview": "name: Linux\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/Linux.yml'"
  },
  {
    "path": ".github/workflows/MacOS.yml",
    "chars": 1711,
    "preview": "name: MacOS\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/MacOS.yml'"
  },
  {
    "path": ".github/workflows/NetBSD.yml",
    "chars": 2046,
    "preview": "name: NetBSD\non:\n  push:\n    branches:\n      - '*'\n    paths:\n      - '*.sh'\n      - '.github/workflows/NetBSD.yml'\n\n  p"
  },
  {
    "path": ".github/workflows/Omnios.yml",
    "chars": 2189,
    "preview": "name: Omnios\non:\n  push:\n    branches:\n      - '*'\n    paths:\n      - '*.sh'\n      - '.github/workflows/Omnios.yml'\n\n  p"
  },
  {
    "path": ".github/workflows/OpenBSD.yml",
    "chars": 2306,
    "preview": "name: OpenBSD\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/OpenBSD."
  },
  {
    "path": ".github/workflows/OpenIndiana.yml",
    "chars": 2214,
    "preview": "name: OpenIndiana\non:\n  push:\n    branches:\n      - '*'\n    paths:\n      - '*.sh'\n      - '.github/workflows/OpenIndiana"
  },
  {
    "path": ".github/workflows/PebbleStrict.yml",
    "chars": 2172,
    "preview": "name: PebbleStrict\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/Peb"
  },
  {
    "path": ".github/workflows/Solaris.yml",
    "chars": 2234,
    "preview": "name: Solaris\non:\n  push:\n    branches:\n      - '*'\n    paths:\n      - '*.sh'\n      - '.github/workflows/Solaris.yml'\n\n "
  },
  {
    "path": ".github/workflows/Ubuntu.yml",
    "chars": 3420,
    "preview": "name: Ubuntu\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/Ubuntu.ym"
  },
  {
    "path": ".github/workflows/Windows.yml",
    "chars": 2494,
    "preview": "name: Windows\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '*.sh'\r\n      - '.github/workflows/Windows."
  },
  {
    "path": ".github/workflows/dockerhub.yml",
    "chars": 2548,
    "preview": "\r\nname: Build DockerHub\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    tags:\r\n      - '*'\r\n    paths:\r\n      - '**.sh'\r\n"
  },
  {
    "path": ".github/workflows/issue.yml",
    "chars": 644,
    "preview": "name: \"Update issues\"\non:\n  issues:\n    types: [opened]\n\njobs:\n  comment:\n    runs-on: ubuntu-latest\n    steps:\n      - "
  },
  {
    "path": ".github/workflows/pr_dns.yml",
    "chars": 1202,
    "preview": "name: Check dns api\n\non:\n  pull_request_target:\n    types:\n      - opened\n    paths:\n      - 'dnsapi/*.sh'\n\n\njobs:\n  wel"
  },
  {
    "path": ".github/workflows/pr_notify.yml",
    "chars": 866,
    "preview": "name: Check notify api\n\non:\n  pull_request_target:\n    types:\n      - opened\n    branches:\n      - 'dev'\n    paths:\n    "
  },
  {
    "path": ".github/workflows/shellcheck.yml",
    "chars": 981,
    "preview": "name: Shellcheck\r\non:\r\n  push:\r\n    branches:\r\n      - '*'\r\n    paths:\r\n      - '**.sh'\r\n      - '.github/workflows/shel"
  },
  {
    "path": ".github/workflows/wiki-monitor.yml",
    "chars": 2117,
    "preview": "name: Notify via Issue on Wiki Edit\r\n\r\non:\r\n  gollum:\r\n\r\njobs:\r\n  notify:\r\n    runs-on: ubuntu-latest\r\n    if: github.ac"
  },
  {
    "path": "Dockerfile",
    "chars": 2403,
    "preview": "FROM alpine:3.22\n\nRUN apk --no-cache add -f \\\n  openssl \\\n  openssh-client \\\n  coreutils \\\n  bind-tools \\\n  curl \\\n  sed"
  },
  {
    "path": "LICENSE.md",
    "chars": 35149,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 25240,
    "preview": "<p align=\"center\">\n  <a href=\"https://zerossl.com/?fromacme.sh\">\n    <img src=\"https://github.com/user-attachments/asset"
  },
  {
    "path": "acme.sh",
    "chars": 235088,
    "preview": "#!/usr/bin/env sh\n\nVER=3.1.3\n\nPROJECT_NAME=\"acme.sh\"\n\nPROJECT_ENTRY=\"acme.sh\"\n\nPROJECT=\"https://github.com/acmesh-offici"
  },
  {
    "path": "deploy/README.md",
    "chars": 101,
    "preview": "# Using deploy api\n\ndeploy hook usage:\n\nhttps://github.com/acmesh-official/acme.sh/wiki/deployhooks\n\n"
  },
  {
    "path": "deploy/ali_cdn.sh",
    "chars": 2753,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034,SC2154\n\n# Script to create certificate to Alibaba Cloud CDN\n#\n# Docs: http"
  },
  {
    "path": "deploy/ali_dcdn.sh",
    "chars": 2780,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034,SC2154\n\n# Script to create certificate to Alibaba Cloud DCDN\n#\n# Docs: htt"
  },
  {
    "path": "deploy/apache.sh",
    "chars": 512,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to apache server.\n\n#returns 0 means success, otherwise error.\n\n#####"
  },
  {
    "path": "deploy/cachefly.sh",
    "chars": 1614,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificate to CacheFly\n# https://api.cachefly.com/api/2.5/docs#tag/Certificates/p"
  },
  {
    "path": "deploy/cleverreach.sh",
    "chars": 3520,
    "preview": "#!/usr/bin/env sh\n# Here is the script to deploy the cert to your CleverReach Account using the CleverReach REST API.\n# "
  },
  {
    "path": "deploy/consul.sh",
    "chars": 3138,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert to hashicorp consul using curl\n# (https://www.consul.io/)\n#\n# it re"
  },
  {
    "path": "deploy/cpanel_uapi.sh",
    "chars": 7683,
    "preview": "#!/usr/bin/env sh\n# Here is the script to deploy the cert to your cpanel using the cpanel API.\n# Uses command line uapi."
  },
  {
    "path": "deploy/directadmin.sh",
    "chars": 3025,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificate to DirectAdmin\n# https://docs.directadmin.com/directadmin/customizing-"
  },
  {
    "path": "deploy/docker.sh",
    "chars": 9332,
    "preview": "#!/usr/bin/env sh\n\n#DEPLOY_DOCKER_CONTAINER_LABEL=\"xxxxxxx\"\n\n#DEPLOY_DOCKER_CONTAINER_KEY_FILE=\"/path/to/key.pem\"\n#DEPLO"
  },
  {
    "path": "deploy/dovecot.sh",
    "chars": 484,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to dovecot server.\n\n#returns 0 means success, otherwise error.\n\n####"
  },
  {
    "path": "deploy/edgio.sh",
    "chars": 2987,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert to edgio using its API\n# https://docs.edg.io/guides/v7/develop/rest"
  },
  {
    "path": "deploy/exim4.sh",
    "chars": 3195,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to exim4 server.\n\n#returns 0 means success, otherwise error.\n\n#DEPLO"
  },
  {
    "path": "deploy/fritzbox.sh",
    "chars": 4659,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to an AVM FRITZ!Box router.\n\n#returns 0 means success, otherwise err"
  },
  {
    "path": "deploy/gcore_cdn.sh",
    "chars": 4780,
    "preview": "#!/usr/bin/env sh\n\n# Here is the script to deploy the cert to G-Core CDN service (https://gcore.com/) using the G-Core L"
  },
  {
    "path": "deploy/gitlab.sh",
    "chars": 2082,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificate to a Gitlab hosted page\n\n# The following variables exported from envir"
  },
  {
    "path": "deploy/haproxy.sh",
    "chars": 15789,
    "preview": "#!/usr/bin/env sh\n\n# Script for acme.sh to deploy certificates to haproxy\n#\n# The following variables can be exported:\n#"
  },
  {
    "path": "deploy/kemplm.sh",
    "chars": 3193,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to a Kemp Loadmaster.\n\n#returns 0 means success, otherwise error.\n\n#"
  },
  {
    "path": "deploy/keychain.sh",
    "chars": 669,
    "preview": "#!/usr/bin/env sh\n\n########  Public functions #####################\n\n#domain keyfile certfile cafile fullchain\nkeychain_"
  },
  {
    "path": "deploy/keyhelp.sh",
    "chars": 5088,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificate to KeyHelp\n# This deployment required following variables\n# export DEP"
  },
  {
    "path": "deploy/keyhelp_api.sh",
    "chars": 2414,
    "preview": "#!/usr/bin/env sh\n\nkeyhelp_api_deploy() {\n  _cdomain=\"$1\"\n  _ckey=\"$2\"\n  _ccert=\"$3\"\n  _cca=\"$4\"\n\n  _debug _cdomain \"$_c"
  },
  {
    "path": "deploy/kong.sh",
    "chars": 2886,
    "preview": "#!/usr/bin/env sh\n# If certificate already exists it will update only cert and key, not touching other parameters\n# If c"
  },
  {
    "path": "deploy/lighttpd.sh",
    "chars": 10156,
    "preview": "#!/usr/bin/env sh\n\n# Script for acme.sh to deploy certificates to lighttpd\n#\n# The following variables can be exported:\n"
  },
  {
    "path": "deploy/localcopy.sh",
    "chars": 5278,
    "preview": "#!/usr/bin/env sh\n\n# Deploy-hook to very simply copy files to set directories and then\n# execute whatever reloadcmd the "
  },
  {
    "path": "deploy/mailcow.sh",
    "chars": 1831,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to mailcow.\n\n#returns 0 means success, otherwise error.\n\n########  P"
  },
  {
    "path": "deploy/multideploy.sh",
    "chars": 9431,
    "preview": "#!/usr/bin/env sh\n\n################################################################################\n# ACME.sh 3rd party "
  },
  {
    "path": "deploy/myapi.sh",
    "chars": 592,
    "preview": "#!/usr/bin/env sh\n\n#Here is a sample custom api script.\n#This file name is \"myapi.sh\"\n#So, here must be a method   myapi"
  },
  {
    "path": "deploy/mydevil.sh",
    "chars": 1472,
    "preview": "#!/usr/bin/env sh\n\n# MyDevil.net API (2019-02-03)\n#\n# MyDevil.net already supports automatic Let's Encrypt certificates,"
  },
  {
    "path": "deploy/mysqld.sh",
    "chars": 512,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to mysqld server.\n\n#returns 0 means success, otherwise error.\n\n#####"
  },
  {
    "path": "deploy/netlify.sh",
    "chars": 2108,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificate to Netlify\n# https://docs.netlify.com/api/get-started/#authentication\n"
  },
  {
    "path": "deploy/nginx.sh",
    "chars": 509,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to nginx server.\n\n#returns 0 means success, otherwise error.\n\n######"
  },
  {
    "path": "deploy/openmediavault.sh",
    "chars": 6401,
    "preview": "#!/usr/bin/env sh\n\n# This deploy hook is tested on OpenMediaVault 5.x. It supports both local and remote deployment.\n# T"
  },
  {
    "path": "deploy/opensshd.sh",
    "chars": 518,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to opensshd server.\n\n#returns 0 means success, otherwise error.\n\n###"
  },
  {
    "path": "deploy/openstack.sh",
    "chars": 8699,
    "preview": "#!/usr/bin/env sh\n\n# OpenStack Barbican deploy hook\n#\n# This requires you to have OpenStackClient and python-barbicancli"
  },
  {
    "path": "deploy/panos.sh",
    "chars": 13107,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificates to Palo Alto Networks PANOS via API\n# Note PANOS API KEY and IP addre"
  },
  {
    "path": "deploy/peplink.sh",
    "chars": 4447,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy cert to Peplink Routers\n#\n# The following environment variables must be set:\n#\n# P"
  },
  {
    "path": "deploy/proxmoxbs.sh",
    "chars": 4733,
    "preview": "#!/usr/bin/env sh\n\n# Deploy certificates to a proxmox backup server using the API.\n#\n# Environment variables that can be"
  },
  {
    "path": "deploy/proxmoxve.sh",
    "chars": 5274,
    "preview": "#!/usr/bin/env sh\n\n# Deploy certificates to a proxmox virtual environment node using the API.\n#\n# Environment variables "
  },
  {
    "path": "deploy/pureftpd.sh",
    "chars": 518,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to pureftpd server.\n\n#returns 0 means success, otherwise error.\n\n###"
  },
  {
    "path": "deploy/qiniu.sh",
    "chars": 3195,
    "preview": "#!/usr/bin/env sh\n\n# Script to create certificate to qiniu.com\n#\n# This deployment required following variables\n# export"
  },
  {
    "path": "deploy/routeros.sh",
    "chars": 6128,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert to routeros router.\n# Deploy the cert to remote routeros\n#\n# ```sh\n"
  },
  {
    "path": "deploy/ruckus.sh",
    "chars": 6185,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert to Ruckus ZoneDirector / Unleashed.\n#\n# Public domain, 2024, Tony R"
  },
  {
    "path": "deploy/ssh.sh",
    "chars": 15875,
    "preview": "#!/usr/bin/env sh\n\n# Script to deploy certificates to remote server by SSH\n# Note that SSH must be able to login to remo"
  },
  {
    "path": "deploy/strongswan.sh",
    "chars": 2684,
    "preview": "#!/usr/bin/env sh\n\n#Here is a sample custom api script.\n#This file name is \"myapi.sh\"\n#So, here must be a method   myapi"
  },
  {
    "path": "deploy/synology_dsm.sh",
    "chars": 20667,
    "preview": "#!/bin/bash\n\n################################################################################\n# ACME.sh 3rd party deploy"
  },
  {
    "path": "deploy/truenas.sh",
    "chars": 12369,
    "preview": "#!/usr/bin/env sh\n\n# Here is a scipt to deploy the cert to your TrueNAS using the REST API.\n# https://www.truenas.com/do"
  },
  {
    "path": "deploy/truenas_ws.sh",
    "chars": 9435,
    "preview": "#!/usr/bin/env sh\n\n# TrueNAS deploy script for SCALE/CORE using websocket\n# It is recommend to use a wildcard certificat"
  },
  {
    "path": "deploy/unifi.sh",
    "chars": 13690,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert on a Unifi Controller or Cloud Key device.\n# It supports:\n#   - sel"
  },
  {
    "path": "deploy/vault.sh",
    "chars": 7022,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert to hashicorp vault using curl\n# (https://www.vaultproject.io/)\n#\n# "
  },
  {
    "path": "deploy/vault_cli.sh",
    "chars": 3662,
    "preview": "#!/usr/bin/env sh\n\n# Here is a script to deploy cert to hashicorp vault\n# (https://www.vaultproject.io/)\n#\n# it requires"
  },
  {
    "path": "deploy/vsftpd.sh",
    "chars": 3152,
    "preview": "#!/usr/bin/env sh\n\n#Here is a script to deploy cert to vsftpd server.\n\n#returns 0 means success, otherwise error.\n\n#DEPL"
  },
  {
    "path": "deploy/zyxel_gs1900.sh",
    "chars": 19066,
    "preview": "#!/usr/bin/env sh\n\n# Deploy certificates to Zyxel GS1900 series switches\n#\n# This script uses the https web administrati"
  },
  {
    "path": "dnsapi/README.md",
    "chars": 94,
    "preview": "# How to use DNS API\nDNS api usage:\n\n\nhttps://github.com/acmesh-official/acme.sh/wiki/dnsapi\n\n"
  },
  {
    "path": "dnsapi/dns_1984hosting.sh",
    "chars": 8763,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_1984hosting_info='1984.hosting\nDomains: 1984.is\nSite: 1984.hosting\nDoc"
  },
  {
    "path": "dnsapi/dns_acmedns.sh",
    "chars": 3711,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_acmedns_info='acme-dns Server API\n The acme-dns is a limited DNS serve"
  },
  {
    "path": "dnsapi/dns_acmeproxy.sh",
    "chars": 3227,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_acmeproxy_info='AcmeProxy Server API\n AcmeProxy can be used to as a si"
  },
  {
    "path": "dnsapi/dns_active24.sh",
    "chars": 5882,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_active24_info='Active24.cz\nSite: Active24.cz\nDocs: github.com/acmesh-o"
  },
  {
    "path": "dnsapi/dns_ad.sh",
    "chars": 3539,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ad_info='AlwaysData.com\nSite: AlwaysData.com\nDocs: github.com/acmesh-o"
  },
  {
    "path": "dnsapi/dns_ali.sh",
    "chars": 5826,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ali_info='AlibabaCloud.com\nDomains: Aliyun.com\nSite: AlibabaCloud.com\n"
  },
  {
    "path": "dnsapi/dns_alviy.sh",
    "chars": 4644,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_alviy_info='Alviy.com\nSite: Alviy.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_anx.sh",
    "chars": 3386,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_anx_info='Anexia.com CloudDNS\nSite: Anexia.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_artfiles.sh",
    "chars": 5168,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_artfiles_info='ArtFiles.de\nSite: ArtFiles.de\nDocs: github.com/acmesh-o"
  },
  {
    "path": "dnsapi/dns_arvan.sh",
    "chars": 4212,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_arvan_info='ArvanCloud.ir\nSite: ArvanCloud.ir\nDocs: github.com/acmesh-"
  },
  {
    "path": "dnsapi/dns_aurora.sh",
    "chars": 4941,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_aurora_info='versio.nl AuroraDNS\nDomains: pcextreme.nl\nSite: versio.nl"
  },
  {
    "path": "dnsapi/dns_autodns.sh",
    "chars": 5929,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_autodns_info='InternetX autoDNS\n InternetX autoDNS XML API\nSite: Inter"
  },
  {
    "path": "dnsapi/dns_aws.sh",
    "chars": 12576,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_aws_info='Amazon AWS Route53 domain API\nSite: docs.aws.amazon.com/rout"
  },
  {
    "path": "dnsapi/dns_azion.sh",
    "chars": 5566,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_azion_info='Azion.om\nSite: Azion.com\nDocs: github.com/acmesh-official/"
  },
  {
    "path": "dnsapi/dns_azure.sh",
    "chars": 16740,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_azure_info='Azure\nSite: Azure.microsoft.com\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_beget.sh",
    "chars": 7567,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_beget_info='Beget.com\nSite: Beget.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_bookmyname.sh",
    "chars": 3213,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_bookmyname_info='BookMyName.com\nSite: BookMyName.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_bunny.sh",
    "chars": 7827,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_bunny_info='Bunny.net\nSite: Bunny.net/dns/\nDocs: github.com/acmesh-off"
  },
  {
    "path": "dnsapi/dns_cf.sh",
    "chars": 7331,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_cf_info='CloudFlare\nSite: CloudFlare.com\nDocs: github.com/acmesh-offic"
  },
  {
    "path": "dnsapi/dns_clouddns.sh",
    "chars": 6624,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_clouddns_info='vshosting.cz CloudDNS\nSite: github.com/vshosting/cloudd"
  },
  {
    "path": "dnsapi/dns_cloudns.sh",
    "chars": 5980,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_cloudns_info='ClouDNS.net\nSite: ClouDNS.net\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_cn.sh",
    "chars": 3928,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_cn_info='Core-Networks.de\nSite: beta.api.Core-Networks.de/doc/\nDocs: g"
  },
  {
    "path": "dnsapi/dns_conoha.sh",
    "chars": 8501,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_conoha_info='ConoHa.jp\nDomains: ConoHa.io\nSite: ConoHa.jp\nDocs: github"
  },
  {
    "path": "dnsapi/dns_constellix.sh",
    "chars": 6059,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_constellix_info='Constellix.com\nSite: Constellix.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_cpanel.sh",
    "chars": 5113,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_cpanel_info='cPanel Server API\n Manage DNS via cPanel Dashboard.\nSite:"
  },
  {
    "path": "dnsapi/dns_curanet.sh",
    "chars": 4914,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_curanet_info='Curanet.dk\nDomains: scannet.dk wannafind.dk dandomain.dk"
  },
  {
    "path": "dnsapi/dns_cyon.sh",
    "chars": 10944,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_cyon_info='cyon.ch\nSite: cyon.ch\nDocs: github.com/acmesh-official/acme"
  },
  {
    "path": "dnsapi/dns_da.sh",
    "chars": 4991,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_da_info='DirectAdmin Server API\nSite: DirectAdmin.com/api.php\nDocs: gi"
  },
  {
    "path": "dnsapi/dns_ddnss.sh",
    "chars": 3594,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ddnss_info='DDNSS.de\nSite: DDNSS.de\nDocs: github.com/acmesh-official/a"
  },
  {
    "path": "dnsapi/dns_desec.sh",
    "chars": 5223,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_desec_info='deSEC.io\nSite: desec.readthedocs.io/en/latest/\nDocs: githu"
  },
  {
    "path": "dnsapi/dns_df.sh",
    "chars": 1702,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_df_info='DynDnsFree.de\nDomains: dynup.de\nSite: DynDnsFree.de\nDocs: git"
  },
  {
    "path": "dnsapi/dns_dgon.sh",
    "chars": 7802,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dgon_info='DigitalOcean.com\nSite: DigitalOcean.com/help/api/\nDocs: git"
  },
  {
    "path": "dnsapi/dns_dnsexit.sh",
    "chars": 4429,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dnsexit_info='DNSExit.com\nSite: DNSExit.com\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_dnshome.sh",
    "chars": 2461,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dnshome_info='dnsHome.de\nSite: dnsHome.de\nDocs: github.com/acmesh-offi"
  },
  {
    "path": "dnsapi/dns_dnsimple.sh",
    "chars": 4728,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dnsimple_info='DNSimple.com\nSite: DNSimple.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_dnsservices.sh",
    "chars": 9571,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dnsservices_info='DNS.Services\nSite: DNS.Services\nDocs: github.com/acm"
  },
  {
    "path": "dnsapi/dns_doapi.sh",
    "chars": 1796,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_doapi_info='Domain-Offensive do.de\n Official LetsEncrypt API for do.de"
  },
  {
    "path": "dnsapi/dns_domeneshop.sh",
    "chars": 4408,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_domeneshop_info='DomeneShop.no\nSite: DomeneShop.no\nDocs: github.com/ac"
  },
  {
    "path": "dnsapi/dns_dp.sh",
    "chars": 3913,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dp_info='DNSPod.cn\nSite: DNSPod.cn\nDocs: github.com/acmesh-official/ac"
  },
  {
    "path": "dnsapi/dns_dpi.sh",
    "chars": 3941,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dpi_info='DNSPod.com\nSite: DNSPod.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_dreamhost.sh",
    "chars": 2318,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dreamhost_info='DreamHost.com\nSite: DreamHost.com\nDocs: github.com/acm"
  },
  {
    "path": "dnsapi/dns_duckdns.sh",
    "chars": 3934,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_duckdns_info='DuckDNS.org\nSite: www.DuckDNS.org\nDocs: github.com/acmes"
  },
  {
    "path": "dnsapi/dns_durabledns.sh",
    "chars": 4953,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_durabledns_info='DurableDNS.com\nSite: DurableDNS.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_dyn.sh",
    "chars": 8001,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dyn_info='Dyn.com\nDomains: dynect.net\nSite: Dyn.com\nDocs: github.com/a"
  },
  {
    "path": "dnsapi/dns_dynu.sh",
    "chars": 5331,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dynu_info='Dynu.com\nSite: Dynu.com\nDocs: github.com/acmesh-official/ac"
  },
  {
    "path": "dnsapi/dns_dynv6.sh",
    "chars": 9005,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_dynv6_info='DynV6.com\nSite: DynV6.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_easydns.sh",
    "chars": 4493,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_easydns_info='easyDNS.net\nSite: easyDNS.net\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_edgecenter.sh",
    "chars": 4064,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_edgecenter_info='EdgeCenter.ru\nSite: EdgeCenter.ru\nDocs: github.com/ac"
  },
  {
    "path": "dnsapi/dns_edgedns.sh",
    "chars": 15703,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_edgedns_info='Akamai.com Edge DNS\nSite: techdocs.Akamai.com/edge-dns/r"
  },
  {
    "path": "dnsapi/dns_efficientip.sh",
    "chars": 5481,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_efficientip_info='efficientip.com\nSite: https://efficientip.com/\nDocs:"
  },
  {
    "path": "dnsapi/dns_euserv.sh",
    "chars": 9435,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_euserv_info='EUserv.com\nDomains: EUserv.eu\nSite: EUserv.com\nDocs: gith"
  },
  {
    "path": "dnsapi/dns_exoscale.sh",
    "chars": 6077,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_exoscale_info='Exoscale.com\nSite: Exoscale.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_fornex.sh",
    "chars": 3378,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_fornex_info='Fornex.com\nSite: Fornex.com\nDocs: github.com/acmesh-offic"
  },
  {
    "path": "dnsapi/dns_freedns.sh",
    "chars": 12320,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_freedns_info='FreeDNS\nSite: FreeDNS.afraid.org\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_freemyip.sh",
    "chars": 3605,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_freemyip_info='FreeMyIP.com\nSite: FreeMyIP.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_gandi_livedns.sh",
    "chars": 5593,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_gandi_livedns_info='Gandi.net LiveDNS\nSite: Gandi.net/domain/dns\nDocs:"
  },
  {
    "path": "dnsapi/dns_gcloud.sh",
    "chars": 5195,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_gcloud_info='Google Cloud DNS\nSite: Cloud.Google.com/dns\nDocs: github."
  },
  {
    "path": "dnsapi/dns_gcore.sh",
    "chars": 5189,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_gcore_info='Gcore.com\nSite: Gcore.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_gd.sh",
    "chars": 5231,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_gd_info='GoDaddy.com\nSite: GoDaddy.com\nDocs: github.com/acmesh-officia"
  },
  {
    "path": "dnsapi/dns_geoscaling.sh",
    "chars": 8149,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_geoscaling_info='GeoScaling.com\nSite: GeoScaling.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_googledomains.sh",
    "chars": 4595,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_googledomains_info='Google Domains\nSite: Domains.Google.com\nDocs: gith"
  },
  {
    "path": "dnsapi/dns_he.sh",
    "chars": 6516,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_he_info='Hurricane Electric HE.net\nSite: dns.he.net\nDocs: github.com/a"
  },
  {
    "path": "dnsapi/dns_he_ddns.sh",
    "chars": 1450,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_he_ddns_info='Hurricane Electric HE.net DDNS\nSite: dns.he.net\nDocs: gi"
  },
  {
    "path": "dnsapi/dns_hetzner.sh",
    "chars": 7039,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_hetzner_info='Hetzner.com\nSite: Hetzner.com\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_hetznercloud.sh",
    "chars": 18074,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_hetznercloud_info='Hetzner Cloud DNS\nSite: Hetzner.com\nDocs: github.co"
  },
  {
    "path": "dnsapi/dns_hexonet.sh",
    "chars": 4210,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_hexonet_info='Hexonet.com\nSite: Hexonet.com\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_hostingde.sh",
    "chars": 8850,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_hostingde_info='Hosting.de\nSite: Hosting.de\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_hostup.sh",
    "chars": 12566,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034,SC2154\n\ndns_hostup_info='HostUp DNS\nSite: hostup.se\nDocs: https://develope"
  },
  {
    "path": "dnsapi/dns_huaweicloud.sh",
    "chars": 9807,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_huaweicloud_info='HuaweiCloud.com\nSite: HuaweiCloud.com\nDocs: github.c"
  },
  {
    "path": "dnsapi/dns_infoblox.sh",
    "chars": 3957,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_infoblox_info='Infoblox.com\nSite: Infoblox.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_infoblox_uddi.sh",
    "chars": 7409,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_infoblox_uddi_info='Infoblox UDDI\nSite: Infoblox.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_infomaniak.sh",
    "chars": 5780,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_infomaniak_info='Infomaniak.com\nSite: Infomaniak.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_internetbs.sh",
    "chars": 5355,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_internetbs_info='InternetBS.net\nSite: InternetBS.net\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_inwx.sh",
    "chars": 10229,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_inwx_info='INWX.de\nSite: INWX.de\nDocs: github.com/acmesh-official/acme"
  },
  {
    "path": "dnsapi/dns_ionos.sh",
    "chars": 4165,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ionos_info='IONOS.de\nSite: IONOS.de\nDocs: github.com/acmesh-official/a"
  },
  {
    "path": "dnsapi/dns_ionos_cloud.sh",
    "chars": 4169,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ionos_cloud_info='IONOS Cloud DNS\nSite: ionos.com\nDocs: github.com/acm"
  },
  {
    "path": "dnsapi/dns_ipv64.sh",
    "chars": 4228,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ipv64_info='IPv64.net\nSite: IPv64.net\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_ispconfig.sh",
    "chars": 7587,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_ispconfig_info='ISPConfig Server API\nSite: ISPConfig.org\nDocs: github."
  },
  {
    "path": "dnsapi/dns_jd.sh",
    "chars": 8623,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_jd_info='jdcloud.com\nSite: jdcloud.com\nDocs: github.com/acmesh-officia"
  },
  {
    "path": "dnsapi/dns_joker.sh",
    "chars": 3098,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_joker_info='Joker.com\nSite: Joker.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_kappernet.sh",
    "chars": 4744,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_kappernet_info='kapper.net\nSite: kapper.net\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_kas.sh",
    "chars": 11607,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_kas_info='All-inkl Kas Server\nSite: kas.all-inkl.com\nDocs: github.com/"
  },
  {
    "path": "dnsapi/dns_kinghost.sh",
    "chars": 3133,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_kinghost_info='King.host\nDomains: KingHost.net KingHost.com.br\nSite: K"
  },
  {
    "path": "dnsapi/dns_knot.sh",
    "chars": 2294,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_knot_info='Knot Server knsupdate\nSite: www.knot-dns.cz/docs/2.5/html/m"
  },
  {
    "path": "dnsapi/dns_la.sh",
    "chars": 4666,
    "preview": "#!/usr/bin/env sh\n\n# LA_Id=\"123\"\n# LA_Sk=\"456\"\n# shellcheck disable=SC2034\ndns_la_info='dns.la\nSite: dns.la\nDocs: github"
  },
  {
    "path": "dnsapi/dns_leaseweb.sh",
    "chars": 3820,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_leaseweb_info='Leaseweb.com\nSite: Leaseweb.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_lexicon.sh",
    "chars": 3743,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_lexicon_info='Lexicon DNS client\nSite: github.com/AnalogJ/lexicon\nDocs"
  },
  {
    "path": "dnsapi/dns_limacity.sh",
    "chars": 2929,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_limacity_info='lima-city.de\nSite: www.lima-city.de\nDocs: github.com/ac"
  },
  {
    "path": "dnsapi/dns_linode.sh",
    "chars": 4850,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_linode_info='Linode.com (Old)\n Deprecated. Use dns_linode_v4\nSite: Lin"
  },
  {
    "path": "dnsapi/dns_linode_v4.sh",
    "chars": 5721,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_linode_v4_info='Linode.com\nSite: Linode.com\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_loopia.sh",
    "chars": 8032,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_loopia_info='Loopia.se\nSite: Loopia.se\nDocs: github.com/acmesh-officia"
  },
  {
    "path": "dnsapi/dns_lua.sh",
    "chars": 4102,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_lua_info='LuaDNS.com\nDomains: LuaDNS.net\nSite: LuaDNS.com\nDocs: github"
  },
  {
    "path": "dnsapi/dns_maradns.sh",
    "chars": 2351,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_maradns_info='MaraDNS Server\nSite: MaraDNS.samiam.org\nDocs: github.com"
  },
  {
    "path": "dnsapi/dns_me.sh",
    "chars": 4171,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_me_info='DnsMadeEasy.com\nSite: DnsMadeEasy.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_mgwm.sh",
    "chars": 4404,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_mgwm_info='mgw-media.de\nSite: mgw-media.de\nDocs: github.com/acmesh-off"
  },
  {
    "path": "dnsapi/dns_miab.sh",
    "chars": 5839,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_miab_info='Mail-in-a-Box\nSite: MailInaBox.email\nDocs: github.com/acmes"
  },
  {
    "path": "dnsapi/dns_mijnhost.sh",
    "chars": 5934,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_mijnhost_info='mijn.host\nSite: mijn.host\nDocs: https://github.com/acme"
  },
  {
    "path": "dnsapi/dns_misaka.sh",
    "chars": 4005,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_misaka_info='Misaka.io\nSite: Misaka.io\nDocs: github.com/acmesh-officia"
  },
  {
    "path": "dnsapi/dns_myapi.sh",
    "chars": 1450,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_myapi_info='Custom API Example\n A sample custom DNS API script descrip"
  },
  {
    "path": "dnsapi/dns_mydevil.sh",
    "chars": 2876,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_mydevil_info='MyDevil.net\n MyDevil.net already supports automatic Lets"
  },
  {
    "path": "dnsapi/dns_mydnsjp.sh",
    "chars": 4963,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_mydnsjp_info='MyDNS.JP\nSite: MyDNS.JP\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_mythic_beasts.sh",
    "chars": 6983,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_mythic_beasts_info='Mythic-Beasts.com\nSite: Mythic-Beasts.com\nDocs: gi"
  },
  {
    "path": "dnsapi/dns_namecheap.sh",
    "chars": 9967,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_namecheap_info='NameCheap.com\nSite: NameCheap.com\nDocs: github.com/acm"
  },
  {
    "path": "dnsapi/dns_namecom.sh",
    "chars": 4840,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_namecom_info='Name.com\nSite: Name.com\nDocs: github.com/acmesh-official"
  },
  {
    "path": "dnsapi/dns_namesilo.sh",
    "chars": 3918,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_namesilo_info='NameSilo.com\nSite: NameSilo.com\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_nanelo.sh",
    "chars": 3284,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nanelo_info='Nanelo.com\nSite: Nanelo.com\nDocs: github.com/acmesh-offic"
  },
  {
    "path": "dnsapi/dns_nederhost.sh",
    "chars": 3217,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nederhost_info='NederHost.nl\nSite: NederHost.nl\nDocs: github.com/acmes"
  },
  {
    "path": "dnsapi/dns_neodigit.sh",
    "chars": 4556,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_neodigit_info='Neodigit.net\nSite: Neodigit.net\nDocs: github.com/acmesh"
  },
  {
    "path": "dnsapi/dns_netcup.sh",
    "chars": 4927,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_netcup_info='netcup.eu\nDomains: netcup.de netcup.net\nSite: netcup.eu/\n"
  },
  {
    "path": "dnsapi/dns_netlify.sh",
    "chars": 4387,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_netlify_info='Netlify.com\nSite: Netlify.com\nDocs: github.com/acmesh-of"
  },
  {
    "path": "dnsapi/dns_nic.sh",
    "chars": 5752,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nic_info='nic.ru\nSite: nic.ru\nDocs: github.com/acmesh-official/acme.sh"
  },
  {
    "path": "dnsapi/dns_njalla.sh",
    "chars": 4811,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_njalla_info='Njalla\nSite: Njal.la\nDocs: github.com/acmesh-official/acm"
  },
  {
    "path": "dnsapi/dns_nm.sh",
    "chars": 2236,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nm_info='NameMaster.de\nSite: NameMaster.de\nDocs: github.com/acmesh-off"
  },
  {
    "path": "dnsapi/dns_nsd.sh",
    "chars": 1803,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nsd_info='NLnetLabs NSD Server\nSite: github.com/NLnetLabs/nsd\nDocs: gi"
  },
  {
    "path": "dnsapi/dns_nsone.sh",
    "chars": 4079,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nsone_info='ns1.com\nDomains: ns1.net\nSite: ns1.com\nDocs: github.com/ac"
  },
  {
    "path": "dnsapi/dns_nsupdate.sh",
    "chars": 5049,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nsupdate_info='nsupdate RFC 2136 DynDNS client\nSite: bind9.readthedocs"
  },
  {
    "path": "dnsapi/dns_nw.sh",
    "chars": 5729,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_nw_info='Nexcess.net (NocWorx)\nDomains: Thermo.io Futurehosting.com\nSi"
  },
  {
    "path": "dnsapi/dns_oci.sh",
    "chars": 10861,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_oci_info='Oracle Cloud Infrastructure (OCI)\n If OCI CLI configuration "
  },
  {
    "path": "dnsapi/dns_omglol.sh",
    "chars": 11531,
    "preview": "#!/usr/bin/env sh\n# shellcheck disable=SC2034\ndns_omglol_info='omg.lol\nSite: omg.lol\nDocs: github.com/acmesh-official/ac"
  }
]

// ... and 75 more files (download for full content)

About this extraction

This page contains the full source code of the acmesh-official/acme.sh GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 275 files (1.6 MB), approximately 538.2k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!