Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All inkl kasserver dns script #1341

Merged
merged 32 commits into from
Feb 11, 2020

Conversation

phlegx
Copy link
Contributor

@phlegx phlegx commented Mar 9, 2018

Hi @Neilpang

Added my script for German provider All-inkl. It all works fine. However I cannot support yet the Domains with double endings like co.uk since my provider does not offer to get all root zones, as you suggested here: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide

In case I just missed it, If anyone finds a way to get all root zones here: http://kasapi.kasserver.com/dokumentation/phpdoc/packages/API%20Funktionen.html just let me know and I add.

Let me know what you think Neil, and in best case lets just merge it right away! ;-)

thanks
Martin

@Neilpang
Copy link
Member

@Neilpang
Copy link
Member

Is this api free?
How can I register account there to test ?

Thanks.

@Neilpang
Copy link
Member

There is a function get_domains (array $ parameter) in the doc.
http://kasapi.kasserver.com/dokumentation/phpdoc/packages/API%20Funktionen.html

@Neilpang
Copy link
Member

please fix the CI errors.

_info "Adding or Updating $_full_domain DNS TXT entry on All-inkl/Kasserver"

_check_and_save
_get_zone "$_full_domain"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check the return value of these function calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neilpang you mean all of the functions need a return value (i.e. successful: return 0), or?

params="$params&var5=zone_host"
params="$params&wert5=$_zone"
else # Update the existing record
_info "Updating existing TXT DNS record"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never use updating, just adding.
#1261

response="$(_get "$KAS_Api$params")"
_debug2 "response" "$response"

_record_id="$(echo "$response" | grep -A 4 "$_record_name" | grep "record_id" | cut -f2 -d">" | xargs)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use grep -A and xargs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neilpang I think without using grep -A I can not do it actually. To me this seems to be the only most possible sane solution here, since what I get back is some HTML chunk with some plaintext array at the end, see example: https://gist.github.com/anonymous/eec9b149ab4b5ab8c30541a15e587d80

They also offer a WSDL https://kasapi.kasserver.com/dokumentation/?open=quellcode endpoint that can be accessed via SOAP and I think there I would get XML back, but I have no clue how to do this without using curl actually.

If you have an idea on how to solve this, let me know. thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, we have removed a lot of grep -A before.
show me your $response, and what you want to grep.

Copy link
Contributor Author

@phlegx phlegx Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Neilpang see the example gist above. We need to grep for the record name (in this case _acme-challenge.test51 and then get out the appropriate record_id) I post the example here again:

....
            <td align='right'>
               10 <input name='var10' size='25' value=''>
            </td>
            <td>
               <input name='wert10' size='25' value=''>
            </td>
          </tr>
                  <tr>
            <th colspan="2">
               <a target="_blank" href="/dokumentation/?open=quellcode">
                  Beispiel Quellcode ansehen
               </a>
            </th>
         </tr>
         <tr>
            <th colspan="2" align="right">
               Felder:
			   <input size="2" name="anz_var" value="10" />
			   <input type="submit" />
            </th>
            </tr>
      </table>
   </form>
   </div>
   <div style="float:left;">
			   <div class="erfolg">
			  <b>ReturnString: </b>TRUE</br>
			  <b>ReturnInfo: </b><pre>Array
(
    [0] => Array
        (
            [record_zone] => example.com
            [record_name] => 
            [record_type] => NS
            [record_data] => ns6.kasserver.com.
            [record_aux] => 0
            [record_id] => 0
            [record_changeable] => N
        )

    [1] => Array
        (
            [record_zone] => example.com
            [record_name] => *
            [record_type] => A
            [record_data] => 85.13.yyy.xx
            [record_aux] => 0
            [record_id] => 0
            [record_changeable] => N
        )

    [2] => Array
        (
            [record_zone] => example.com
            [record_name] => _acme-challenge.test51
            [record_type] => TXT
            [record_data] => jU6yvYv2Y4rHk2uFNwjxH1gcHmU7DRp4wvjoR6TEfgI
            [record_aux] => 0
            [record_id] => 36986630
            [record_changeable] => Y
        )
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neilpang have you had already a chance to have a look at it? thanks!

Copy link
Contributor Author

@phlegx phlegx Apr 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guptamp, @Neilpang has a few requirements that I should need to add to this as you can see in this Thread. I'm waiting for the suggestions he has for parsing this "HTML" file properly and according to the acme.sh rules.

However my implementation is already working and you could in the meanwhile just use my fork: https://github.com/phlegx/acme.sh I'm using it already in production and I will try to keep it up to date should it fail at some point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, for the delay. I was totally missing this PR.

This can grep the correct record id:

echo "$response"  | tr -d "\n\r" | sed "s/=> Array/\n=> Array/g" | tr -d " " | tr '[]' '<>' | grep "=>_acme-challenge.test51<" | grep '>TXT<' | tr '<' '\n' | grep record_id | cut -d '>' -f 3

Copy link
Contributor Author

@phlegx phlegx Nov 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Neilpang! Also bit busy these days and need to see if I can have a look at this again in the next days. @dojo90 fyi! If you like and have time feel free to send me pull request!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm confused. As you (@Neilpang) write here

do not use grep -A and xargs
#1341 (comment)

you give us a solution which uses grep 🤔

So I think we can use the actual implementation (https://github.com/phlegx/acme.sh/blob/all-inkl-kasserver-dns-script/dnsapi/dns_kas.sh#L153) ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dojo90

I mean don't use -A option with grep.

you can use simple grep command.

@phlegx phlegx force-pushed the all-inkl-kasserver-dns-script branch from 5e821ce to 32d7bd5 Compare March 16, 2018 13:42
@Ducksoul
Copy link

push

I'd like to see this script in the production version. Unfortunately I'm not able to help concerning the points @Neilpang stated in his previous comments.

@King3R
Copy link

King3R commented Jan 25, 2019

@phlegx Can you allow creating issues on your fork https://github.com/phlegx/acme.sh?

@phlegx
Copy link
Contributor Author

phlegx commented Jan 25, 2019

@King3R done!

@phlegx
Copy link
Contributor Author

phlegx commented Jan 25, 2019

I'm also open for fixes and pull requests btw, to finally get this merged in the original project :-)

@King3R
Copy link

King3R commented Jan 25, 2019

I also hope that the PR will be merged with the original project. I can't help you because of my insufficient programming knowledge. :-(

@Neilpang
Copy link
Member

@phlegx please resolve the conflicts first.

@Neilpang
Copy link
Member

please fix CI errors first.
And follow this guide:
https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide

@Marco4223
Copy link
Contributor

Hi Neilpang,
when can we expect this feaure in prod? I'm interesst to use this with my pfsense.
If you need tester orsome test accounmts feel free to conatct me.
Cheers and merry christmas
Marco

# TODO Get a list of all possible root zones and compare (Currently not possible via provider)
# See: https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide
_get_zone() {
_zone=$(echo "$1" | rev | cut -d . -f1-2 | rev).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please not use rev ?

Copy link
Contributor Author

@phlegx phlegx Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neilpang:

@Marco4223 was fixing a few more things (thank you very much Marco) and also he replaced the rev. For some reason the build is still failing. Could you please have a look and tell us what the issues still is since with this error Travis throws it is not clear to us what is missing. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the empty lines with spaces?

Marco4223 and others added 10 commits December 28, 2019 11:58
remove "rev" command
fix "Error removing txt for domain:_acme-challenge.foo"
only bash needed
sorry for this commit.  ;)
Fix NewBeMistakes
This reverts commit 99c47dd.
tested and works now
fixing 4 Travis style
Removing spaces in empty lines
…-record-name

delete spaces in empty lines
@Marco4223
Copy link
Contributor

Hi Neilpang,
just for your info:
I have this script running on Pfsense an two Synology NAS systems.
Do you need an account for testing?
If yes just ping me.
Cheers
Marco

params="$params&var5=zone_host"
params="$params&wert5=$_zone"
_debug2 "Wait for 10 seconds by default before calling KAS API."
sleep 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use our _sleep() function instead.

@Neilpang
Copy link
Member

sorry, but we have a dev guide, please read and check it https://github.com/Neilpang/acme.sh/wiki/DNS-API-Dev-Guide

We need you to update your usage to the wiki and create a issue for future bug reporting.

@Marco4223
Copy link
Contributor

Marco4223 commented Jan 22, 2020 via email

Marco4223 and others added 2 commits January 23, 2020 19:20
sleep 10 to _sleep 10
@Marco4223
Copy link
Contributor

Marco4223 commented Feb 10, 2020

Hi Nail,
everything fine now?
Cheers
MarcO

@Neilpang
Copy link
Member

resolve the conflicts first, please.

@Marco4223
Copy link
Contributor

Sorry, may be I’m blind.
Where are conflicts?

@Neilpang Neilpang merged commit 51fc853 into acmesh-official:dev Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants