committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
191 changed files with 5969 additions and 2623 deletions
-
90.github/workflows/DNS.yml
-
14.github/workflows/DragonFlyBSD.yml
-
10.github/workflows/FreeBSD.yml
-
6.github/workflows/Linux.yml
-
4.github/workflows/MacOS.yml
-
14.github/workflows/NetBSD.yml
-
75.github/workflows/Omnios.yml
-
10.github/workflows/OpenBSD.yml
-
6.github/workflows/PebbleStrict.yml
-
17.github/workflows/Solaris.yml
-
6.github/workflows/Ubuntu.yml
-
4.github/workflows/Windows.yml
-
17.github/workflows/dockerhub.yml
-
7.github/workflows/pr_dns.yml
-
4.github/workflows/pr_notify.yml
-
4.github/workflows/shellcheck.yml
-
31README.md
-
766acme.sh
-
88deploy/ali_cdn.sh
-
88deploy/ali_dcdn.sh
-
1deploy/exim4.sh
-
125deploy/haproxy.sh
-
19deploy/panos.sh
-
8deploy/proxmoxve.sh
-
7deploy/routeros.sh
-
172deploy/ruckus.sh
-
111deploy/strongswan.sh
-
416deploy/synology_dsm.sh
-
97deploy/truenas.sh
-
64deploy/unifi.sh
-
8deploy/vault.sh
-
2deploy/vsftpd.sh
-
35dnsapi/dns_1984hosting.sh
-
28dnsapi/dns_acmedns.sh
-
18dnsapi/dns_acmeproxy.sh
-
17dnsapi/dns_active24.sh
-
21dnsapi/dns_ad.sh
-
153dnsapi/dns_ali.sh
-
185dnsapi/dns_alviy.sh
-
20dnsapi/dns_anx.sh
-
23dnsapi/dns_artfiles.sh
-
19dnsapi/dns_arvan.sh
-
20dnsapi/dns_aurora.sh
-
27dnsapi/dns_autodns.sh
-
49dnsapi/dns_aws.sh
-
18dnsapi/dns_azion.sh
-
81dnsapi/dns_azure.sh
-
21dnsapi/dns_bookmyname.sh
-
29dnsapi/dns_bunny.sh
-
25dnsapi/dns_cf.sh
-
17dnsapi/dns_clouddns.sh
-
19dnsapi/dns_cloudns.sh
-
17dnsapi/dns_cn.sh
-
15dnsapi/dns_conoha.sh
-
18dnsapi/dns_constellix.sh
-
26dnsapi/dns_cpanel.sh
-
18dnsapi/dns_curanet.sh
-
28dnsapi/dns_cyon.sh
-
41dnsapi/dns_da.sh
-
21dnsapi/dns_ddnss.sh
-
20dnsapi/dns_desec.sh
-
25dnsapi/dns_df.sh
-
26dnsapi/dns_dgon.sh
-
21dnsapi/dns_dnsexit.sh
-
21dnsapi/dns_dnshome.sh
-
20dnsapi/dns_dnsimple.sh
-
17dnsapi/dns_dnsservices.sh
-
148dnsapi/dns_do.sh
-
22dnsapi/dns_doapi.sh
-
13dnsapi/dns_domeneshop.sh
-
18dnsapi/dns_dp.sh
-
18dnsapi/dns_dpi.sh
-
14dnsapi/dns_dreamhost.sh
-
18dnsapi/dns_duckdns.sh
-
16dnsapi/dns_durabledns.sh
-
25dnsapi/dns_dyn.sh
-
25dnsapi/dns_dynu.sh
-
28dnsapi/dns_dynv6.sh
-
23dnsapi/dns_easydns.sh
-
25dnsapi/dns_edgedns.sh
-
28dnsapi/dns_euserv.sh
-
12dnsapi/dns_exoscale.sh
-
35dnsapi/dns_fornex.sh
-
19dnsapi/dns_freedns.sh
-
25dnsapi/dns_gandi_livedns.sh
-
12dnsapi/dns_gcloud.sh
-
24dnsapi/dns_gcore.sh
-
20dnsapi/dns_gd.sh
-
18dnsapi/dns_geoscaling.sh
-
17dnsapi/dns_googledomains.sh
-
23dnsapi/dns_he.sh
-
16dnsapi/dns_hetzner.sh
-
18dnsapi/dns_hexonet.sh
-
15dnsapi/dns_hostingde.sh
-
18dnsapi/dns_huaweicloud.sh
-
14dnsapi/dns_infoblox.sh
-
15dnsapi/dns_infomaniak.sh
-
22dnsapi/dns_internetbs.sh
-
30dnsapi/dns_inwx.sh
-
23dnsapi/dns_ionos.sh
@ -0,0 +1,75 @@ |
|||||
|
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@v4 |
||||
|
- uses: vmactions/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 |
||||
|
copyback: false |
||||
|
run: | |
||||
|
cd ../acmetest \ |
||||
|
&& ./letest.sh |
||||
|
|
||||
|
|
766
acme.sh
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,88 @@ |
|||||
|
#!/usr/bin/env sh |
||||
|
# shellcheck disable=SC2034,SC2154 |
||||
|
|
||||
|
# Script to create certificate to Alibaba Cloud CDN |
||||
|
# |
||||
|
# Docs: https://github.com/acmesh-official/acme.sh/wiki/deployhooks#33-deploy-your-certificate-to-cdn-or-dcdn-of-alibaba-cloud-aliyun |
||||
|
# |
||||
|
# This deployment required following variables |
||||
|
# export Ali_Key="ALIACCESSKEY" |
||||
|
# export Ali_Secret="ALISECRETKEY" |
||||
|
# The credentials are shared with all the Alibaba Cloud deploy hooks and dnsapi |
||||
|
# |
||||
|
# To specify the CDN domain that is different from the certificate CN, usually used for multi-domain or wildcard certificates |
||||
|
# export DEPLOY_ALI_CDN_DOMAIN="cdn.example.com" |
||||
|
# If you have multiple CDN domains using the same certificate, just |
||||
|
# export DEPLOY_ALI_CDN_DOMAIN="cdn1.example.com cdn2.example.com" |
||||
|
# |
||||
|
# For DCDN, see ali_dcdn deploy hook |
||||
|
|
||||
|
Ali_CDN_API="https://cdn.aliyuncs.com/" |
||||
|
|
||||
|
ali_cdn_deploy() { |
||||
|
_cdomain="$1" |
||||
|
_ckey="$2" |
||||
|
_ccert="$3" |
||||
|
_cca="$4" |
||||
|
_cfullchain="$5" |
||||
|
|
||||
|
_debug _cdomain "$_cdomain" |
||||
|
_debug _ckey "$_ckey" |
||||
|
_debug _ccert "$_ccert" |
||||
|
_debug _cca "$_cca" |
||||
|
_debug _cfullchain "$_cfullchain" |
||||
|
|
||||
|
# Load dnsapi/dns_ali.sh to reduce the duplicated codes |
||||
|
# https://github.com/acmesh-official/acme.sh/pull/5205#issuecomment-2357867276 |
||||
|
dnsapi_ali="$(_findHook "$_cdomain" "$_SUB_FOLDER_DNSAPI" dns_ali)" |
||||
|
# shellcheck source=/dev/null |
||||
|
if ! . "$dnsapi_ali"; then |
||||
|
_err "Error loading file $dnsapi_ali. Please check your API file and try again." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_prepare_ali_credentials || return 1 |
||||
|
|
||||
|
_getdeployconf DEPLOY_ALI_CDN_DOMAIN |
||||
|
if [ "$DEPLOY_ALI_CDN_DOMAIN" ]; then |
||||
|
_savedeployconf DEPLOY_ALI_CDN_DOMAIN "$DEPLOY_ALI_CDN_DOMAIN" |
||||
|
else |
||||
|
DEPLOY_ALI_CDN_DOMAIN="$_cdomain" |
||||
|
fi |
||||
|
|
||||
|
# read cert and key files and urlencode both |
||||
|
_cert=$(_url_encode upper-hex <"$_cfullchain") |
||||
|
_key=$(_url_encode upper-hex <"$_ckey") |
||||
|
|
||||
|
_debug2 _cert "$_cert" |
||||
|
_debug2 _key "$_key" |
||||
|
|
||||
|
## update domain ssl config |
||||
|
for domain in $DEPLOY_ALI_CDN_DOMAIN; do |
||||
|
_set_cdn_domain_ssl_certificate_query "$domain" "$_cert" "$_key" |
||||
|
if _ali_rest "Set CDN domain SSL certificate for $domain" "" POST; then |
||||
|
_info "Domain $domain certificate has been deployed successfully" |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
return 0 |
||||
|
} |
||||
|
|
||||
|
# domain pub pri |
||||
|
_set_cdn_domain_ssl_certificate_query() { |
||||
|
endpoint=$Ali_CDN_API |
||||
|
query='' |
||||
|
query=$query'AccessKeyId='$Ali_Key |
||||
|
query=$query'&Action=SetCdnDomainSSLCertificate' |
||||
|
query=$query'&CertType=upload' |
||||
|
query=$query'&DomainName='$1 |
||||
|
query=$query'&Format=json' |
||||
|
query=$query'&SSLPri='$3 |
||||
|
query=$query'&SSLProtocol=on' |
||||
|
query=$query'&SSLPub='$2 |
||||
|
query=$query'&SignatureMethod=HMAC-SHA1' |
||||
|
query=$query"&SignatureNonce=$(_ali_nonce)" |
||||
|
query=$query'&SignatureVersion=1.0' |
||||
|
query=$query'&Timestamp='$(_timestamp) |
||||
|
query=$query'&Version=2018-05-10' |
||||
|
} |
@ -0,0 +1,88 @@ |
|||||
|
#!/usr/bin/env sh |
||||
|
# shellcheck disable=SC2034,SC2154 |
||||
|
|
||||
|
# Script to create certificate to Alibaba Cloud DCDN |
||||
|
# |
||||
|
# Docs: https://github.com/acmesh-official/acme.sh/wiki/deployhooks#33-deploy-your-certificate-to-cdn-or-dcdn-of-alibaba-cloud-aliyun |
||||
|
# |
||||
|
# This deployment required following variables |
||||
|
# export Ali_Key="ALIACCESSKEY" |
||||
|
# export Ali_Secret="ALISECRETKEY" |
||||
|
# The credentials are shared with all the Alibaba Cloud deploy hooks and dnsapi |
||||
|
# |
||||
|
# To specify the DCDN domain that is different from the certificate CN, usually used for multi-domain or wildcard certificates |
||||
|
# export DEPLOY_ALI_DCDN_DOMAIN="dcdn.example.com" |
||||
|
# If you have multiple CDN domains using the same certificate, just |
||||
|
# export DEPLOY_ALI_DCDN_DOMAIN="dcdn1.example.com dcdn2.example.com" |
||||
|
# |
||||
|
# For regular CDN, see ali_cdn deploy hook |
||||
|
|
||||
|
Ali_DCDN_API="https://dcdn.aliyuncs.com/" |
||||
|
|
||||
|
ali_dcdn_deploy() { |
||||
|
_cdomain="$1" |
||||
|
_ckey="$2" |
||||
|
_ccert="$3" |
||||
|
_cca="$4" |
||||
|
_cfullchain="$5" |
||||
|
|
||||
|
_debug _cdomain "$_cdomain" |
||||
|
_debug _ckey "$_ckey" |
||||
|
_debug _ccert "$_ccert" |
||||
|
_debug _cca "$_cca" |
||||
|
_debug _cfullchain "$_cfullchain" |
||||
|
|
||||
|
# Load dnsapi/dns_ali.sh to reduce the duplicated codes |
||||
|
# https://github.com/acmesh-official/acme.sh/pull/5205#issuecomment-2357867276 |
||||
|
dnsapi_ali="$(_findHook "$_cdomain" "$_SUB_FOLDER_DNSAPI" dns_ali)" |
||||
|
# shellcheck source=/dev/null |
||||
|
if ! . "$dnsapi_ali"; then |
||||
|
_err "Error loading file $dnsapi_ali. Please check your API file and try again." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_prepare_ali_credentials || return 1 |
||||
|
|
||||
|
_getdeployconf DEPLOY_ALI_DCDN_DOMAIN |
||||
|
if [ "$DEPLOY_ALI_DCDN_DOMAIN" ]; then |
||||
|
_savedeployconf DEPLOY_ALI_DCDN_DOMAIN "$DEPLOY_ALI_DCDN_DOMAIN" |
||||
|
else |
||||
|
DEPLOY_ALI_DCDN_DOMAIN="$_cdomain" |
||||
|
fi |
||||
|
|
||||
|
# read cert and key files and urlencode both |
||||
|
_cert=$(_url_encode upper-hex <"$_cfullchain") |
||||
|
_key=$(_url_encode upper-hex <"$_ckey") |
||||
|
|
||||
|
_debug2 _cert "$_cert" |
||||
|
_debug2 _key "$_key" |
||||
|
|
||||
|
## update domain ssl config |
||||
|
for domain in $DEPLOY_ALI_DCDN_DOMAIN; do |
||||
|
_set_dcdn_domain_ssl_certificate_query "$domain" "$_cert" "$_key" |
||||
|
if _ali_rest "Set DCDN domain SSL certificate for $domain" "" POST; then |
||||
|
_info "Domain $domain certificate has been deployed successfully" |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
return 0 |
||||
|
} |
||||
|
|
||||
|
# domain pub pri |
||||
|
_set_dcdn_domain_ssl_certificate_query() { |
||||
|
endpoint=$Ali_DCDN_API |
||||
|
query='' |
||||
|
query=$query'AccessKeyId='$Ali_Key |
||||
|
query=$query'&Action=SetDcdnDomainSSLCertificate' |
||||
|
query=$query'&CertType=upload' |
||||
|
query=$query'&DomainName='$1 |
||||
|
query=$query'&Format=json' |
||||
|
query=$query'&SSLPri='$3 |
||||
|
query=$query'&SSLProtocol=on' |
||||
|
query=$query'&SSLPub='$2 |
||||
|
query=$query'&SignatureMethod=HMAC-SHA1' |
||||
|
query=$query"&SignatureNonce=$(_ali_nonce)" |
||||
|
query=$query'&SignatureVersion=1.0' |
||||
|
query=$query'&Timestamp='$(_timestamp) |
||||
|
query=$query'&Version=2018-01-15' |
||||
|
} |
@ -0,0 +1,172 @@ |
|||||
|
#!/usr/bin/env sh |
||||
|
|
||||
|
# Here is a script to deploy cert to Ruckus ZoneDirector / Unleashed. |
||||
|
# |
||||
|
# Public domain, 2024, Tony Rielly <https://github.com/ms264556> |
||||
|
# |
||||
|
# ```sh |
||||
|
# acme.sh --deploy -d ruckus.example.com --deploy-hook ruckus |
||||
|
# ``` |
||||
|
# |
||||
|
# Then you need to set the environment variables for the |
||||
|
# deploy script to work. |
||||
|
# |
||||
|
# ```sh |
||||
|
# export RUCKUS_HOST=myruckus.example.com |
||||
|
# export RUCKUS_USER=myruckususername |
||||
|
# export RUCKUS_PASS=myruckuspassword |
||||
|
# |
||||
|
# acme.sh --deploy -d myruckus.example.com --deploy-hook ruckus |
||||
|
# ``` |
||||
|
# |
||||
|
# returns 0 means success, otherwise error. |
||||
|
|
||||
|
######## Public functions ##################### |
||||
|
|
||||
|
#domain keyfile certfile cafile fullchain |
||||
|
ruckus_deploy() { |
||||
|
_cdomain="$1" |
||||
|
_ckey="$2" |
||||
|
_ccert="$3" |
||||
|
_cca="$4" |
||||
|
_cfullchain="$5" |
||||
|
_err_code=0 |
||||
|
|
||||
|
_debug _cdomain "$_cdomain" |
||||
|
_debug _ckey "$_ckey" |
||||
|
_debug _ccert "$_ccert" |
||||
|
_debug _cca "$_cca" |
||||
|
_debug _cfullchain "$_cfullchain" |
||||
|
|
||||
|
_getdeployconf RUCKUS_HOST |
||||
|
_getdeployconf RUCKUS_USER |
||||
|
_getdeployconf RUCKUS_PASS |
||||
|
|
||||
|
if [ -z "$RUCKUS_HOST" ]; then |
||||
|
_debug "Using _cdomain as RUCKUS_HOST, please set if not correct." |
||||
|
RUCKUS_HOST="$_cdomain" |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$RUCKUS_USER" ]; then |
||||
|
_err "Need to set the env variable RUCKUS_USER" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$RUCKUS_PASS" ]; then |
||||
|
_err "Need to set the env variable RUCKUS_PASS" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_savedeployconf RUCKUS_HOST "$RUCKUS_HOST" |
||||
|
_savedeployconf RUCKUS_USER "$RUCKUS_USER" |
||||
|
_savedeployconf RUCKUS_PASS "$RUCKUS_PASS" |
||||
|
|
||||
|
_debug RUCKUS_HOST "$RUCKUS_HOST" |
||||
|
_debug RUCKUS_USER "$RUCKUS_USER" |
||||
|
_secure_debug RUCKUS_PASS "$RUCKUS_PASS" |
||||
|
|
||||
|
export ACME_HTTP_NO_REDIRECTS=1 |
||||
|
|
||||
|
_info "Discovering the login URL" |
||||
|
_get "https://$RUCKUS_HOST" >/dev/null |
||||
|
_login_url="$(_response_header 'Location')" |
||||
|
if [ -n "$_login_url" ]; then |
||||
|
_login_path=$(echo "$_login_url" | sed 's|https\?://[^/]\+||') |
||||
|
if [ -z "$_login_path" ]; then |
||||
|
# redirect was to a different host |
||||
|
_err "Connection failed: redirected to a different host. Configure Unleashed with a Preferred Master or Management Interface." |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
if [ -z "${_login_url}" ]; then |
||||
|
_err "Connection failed: couldn't find login page." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_base_url=$(dirname "$_login_url") |
||||
|
_login_page=$(basename "$_login_url") |
||||
|
|
||||
|
if [ "$_login_page" = "index.html" ]; then |
||||
|
_err "Connection temporarily unavailable: Unleashed Rebuilding." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
if [ "$_login_page" = "wizard.jsp" ]; then |
||||
|
_err "Connection failed: Setup Wizard not complete." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_info "Login" |
||||
|
_username_encoded="$(printf "%s" "$RUCKUS_USER" | _url_encode)" |
||||
|
_password_encoded="$(printf "%s" "$RUCKUS_PASS" | _url_encode)" |
||||
|
_login_query="$(printf "%s" "username=${_username_encoded}&password=${_password_encoded}&ok=Log+In")" |
||||
|
_post "$_login_query" "$_login_url" >/dev/null |
||||
|
|
||||
|
_login_code="$(_response_code)" |
||||
|
if [ "$_login_code" = "200" ]; then |
||||
|
_err "Login failed: incorrect credentials." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_info "Collect Session Cookie" |
||||
|
_H1="Cookie: $(_response_cookie)" |
||||
|
export _H1 |
||||
|
_info "Collect CSRF Token" |
||||
|
_H2="X-CSRF-Token: $(_response_header 'HTTP_X_CSRF_TOKEN')" |
||||
|
export _H2 |
||||
|
|
||||
|
_info "Uploading certificate" |
||||
|
_post_upload "uploadcert" "$_cfullchain" |
||||
|
|
||||
|
_info "Uploading private key" |
||||
|
_post_upload "uploadprivatekey" "$_ckey" |
||||
|
|
||||
|
_info "Replacing certificate" |
||||
|
_replace_cert_ajax='<ajax-request action="docmd" comp="system" updater="rid.0.5" xcmd="replace-cert" checkAbility="6" timeout="-1"><xcmd cmd="replace-cert" cn="'$RUCKUS_HOST'"/></ajax-request>' |
||||
|
_post "$_replace_cert_ajax" "$_base_url/_cmdstat.jsp" >/dev/null |
||||
|
|
||||
|
_info "Rebooting" |
||||
|
_cert_reboot_ajax='<ajax-request action="docmd" comp="worker" updater="rid.0.5" xcmd="cert-reboot" checkAbility="6"><xcmd cmd="cert-reboot" action="undefined"/></ajax-request>' |
||||
|
_post "$_cert_reboot_ajax" "$_base_url/_cmdstat.jsp" >/dev/null |
||||
|
|
||||
|
return 0 |
||||
|
} |
||||
|
|
||||
|
_response_code() { |
||||
|
_egrep_o <"$HTTP_HEADER" "^HTTP[^ ]* .*$" | cut -d " " -f 2-100 | tr -d "\f\n" | _egrep_o "^[0-9]*" |
||||
|
} |
||||
|
|
||||
|
_response_header() { |
||||
|
grep <"$HTTP_HEADER" -i "^$1:" | cut -d ':' -f 2- | tr -d "\r\n\t " |
||||
|
} |
||||
|
|
||||
|
_response_cookie() { |
||||
|
_response_header 'Set-Cookie' | sed 's/;.*//' |
||||
|
} |
||||
|
|
||||
|
_post_upload() { |
||||
|
_post_action="$1" |
||||
|
_post_file="$2" |
||||
|
|
||||
|
_post_boundary="----FormBoundary$(date "+%s%N")" |
||||
|
|
||||
|
_post_data="$({ |
||||
|
printf -- "--%s\r\n" "$_post_boundary" |
||||
|
printf -- "Content-Disposition: form-data; name=\"u\"; filename=\"%s\"\r\n" "$_post_action" |
||||
|
printf -- "Content-Type: application/octet-stream\r\n\r\n" |
||||
|
printf -- "%s\r\n" "$(cat "$_post_file")" |
||||
|
|
||||
|
printf -- "--%s\r\n" "$_post_boundary" |
||||
|
printf -- "Content-Disposition: form-data; name=\"action\"\r\n\r\n" |
||||
|
printf -- "%s\r\n" "$_post_action" |
||||
|
|
||||
|
printf -- "--%s\r\n" "$_post_boundary" |
||||
|
printf -- "Content-Disposition: form-data; name=\"callback\"\r\n\r\n" |
||||
|
printf -- "%s\r\n" "uploader_$_post_action" |
||||
|
|
||||
|
printf -- "--%s--\r\n\r\n" "$_post_boundary" |
||||
|
})" |
||||
|
|
||||
|
_post "$_post_data" "$_base_url/_upload.jsp?request_type=xhr" "" "" "multipart/form-data; boundary=$_post_boundary" >/dev/null |
||||
|
} |
@ -0,0 +1,185 @@ |
|||||
|
#!/usr/bin/env sh |
||||
|
# shellcheck disable=SC2034 |
||||
|
dns_alviy_info='Alviy.com |
||||
|
Site: Alviy.com |
||||
|
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_alviy |
||||
|
Options: |
||||
|
Alviy_token API token. Get it from the https://cloud.alviy.com/token |
||||
|
Issues: github.com/acmesh-official/acme.sh/issues/5115 |
||||
|
' |
||||
|
|
||||
|
Alviy_Api="https://cloud.alviy.com/api/v1" |
||||
|
|
||||
|
######## Public functions ##################### |
||||
|
|
||||
|
#Usage: dns_alviy_add _acme-challenge.www.domain.com "content" |
||||
|
dns_alviy_add() { |
||||
|
fulldomain=$1 |
||||
|
txtvalue=$2 |
||||
|
|
||||
|
Alviy_token="${Alviy_token:-$(_readaccountconf_mutable Alviy_token)}" |
||||
|
if [ -z "$Alviy_token" ]; then |
||||
|
Alviy_token="" |
||||
|
_err "Please specify Alviy token." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
#save the api key and email to the account conf file. |
||||
|
_saveaccountconf_mutable Alviy_token "$Alviy_token" |
||||
|
|
||||
|
_debug "First detect the root zone" |
||||
|
if ! _get_root "$fulldomain"; then |
||||
|
_err "invalid domain" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_debug _sub_domain "$_sub_domain" |
||||
|
_debug _domain "$_domain" |
||||
|
|
||||
|
_debug "Getting existing records" |
||||
|
if _alviy_txt_exists "$_domain" "$fulldomain" "$txtvalue"; then |
||||
|
_info "This record already exists, skipping" |
||||
|
return 0 |
||||
|
fi |
||||
|
|
||||
|
_add_data="{\"content\":\"$txtvalue\",\"type\":\"TXT\"}" |
||||
|
_debug2 _add_data "$_add_data" |
||||
|
_info "Adding record" |
||||
|
if _alviy_rest POST "zone/$_domain/domain/$fulldomain/" "$_add_data"; then |
||||
|
_debug "Checking updated records of '${fulldomain}'" |
||||
|
|
||||
|
if ! _alviy_txt_exists "$_domain" "$fulldomain" "$txtvalue"; then |
||||
|
_err "TXT record '${txtvalue}' for '${fulldomain}', value wasn't set!" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
else |
||||
|
_err "Add txt record error, value '${txtvalue}' for '${fulldomain}' was not set." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_sleep 10 |
||||
|
_info "Added TXT record '${txtvalue}' for '${fulldomain}'." |
||||
|
return 0 |
||||
|
} |
||||
|
|
||||
|
#fulldomain |
||||
|
dns_alviy_rm() { |
||||
|
fulldomain=$1 |
||||
|
txtvalue=$2 |
||||
|
|
||||
|
Alviy_token="${Alviy_token:-$(_readaccountconf_mutable Alviy_token)}" |
||||
|
|
||||
|
_debug "First detect the root zone" |
||||
|
if ! _get_root "$fulldomain"; then |
||||
|
_err "invalid domain" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
_debug _sub_domain "$_sub_domain" |
||||
|
_debug _domain "$_domain" |
||||
|
|
||||
|
if ! _alviy_txt_exists "$_domain" "$fulldomain" "$txtvalue"; then |
||||
|
_info "The record does not exist, skip" |
||||
|
return 0 |
||||
|
fi |
||||
|
|
||||
|
_add_data="" |
||||
|
uuid=$(echo "$response" | tr "{" "\n" | grep "$txtvalue" | tr "," "\n" | grep uuid | cut -d \" -f4) |
||||
|
# delete record |
||||
|
_debug "Delete TXT record for '${fulldomain}'" |
||||
|
if ! _alviy_rest DELETE "zone/$_domain/record/$uuid" "{\"confirm\":1}"; then |
||||
|
_err "Cannot delete empty TXT record for '$fulldomain'" |
||||
|
return 1 |
||||
|
fi |
||||
|
_info "The record '$fulldomain'='$txtvalue' deleted" |
||||
|
} |
||||
|
|
||||
|
#################### Private functions below ################################## |
||||
|
#_acme-challenge.www.domain.com |
||||
|
#returns |
||||
|
# _sub_domain=_acme-challenge.www |
||||
|
# _domain=domain.com |
||||
|
_get_root() { |
||||
|
domain=$1 |
||||
|
i=3 |
||||
|
a="init" |
||||
|
while [ -n "$a" ]; do |
||||
|
a=$(printf "%s" "$domain" | cut -d . -f $i-) |
||||
|
i=$((i + 1)) |
||||
|
done |
||||
|
n=$((i - 3)) |
||||
|
h=$(printf "%s" "$domain" | cut -d . -f $n-) |
||||
|
if [ -z "$h" ]; then |
||||
|
#not valid |
||||
|
_alviy_rest GET "zone/$domain/" |
||||
|
_debug "can't get host from $domain" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
if ! _alviy_rest GET "zone/$h/"; then |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
if _contains "$response" '"code":"NOT_FOUND"'; then |
||||
|
_debug "$h not found" |
||||
|
else |
||||
|
s=$((n - 1)) |
||||
|
_sub_domain=$(printf "%s" "$domain" | cut -d . -f -$s) |
||||
|
_domain="$h" |
||||
|
return 0 |
||||
|
fi |
||||
|
return 1 |
||||
|
} |
||||
|
|
||||
|
_alviy_txt_exists() { |
||||
|
zone=$1 |
||||
|
domain=$2 |
||||
|
content_data=$3 |
||||
|
_debug "Getting existing records" |
||||
|
|
||||
|
if ! _alviy_rest GET "zone/$zone/domain/$domain/TXT/"; then |
||||
|
_info "The record does not exist" |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
if ! _contains "$response" "$3"; then |
||||
|
_info "The record has other value" |
||||
|
return 1 |
||||
|
fi |
||||
|
# GOOD code return - TRUE function |
||||
|
return 0 |
||||
|
} |
||||
|
|
||||
|
_alviy_rest() { |
||||
|
method=$1 |
||||
|
path="$2" |
||||
|
content_data="$3" |
||||
|
_debug "$path" |
||||
|
|
||||
|
export _H1="Authorization: Bearer $Alviy_token" |
||||
|
export _H2="Content-Type: application/json" |
||||
|
|
||||
|
if [ "$content_data" ] || [ "$method" = "DELETE" ]; then |
||||
|
_debug "data ($method): " "$content_data" |
||||
|
response="$(_post "$content_data" "$Alviy_Api/$path" "" "$method")" |
||||
|
else |
||||
|
response="$(_get "$Alviy_Api/$path")" |
||||
|
fi |
||||
|
_code="$(grep "^HTTP" "$HTTP_HEADER" | _tail_n 1 | cut -d " " -f 2 | tr -d "\\r\\n")" |
||||
|
if [ "$_code" = "401" ]; then |
||||
|
_err "It seems that your api key or secret is not correct." |
||||
|
return 1 |
||||
|
fi |
||||
|
|
||||
|
if [ "$_code" != "200" ]; then |
||||
|
_err "API call error ($method): $path Response code $_code" |
||||
|
fi |
||||
|
if [ "$?" != "0" ]; then |
||||
|
_err "error on rest call ($method): $path. Response:" |
||||
|
_err "$response" |
||||
|
return 1 |
||||
|
fi |
||||
|
_debug2 response "$response" |
||||
|
return 0 |
||||
|
} |
@ -1,148 +0,0 @@ |
|||||
#!/usr/bin/env sh |
|
||||
|
|
||||
# DNS API for Domain-Offensive / Resellerinterface / Domainrobot |
|
||||
|
|
||||
# Report bugs at https://github.com/seidler2547/acme.sh/issues |
|
||||
|
|
||||
# set these environment variables to match your customer ID and password: |
|
||||
# DO_PID="KD-1234567" |
|
||||
# DO_PW="cdfkjl3n2" |
|
||||
|
|
||||
DO_URL="https://soap.resellerinterface.de/" |
|
||||
|
|
||||
######## Public functions ##################### |
|
||||
|
|
||||
#Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" |
|
||||
dns_do_add() { |
|
||||
fulldomain=$1 |
|
||||
txtvalue=$2 |
|
||||
if _dns_do_authenticate; then |
|
||||
_info "Adding TXT record to ${_domain} as ${fulldomain}" |
|
||||
_dns_do_soap createRR origin "${_domain}" name "${fulldomain}" type TXT data "${txtvalue}" ttl 300 |
|
||||
if _contains "${response}" '>success<'; then |
|
||||
return 0 |
|
||||
fi |
|
||||
_err "Could not create resource record, check logs" |
|
||||
fi |
|
||||
return 1 |
|
||||
} |
|
||||
|
|
||||
#fulldomain |
|
||||
dns_do_rm() { |
|
||||
fulldomain=$1 |
|
||||
if _dns_do_authenticate; then |
|
||||
if _dns_do_list_rrs; then |
|
||||
_dns_do_had_error=0 |
|
||||
for _rrid in ${_rr_list}; do |
|
||||
_info "Deleting resource record $_rrid for $_domain" |
|
||||
_dns_do_soap deleteRR origin "${_domain}" rrid "${_rrid}" |
|
||||
if ! _contains "${response}" '>success<'; then |
|
||||
_dns_do_had_error=1 |
|
||||
_err "Could not delete resource record for ${_domain}, id ${_rrid}" |
|
||||
fi |
|
||||
done |
|
||||
return $_dns_do_had_error |
|
||||
fi |
|
||||
fi |
|
||||
return 1 |
|
||||
} |
|
||||
|
|
||||
#################### Private functions below ################################## |
|
||||
_dns_do_authenticate() { |
|
||||
_info "Authenticating as ${DO_PID}" |
|
||||
_dns_do_soap authPartner partner "${DO_PID}" password "${DO_PW}" |
|
||||
if _contains "${response}" '>success<'; then |
|
||||
_get_root "$fulldomain" |
|
||||
_debug "_domain $_domain" |
|
||||
return 0 |
|
||||
else |
|
||||
_err "Authentication failed, are DO_PID and DO_PW set correctly?" |
|
||||
fi |
|
||||
return 1 |
|
||||
} |
|
||||
|
|
||||
_dns_do_list_rrs() { |
|
||||
_dns_do_soap getRRList origin "${_domain}" |
|
||||
if ! _contains "${response}" 'SOAP-ENC:Array'; then |
|
||||
_err "getRRList origin ${_domain} failed" |
|
||||
return 1 |
|
||||
fi |
|
||||
_rr_list="$(echo "${response}" | |
|
||||
tr -d "\n\r\t" | |
|
||||
sed -e 's/<item xsi:type="ns2:Map">/\n/g' | |
|
||||
grep ">$(_regexcape "$fulldomain")</value>" | |
|
||||
sed -e 's/<\/item>/\n/g' | |
|
||||
grep '>id</key><value' | |
|
||||
_egrep_o '>[0-9]{1,16}<' | |
|
||||
tr -d '><')" |
|
||||
[ "${_rr_list}" ] |
|
||||
} |
|
||||
|
|
||||
_dns_do_soap() { |
|
||||
func="$1" |
|
||||
shift |
|
||||
# put the parameters to xml |
|
||||
body="<tns:${func} xmlns:tns=\"${DO_URL}\">" |
|
||||
while [ "$1" ]; do |
|
||||
_k="$1" |
|
||||
shift |
|
||||
_v="$1" |
|
||||
shift |
|
||||
body="$body<$_k>$_v</$_k>" |
|
||||
done |
|
||||
body="$body</tns:${func}>" |
|
||||
_debug2 "SOAP request ${body}" |
|
||||
|
|
||||
# build SOAP XML |
|
||||
_xml='<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> |
|
||||
<env:Body>'"$body"'</env:Body> |
|
||||
</env:Envelope>' |
|
||||
|
|
||||
# set SOAP headers |
|
||||
export _H1="SOAPAction: ${DO_URL}#${func}" |
|
||||
|
|
||||
if ! response="$(_post "${_xml}" "${DO_URL}")"; then |
|
||||
_err "Error <$1>" |
|
||||
return 1 |
|
||||
fi |
|
||||
_debug2 "SOAP response $response" |
|
||||
|
|
||||
# retrieve cookie header |
|
||||
_H2="$(_egrep_o 'Cookie: [^;]+' <"$HTTP_HEADER" | _head_n 1)" |
|
||||
export _H2 |
|
||||
|
|
||||
return 0 |
|
||||
} |
|
||||
|
|
||||
_get_root() { |
|
||||
domain=$1 |
|
||||
i=1 |
|
||||
|
|
||||
_dns_do_soap getDomainList |
|
||||
_all_domains="$(echo "${response}" | |
|
||||
tr -d "\n\r\t " | |
|
||||
_egrep_o 'domain</key><value[^>]+>[^<]+' | |
|
||||
sed -e 's/^domain<\/key><value[^>]*>//g')" |
|
||||
|
|
||||
while true; do |
|
||||
h=$(printf "%s" "$domain" | cut -d . -f $i-100) |
|
||||
if [ -z "$h" ]; then |
|
||||
return 1 |
|
||||
fi |
|
||||
|
|
||||
if _contains "${_all_domains}" "^$(_regexcape "$h")\$"; then |
|
||||
_domain="$h" |
|
||||
return 0 |
|
||||
fi |
|
||||
|
|
||||
i=$(_math $i + 1) |
|
||||
done |
|
||||
_debug "$domain not found" |
|
||||
|
|
||||
return 1 |
|
||||
} |
|
||||
|
|
||||
_regexcape() { |
|
||||
echo "$1" | sed -e 's/\([]\.$*^[]\)/\\\1/g' |
|
||||
} |
|
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue