-
Notifications
You must be signed in to change notification settings - Fork 54
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
windowsdnsserver driver implementation #215
base: master
Are you sure you want to change the base?
windowsdnsserver driver implementation #215
Conversation
Codecov Report
@@ Coverage Diff @@
## master #215 +/- ##
==========================================
- Coverage 88.02% 87.36% -0.67%
==========================================
Files 21 22 +1
Lines 1303 1353 +50
==========================================
+ Hits 1147 1182 +35
- Misses 156 171 +15
Continue to review full report at Codecov.
|
Sorry, @bilalekremharmansa, it's been crazy here - more a hardware upgrade that went awry than any other single thing. For now, mostly code non-specific questions for you. Love that you've noticed dns-01 and added the new driver! I'll have to revise that, since you didn't stuff it into the old interface, but that's a problem I enjoy. :-) A couple questions that relate to the feature columns there.
Moving along to |
Hi, @mmaney First of all, I did not understand what you mean by "since you didn't stuff it into the old interface".
About the zone, I've glanced at to existing dns providers and some of them use zone information to operate and some of them has not need at all. In that case, I've agreed with you, optional zone name could be useful in some cases, but I think each driver should has its own parameter if require's zone information. |
@bilalekremharmansa, let me rephrase the "stuffing" remark: Thank you for using the new interface, even though all the existing examples of working drivers are still implemented using the legacy interface! wildcard: yes, a requested name As you've observed, some of the services require the driver to identify the zone in which to publish the records. I don't happen to use any such service myself, but from what I've seen, there's some sort of list the service keeps that is connected to the user account, and the search is for the one that matches the requested ...domain.tld. As the |
@mmaney, okay I understand now and I thought that being first one to implementing the new dns driver would be nice 😄. If you have any reservations I would like to hear. I've also made some tests about wildcard issue, and here my observations;
And the zone issue, what is your mind about the zone issue ? I've come up with two ideas; 1 - Deprecate domain paramater, and propose two new parameters -> "zone:str" and "subdomain:str" For instance for challenge to "test.example.tld" -> zone: example.tld, subdomain: test This one would be used from all providers and that would make more clear, however that breaks backward compatibility for sure, and I assume you would not prefer that. 2- New parameter for both zone and cli, like zone_id:str Some providers will not use this new parameter. Still, should driver implement this behaviour by theirselves ? or sewer client should implement it ? Currently, I think adding to sewer client semantically is not completely wrong, yet some providers will not use it and that yields a provider(s) spesific argument. For example, in that case people who use windowsdnsserver driver need to know zone_id is a REQUIRED parameter, on the other hand acmedns driver users will not use zone_id at all. Lastly, I have a question, here is a code snippet in sewer DNSProviderBase
In master code, there is no field named 'domain' in challenge. I am not planning to use this function, but I notice that and wanted let you know in case you are not aware of it. |
circleci failed because I did not push windowsdnsserver-py package's new version to pypi when circleci is triggered. Now, I've published the new version to pypi. Is there a way to rerun without committing ? |
@bilalekremharmansa Yes, there's a rerun button somewhere in the mess of CircleCI's web stuff. Don't know if you can get to it, and I just kind of poke around looking for it myself... Not so fond of CCI, its reports seem to obfuscate as much as they reveal. But for now, well, it's already setup and more or less works. I was somewhat surprised to find that sewer created a file named re: zone - I don't see this as having anything, really, to do with the current (I can't now recall how far I've gone with cleaning up that challenge dict interface. Early work ran into obscure issues in testing - mocks that were far too attached to details, plus that was back when a lot of the old tests were mysterious magic to me . So adding your zone before 0.9 might be... interesting.) I was going to dispute the absence of a "domain" key, but after a little digging I see you're right. Look at unbound_ssh in dns_providers for the only known (and working!) use of target_domain. I think this may have been a case where those old issues with changing the contents of the challenge dicts used inside Client have delayed the implementation I had planned for that. :-( Thanks! |
@mmaney, yes I found the rerun button, and I am not allowed to click it. I see you handled it.
While i was telling you to Windows does not allow asterisk character, I had not deep thought how it behaves on Linux. I am not sure whether sewer could manage to create a file name like "*.example.tld" or not on Linux. Now, I've made a quick research, and you can create a file name that contains asterisk by escaping it on Linux, for instance; $ That creates an empty file with named "*.example.tld". But I am not sure sewer use this trick (or the python module that sewer uses). WILDCARD.domain.tld looks fine to me (which I prefer this one), or a second option domain.tld could be used as well. As I say said, it is not a blocking issue and can be solved by using bundle name. zone -- that will probably work, and it would be easy to implement. It will be a generic parameter for dns providers who has interest in. By the way I might realise an edge case about zone. Please, correct me if I'm wrong, imagine a challenge with the following parameters: --domain example.tld In that case driver has to deal two different zones which will not have ability to handle "myother.domain.tld". I know I am pushing the limits, but it came to mind and thought its worth to mention. FYI: I noticed something in Aliasing.md. In first paragraph you mention that aliasing could be use with "p_opts alias=.." which how it is working right know. However, in bottom of the document, a cli option is mentioned "--alias_domain" which is not available right know. |
Just patched the ["domain"] and aliasing doc issues you mentioned (for the 0.8.5 branch). These are both, in their own way, due to some parts of the code & docs having changed and other parts not having noticed. :-/ |
@bilalekremharmansa let's get this one in for 0.8.5! The problem with the aliasing support is fixed, so if you could rebase onto the current master branch, change that, and test it, that would be one down. I don't like the use of asserts in some of the ways you have, such as testing and "reporting" the problem. Maybe it's just because I've been fighting with some old tests (mostly in test_Client I think) where the [over]use of generic exceptions has the tests parsing the exception's text, which is of course easily broken by just improving the description. But I'm moving in the direction of using our own exceptions, though I don't think there are many (any?) in 0.8.4. There's also an issue with those being errors that certainly ought to be logged, if sewer had proper (read: persistent) logging setup. Which is also on my list... Also trying to make sure interfaces are checked more carefully where they are intended to interact with users' code. So that first one might be (for now, with logging left to the future)
...I need to refresh my memory of just what is in 0.8.4 on this score. Semi-trivial: the name is unwieldy. "server" is entirely unnecessary (in a sewer context). "windns" is arguably clear enough, I think. Pointless, trivial functions like _get_challenge_name() drive me crazy. Also, I let someone else slip a bunch of Java(?) like stuff similar to that through in another driver "to be agile", and of course it's still sitting there indigestibly. Oh yeah, speaking of names and such, this should be in sewer/providers - dns_providers is for the old fashioned drivers. I still have hopes that those will gradually get updated... One more oh yeah - in 0.8.4, or maybe even earlier, the CI switched to using pytest as the test runner (configured in pyproject.toml). So if you were only using unittest because that's what you saw in the repo, feel free to switch. All my new tests (in the 0.9 branch) have been pytest, and they're so much clearer I've been converting some of the old ones as well. Thanks |
Thanks for the review @mmaney! I've been refactoring the existing code, and mostly it's done. Yet, I could not decide how to mock objects with using pytest. What library (or approach) sewer use to mock test objects ? Just after refactoring, I will rebase whole commit history of "dev/windowsdnsserver" with squashing commits if you don't mind ? |
@bilalekremharmansa last things first: if you want to squash your changes that's fine. sewer is configured (on github) to do squashing commits, and I don't usually care myself other than I hate to see what GH's own advice about updating a clone repo to track its parent appears to favor, with repeated merges from master. As a reviewer, I don't want to be distracted by stuff from outside the work at hand as much as possible. ;-) I haven't really needed to do mocks in the new (pytest) test cases yet. Nor have I looked at your tests hardly at all, since as with so much of sewer the real test has to have access to the service. The driver tests mostly mock out the most important interface, the interaction with the outside service. Not that I can see what else they could do... In your case, the mock might [need to] be a dummy power shell runner or something like that? It's for sure the CI testing can't touch a real power shell! I'm still more than a little distracted by the half (?) done 0.9 rework... |
Yes, I need to mock power shell in some cases, and also mocking sys.platform to 'windows' is required since CI testing is not running on Windows (second one comes from windowsdnsserver-py, it throws an error when DNS service is not running on Windows platform) |
8fee390
to
557114b
Compare
557114b
to
366ffd2
Compare
Hello @mmaney, It's been a while since you've not heard anything from me :) At first, I was waiting a comment from you to my previous comment, which was about how to mock powershell with pytest. Then, unfortunately, I forget existing of this PR :/ Anyways, I've refactored the code regarding your comments, i think it is ready to go now. I, kindly, ask you to review once again, but before that I should mention about tests. I've not migrated unittest to pytest in this work (test of windns still uses unittest module), the reason is mocking. I've still not clear what to do about it. By the way, I've run some tests to staging environment with the following parameters, and I've not encounter with any problem.
|
What(What have you changed?)
windowsdnsserver driver implementation uses PowerShell DNSServer module for Let's Encrypt dns challenge.
details about DNSServer module: https://docs.microsoft.com/en-us/powershell/module/dnsserver/?view=win10-ps
The driver uses a wrapper python library, which is called windowsdnsserver-py, to interact with PowerShell DnsServer module. Basically, the driver performs process calls to DNSServer over python subprocess module. Since commands are made on local machine (remote session is not supported), this driver has to be used on windows server where dns server is located, either using sewer as a cli and as a library.
Why(Why did you change it?)
new dns driver to sewer