-
Notifications
You must be signed in to change notification settings - Fork 250
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
OID of MechToken does not match the first in the MechTypeList? #278
Comments
The default OID token generated by curl on Linux is of MechType OIDKRB5 ( I had to use the credential cache to generate a suitable OID token to satisfy the requirement. It will be great if the library can support OIBKRB5 as well. Sample code:
}` |
The problem was solved partially only by changing the code in the file:
Before:
After:
In the same time I notice that if I make GET request to the URL from client application it raise error: |
@shanmugh Hello! Thank you for your answer. I am little bit confused. As I understand you correctly, you recommend not to use |
@NogerbekNurzhan can you provide some more details on the client you are using? The lines you have quoted from However looking at the |
@jcmturner I'm having the same problem. It appears that when authenticating from a browser with a Microsoft Server 2016 domain controller, the first MechType is the Looking at the implementation of those types, it looks like they might be able to be used interchangeably? |
I'm having the same problem as @NogerbekNurzhan and @BryceDFisher. RFC4178 states:
So, if I understand it correctly, sending negotiation token with negstate=request-mic is not implemented in
But this solution is far from perfect, and as @BryceDFisher noted, it looks like there those types can be used interchangeably (I tried to comment the equality check in spnego/negotiationToken.go and it worked), so there is no need in another negotiation round in this case. |
I'm also having the same issue. I setup an example based on the httpServer.go example, I just swapped in a keytab file I generated on the AD server. My AD server is Windows Server 2019 Core Then I added the url of this test site to my "Local intranet" listing. Open the site up with Google Chrome and I get the below error.
As a quick dirty test, I commented out https://github.com/jcmturner/gokrb5/blob/master/spnego/negotiationToken.go#L174 to see what would happen - and everything worked (or seems to), and my I got the results showing my logged in user info. If there's any added details you want that could help debug this, I'm game to help. Having this library working well would be pretty handy for me. |
@jcmturner just checking if you've had time to review any of this? It seems you've been off the radar for a bit in terms of this repo - which I understand that life gets in the way. However, without a fix to this here I'll need to fork and apply changes to my own copy of this package and that's something I'd rather not do :) |
@jcmturner . Wondering if you had time to review this? I too am in the same situation. |
If anyone is interested, I have made fixes for these two issues
I have made a branch with both fixes: https://github.com/jgiannuzzi/gokrb5/tree/compatibility_fixes To use it, you can either add this to your [[constraint]]
name = "gopkg.in/jcmturner/gokrb5.v7"
source = "github.com/jgiannuzzi/gokrb5"
branch = "compatibility_fixes" or add this to your
|
Hi all, sorry for being away for a while. I hope to start looking into this again but it may take me a while to get back up to speed so please be patient. I also need to fix the integration test automation that no longer seems to run. Thanks for the contributions. I want to make sure that we solve this in the right way with regards to the RFCs etc. Therefore I want to get a good understanding of what is going on here and what has been contributed so that we produce the correct long term solution and not just a work around. Thanks. |
@jcmturner phew, that's really great news. I really didn't want fork this and find myself trying to maintain it - especially since I don't know the RFC as well as you surely do. I am happy to help with testing or otherwise if it helps. If you setup a way to donate, I'll happily buy you a beer, or ten. I know keeping up maintenance on libraries can be very hard to do as life changes. |
* Add minimal kerberos support. * Clean up Kerberos implementation. * White space. * Try fixed gokrb5 library jcmturner/gokrb5#278 * Add more logging. * Add windows client kerberos support, refactor client connections. * Fix executor config including docs. * Add kerberos support for linux clients. * Fix not checked error. * Update go.mod. * Fix url parsing for spn. * Fix credentials file loading. * Add env option to executor helm chart. * Add user name suffix support for Kerberos auth. * Remove logging of the token. * RefreshKerberos cache file every 5 minutes. * Remove unnecessary logging.
Hi all, thanks very much for all your contributions and information. This is has been really helpful! After reviewing this thread again and the PRs some have been kind enough to send I have put together the following to summarise what I think the position is and how we should proceed. Firstly there are three issues raised here:
ACTION: I will dedicate this github issue (#278) to the first issue and will be raising separate github issues to cover the other two. Please can you follow and comment on the relevant issues so we can decouple them from now on. |
From now on I am focusing here on the first issue that arises when using Microsoft Windows Server 2016. Some background: RFC4178 states that the initial negotiation message can optionally contain the initial mechanism token for the preferred mechanism of the client. gokrb5/spnego/negotiationToken.go Line 173 in 039b60d
It is this that generates the error seen. It seems that the Microsoft Server 2016 AD DCs are doing one of two things which is the root cause: From a purist point of view I think the true issue here is in Windows Server 2016 not following the RFC correctly. ACTION: I will look to post something on the Microsoft Community site to see if someone can take a look at that. Nevertheless this does not help with the problem people are experiencing in the short term. Therefore I suggest gokrb5 implements a work around for now even though it is not in strict compliance with the RFC. I think this is acceptable as I don’t see any impact on security. Given that there are two possible root causes behind Windows Server 2016 behaviour there are two possible solutions for which PRs have already been submitted for each (thanks!). For each of the root causes we have: ACTION: We need to confirm which is happening to select which work around to merge. Is it “a” or “b”? I don’t have access to a Windows Server 2016 instance to check currently so I am hoping that either @jgiannuzzi or @BryceDFisher would be able to help investigate. Can you help here? |
I have raised this question with the Windows community: https://social.technet.microsoft.com/Forums/en-US/0e4252d1-a102-4628-a6a5-266514090e88/bug-in-windows-server-2016-spnego?forum=winserverDS |
@jgiannuzzi , @BryceDFisher I've just thought that the issue here is probably not with Windows 2016 as the DC. This will just send back Kerberos tickets. It is the client that wraps it up into SPNEGO tokens and therefore the issue is most likely with the client that is being used. I assume you are both using a browser when seeing this issue? Can you comment back with the detail of the browser and its version? Thanks! |
@jcmturner I have seen this issue with Google Chrome, Microsoft Edge, and Internet Explorer 11; all on Windows 10. I unfortunately do not have access to this setup anymore, and thus to the exact versions, but I could try reproducing it in a VM. Let me know if that would be useful. With regards to the root cause, as per #325, what I observed was that the created tokens would contain the MechToken in the MechTypes, but not always as the first one. I think the affected browsers all use the same Microsoft API to create the SPNEGO tokens, and it is probably that API that creates them in that specific way on Windows 10. In that case, any other client using that API would potentially generate the same kind of tokens, and not just browsers. |
By the way I have the same issue using Windows Server 2012 as DC. Client: Windows 7 SP1; Chrome 79. |
I have been able to recreate this on Windows 2012. I believe the issue is on the client side not the DC as it is the client that forms the SPNEGO ticket. You can see in the wireshark screen shot below that the order of the preferred mech types does not match the mech token being sent. That is the OID of the mech token is not the same as the first item in the mech types list. A strict interpretation of this is the client is sending its 2nd preference which does not make sense. Both the KRB5 and MS KRB5 mech types are in the list so I don't think they are being used interchangeably. Therefore I don't think that PR #293 is the correct approach. |
Hey @jcmturner, thanks a lot for looking into this! I wonder if removing that check entirely means that we don't check anywhere the OID of the MechToken. Maybe we should at least verify that it is one of our supported mechs? I guess this could be done in KRB5Token.Unmarshal or KRB5Token.Verify? As a side note, whilst researching why this MSLegacyKRB5 OID even exists, I found this note from Microsoft, which states in point 8 that
My understanding is that we currently send back a static response token with the standard Kerberos OID, no matter what. So if we want to support Windows 2000, it looks like we should change that. And if we do not want to support it, then we do not need to support the MSLegacyKRB5 OID when accepting requests. Thoughts? |
Thanks @jgiannuzzi this is really useful. My view is that Windows 2000 is so old and isn't supported by MS any more so I don't see that we should be supporting it either. As you suggest it would make sense to add to the unmarshal at... Lines 67 to 73 in 8a3a3d7
a check that this OID is 1.2.840.113554.1.2.2 |
I merged in #353 for this. |
Hello! I am little bit confused and need some advice.
In my
Golang
(versiongo1.11.5 linux/amd64
) application I am trying to use this library to create SSO (single sign on) authorization byKerberos
andActive Directory
.I have several things:
SPN
name for my microservice.krb5.keytab
for my microservice.krb5.conf
file for kerberos client where I setREALM
andKDC
information.As you can see my main.go file looks pretty simple:
This code raise such ERROR:
OID looks like this:
1.2.840.113554.1.2.2
My MechTypeList looks like this:
MechTypeList{true false {[1.2.840.48018.1.2.2 1.2.840.113554.1.2.2 1.3.6.1.4.1.311.2.2.30 1.3.6.1.4.1.311.2.2.10] {[] 0} [96 130 6 130 6 9 42 134 72 ***] [] <nil> <nil>} {0 [] [] <nil> <nil>} <nil> <nil>}
It seems like MechToken comparison failes. What's wrong happens? What can you advice for fix this problem? Let my know if you need some additional information.
The text was updated successfully, but these errors were encountered: