PacketFence - BTS - PacketFence
View Issue Details
0001676PacketFenceradiuspublic2013-08-01 16:112013-09-13 11:10
dgreer 
francis 
normalmajorhave not tried
resolvedfixed 
4.0.1 
4.0.4 
4861189ba7faf680eef257d5b1c157d7260fe0de
0001676: In 4.0.3, RADIUS stopped authenticating
Not sure what I did to trigger this, but had a problem with RADIUS authentication, specifically the following error message:
"Error: rlm_perl: No or invalid reply in SOAP communication with server. Check server side logs for details."

Digging down, I found this was coming from the call of pf/raddb/packetfence.pm, and in that I figured out that I could dump return contents to the radius.log, so I did that and got this:

"Thu Aug 1 14:37:44 2013 : Info: rlm_perl: curl_return_code: 0
Thu Aug 1 14:37:44 2013 : Info: rlm_perl: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [^] xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" [^] xmlns:xsd="http://www.w3.org/2001/XMLSchema" [^] soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" [^] xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Content-Type [^] must be 'text/xml,' 'multipart/*,' 'application/soap+xml,' 'or 'application/dime' instead of 'application/x-www-form-urlencoded'</faultstring></soap:Fault></soap:Body></soap:Envelope>
"

Doing some Googling brought me to this article on StackExchange:
http://stackoverflow.com/questions/9062121/send-a-http-post-requestxml-data-using-wwwcurl-in-perl [^]

So I plugged in the CURLOPT_HTTPHEADER() line to force it to use "text/xml" and problem is fixed.

Here's the patch:

]# diff -U2 /root/backup/usr/local/pf/raddb/packetfence.pm packetfence.pm
--- /root/backup/usr/local/pf/raddb/packetfence.pm 2013-07-22 14:30:34.000000000 -0500
+++ packetfence.pm 2013-08-01 15:01:57.000000000 -0500
@@ -174,4 +174,5 @@
     my $response_body;
     $curl->setopt(CURLOPT_HEADER, 0);
+ $curl->setopt(CURLOPT_HTTPHEADER(), ['Content-Type: text/xml; charset=UTF-8']);
     $curl->setopt(CURLOPT_URL, 'http://127.0.0.1:' [^] . SOAP_PORT); # TODO: See note1
 # $curl->setopt(CURLOPT_URL, 'http://127.0.0.1:' [^] . $Config{'ports'}{'soap'}); # TODO: See note1
@@ -184,5 +185,6 @@

     # For debugging purposes
- #&radiusd::radlog($RADIUS::L_INFO, "curl_return_code: $curl_return_code");
+# &radiusd::radlog($RADIUS::L_INFO, "curl_return_code: $curl_return_code");
+# &radiusd::radlog($RADIUS::L_INFO, "$response_body");

     # Looking at the results...
No tags attached.
Issue History
2013-08-01 16:11dgreerNew Issue
2013-08-01 21:12fdurandNote Added: 0003373
2013-09-13 11:10francisfixed in git revision => 4861189ba7faf680eef257d5b1c157d7260fe0de
2013-09-13 11:10francisStatusnew => resolved
2013-09-13 11:10francisFixed in Version => 4.0.4
2013-09-13 11:10francisResolutionopen => fixed
2013-09-13 11:10francisAssigned To => francis

Notes
(0003373)
fdurand   
2013-08-01 21:12   
Hello,
you are right but to late ;-)
https://github.com/inverse-inc/packetfence/commit/4861189ba7faf680eef257d5b1c157d7260fe0de [^]

Fabrice