-
Notifications
You must be signed in to change notification settings - Fork 27
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
Debug-log for gssntlmssp cannot be collected for process with nonempty permitted capability set #53
Comments
The debug log can reveal security relevant information, and we do not want to accidentally do that in a setuid binary or similar, which is why secure_getenv() is used. You would have to use dlsym() to make sure the symbol is currently available in the process to avoid a potential crash if the plugin is not actually loaded, but other than that it would give direct control to the calling binary w/o depending on an environment variable. |
Alternatively I think we could provide a facility via a gss_set_sec_context_option() call ? |
Uhm the problem with gss_set_sec_context_option() is that it requires a context object, so it would come too late .. |
A gss_set_cred_option() call could be used too ... not ideal but at least can be set before a ISC/ASC operation is performed by acquiring the credentials before hand ... |
I'm afraid that using dlopen/dlsym for direct access to gssntlmssp library .so breaks the whole concept of GSSAPI. What we actually do in our code is linking with '-lgssapi_krb5' library (MIT Kerberos GSSAPI library) and we use GSSAPI provided by it. Our binary doesn't do anything to load gssntlmssp, this is done internally by MIT library (i.e. gssntlmssp acts like a plugin of public GSSAPI to provide NTLM auth additionally to Kerberos). Moreover, the path to gssntlmssp.so is written in /etc/gss/mech.d/ntlmssp.conf (not hardcoded) and we don't want to duplicate the logic of GSSAPI to read and parse this file during our initialization. We want to have more convenient public API for this; using dlsym looks like a hack... |
The option with calling gss_set_cred_option() looks much better from API point of view. I would refactored/split gssntlm_debug_init code to accept new path of log-file (NULL if should be disabled) and would make it re-enetable (current code never closes debug_fd and does not free associated resources). In case if debug_fd is already opened then gss_set_cred_option should make a transaction to open a new file and update debug_fd atomically (it's a pointer, we can rely on CPU atomic updates of machine-word variable) and then free old resources if needed. |
Ok, I need to carefully think about this. Esp in terms of how it will work once (one day) we finally get gss_create_sec_context() and will be finally able to set context options. My intention with proposing context/cred options was to then tied debug logs to only calls that use those creds, and if a context is created from the creds then "inherit" the debug setting on the context. Ie my intention is not to abuse a gss_set_cred_option() to set a global variable or even a per-thread variable. Do these considerations change in any way your opinion on the viability of using gss_set_cred_option() ? |
For our specific use-case we call gss_acquire_cred to fetch SMB server credentials and after that we use it for gss_accept_sec_context every time we need authentication via GSS. We call gss_acquire_cred during initialization of SMB server (usually done only once on the very start) so calling gss_set_cred_option doesn't change our main flow (not needed for each individual authentication). But from other side, if the problem happens in GSS layer BEFORE successful call of gss_accept_sec_context/gss_set_cred_option, we will be not able to see anything in logs (because they are not enabled yet); so the feature of 'global variable' introduced by gssntlm_debug_init is still useful in general case. |
Ok so I think there has been a previous misunderstanding that perhaps will make this simpler for you. All that said I think we could aso use gssspi_mech_invoke() (sepxorted by gssapi_ext.h) to call a mechanism specific function. |
Well, we don't need to support old and new versions of gssntlmssp with the same code. |
We use gssntlmssp from SMB server (NTLM authentication) and we need to enable logging feature for gssntlmssp.
Logging is already supported here in some basic way via GSSNTLMSSP_DEBUG environment variable.
However in the code 'secure_getenv' function is used to fetch it:
From 'man secure_getenv':
Alas, in SMB server we need to listen SMB port 445 (lower port < 1024) so cap_net_bind_service is specially set for this.
Bottom line - our process can't enable logging in any way because secure_getenv always returns NULL. We need some optional way to enable logging.
The text was updated successfully, but these errors were encountered: