RE: Kerberos authentication using GSSAPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Simo,
Yes, I can use a Kerberos client script in Python to authenticate successfully.

Below is the result of the Python script in which you can see that I can get the key from KDC after authenticated.

iscca3005:jfan:252: KerberosTicket.py
Got key and prepare for web service call:

'Authorization': 'Negotiate YIINrwYJKoZIhvcSAQICAQBugg2eMIINmqADAgEFoQMCAQ6iBwMFACAAAACjggyrYYIMpzCCDKOgAwIBBaEUGxJBTVIuQ09SUC5JTlRFTC5DT02iNTAzoAMCAQOhLDAqGwRIVFRQGyJzY3ZpbW9weGpkYXBwMDEuYW1yLmNvcnAuaW50ZWwuY29to4IMTTCCDEmgAwIBEqEDAgEmooIMOwSCDDfyasgCujOFR/7sRMFKZT0Qz8gUVnQhAzUAMsodrLKvY6kgNZEz5yI5djUQRqLQPNQ0++yrk9MV2SJRQll7u1AcOXw6/FuPWaon2gyL5Q+eUrFxe7Z9XLd2UNaPjRbOBT+oEeF5nHEtvr575FFZcI4aXPX83DukLksJlVMDXfM10eGlVphw+QWLXXGMeAMB+MoYrRyeiZ2bHsZwsf6GeNu8fnQ6aoX0nmwP3h2OXm5fk6nb5FSRbXP2qpbmGWi4VN2D3LWhOu0EwYIf/Sca1n4ro8USpQYhoMwOMS3/+KZM3HN40Eq6tvQ2uItgAG4obHhPeu3hCFOaFwMfpsvHNAsdco9nnjcmWDoGZ4Em/Mw3mX1LI6zlbiBKx8BXaxiTUUzZXl/nE/uIgVclt2/Jn19DzOiKnSmC+Ovr5Ozf773U1HGFNNhlL+zLQZBxEU6PpT43i9s2y/kxzcERLT+ldC1wASueNhzO3e9s5jpfBGPk/fv8p149r/ahSdQqyFyX9ljH2N1/69sZ6xuLHU3ol7HpwIt0OjEEA7XcM5zLSxK4TncJwN6fMZxXOMoaAP6IDnPzh5MG5yh1MLK1t/zkmz/ZpPDboJQtPhutYRK1waT3nZgV/BDdEvmub+gJGgGNqlfAbXBAylsEJn79FIq+1zt6MNf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qJhrZWLkdtB8kQA428k+7ldFht2UcWTmiEa6UcL4a6n1CRU4IXzjIZ0facjv+j7mw37oCmfTR5rDL84tx/C/5lbQoQfLfZVkmXox/fAQU4jtHjIGc85eH82v/9GMQ8rRo9SkOrHiXkvKfb2GEjJXNG8tKxfO8egg5Xx/4QvEGwlO9wDTA1y0iE8A6OocSDZaQAfkLgWQ7wagfSESfSwPuJsI1U3f4+3kgsUlTxSlddqGlD38Rtcu+pIHVMIHSoAMCARKigcoEgccErTN+cgLl02mlUOjUHjWqACjHHmcJeU3EEhZO3T6iX0Ze1fOruapw0ZZlo729oCjn/P5QPceZ7HjwKr1V56gBTJ9MCy81mZhGB7haNyEJd/2jBV+ndn+klyq87j5yJ/xRTPo7dkcu6dFYpP/bqeZSfkZYjATKSvt+t46Ku1k5sJLr86FSQpeDnL8JpolaYMHiFM2MVDIfqRpipNsdOpSzViKCDW1kP6Cyf3aZpcr1arJAKlAVk8D4XeU31bsRXzoev4IXc0AC'


Thank you.
Jan


-----Original Message-----
From: Simo Sorce [mailto:simo@xxxxxxxxxx] 
Sent: Thursday, May 23, 2019 1:04 PM
To: Fan, Jan-fon <jan-fon.fan@xxxxxxxxx>; Cyrus-sasl@xxxxxxxxxxxxxxxxxxxx
Subject: Re: Kerberos authentication using GSSAPI

Are you able to obtain proper kerberos credentials outside of sasl ?
I would make sure you can manually get that going first.

Simo.

On Thu, 2019-05-23 at 18:47 +0000, Fan, Jan-fon wrote:
> Hi,
> I have been using a Python client script to do the authentication in our Linux environment and it's working properly.
> Now I need to write a C program to do the authentication and I am choosing Cyrus 2.1.27.
> After installation, I ran pluginviewer and it showed:
> 
> Installed and properly configured SASL (client side) mechanisms are:
>   GS2-IAKERB GS2-KRB5 GSSAPI DIGEST-MD5 EXTERNAL CRAM-MD5 PLAIN 
> ANONYMOUS Available SASL (client side) mechanisms matching your criteria are:
>   GS2-IAKERB GS2-KRB5 GSSAPI DIGEST-MD5 EXTERNAL CRAM-MD5 PLAIN 
> ANONYMOUS
> 
> So I think the installation is OK.
> 
> But after more than one week of trying, I am not able to make it work. Currently I got "generic failure" error message from the sasl_client_step.
> I will be appreciated if someone can send me a sample client program using GSSAPI mechanism.
> Below is my code:
> 
> int result;
> const char *data;
> unsigned len;
> const char *sasl_impl, *sasl_ver;
> sasl_interact_t *interactions = NULL;
> sasl_conn_t *conn;
> const char *chosenmech;
> char buf[2048];
> 
> sasl_security_properties_t secprops = {56, 256, 2048, 
> SASL_SEC_PASS_CREDENTIALS, NULL, NULL };
> 
> sasl_callback_t callbacks[] = {
>                 { SASL_CB_AUTHNAME, NULL, NULL },
>                 { SASL_CB_PASS, NULL, NULL },
>                 { SASL_CB_LIST_END, NULL, NULL }};
> 
> result = sasl_client_init(callbacks);
> 
> result = sasl_client_new("HTTP", "SCVIMOPXJDAPP01.INTEL.COM", NULL, 
> NULL, NULL, callbacks, SASL_SUCCESS_DATA, &conn);
> 
> sasl_setprop(conn, SASL_SEC_PROPS, &secprops);
> 
> result=sasl_client_start(conn, "GSSAPI", &interactions, &data, &len, 
> &chosenmech);
> 
> result = sasl_client_step(conn, NULL, NULL, NULL, &data, &len); while 
> (result == SASL_CONTINUE) {
>                 strcpy(buf, data);
>                 data=NULL;
>                 result = sasl_client_step(conn, buf, len, NULL, &data, 
> &len); }
> 
> After the while loop, the result is -1 (generic failure).
> 
> Thanks,
> Jan

--
Simo Sorce
Sr. Principal Software Engineer
Red Hat, Inc






[Index of Archives]     [Info Cyrus]     [Squirrel Mail]     [Linux Media]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux