mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-10 00:11:45 +00:00
Merge branch 'acmesh-official:master' into master
This commit is contained in:
commit
68c533f777
96
.github/workflows/DNS.yml
vendored
96
.github/workflows/DNS.yml
vendored
@ -54,6 +54,8 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
@ -77,10 +79,20 @@ jobs:
|
|||||||
echo "${{ secrets.TokenName5}}=${{ secrets.TokenValue5}}" >> docker.env
|
echo "${{ secrets.TokenName5}}=${{ secrets.TokenValue5}}" >> docker.env
|
||||||
fi
|
fi
|
||||||
echo "TEST_DNS_NO_WILDCARD" >> docker.env
|
echo "TEST_DNS_NO_WILDCARD" >> docker.env
|
||||||
echo "TEST_DNS_SLEEP" >> docker.env
|
echo "http_proxy" >> docker.env
|
||||||
|
echo "https_proxy" >> docker.env
|
||||||
- name: Run acmetest
|
- name: Run acmetest
|
||||||
run: cd ../acmetest && ./rundocker.sh testall
|
run: cd ../acmetest && ./rundocker.sh testall
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: Docker-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
../acmetest/logs
|
||||||
|
|
||||||
|
|
||||||
MacOS:
|
MacOS:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
needs: Docker
|
needs: Docker
|
||||||
@ -93,6 +105,8 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
@ -119,6 +133,15 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: MacOS-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: MacOS
|
needs: MacOS
|
||||||
@ -131,6 +154,8 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set git to use LF
|
- name: Set git to use LF
|
||||||
run: |
|
run: |
|
||||||
@ -172,6 +197,13 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: Windows-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
needs: Windows
|
needs: Windows
|
||||||
@ -184,13 +216,15 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
||||||
- uses: vmactions/freebsd-vm@v0
|
- uses: vmactions/freebsd-vm@v0
|
||||||
with:
|
with:
|
||||||
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
||||||
prepare: pkg install -y socat curl
|
prepare: pkg install -y socat curl
|
||||||
usesh: true
|
usesh: true
|
||||||
copyback: false
|
copyback: false
|
||||||
@ -213,6 +247,14 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: FreeBSD-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
|
|
||||||
Solaris:
|
Solaris:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
needs: FreeBSD
|
needs: FreeBSD
|
||||||
@ -225,13 +267,15 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
||||||
- uses: vmactions/solaris-vm@v0
|
- uses: vmactions/solaris-vm@v0
|
||||||
with:
|
with:
|
||||||
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
||||||
copyback: false
|
copyback: false
|
||||||
prepare: pkgutil -y -i socat
|
prepare: pkgutil -y -i socat
|
||||||
run: |
|
run: |
|
||||||
@ -255,6 +299,13 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: Solaris-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
|
|
||||||
OpenBSD:
|
OpenBSD:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
@ -268,13 +319,15 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
||||||
- uses: vmactions/openbsd-vm@v0
|
- uses: vmactions/openbsd-vm@v0
|
||||||
with:
|
with:
|
||||||
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
||||||
prepare: pkg_add socat curl
|
prepare: pkg_add socat curl
|
||||||
usesh: true
|
usesh: true
|
||||||
copyback: false
|
copyback: false
|
||||||
@ -297,6 +350,14 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: OpenBSD-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
|
|
||||||
NetBSD:
|
NetBSD:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
needs: OpenBSD
|
needs: OpenBSD
|
||||||
@ -309,13 +370,15 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
||||||
- uses: vmactions/netbsd-vm@v0
|
- uses: vmactions/netbsd-vm@v0
|
||||||
with:
|
with:
|
||||||
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
||||||
prepare: |
|
prepare: |
|
||||||
pkg_add curl socat
|
pkg_add curl socat
|
||||||
usesh: true
|
usesh: true
|
||||||
@ -339,6 +402,14 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: NetBSD-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
|
|
||||||
DragonFlyBSD:
|
DragonFlyBSD:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
needs: NetBSD
|
needs: NetBSD
|
||||||
@ -351,13 +422,15 @@ jobs:
|
|||||||
CASE: le_test_dnsapi
|
CASE: le_test_dnsapi
|
||||||
TEST_LOCAL: 1
|
TEST_LOCAL: 1
|
||||||
DEBUG: ${{ secrets.DEBUG }}
|
DEBUG: ${{ secrets.DEBUG }}
|
||||||
|
http_proxy: ${{ secrets.http_proxy }}
|
||||||
|
https_proxy: ${{ secrets.https_proxy }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
||||||
- uses: vmactions/dragonflybsd-vm@v0
|
- uses: vmactions/dragonflybsd-vm@v0
|
||||||
with:
|
with:
|
||||||
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
envs: 'TEST_DNS TestingDomain TEST_DNS_NO_WILDCARD TEST_DNS_NO_SUBDOMAIN TEST_DNS_SLEEP CASE TEST_LOCAL DEBUG http_proxy https_proxy ${{ secrets.TokenName1}} ${{ secrets.TokenName2}} ${{ secrets.TokenName3}} ${{ secrets.TokenName4}} ${{ secrets.TokenName5}}'
|
||||||
prepare: |
|
prepare: |
|
||||||
pkg install -y curl socat
|
pkg install -y curl socat
|
||||||
usesh: true
|
usesh: true
|
||||||
@ -381,3 +454,14 @@ jobs:
|
|||||||
cd ../acmetest
|
cd ../acmetest
|
||||||
./letest.sh
|
./letest.sh
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v1
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: DragonFlyBSD-logs
|
||||||
|
path: |
|
||||||
|
../acmetest/*.log
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
9
.github/workflows/PebbleStrict.yml
vendored
9
.github/workflows/PebbleStrict.yml
vendored
@ -41,8 +41,8 @@ jobs:
|
|||||||
PebbleStrict_IPCert:
|
PebbleStrict_IPCert:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TestingDomain: 10.30.50.1
|
TestingDomain: 1.23.45.67
|
||||||
ACME_DIRECTORY: https://localhost:14000/dir
|
TEST_ACME_Server: https://localhost:14000/dir
|
||||||
HTTPS_INSECURE: 1
|
HTTPS_INSECURE: 1
|
||||||
Le_HTTPPort: 5002
|
Le_HTTPPort: 5002
|
||||||
Le_TLSPort: 5001
|
Le_TLSPort: 5001
|
||||||
@ -55,7 +55,10 @@ jobs:
|
|||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: sudo apt-get install -y socat
|
run: sudo apt-get install -y socat
|
||||||
- name: Run Pebble
|
- name: Run Pebble
|
||||||
run: cd .. && curl https://raw.githubusercontent.com/letsencrypt/pebble/master/docker-compose.yml >docker-compose.yml && docker-compose up -d
|
run: |
|
||||||
|
docker run --rm -itd --name=pebble \
|
||||||
|
-e PEBBLE_VA_ALWAYS_VALID=1 \
|
||||||
|
-p 14000:14000 -p 15000:15000 letsencrypt/pebble:latest pebble -config /test/config/pebble-config.json -strict
|
||||||
- name: Clone acmetest
|
- name: Clone acmetest
|
||||||
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
run: cd .. && git clone https://github.com/acmesh-official/acmetest.git && cp -r acme.sh acmetest/
|
||||||
- name: Run acmetest
|
- name: Run acmetest
|
||||||
|
8
.github/workflows/issue.yml
vendored
8
.github/workflows/issue.yml
vendored
@ -14,5 +14,11 @@ jobs:
|
|||||||
issue_number: context.issue.number,
|
issue_number: context.issue.number,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: 'Please provode the log with `--debug 2` if this is a bug report.'
|
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 provode the log with `--debug 2`, otherwise, nobody can help you.'
|
||||||
|
|
||||||
})
|
})
|
5
.github/workflows/pr_dns.yml
vendored
5
.github/workflows/pr_dns.yml
vendored
@ -22,6 +22,9 @@ jobs:
|
|||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: `**Welcome**
|
body: `**Welcome**
|
||||||
Please make sure you're read our [DNS API Dev Guide](../wiki/DNS-API-Dev-Guide) and we look forward to reviewing your Pull request shortly ✨`
|
Please make sure you're read our [DNS API Dev Guide](../wiki/DNS-API-Dev-Guide) and [DNS-API-Test](../wiki/DNS-API-Test).
|
||||||
|
Then reply on this message, otherwise, your code will not be reviewed or merged.
|
||||||
|
We look forward to reviewing your Pull request shortly ✨
|
||||||
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
4
acme.sh
4
acme.sh
@ -1186,7 +1186,7 @@ _createkey() {
|
|||||||
_is_idn() {
|
_is_idn() {
|
||||||
_is_idn_d="$1"
|
_is_idn_d="$1"
|
||||||
_debug2 _is_idn_d "$_is_idn_d"
|
_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 '*.,-_')
|
_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"
|
_debug2 _idn_temp "$_idn_temp"
|
||||||
[ "$_idn_temp" ]
|
[ "$_idn_temp" ]
|
||||||
}
|
}
|
||||||
@ -4195,7 +4195,7 @@ _match_issuer() {
|
|||||||
_isIPv4() {
|
_isIPv4() {
|
||||||
for seg in $(echo "$1" | tr '.' ' '); do
|
for seg in $(echo "$1" | tr '.' ' '); do
|
||||||
_debug2 seg "$seg"
|
_debug2 seg "$seg"
|
||||||
if [ "$(echo "$seg" | tr -d [0-9])" ]; then
|
if [ "$(echo "$seg" | tr -d '[0-9]')" ]; then
|
||||||
#not all number
|
#not all number
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -14,39 +14,43 @@
|
|||||||
# Git repo: https://github.com/phlegx/acme.sh
|
# Git repo: https://github.com/phlegx/acme.sh
|
||||||
# TODO: Better Error handling
|
# TODO: Better Error handling
|
||||||
########################################################################
|
########################################################################
|
||||||
KAS_Api="https://kasapi.kasserver.com/dokumentation/formular.php"
|
KAS_Api="https://kasapi.kasserver.com/soap/KasApi.php"
|
||||||
|
KAS_Auth="https://kasapi.kasserver.com/soap/KasAuth.php"
|
||||||
######## Public functions #####################
|
######## Public functions #####################
|
||||||
dns_kas_add() {
|
dns_kas_add() {
|
||||||
_fulldomain=$1
|
_fulldomain=$1
|
||||||
_txtvalue=$2
|
_txtvalue=$2
|
||||||
_info "Using DNS-01 All-inkl/Kasserver hook"
|
|
||||||
_info "Adding $_fulldomain DNS TXT entry on All-inkl/Kasserver"
|
_info "### -> Using DNS-01 All-inkl/Kasserver hook"
|
||||||
_info "Check and Save Props"
|
_info "### -> Adding $_fulldomain DNS TXT entry on All-inkl/Kasserver"
|
||||||
|
_info "### -> Retriving Credential Token"
|
||||||
|
_get_credential_token
|
||||||
|
|
||||||
|
_info "### -> Check and Save Props"
|
||||||
_check_and_save
|
_check_and_save
|
||||||
_info "Checking Zone and Record_Name"
|
|
||||||
|
_info "### -> Checking Zone and Record_Name"
|
||||||
_get_zone_and_record_name "$_fulldomain"
|
_get_zone_and_record_name "$_fulldomain"
|
||||||
_info "Getting Record ID"
|
|
||||||
|
_info "### -> Checking for existing Record entries"
|
||||||
_get_record_id
|
_get_record_id
|
||||||
|
|
||||||
_info "Creating TXT DNS record"
|
# If there is a record_id, delete the entry
|
||||||
params="?kas_login=$KAS_Login"
|
if [ -n "$_record_id" ]; then
|
||||||
params="$params&kas_auth_type=$KAS_Authtype"
|
_info "Existing records found. Now deleting old entries"
|
||||||
params="$params&kas_auth_data=$KAS_Authdata"
|
for i in $_record_id; do
|
||||||
params="$params&var1=record_name"
|
_delete_RecordByID "$i"
|
||||||
params="$params&wert1=$_record_name"
|
done
|
||||||
params="$params&var2=record_type"
|
else
|
||||||
params="$params&wert2=TXT"
|
_info "No record found."
|
||||||
params="$params&var3=record_data"
|
fi
|
||||||
params="$params&wert3=$_txtvalue"
|
|
||||||
params="$params&var4=record_aux"
|
_info "### -> Creating TXT DNS record"
|
||||||
params="$params&wert4=0"
|
action="add_dns_settings"
|
||||||
params="$params&kas_action=add_dns_settings"
|
kasReqParam="{\"record_name\":\"$_record_name\",\"record_type\":\"TXT\",\"record_data\":\"$_txtvalue\",\"record_aux\":\"0\",\"zone_host\":\"$_zone\"}"
|
||||||
params="$params&var5=zone_host"
|
response="$(_callAPI "$action" "$kasReqParam")"
|
||||||
params="$params&wert5=$_zone"
|
|
||||||
_debug2 "Wait for 10 seconds by default before calling KAS API."
|
_debug2 "Response" "$response"
|
||||||
_sleep 10
|
|
||||||
response="$(_get "$KAS_Api$params")"
|
|
||||||
_debug2 "response" "$response"
|
|
||||||
|
|
||||||
if ! _contains "$response" "TRUE"; then
|
if ! _contains "$response" "TRUE"; then
|
||||||
_err "An unkown error occurred, please check manually."
|
_err "An unkown error occurred, please check manually."
|
||||||
@ -58,45 +62,46 @@ dns_kas_add() {
|
|||||||
dns_kas_rm() {
|
dns_kas_rm() {
|
||||||
_fulldomain=$1
|
_fulldomain=$1
|
||||||
_txtvalue=$2
|
_txtvalue=$2
|
||||||
_info "Using DNS-01 All-inkl/Kasserver hook"
|
|
||||||
_info "Cleaning up after All-inkl/Kasserver hook"
|
|
||||||
_info "Removing $_fulldomain DNS TXT entry on All-inkl/Kasserver"
|
|
||||||
|
|
||||||
_info "Check and Save Props"
|
_info "### -> Using DNS-01 All-inkl/Kasserver hook"
|
||||||
|
_info "### -> Cleaning up after All-inkl/Kasserver hook"
|
||||||
|
_info "### -> Removing $_fulldomain DNS TXT entry on All-inkl/Kasserver"
|
||||||
|
_info "### -> Retriving Credential Token"
|
||||||
|
_get_credential_token
|
||||||
|
|
||||||
|
_info "### -> Check and Save Props"
|
||||||
_check_and_save
|
_check_and_save
|
||||||
_info "Checking Zone and Record_Name"
|
|
||||||
|
_info "### -> Checking Zone and Record_Name"
|
||||||
_get_zone_and_record_name "$_fulldomain"
|
_get_zone_and_record_name "$_fulldomain"
|
||||||
_info "Getting Record ID"
|
|
||||||
|
_info "### -> Getting Record ID"
|
||||||
_get_record_id
|
_get_record_id
|
||||||
|
|
||||||
|
_info "### -> Removing entries with ID: $_record_id"
|
||||||
# If there is a record_id, delete the entry
|
# If there is a record_id, delete the entry
|
||||||
if [ -n "$_record_id" ]; then
|
if [ -n "$_record_id" ]; then
|
||||||
params="?kas_login=$KAS_Login"
|
|
||||||
params="$params&kas_auth_type=$KAS_Authtype"
|
|
||||||
params="$params&kas_auth_data=$KAS_Authdata"
|
|
||||||
params="$params&kas_action=delete_dns_settings"
|
|
||||||
|
|
||||||
for i in $_record_id; do
|
for i in $_record_id; do
|
||||||
params2="$params&var1=record_id"
|
_delete_RecordByID "$i"
|
||||||
params2="$params2&wert1=$i"
|
|
||||||
_debug2 "Wait for 10 seconds by default before calling KAS API."
|
|
||||||
_sleep 10
|
|
||||||
response="$(_get "$KAS_Api$params2")"
|
|
||||||
_debug2 "response" "$response"
|
|
||||||
if ! _contains "$response" "TRUE"; then
|
|
||||||
_err "Either the txt record is not found or another error occurred, please check manually."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
else # Cannot delete or unkown error
|
else # Cannot delete or unkown error
|
||||||
_err "No record_id found that can be deleted. Please check manually."
|
_info "No record_id found that can be deleted. Please check manually."
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
########################## PRIVATE FUNCTIONS ###########################
|
########################## PRIVATE FUNCTIONS ###########################
|
||||||
|
# Delete Record ID
|
||||||
|
_delete_RecordByID() {
|
||||||
|
recId=$1
|
||||||
|
action="delete_dns_settings"
|
||||||
|
kasReqParam="{\"record_id\":\"$recId\"}"
|
||||||
|
response="$(_callAPI "$action" "$kasReqParam")"
|
||||||
|
_debug2 "Response" "$response"
|
||||||
|
if ! _contains "$response" "TRUE"; then
|
||||||
|
_info "Either the txt record is not found or another error occurred, please check manually."
|
||||||
|
fi
|
||||||
|
}
|
||||||
# Checks for the ENV variables and saves them
|
# Checks for the ENV variables and saves them
|
||||||
_check_and_save() {
|
_check_and_save() {
|
||||||
KAS_Login="${KAS_Login:-$(_readaccountconf_mutable KAS_Login)}"
|
KAS_Login="${KAS_Login:-$(_readaccountconf_mutable KAS_Login)}"
|
||||||
@ -119,50 +124,77 @@ _check_and_save() {
|
|||||||
# Gets back the base domain/zone and record name.
|
# Gets back the base domain/zone and record name.
|
||||||
# See: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide
|
# See: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide
|
||||||
_get_zone_and_record_name() {
|
_get_zone_and_record_name() {
|
||||||
params="?kas_login=$KAS_Login"
|
action="get_domains"
|
||||||
params="?kas_login=$KAS_Login"
|
kasReqParam="[]"
|
||||||
params="$params&kas_auth_type=$KAS_Authtype"
|
response="$(_callAPI "$action" "$kasReqParam")"
|
||||||
params="$params&kas_auth_data=$KAS_Authdata"
|
_debug2 "Response" "$response"
|
||||||
params="$params&kas_action=get_domains"
|
zonen="$(echo "$response" | sed 's/<item>/\n/g' | sed -r 's/(.*<key xsi:type="xsd:string">domain_name<\/key><value xsi:type="xsd:string">)(.*)(<\/value.*)/\2/' | sed '/^</d')"
|
||||||
|
domain="$1"
|
||||||
_debug2 "Wait for 10 seconds by default before calling KAS API."
|
temp_domain="$(echo "$1" | sed 's/\.$//')"
|
||||||
_sleep 10
|
rootzone="$domain"
|
||||||
response="$(_get "$KAS_Api$params")"
|
for i in $zonen; do
|
||||||
_debug2 "response" "$response"
|
l1=${#rootzone}
|
||||||
_zonen="$(echo "$response" | tr -d "\n\r" | tr -d " " | tr '[]' '<>' | sed "s/=>Array/\n=> Array/g" | tr ' ' '\n' | grep "domain_name" | tr '<' '\n' | grep "domain_name" | sed "s/domain_name>=>//g")"
|
|
||||||
_domain="$1"
|
|
||||||
_temp_domain="$(echo "$1" | sed 's/\.$//')"
|
|
||||||
_rootzone="$_domain"
|
|
||||||
for i in $_zonen; do
|
|
||||||
l1=${#_rootzone}
|
|
||||||
l2=${#i}
|
l2=${#i}
|
||||||
if _endswith "$_domain" "$i" && [ "$l1" -ge "$l2" ]; then
|
if _endswith "$domain" "$i" && [ "$l1" -ge "$l2" ]; then
|
||||||
_rootzone="$i"
|
rootzone="$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
_zone="${_rootzone}."
|
_zone="${rootzone}."
|
||||||
_temp_record_name="$(echo "$_temp_domain" | sed "s/$_rootzone//g")"
|
temp_record_name="$(echo "$temp_domain" | sed "s/$rootzone//g")"
|
||||||
_record_name="$(echo "$_temp_record_name" | sed 's/\.$//')"
|
_record_name="$(echo "$temp_record_name" | sed 's/\.$//')"
|
||||||
_debug2 "Zone:" "$_zone"
|
_debug "Zone:" "$_zone"
|
||||||
_debug2 "Domain:" "$_domain"
|
_debug "Domain:" "$domain"
|
||||||
_debug2 "Record_Name:" "$_record_name"
|
_debug "Record_Name:" "$_record_name"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Retrieve the DNS record ID
|
# Retrieve the DNS record ID
|
||||||
_get_record_id() {
|
_get_record_id() {
|
||||||
params="?kas_login=$KAS_Login"
|
action="get_dns_settings"
|
||||||
params="$params&kas_auth_type=$KAS_Authtype"
|
kasReqParam="{\"zone_host\":\"$_zone\",\"nameserver\":\"ns5.kasserver.com\"}"
|
||||||
params="$params&kas_auth_data=$KAS_Authdata"
|
response="$(_callAPI "$action" "$kasReqParam")"
|
||||||
params="$params&kas_action=get_dns_settings"
|
|
||||||
params="$params&var1=zone_host"
|
|
||||||
params="$params&wert1=$_zone"
|
|
||||||
|
|
||||||
_debug2 "Wait for 10 seconds by default before calling KAS API."
|
_debug2 "Response" "$response"
|
||||||
_sleep 10
|
_record_id="$(echo "$response" | sed 's/<item xsi:type="ns2:Map">/\n/g' | sed -n -e "/^.*$_record_name.*/Ip" | sed -n -e "/^.*$_txtvalue.*/Ip" | sed -r 's/(.*record_id<\/key><value xsi:type="xsd:string">)([0-9]+)(<\/value.*)/\2/')"
|
||||||
response="$(_get "$KAS_Api$params")"
|
_debug "Record Id: " "$_record_id"
|
||||||
_debug2 "response" "$response"
|
|
||||||
_record_id="$(echo "$response" | tr -d "\n\r" | tr -d " " | tr '[]' '<>' | sed "s/=>Array/\n=> Array/g" | tr ' ' '\n' | grep "=>$_record_name<" | grep '>TXT<' | tr '<' '\n' | grep record_id | sed "s/record_id>=>//g")"
|
|
||||||
_debug2 _record_id "$_record_id"
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Retrieve credential token
|
||||||
|
_get_credential_token() {
|
||||||
|
data="<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"urn:xmethodsKasApiAuthentication\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><ns1:KasAuth>"
|
||||||
|
data="$data<Params xsi:type=\"xsd:string\">{\"kas_login\":\"$KAS_Login\",\"kas_auth_type\":\"$KAS_Authtype\",\"kas_auth_data\":\"$KAS_Authdata\",\"session_lifetime\":600,\"session_update_lifetime\":\"Y\",\"session_2fa\":123456}</Params>"
|
||||||
|
data="$data</ns1:KasAuth></SOAP-ENV:Body></SOAP-ENV:Envelope>"
|
||||||
|
|
||||||
|
_debug "Be frindly and wait 10 seconds by default before calling KAS API."
|
||||||
|
_sleep 10
|
||||||
|
|
||||||
|
contentType="text/xml"
|
||||||
|
export _H1="SOAPAction: ns1:KasAuth"
|
||||||
|
response="$(_post "$data" "$KAS_Auth" "" "POST" "$contentType")"
|
||||||
|
_debug2 "Response" "$response"
|
||||||
|
|
||||||
|
_credential_token="$(echo "$response" | tr '\n' ' ' | sed 's/.*return xsi:type="xsd:string">\(.*\)<\/return>/\1/' | sed 's/<\/ns1:KasAuthResponse\(.*\)Envelope>.*//')"
|
||||||
|
_debug "Credential Token: " "$_credential_token"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_callAPI() {
|
||||||
|
kasaction=$1
|
||||||
|
kasReqParams=$2
|
||||||
|
baseParam="<Params xsi:type=\"xsd:string\">{\"kas_login\":\"$KAS_Login\",\"kas_auth_type\":\"session\",\"kas_auth_data\":\"$_credential_token\",\"kas_action\":\"$kasaction\",\"KasRequestParams\":$kasReqParams"
|
||||||
|
baseParamClosing="}</Params>"
|
||||||
|
data="<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"urn:xmethodsKasApi\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><SOAP-ENV:Body><ns1:KasApi>"
|
||||||
|
data="$data$baseParam$baseParamClosing"
|
||||||
|
data="$data</ns1:KasApi></SOAP-ENV:Body></SOAP-ENV:Envelope>"
|
||||||
|
_debug2 "Request" "$data"
|
||||||
|
|
||||||
|
_debug "Be frindly and wait 10 seconds by default before calling KAS API."
|
||||||
|
_sleep 10
|
||||||
|
|
||||||
|
contentType="text/xml"
|
||||||
|
export _H1="SOAPAction: ns1:KasApi"
|
||||||
|
response="$(_post "$data" "$KAS_Api" "" "POST" "$contentType")"
|
||||||
|
_debug2 "Response" "$response"
|
||||||
|
echo "$response"
|
||||||
|
}
|
||||||
|
@ -92,7 +92,7 @@ _initAuth() {
|
|||||||
|
|
||||||
if [ "$OVH_AK" != "$(_readaccountconf OVH_AK)" ]; then
|
if [ "$OVH_AK" != "$(_readaccountconf OVH_AK)" ]; then
|
||||||
_info "It seems that your ovh key is changed, let's clear consumer key first."
|
_info "It seems that your ovh key is changed, let's clear consumer key first."
|
||||||
_clearaccountconf OVH_CK
|
_clearaccountconf_mutable OVH_CK
|
||||||
fi
|
fi
|
||||||
_saveaccountconf_mutable OVH_AK "$OVH_AK"
|
_saveaccountconf_mutable OVH_AK "$OVH_AK"
|
||||||
_saveaccountconf_mutable OVH_AS "$OVH_AS"
|
_saveaccountconf_mutable OVH_AS "$OVH_AS"
|
||||||
@ -118,14 +118,14 @@ _initAuth() {
|
|||||||
#return and wait for retry.
|
#return and wait for retry.
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_saveaccountconf OVH_CK "$OVH_CK"
|
_saveaccountconf_mutable OVH_CK "$OVH_CK"
|
||||||
|
|
||||||
_info "Checking authentication"
|
_info "Checking authentication"
|
||||||
|
|
||||||
if ! _ovh_rest GET "domain" || _contains "$response" "INVALID_CREDENTIAL" || _contains "$response" "NOT_CREDENTIAL"; then
|
if ! _ovh_rest GET "domain" || _contains "$response" "INVALID_CREDENTIAL" || _contains "$response" "NOT_CREDENTIAL"; then
|
||||||
_err "The consumer key is invalid: $OVH_CK"
|
_err "The consumer key is invalid: $OVH_CK"
|
||||||
_err "Please retry to create a new one."
|
_err "Please retry to create a new one."
|
||||||
_clearaccountconf OVH_CK
|
_clearaccountconf_mutable OVH_CK
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
_info "Consumer key is ok."
|
_info "Consumer key is ok."
|
||||||
@ -236,7 +236,7 @@ _ovh_authentication() {
|
|||||||
_secure_debug consumerKey "$consumerKey"
|
_secure_debug consumerKey "$consumerKey"
|
||||||
|
|
||||||
OVH_CK="$consumerKey"
|
OVH_CK="$consumerKey"
|
||||||
|
_saveaccountconf_mutable OVH_CK "$OVH_CK"
|
||||||
_info "Please open this link to do authentication: $(__green "$validationUrl")"
|
_info "Please open this link to do authentication: $(__green "$validationUrl")"
|
||||||
|
|
||||||
_info "Here is a guide for you: $(__green "$wiki")"
|
_info "Here is a guide for you: $(__green "$wiki")"
|
||||||
|
@ -92,10 +92,10 @@ _get_root() {
|
|||||||
domains_list=$(echo "${response}" | grep dname | sed -r "s/.*dname=\"([^\"]+)\".*/\\1/g")
|
domains_list=$(echo "${response}" | grep dname | sed -r "s/.*dname=\"([^\"]+)\".*/\\1/g")
|
||||||
|
|
||||||
for ITEM in ${domains_list}; do
|
for ITEM in ${domains_list}; do
|
||||||
IDN_ITEM="$(_idn "${ITEM}")"
|
IDN_ITEM=${ITEM}
|
||||||
case "${domain}" in
|
case "${domain}" in
|
||||||
*${IDN_ITEM}*)
|
*${IDN_ITEM}*)
|
||||||
_domain=${IDN_ITEM}
|
_domain="$(_idn "${ITEM}")"
|
||||||
_debug _domain "${_domain}"
|
_debug _domain "${_domain}"
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user