phlegx / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
1 stars 1 forks source link

dns_kas.sh: Command "rev" not found #1

Open King3R opened 5 years ago

King3R commented 5 years ago

When I request a new certificate with:

./acme.sh --issue --test \
> -d "$CERT_DOMAIN" --dns "$CERT_DNS" \
> -d "*.$CERT_DOMAIN" \
> --cert-file "$CERT_PATH/cert.pem" \
> --key-file "$CERT_PATH/privkey.pem" \
> --fullchain-file "$CERT_PATH/fullchain.pem" \
> --ca-file "$CERT_PATH/chain.pem" \
> --reloadcmd "/usr/syno/sbin/synoservicectl --reload nginx" \
> --dnssleep 20
[Fri Jan 25 10:50:00 CET 2019] Using stage ACME_DIRECTORY: https://acme-staging-v02.api.letsencrypt.org/directory
[Fri Jan 25 10:50:02 CET 2019] Multi domain='DNS:meine-domain.de,DNS:*.meine-domain.de'
[Fri Jan 25 10:50:02 CET 2019] Getting domain auth token for each domain
[Fri Jan 25 10:50:05 CET 2019] Getting webroot for domain='meine-domain.de'
[Fri Jan 25 10:50:05 CET 2019] Getting webroot for domain='*.meine-domain.de'
[Fri Jan 25 10:50:05 CET 2019] Found domain api file: /usr/local/share/acme.sh/dnsapi/dns_kas.sh
[Fri Jan 25 10:50:05 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 10:50:05 CET 2019] Adding or Updating _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found
[Fri Jan 25 10:50:16 CET 2019] Creating TXT DNS record
[Fri Jan 25 10:50:26 CET 2019] An unkown error occurred, please check manually.
[Fri Jan 25 10:50:26 CET 2019] Error add txt for domain:_acme-challenge.meine-domain.de
[Fri Jan 25 10:50:26 CET 2019] Please add '--debug' or '--log' to check more details.
[Fri Jan 25 10:50:26 CET 2019] See: https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh
[Fri Jan 25 10:50:27 CET 2019] Removing DNS records.
[Fri Jan 25 10:50:27 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 10:50:27 CET 2019] Cleaning up after All-inkl/Kasserver hook
[Fri Jan 25 10:50:27 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found
[Fri Jan 25 10:50:37 CET 2019] No record_id found that can be deleted. Please check manually.
[Fri Jan 25 10:50:37 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de
[Fri Jan 25 10:50:37 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 10:50:37 CET 2019] Cleaning up after All-inkl/Kasserver hook
[Fri Jan 25 10:50:37 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found
/usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found
[Fri Jan 25 10:50:48 CET 2019] No record_id found that can be deleted. Please check manually.
[Fri Jan 25 10:50:48 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de

I get the following error messages:

[Fri Jan 25 10:50:05 CET 2019] Adding or Updating _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found [Fri Jan 25 10:50:16 CET 2019] Creating TXT DNS record [Fri Jan 25 10:50:26 CET 2019] An unkown error occurred, please check manually. [Fri Jan 25 10:50:26 CET 2019] Error add txt for domain:_acme-challenge.meine-domain.de

[Fri Jan 25 10:50:27 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 120: rev: command not found /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found /usr/local/share/acme.sh/dnsapi/dns_kas.sh: line 129: rev: command not found [Fri Jan 25 10:50:37 CET 2019] No record_id found that can be deleted. Please check manually. [Fri Jan 25 10:50:37 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de

Do you have any idea what could be wrong with that? It seems that the used command "rev" was not found ... Have you already contacted all-inkl.com about the API?

phlegx commented 5 years ago

Hi there!

I see yes. Looks like your OS doesn't have the rev package installed. I'm actually not sure which linux package this provides. It seems in Ubunutu this is installed by default.

This kas script I created is more of a bit of a hack. It works for me and on my Ubuntu server. Not everything could be implemented according to the acme.sh programming style guidelines and therefore it is also not yet merged in original acme.sh. With the SOAP API Kasserver offers, at least to me this is not solvable.

I asked them to provide a better API, like for example Cloudflare API is amazing and easy. But they wrote that they don't see the necessity.

phlegx commented 5 years ago

It seems that in Ubuntu this is the util-linux package that has the rev package/binary. So you could try to install if it's possibile.

King3R commented 5 years ago

Thank you. That's it. I use this with a Synology NAS. I install the util-linux over

from the package center.

Now I get another error:

[Fri Jan 25 12:52:42 CET 2019] Using stage ACME_DIRECTORY: https://acme-staging-v02.api.letsencrypt.org/directory
[Fri Jan 25 12:52:43 CET 2019] Multi domain='DNS:meine-domain.de,DNS:*.meine-domain.de'
[Fri Jan 25 12:52:43 CET 2019] Getting domain auth token for each domain
[Fri Jan 25 12:52:45 CET 2019] Getting webroot for domain='meine-domain.de'
[Fri Jan 25 12:52:45 CET 2019] Getting webroot for domain='*.meine-domain.de'
[Fri Jan 25 12:52:45 CET 2019] Found domain api file: /usr/local/share/acme.sh/dnsapi/dns_kas.sh
[Fri Jan 25 12:52:45 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 12:52:45 CET 2019] Adding or Updating _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
[Fri Jan 25 12:52:56 CET 2019] Creating TXT DNS record
[Fri Jan 25 12:53:06 CET 2019] Found domain api file: /usr/local/share/acme.sh/dnsapi/dns_kas.sh
[Fri Jan 25 12:53:06 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 12:53:06 CET 2019] Adding or Updating _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
[Fri Jan 25 12:53:17 CET 2019] Creating TXT DNS record
[Fri Jan 25 12:53:27 CET 2019] Sleep 20 seconds for the txt records to take effect
[Fri Jan 25 12:53:48 CET 2019] Verifying: meine-domain.de
[Fri Jan 25 12:53:51 CET 2019] Success
[Fri Jan 25 12:53:51 CET 2019] Verifying: *.meine-domain.de
[Fri Jan 25 12:53:54 CET 2019] Success
[Fri Jan 25 12:53:54 CET 2019] Removing DNS records.
[Fri Jan 25 12:53:54 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 12:53:54 CET 2019] Cleaning up after All-inkl/Kasserver hook
[Fri Jan 25 12:53:54 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
[Fri Jan 25 12:54:15 CET 2019] Either the txt record is not found or another error occurred, please check manually.
[Fri Jan 25 12:54:15 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de
[Fri Jan 25 12:54:15 CET 2019] Using DNS-01 All-inkl/Kasserver hook
[Fri Jan 25 12:54:15 CET 2019] Cleaning up after All-inkl/Kasserver hook
[Fri Jan 25 12:54:15 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver
[Fri Jan 25 12:54:36 CET 2019] Either the txt record is not found or another error occurred, please check manually.
[Fri Jan 25 12:54:36 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de
[Fri Jan 25 12:54:36 CET 2019] Verify finished, start to sign.
./acme.sh: line 4163: /usr/syno/etc/certificate/_archive/PyArZo: Is a directory
grep: /usr/syno/etc/certificate/_archive/PyArZo: Is a directory
[Fri Jan 25 12:54:38 CET 2019] Sign failed: 
[Fri Jan 25 12:54:38 CET 2019] Please add '--debug' or '--log' to check more details.
[Fri Jan 25 12:54:38 CET 2019] See: https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh
root@Patricks-DS:/usr/local/share/acme.sh#

It seems that the _acme-challenge entry can't be deleted. Does this affect the creation or the renewal of the certificate? Otherwise i could ignore it ...

[Fri Jan 25 12:53:54 CET 2019] Removing DNS records. [Fri Jan 25 12:53:54 CET 2019] Using DNS-01 All-inkl/Kasserver hook [Fri Jan 25 12:53:54 CET 2019] Cleaning up after All-inkl/Kasserver hook [Fri Jan 25 12:53:54 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver [Fri Jan 25 12:54:15 CET 2019] Either the txt record is not found or another error occurred, please check manually. [Fri Jan 25 12:54:15 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de [Fri Jan 25 12:54:15 CET 2019] Using DNS-01 All-inkl/Kasserver hook [Fri Jan 25 12:54:15 CET 2019] Cleaning up after All-inkl/Kasserver hook [Fri Jan 25 12:54:15 CET 2019] Removing _acme-challenge.meine-domain.de DNS TXT entry on All-inkl/Kasserver [Fri Jan 25 12:54:36 CET 2019] Either the txt record is not found or another error occurred, please check manually. [Fri Jan 25 12:54:36 CET 2019] Error removing txt for domain:_acme-challenge.meine-domain.de

I think this error is caused by using a test certificate. I assume the test certificate isn't stored in the folder, is it?

[Fri Jan 25 12:54:36 CET 2019] Verify finished, start to sign. ./acme.sh: line 4163: /usr/syno/etc/certificate/_archive/PyArZo: Is a directory grep: /usr/syno/etc/certificate/_archive/PyArZo: Is a directory [Fri Jan 25 12:54:38 CET 2019] Sign failed:

phlegx commented 5 years ago

I think deletion does indeed not work yet correctly iirc. It is a bit messy with the Kasserver API to delete the certificate. I would need to have a closer look at the whole script. It is been a while since I last revised it. On my domains this has no negative effect and it works, however the TXT records do pile up in time. ;-)

I'm actually not sure what the Is a directory error means, sorry. Maybe a more verbose log can show what it wrong.

King3R commented 5 years ago

Good to know, I'm gonna try this out. You just have to think about cleaning up the TXT entries from time to time. :-)

So far I have always generated the certificates in test mode. I think that in test mode the certificate is not written to the folder and therefore cannot be signed.

I asked them to provide a better API, like for example Cloudflare API is amazing and easy. But they wrote that they don't see the necessity.

I think you just don't want to do the work for yourself. As you can see from your website, the KAS backend should be a own development. I've been waiting a long time for you to offer wildcard support for LE. But unfortunately one gets only as statement: is planned. In my opinion, they have to solve the same problem ...

King3R commented 5 years ago

So far I have always generated the certificates in test mode. I think that in test mode the certificate is not written to the folder and therefore cannot be signed.

My error, the certificate cannot be downloaded. Do you have any idea why?

[Sat Jan 26 01:28:51 CET 2019] Sign failed, can not download cert:https://acme-v02.api.letsencrypt.org/acme/cert/03f2eae883ae44e881d033435074db62d542.
[Sat Jan 26 01:28:51 CET 2019] {"status":"valid","expires":"2019-02-02T00:26:56Z","identifiers":[{"type":"dns","value":"*.meine-domain.de"},{"type":"dns","value":"meine-domain.de"}],"authorizations":["https://acme-v02.api.letsencrypt.org/acme/authz/92D1pSGjOgZQuQBeW-8NnHBWT1PKFsGv9HA8DjHE75s","https://acme-v02.api.letsencrypt.org/acme/authz/CfQUqeE5FJqlr2FaSYGazLCAR4deagf5qbze5RR9pGE"],"finalize":"https://acme-v02.api.letsencrypt.org/acme/finalize/50243560/287682396","certificate":"https://acme-v02.api.letsencrypt.org/acme/cert/03f2eae883ae44e881d033435074db62d542"}
phlegx commented 5 years ago

@King3R hi! Sorry I'm not sure which error this is. May I ask you how you start the script? Can you give me the exact command?

King3R commented 5 years ago
export KAS_Login="Benutzer" \
export KAS_Authtype="sha1" \
export KAS_Authdata="Passwort"
export CERT_DOMAIN="meine-domain.de" \
export CERT_PATH="/usr/syno/etc/certificate/_archive/PyArZo" \
export CERT_DNS="dns_kas"
./acme.sh --issue --debug \
> -d "$CERT_DOMAIN" --dns "$CERT_DNS" \
> -d "*.$CERT_DOMAIN" \
> --cert-file "$CERT_PATH/cert.pem" \
> --key-file "$CERT_PATH/privkey.pem" \
> --fullchain-file "$CERT_PATH/fullchain.pem" \
> --ca-file "$CERT_PATH/chain.pem" \
> --reloadcmd "/usr/syno/sbin/synoservicectl --reload nginx" \
> --dnssleep 20
phlegx commented 5 years ago

@King3R I'm sorry for the late reply. I currently have very litte time left for have a closer look on this. I hope you have figured it out. Let me know!

djonasdev commented 5 years ago

@King3R I'm using a Synology as well and it is working so far. I have used the following command:

acme.sh --issue -d *.dyndns.my-domain.info -d *.my-domain.info -d my-domain.info --ddns dns_kas