-
-
Notifications
You must be signed in to change notification settings - Fork 666
Changed deSEC controll flow to allow for using existing subdomains with Authkey #2080
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
Conversation
Haven't tested yet, but please don't use tab, use 4 spaces for indentation. Thanks! |
Fixed |
Thanks, I will have a look at this tomorrow or Friday. |
Aaah, you need to generate a new token from within your admin panel. We should add that, will fix! |
Tob e honest, I simply asumed the AUTH_token you get from first setup is the same as the one you get sent in the e-mail. If it isn’t, I would need to look more into the process deDYN uses.
|
Ah, nice, I can leave that to you then?
|
Well, if we could automate it, it would be great, but I'm not sure that's possible. You can help me come up with an idea to fix it if you have time? |
I’m reading into the deSEC documentation at the moment.
Maybe this is usefull?
https://desec.readthedocs.io/en/latest/auth/tokens.html
|
What we would like is to generate a new TOKEN by email, so that the user can add that in the same way as a new domain, but for an existing account. |
I believe proper procedure would be testing if the provided token is a valid key management token in some way, then use the creating a Token procedure as described there to create a new one.
Or if it is not one, testing if it is valid for managing the IP address assigned to a/the domain.
But that is in the case that the person owns to domain and has a valid token ready.
If they own the domain but don’t have a valid token ready, I that would lend itself to the situation where they would be sent a new valid one per e-mail.
Let me play with the API a bit and see what I come up with.
|
I'm quite happy with the flow right now. If we can automate the flow, sure, but the current way also works as we instruct the user how to do it. @szaimen If you have time to test it would be appreciated. |
Is the existing account but not existing subdomain flow correct? It's missing registering the new domain claiming at the moment as far as i can tell... |
I'm not sure I follow. Can you ellaborate, or actually show what you mean? |
Going throught he controll flow, lats assume the domain is free and they have an account:
This following check seems to be wrong, if the user entered "no" They don't have an existing account, then the negation turns it into true and it follows the Register with existing account flow?
So the steps it actually executes is: prompt_dedyn_subdomain -> ask which subdomain it is for Nowhere in that list is the domain, confirmed to be free, actually claimed by/assigned to the user on deSEC's service, right? |
The argument is changed in the latest version, please check again. Still, we have a loop going on, working on it now. |
I'm going to really rework this script, it currently functions off of claiming the domain at account creation on deSEC, and using the included account recovery authtoken for the rest. That is also the source of the weird requirement that any new domain required an as of yet unused email. I envision the best way to do it would be:
|
@wildd0g Found any solution to the email issue, or do you think that the current one works? |
As i mentioned, currently reworking the script/flow. Getting the login functionality working is not as easy, extracting the token from the responce stored to file is providing a bit of a challenge. |
But it works as it is right now, at least in my testing. Anything missing you think? |
You can also assume that 99% of the users doesn't have an account with deSEC, so that shouldn't be a priority/first question. |
Mostly that horrible behavior of not being able to add new domains to an existing account currently, due to the fact domain claiming is done by using the added 'domain' option in the account creation API. I'm 90% done with a reworked version that separates out the domain claiming from account creation. Since the control flow is also separated from the rest, changing the order later to favor first checking domain availability and then account existence should be trivial. |
OK, gotcha. 👍 If you're interested in investing some time, maybe you could have a look at this as well? |
So while playing around, I believe i got the |
By the way, do you have an occupied domain that I can test the "domain taken that you do not own" behavior against? |
Change the repo to to yours for the testing part, all the scripts exists in your fork as well. In lib.sh there are several mentions, and then you need to change the
I just test random domains and delete them afterwards, either manually, or with the delete account script included in the deSEC menu. |
Well, I believe it finally works as intended. Using while: do and continue as a substitute for a goto feels so weird/dirty, but if can't do it as you should, then you should do it as you can.
blocks. I put them in a function at first, but apparently doing a break or continue in a function does not propagate to the outer loop. Have a look, the behavior should be as I described above. Also something to note, the login generates a token that is valid for 1 day and gets removed after 7 (if i understand deSEC right) which can manage other tokens. |
Signed-off-by: szaimen <szaimen@e.mail.de> Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
1. Since the script now works with existing accounts, make a new function to ask for that, and use it in the final composition. 2. Domain available? Ask for existing account to register it with 3. Domain taken? Ask for existing account to register it with Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
Signed-off-by: wildd0g <mpeppelman2008@hotmail.com>
So that was an entire mess. I signed off all your previous commits as well, since DCO was complaining about them. |
This feel uncomfortable to merge. Please revert to the proposed commit. That works at least. I'll merge that, and then we start over with this. |
We can continue to work in this, I'll merge the changes from the original idea in another PR: #2088 You can start clean backing up your changes, then create a new PR to get a clean start. |
Did a test now with no account, and no domain. Noticed this: desec.sh: line 190: -Po: command not found. Also, TLS doesn't work as the hook seems to be gone. You changed the name of the most important token to RETURNTOKEN, please revert that change, else we have to change in several scripts and I see no reason to change the name of that variable. |
But I like the idea, instead of registering the domain, we register an account, and connects the domain to that account. 👍 Some code styling, and minor fixes, but generally great! |
We should also implement this:
It requires that we remove some of the assumptions in the removal script, or simply copy the code from the removal script to the main install script. |
So i did that revert to d4b811f you asked for, but that also undid a merge you performed? |
I'm... confused, what functionality do you want to add with that?
|
Remove your fork, delete the repo. Git pull fresh, and start over. But first, (let me take a selife) copy your current code in desec.sh so that you can add that back on the fresh clone.
Yes, I would like it to work as with "Activate TLS" where we make a function out of the TLS stuff for deSEC so that we can use that repo wide if needed, in the same way as with the regular TLS. I made a script for adding subdomains, but I'm not sure that works with Collabora|Onlyoffice|Talk and other apps that needs TLS on a separate subdoman. I wrote a list here: #1994 The removal function is great, but we need to implement it here as well as the removal script is assumed to be run standalone. |
Also, yes, generally we put all functions into lib.sh, but in this case I see no need for it as they're only used in desec.sh. If there are functions that are used in more places, they should go into lib.sh. Thinking about it, one is actually |
Just to confirm, I'm to remove my fork entirely and start from scratch? In stead of closing this pull request, update my fork to the newest master, and continue onward with my branch in another pull request? |
Do as you wish, but we need a clean slate here. As long as it's the latest master, I'm fine with it. 👍 |
👍Closing this PR |
@wildd0g Hey, just wondering if you ha any plans on improving deSEC further? You talked about a refactor IIRC. |
I'm currently moving house, afterwards I can take another look.
Refactor was focused on cotroll flow for assigning and auto updating a domain name, since the flow as it was assumed you need to create a new one and had no account yet, so situations where you already had an account and/or already had a domain you wanted to re-use were not supported.
…________________________________
Van: Daniel Hansson ***@***.***>
Verzonden: donderdag 18 augustus 2022 23:27
Aan: nextcloud/vm ***@***.***>
CC: wildd0g ***@***.***>; Mention ***@***.***>
Onderwerp: Re: [nextcloud/vm] Changed deSEC controll flow to allow for using existing subdomains with Authkey (#2080)
@wildd0g<https://github.com/wildd0g> Hey, just wondering if you ha any plans on improving deSEC further? You talked about a refactor IIRC.
—
Reply to this email directly, view it on GitHub<#2080 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACJIBM43YNSDGYSPF6LPCW3VZ2TE5ANCNFSM5CGB2C4Q>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
OK, no stress. Just switched house myself this month, I know the work load! |
Put individual steps of script into functions, and the functions in a controll flow at the bottom.
Added a path to the control flow for people who already have a subdomain claimed.
Changed some of the text to accomodate the new controll flow.
Added general abbort-exit function, which displays instructions how to run the script at a later time.
#2077