summaryrefslogtreecommitdiffstats
path: root/proxy/src
Commit message (Collapse)AuthorAgeFilesLines
* Control access to constrained delegationSimo Sorce2017-01-135-0/+124
| | | | | | | | A client must be tusted or must be explicitly allowed to perform impersonation or constrained delegation to be able to use evidence tickets for s4u2proxy operations. Signed-off-by: Simo Sorce <simo@redhat.com>
* Add control to permit/deny protocol transitionSimo Sorce2017-01-133-7/+15
| | | | | | Denies by default. Signed-off-by: Simo Sorce <simo@redhat.com>
* Make local call staticSimo Sorce2017-01-131-4/+4
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Parse cred_store struct earlierSimo Sorce2017-01-133-47/+73
| | | | | | | | This will provide immediate feedback if an option is incorrectly formatted as well as avoid multiple parsing when the cred store spec needs to be used in multiple places. Signed-off-by: Simo Sorce <simo@redhat.com>
* Use a local keytab for creds encryptionSimo Sorce2017-01-133-36/+142
| | | | | | | | | | | | | If available use a keytab for creds encryption. Since now we can store encrypted credentials, on the cient side, for later reuse, it is better to be able to decrypt them even after a gssproxy daemon restart (maintenance, crashes, etc..) If a keytab is rotated this can cause a restarted gssproxy to fail to decrypt stored credentials, but in that case those credentials are also probably useless and need to be refreshed, so this is not a huge deal, and definitely better than the status quo. Signed-off-by: Simo Sorce <simo@redhat.com>
* Always initialize ccache when storing.Simo Sorce2017-01-091-8/+4
| | | | | | | | | | | If we do not initialize the ccache additional entries will pile up and the code that retrieves the encrypted credentials will end up sourcing old, expired creds instead of the latest ones. Plues storage size may grow indefinitely. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com> Merges #35
* In acquire_cred_from, probe for remote credsSimo Sorce2017-01-093-5/+46
| | | | | | | | | | | | | | | | If the calling application is passing in a cred_store, it's either one of two cases: - The application previously stored credentials in a ccache and now wants to use them. - The application has access to specific keys and wants to acquire a local credential. In the first case we can only work with a remote call as a local mechanism wouldn't know what to do with remote creds. In the latter calling the remote code would make no sense as we have local credentials. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Make sure to pass on request for delegated credsSimo Sorce2017-01-091-0/+5
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Add cred_store support for local calls.Simo Sorce2017-01-093-29/+122
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix leak of ach in gp_accept_sec_context()Robbie Harwood2016-10-131-0/+1
| | | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com> Merges #34
* Fix leak of localname in gp_export_creds_linux()Robbie Harwood2016-09-281-1/+3
| | | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com> Merges #33
* Fix two leaks in gp_get_cred_environment()Robbie Harwood2016-09-281-9/+9
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Appease clang with memset instead of initializerRobbie Harwood2016-09-271-1/+3
| | | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com> Closes 31
* Fix type of argument to gppint_get_def_creds()Robbie Harwood2016-09-271-1/+1
| | | | | | | Some compilers don't like GSS_C_NO_NAME as a generic NULL value. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix NULL deref in gssi_release_cred()Robbie Harwood2016-09-261-1/+3
| | | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com> Merges 32
* Fix NULL deref in gssi_release_name()Robbie Harwood2016-09-261-1/+1
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Use new socket if uid, pid, or gid changesRobbie Harwood2016-06-071-0/+22
| | | | | | | | | | | The gssproxy daemon uses SO_PEERCRED to determine credentials of the connecting process. However, these credentials are set only at the time connect has called. Therefore they must be reset every time uid or pid changes. For completeness, we check gid as well. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com> Closes #27
* Fix typo in gp_get_export_creds_type()Andrew Elble2016-06-011-1/+1
| | | | | | | | Should be EXP_CREDS_TYPE_OPTION, not EXP_CTX_TYPE_OPTION. Fixes: e155f81d84f7 ("Add helper to find options in rpc messages") Signed-off-by: Andrew Elble <aweits@rit.edu> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix return check on gp_conv_gssx_to_nameRobbie Harwood2016-05-181-1/+3
| | | | | | | | | This bug was found by Coverity. Merges #25 Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Implement the krb5_principal optionSimo Sorce2016-04-221-0/+17
| | | | | | | | | | The krb5_principal option was defined and documented but not actually used. Implement it's use when a service keytab is provided. Ticket: https://fedorahosted.org/gss-proxy/ticket/155 Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix use after free bugSimo Sorce2016-04-221-1/+2
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix crash bug when reconfiguring serviceSimo Sorce2016-04-221-2/+6
| | | | | | | | If the socket is null the strcmp will segfault. Check for equality of pointers or nullity before entering the strcmp() Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix for gss_inquire_attrs_for_mech accepting NULLsRobbie Harwood2015-12-161-16/+22
| | | | | | | | | | | | | | As per rfc5587, gss_inquire_attrs_for_mech must accept NULL mech_attrs and known_mech_attrs arguments. Up until 1.14, MIT krb5 was not ever passing NULLs in these fields. This fixes an interposer loop (and subsequent segmentation fault) due to our previous assumption that these arguments not be NULL. See also: https://tools.ietf.org/html/rfc5587#section-3.4.3 Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Since krb5 1.14 inquire_context may return no nameSimo Sorce2015-12-161-6/+10
| | | | | | | | | | In 1.14 a patch to more officially support partially established contexts has been intrdouced. With this patch names are not returned. Cope with that by checking if a name is provided before trying to convert. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix acquiring default credentialsSimo Sorce2015-12-011-1/+3
| | | | | | | | | In this case we want to prefer sourcing the "acceptor" credentials from a keytab if available, as that's what applications expect if they have no credentials. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwoood <rharwood@redhat.com>
* Add helpers to store and retrieve encrypted credsSimo Sorce2015-12-014-9/+246
| | | | | | | | This will allow to (ab)use the krb5 ccache to store encrypted credentials in the user's ccache for later reuse. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwoood <rharwood@redhat.com>
* Add gss_acquire_cred_impersonate_name supportSimo Sorce2015-12-0111-26/+261
| | | | | | | | This is used by a client that wants to peform a s4u2self operation using its server credentials. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwoood <rharwood@redhat.com>
* Add helper to find options in rpc messagesSimo Sorce2015-12-012-30/+44
| | | | | | | Use it in gp_export.c where the code is duplicate already. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwoood <rharwood@redhat.com>
* Add higher level debugging for all rpc callsSimo Sorce2015-12-0114-0/+804
| | | | | | | Print everything, except octet string buffers which are truncated. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Add options to specify a debug levelSimo Sorce2015-12-015-13/+71
| | | | | | | | Print only messages that are at that level or lower. Also add timestamps to debug messages. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Improve code in gp_export_gssx_cred()Simo Sorce2015-11-301-9/+5
| | | | | | | | Remove dead code, and set length only if allocation was successful. Also resolve valgrind complaints about uninitialized memory. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix const warning that can lead to issuesSimo Sorce2015-11-301-1/+1
| | | | | | | This could lead to a free() being called on a constant, and that wuld be bad. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix const warning in gp_creds.cSimo Sorce2015-11-302-1/+3
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
* Fix several leaksRobbie Harwood2015-11-195-0/+8
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix possible explicit NULL deref in gpm_accept_sec_contextRobbie Harwood2015-10-291-5/+7
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix potential deadlock on socket grabRobbie Harwood2015-10-291-3/+1
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Clear message structure before decoding into itRobbie Harwood2015-10-211-0/+1
| | | | | | | | This resolves a segfault appearing on ARM. Ticket: https://bugzilla.redhat.com/show_bug.cgi?id=1235902 Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Log useful message on kernel interface failureRobbie Harwood2015-10-091-5/+8
| | | | | | | | | Also, cause all failures on accessing this interface to exit GSS-Proxy similar to config file errors. Ticket: https://fedorahosted.org/gss-proxy/ticket/126 Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Correct handling of EINTR on read()/write()Robbie Harwood2015-09-281-2/+2
| | | | | | | | The common send/recv functions where zeroing the ret variable only once causing a loop if EINTR as actually ever set. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Signed-off-by: Simo Sorce <simo@redhat.com>
* Reload config on SIGHUPRobbie Harwood2015-09-154-45/+157
| | | | | | | | For sockets, we will only reinitialize those that have changed. Additionally, the old text about SIGHUP behavior was incorrect. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Ticket: https://fedorahosted.org/gss-proxy/ticket/125
* getpwman(3) can return NULL without setting errnoRobbie Harwood2015-09-141-0/+3
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Allow configdir and configfile to be specified togetherRobbie Harwood2015-09-141-7/+0
| | | | | | | Not being able to do this is a relic of a previous design. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix formatting on noncompliant copyright linesRobbie Harwood2015-09-0461-1477/+61
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Error on `allow_any_uid` issuesRobbie Harwood (frozencemetery)2015-09-041-1/+43
| | | | | | | | As per gssproxy.conf(5), setting allow_any_uid without also setting socket or selinux_context is known to cause problems. Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Extract generalized selinux context comparison functionRobbie Harwood2015-09-042-13/+26
| | | | | Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Add support for config directoriesRobbie Harwood (frozencemetery)2015-09-044-30/+142
| | | | | | | | | | Option '-C|--configdir' has been added, and defaults to /etc/gssproxy. File "gssproxy.conf" and all files of the form "##-foo.conf" will be read from that directory. Ticket: https://fedorahosted.org/gss-proxy/ticket/122 Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Remove one layer of abstraction over dinglibsRobbie Harwood (frozencemetery)2015-08-313-397/+261
| | | | | | | | A handful of parameter name differences (`key` vs. `keyname`) have been tweaked but the function bodies are otherwise unchanged. Signed-off-by: Robbie Harwood (frozencemetery) <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Allow symbolic euids in conf filesRobbie Harwood (frozencemetery)2015-08-261-9/+25
| | | | | | Fixes: https://fedorahosted.org/gss-proxy/ticket/151 Signed-off-by: Robbie Harwood (frozencemetery) <rharwood@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Remove support for iniparse libraryRoland Mainz2015-04-153-258/+0
| | | | | | | | | | This library already does not support some features we need and we want to drop its usage as the code quality is bad. Fixes: https://fedorahosted.org/gss-proxy/ticket/139 Signed-off-by: Roland Mainz <rmainz@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix handling of context initializationSimo Sorce2015-03-301-5/+7
| | | | | | | | | | | | | | If a previous call has decided to use only local (to the process) credentials, then we need to override all the way to the end. A previous patch also swapped the order in which credential handler and context handler are initialized, make sure also to swap the fallback checks. Set the behavior to the process default only if it wasn't forced to local. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Lukas Slebodnik <lslebodn@redhat.com>