edimusrex has asked for the wisdom of the Perl Monks concerning the following question:

I am using Perl to (or attempt to) connect to our internal openfire server using the Net::XMPP module. The idea is I will be able to connect and send an IM message to a specified chat user. This very basic example of my code is failing and I can't seem to figure out why

#!/usr/bin/perl use strict; use Net::XMPP; use Data::Dumper; my $con = Net::XMPP::Client->new( debuglevel=>1,); my $host = '<host name here>'; my $user = '<my username>'; my $pass = '<my password>'; my $status = $con->Connect( hostname => $host, connectiontype => 'tcpip', tls => 1 ); my @result = $con->AuthSend( hostname => $host, username => $user, password => $pass, ); print Dumper \@result;
When I execute the about code this is the message :
XML::Stream: new: hostname = (xxxxxxx) XML::Stream: SetCallBacks: tag(node) func(CODE(0xe540cc)) XMPP::Conn: xmppCallbackInit: start XMPP::Conn: SetCallBacks: tag(message) func(CODE(0x31bce1c)) XMPP::Conn: SetCallBacks: tag(presence) func(CODE(0x2ffe78c)) XMPP::Conn: SetCallBacks: tag(iq) func(CODE(0x31af94c)) XMPP::Conn: SetPresenceCallBacks: type(unsubscribe) func(CODE(0x31 +b15cc)) XMPP::Conn: SetPresenceCallBacks: type(subscribe) func(CODE(0x31af +4cc)) XMPP::Conn: SetPresenceCallBacks: type(unsubscribed) func(CODE(0x3 +1af424)) XMPP::Conn: SetPresenceCallBacks: type(subscribed) func(CODE(0x31b +32dc)) XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns="urn:ietf:para +ms:xml:ns:xmpp-tls"]) func(CODE(0x31b366c)) XMPP::Conn: SetDirectXPathCallBacks: xpath(/[@xmlns="urn:ietf:para +ms:xml:ns:xmpp-sasl"]) func(CODE(0x31b6774)) XMPP::Conn: xmppCallbackInit: stop XMPP::Conn: Connect: host(xxxxx:5222) namespace(jabber:client) XMPP::Conn: Connect: timeout(10) XML::Stream: Connect: type(tcpip) XML::Stream: Connect: Got a connection XML::Stream: Send: (<?xml version='1.0'?><stream:stream version='1 +.0' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:cli +ent' to='xxxxx' from='xxxxx' xml:lang='en' >) XML::Stream: Read: buff(<?xml version='1.0' encoding='UTF-8'?><str +eam:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jab +ber:client" from="xxxxx" id="4vpo9pt1zr" xml:lang="en" version="1.0"> +) XML::Stream: Read: buff(<stream:features><starttls xmlns="urn:ietf +:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:param +s:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>SCRAM-SHA- +1</mechanism><mechanism>EXTERNAL</mechanism><mechanism>CRAM-MD5</mech +anism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmln +s="http://jabber.org/features/compress"><method>zlib</method></compre +ssion></stream:features>) XMPP::Conn: Connect: connection made XML::Stream: SetCallBacks: tag(node) func(CODE(0x31b6e34)) XML::Stream: Send: (<starttls xmlns='urn:ietf:params:xml:ns:xmpp-t +ls'/>) XML::Stream: Read: buff(<proceed xmlns="urn:ietf:params:xml:ns:xmp +p-tls"/>) XML::Stream: TLSClientProceed: Convert normal socket to SSL XML::Stream: TLSClientProceed: sock(IO::Socket::INET=GLOB(0x31b6e1 +c)) XML::Stream: LoadSSL: Load the IO::Socket::SSL module XML::Stream: LoadSSL: Success XML::Stream: TLSClientProceed: ssl_sock(IO::Socket::INET=GLOB(0x31 +b6e1c)) XML::Stream: TLSClientProceed: SSL: We are secure XML::Stream: Send: (<?xml version='1.0'?><stream:stream version='1 +.0' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:cli +ent' to='xxxxx' from='xxxxx' xml:lang='en' >) XML::Stream: Read: buff(&#9702;&#9702;) XML::Stream: Read: buff() XML::Stream: Read: ERROR Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 1829. XMPP::Conn: AuthIQAuth: old school auth AuthIQAuth requires a resource arguement at chat.pl line 16. XMPP::Conn: SendAndReceiveWithID: object(Net::XMPP::IQ=HASH(0x31b9 +c3c)) XMPP::Conn: SendWithID: id(netjabber-0) XMPP::Conn: SendWithID: in(<iq type='get'><query xmlns='jabber:iq: +auth'><username>xxxx</username></query></iq>) XMPP::Conn: RegisterID: tag(iq) id(netjabber-0) XMPP::Conn: SendWithID: out(<iq id='netjabber-0' type='get'><query + xmlns='jabber:iq:auth'><username>xxxx</username></query></iq>) XMPP::Conn: SendXML: sent(<iq id='netjabber-0' type='get'><query x +mlns='jabber:iq:auth'><username>xxxx</username></query></iq>) Use of uninitialized value $sid in concatenation (.) or string at +C:/Perl/site/lib/XML/Stream.pm line 2735. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 2737. XML::Stream: Send: (<iq id='netjabber-0' type='get'><query xmlns=' +jabber:iq:auth'><username>test</username></query></iq>) Use of uninitialized value $sid in concatenation (.) or string at +C:/Perl/site/lib/XML/Stream.pm line 1668. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 1669. Use of uninitialized value in concatenation (.) or string at C:/Pe +rl/site/lib/XML/Stream.pm line 1669. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 1671. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 1673. Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/ +XML/Stream.pm line 1673. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 1675. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 1678. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 2615. Use of uninitialized value $sid in concatenation (.) or string at +C:/Perl/site/lib/XML/Stream.pm line 2735. Use of uninitialized value $sid in hash element at C:/Perl/site/li +b/XML/Stream.pm line 2737. XMPP::Conn: SendAndReceiveWithID: sent with id(netjabber-0) XMPP::Conn: WaitForID: id(netjabber-0) XMPP::Conn: ReceivedID: id(netjabber-0) XMPP::Conn: ReceivedID: nope... XMPP::Conn: WaitForID: haven't gotten it yet... let's wait for mor +e packets XMPP::Conn: Process: timeout(1) Use of uninitialized value in concatenation (.) or string at C:/Pe +rl/site/lib/XML/Stream.pm line 1440. Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/ +XML/Stream.pm line 1442. Use of uninitialized value within %status in numeric eq (==) at C: +/Perl/site/lib/XML/Stream.pm line 1506. Use of uninitialized value in subtraction (-) at C:/Perl/site/lib/ +XML/Stream.pm line 1507. XML::Stream: Send: ( ) Use of uninitialized value in concatenation (.) or string at C:/Pe +rl/site/lib/XML/Stream.pm line 1669. Use of uninitialized value in numeric eq (==) at C:/Perl/site/lib/ +XML/Stream.pm line 1673. XMPP::Conn: ReceivedID: id(netjabber-0) XMPP::Conn: ReceivedID: nope... XMPP::Conn: WaitForID: haven't gotten it yet... let's wait for mor +e packets XMPP::Conn: Process: timeout(1) XML::Stream: Send: ( ) XML::Stream: Send: ( ) XML::Stream: Send: ( ) $VAR1 = [];

Checking the server I can see the connection request, the firewall is also allow the connection to go through and using pigin and client type XMPP, I can connect via the user. Any help would be greatly appreciated

Replies are listed 'Best First'.
Re: Issues connecting to openfire via Net::XMPP
by Corion (Pope) on Dec 29, 2016 at 20:08 UTC

    Maybe this patch that supposedly is applied on Debian helps you too?

    It claims to make SSL failures fatal, which could then help you in debugging the real cause. My guess is that the connection is SSL with a self-signed certificate but you don't have the appropriate certificate chain or didn't tell IO::Socket::SSL to allow your organisations certificate.

      Thank you for the response, it gives me something to look for. Spending a few moments looking into this it appears there is a possible issue with my certificate. I will try and clear that up first and see if it resolves the issue. Thank you

        Hello edimusrex,

        What was your final solution to this problem?

        I recently upgraded to Openfire 4.1.1 and a legacy XMPP bot written in Perl will no longer authenticate.
        In my case it fails when calling AuthIQAuth()

        Thanks,
        Mike