Secure Search Fails

Oct 29, 2012 at 3:26 PM
Edited Nov 13, 2012 at 9:34 PM

I am attempting to conduct a secure search.  I have set the access field to ALL and created network credentials to give to ca.credentials.  The GSA is set to do secure searches over an https connection. I keep getting "System.IO.IOException: The handshake failed due to an unexpected packet format." error returned from the GSA. Any ideas what I am doing wrong?

UPDATE:  I changed to port number in the initialization of the clientaccess object from 80 to 443 to match the https connection.  I am now getting a 417 expectation failed error.

Here is my code:

 

public static GSALib.GSA.Response GetGoogleSearchResponse(string searchTerm, int start, int numToGet)
    {
        GSALib.GSA.Query q = new GSALib.GSA.Query();

        q.setSiteCollections(new string[] { ConfigurationManager.AppSettings["GSACollection"] });

        q.setFrontend(ConfigurationManager.AppSettings["GSAFrontEnd"]);

        q.setOutputFormat(GSALib.Constants.Output.XML_NO_DTD);

        q.setOutputEncoding(GSALib.Constants.Encoding.UTF8);

        q.setAccess(GSALib.Constants.Access.ALL);
        //q.setAccess(GSALib.Constants.Access.PUBLIC);

        q.setMaxResults(numToGet);

        q.setScrollAhead(start);

        GSALib.GSA.QueryTerm term = new GSALib.GSA.QueryTerm(searchTerm);

        q.setQueryTerm(term);

//Changed port number to 443. GSALib.GSA.ClientAccess ca = new GSALib.GSA.ClientAccess("https", "addressOfGoogleServer", "443", "search"); ca.credentails = System.Net.CredentialCache.DefaultNetworkCredentials; try { GSALib.GSA.Response response = ca.getGSAResponse(q, null); return response; } catch (GSALib.Exceptions.GSANeedNetworkCredentailsException ex) { EventLogWriter.WriteExceptionToEventLog("GSA Secure call made without credentials.", ex.ToString()); return null; } catch (System.Exception ex) { EventLogWriter.WriteExceptionToEventLog("Error occured in GetGoogleSearchResponse.", ex.ToString()); return null; } }
Coordinator
Nov 13, 2012 at 4:54 AM

Is SSL setup correct on your GSA?  How is universal login configured?

Nov 13, 2012 at 9:39 PM
Edited Mar 3, 2014 at 3:30 PM
I updated the post to reflect the "updates" I have put in place since I first posted.  I am now receiving "417 Expectation Failed"
SSL is set up correctly.  I can visit the GSA's interface and perform secure searches with no problem.  Universal login is configured to use Kerberos and NTLM. 
Mar 1, 2014 at 3:28 PM
Can you please specify what the fix was for the "417 Expectation failed" error.Facing the the same issue after setting the access parameter as "a".Also sending the default network credentials.What else need to be set in the C# code?
Coordinator
Mar 1, 2014 at 8:14 PM
Mar 3, 2014 at 6:23 AM
Thanks for the quick reply. I had gone through the link previously. One thing I forgot to mention is that the secure search is working perfectly through the google interface.The secure search doesn't work only when I hit the GSA from my .NET code. If the problem was with the SSL setup, it shouldn't have worked from the google interface either. Please correct me if I am wrong.

Some more info:

When I check the serving logs after hitting the GSA from the .Net app,the authentication ends abruptly after redirecting to SAML.
The query has reached GSA,but looks like it needs some additional info to continue with the authentication.

Logfile for request: 8254393637994017885
140361 22:06:03.446
[Appliance Frontend]
Query received: walking yoga
140361 22:06:03.449

[Appliance Frontend] Full query URI: /search?q=walking+yoga&access=a&as_occt=&num=10&start=0&as_sitesearch=&filter=1&ie=utf8&oe=utf8&lr=&getfields=vc&UserQuery=walking+yoga&userInfo=ashaale1&site=A000_iSearch%7cP002_AllVC%7cP002_emb&client=A000_iSearch&output=xml_no_dtd
140361 22:06:03.465

[Authentication] New session for this request: d17ee287c519814c2e48d4ae46d293af
140361 22:06:03.474

[Authentication]
running AuthN mechanism SAML
140361 22:06:03.478 [Authentication] Redirecting user to be authenticated by the Security Manager: https://searchsc-dev.intel.com/security-manager/samlauthn?gsaRequestId=8254393637994017885&SAMLRequest=jZJNj9MwEIbvSPyHyPd8Nuy2VpNVoWyJBKsCAbTcXHuSeOXYweO0y78nSYs2e2CFNAdrbM/7zDuzvnlslXcEi9LojMRBRDzQ3Aip64x8K2/9JbnJX79aI2tVRze9a/QX%2BNUDOm/4qZFOFxnpraaGoUSqWQtIHadfN58%2B0iSIaGeNM9wo4hXbjBweaq5bKR4OShtoKtMJJRTwqhN1w%2BsaeKPrWlbE%2B/4XKxmxCsQeCo2OaTekojj1o8UQZXRFx1j8JN7%2BovRW6nMHL2Edzo%2BQfijLvb%2BxTlaMu6nIUQqwd8OPjNTG1AoCbtoRYc8Q5XFIV0whkHzyhU5odmbIy8JDDRjUjCZ541xHw/BJJATtwHZWIoQ1srBc%2BNu73eftrixX9z929%2BtwpniWTzr6/tGBHr3CGUTyv2PJ16M%2B3SGb5nspMeYycgE8nU7BDJLMVoZ4CDieC5EREV8DJMtr/iZeLeOUJ5AuRcogvRLJasGGoYb5uYVn1Pllv0bLi%2B3eKMl/exulzOmdBeYGv53tgXi3xrbM/butOIinjBR%2BNT2lvcYOuKwkiCft54s8rPcf&RelayState=/search?site%3DA000_iSearch%257cP002_AllVC%257cP002_emb%26as_sitesearch%3D%26UserQuery%3Dwalking%2Byoga%26client%3DA000_iSearch%26lr%3D%26gsaRequestId%3D8254393637994017885%26access%3Da%26oe%3Dutf8%26as_occt%3D%26num%3D10%26start%3D0%26q%3Dwalking%2Byoga%26ie%3Dutf8%26getfields%3Dvc%26output%3Dxml_no_dtd%26userInfo%3Dashaale1%26filter%3D1
Coordinator
Mar 3, 2014 at 1:49 PM
How is your universal Login Manager setup? .NET will support Kerberos and NTLM.
Mar 3, 2014 at 3:28 PM
ashaalex30 wrote:
Can you please specify what the fix was for the "417 Expectation failed" error.Facing the the same issue after setting the access parameter as "a".Also sending the default network credentials.What else need to be set in the C# code?
ashaalex30, I have yet to fix the "417 Expectation Failed" error. The "fix" I applied is described in the original post as an update. I was originally getting a system.io.exception. After changing the port number from 80 to 443, I started receiving "417...". If you find a solution to your problem please be sure to post it here as I am stuck in a situation very similar to yours.
Coordinator
Mar 3, 2014 at 3:32 PM
Also, if you feel there is an issue, please create one and we'll look into it.
Mar 4, 2014 at 7:23 AM
I have created an issue for the same (item# 16740).Can you please provide me with a working .Net(C#) implementation of the same?