I'm trying to connect to my company XMPPServer and get the following exception:
java.io.EOFException: input contained no data
at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3003)
at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1410)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:325)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)
My code is really basic...
System.setProperty("smack.debugEnabled", "true");
XMPPConnection.DEBUG_ENABLED = true;
ConnectionConfiguration config = new ConnectionConfiguration("xxx", 5223);
config.setSecurityMode(SecurityMode.enabled);
config.setSASLAuthenticationEnabled(true);
config.setDebuggerEnabled(true);
config.setCompressionEnabled(false);
XMPPConnection connection = new XMPPConnection(config);
connection.connect();
What am I doing wrong?
The "Raw Sent Packets" from the Smack Debug window seem to display the right xml flow:
<stream:stream to="xxx" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
<presence id="3347O-0" type="unavailable"></presence>
</stream:stream>
---- UPDATE ----
I found the issue.
For SSL connection the following code is needed:
config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
config.setSocketFactory(new DummySSLSocketFactory());
The DummySSLSocketFactory class can be found in Spark or directly here:
http://svn.igniterealtime.org/svn/repos/spark/trunk/src/java/org/jivesoftware/spark/util/DummySSLSocketFactory.java
I found the issue.
For SSL connection the following code is needed:
config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
config.setSocketFactory(new DummySSLSocketFactory());
You can use the DummySSL class, which can also be found in Spark.
Related
I am libstrophe example client program bot.c and trying to connect with ejabberd server.
I am facing authentication failure. Please refer the log below.
xmpp DEBUG Connecting via altdomain.
xmpp DEBUG sock_connect() to 127.0.0.1:5222 returned 3
xmpp DEBUG Attempting to connect to 127.0.0.1
xmpp DEBUG connection successful
conn DEBUG SENT: <?xml version="1.0"?><stream:stream to="prakash.com" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">
xmpp DEBUG RECV: <stream:stream id="16900185530209358531" version="1.0" lang="en" from="prakash.com">
xmpp DEBUG RECV: <features xmlns="http://etherx.jabber.org/streams"><c hash="sha-1" xmlns="http://jabber.org/protocol/caps" node="http://www.process-one.net/en/ejabberd/" ver="LSc28EBBWo2uA2P3nRDU+sBlbsc="/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>X-OAUTH2</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms></features>
conn DEBUG SENT: <auth mechanism="SCRAM-SHA-1" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj1CVlAscj0zZjMwOTQ5N2IyYTEwZDYzNjUwZTRiNzEwMmY3Zjk1</auth>
xmpp DEBUG RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
xmpp DEBUG handle SCRAM-SHA-1 (challenge) called for failure
xmpp DEBUG SASL SCRAM-SHA-1 auth failed
conn DEBUG SENT: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
xmpp DEBUG RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bm9uY2U9IjcwOTEwMTI1NzE1NzkzNzMyOTkiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
xmpp DEBUG handle digest-md5 (challenge) called for challenge
conn DEBUG SENT: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9IkJWUCIscmVhbG09InByYWthc2guY29tIixub25jZT0iNzA5MTAxMjU3MTU3OTM3MzI5OSIsY25vbmNlPSJhMjZkZWQ0M2Y4MmMiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvcHJha2FzaC5jb20iLHJlc3BvbnNlPWEyYTVlMDIwYTNkZjc1NmY1NTAxZDBkYzMyMDliOGQ5LGNoYXJzZXQ9dXRmLTg=</response>
xmpp DEBUG RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
xmpp DEBUG handle digest-md5 (rspauth) called for failure
xmpp DEBUG SASL DIGEST-MD5 auth failed
conn DEBUG SENT: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AEJWUABhZG1pbjEyMw==</auth>
xmpp DEBUG RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
xmpp DEBUG SASL PLAIN auth failed
auth ERROR Cannot authenticate without resource
conn DEBUG SENT: </stream:stream>
xmpp DEBUG RECV: </stream:stream>
xmpp DEBUG Closing socket.
DEBUG: disconnected
event DEBUG Stopping event loop.
event DEBUG Event loop completed.
Can someone help me on this how to resolve this authentication problem?
Libstrophe tries supported authentication mechanisms one by one until one succeeds or all fail. The problem is on server side and given logs don't provide enough information to reveal it.
SCRAM-SHA-1 mechanism fails after the 1st stanza. This means that server rejects authentication when only username is sent. I would suggest to check if such a user exists (I'm not sure if it case-sensitive). If this doesn't help look at ejabberd logs.
Take into account that PLAIN mechanism sends base64-encoded login/password and anyone can decode it. Therefore, I would suggest to remove encoded password from libstrophe's logs like this:
conn DEBUG SENT: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">*REDACTED*</auth>
When all authentication mechanisms fail libstrophe tries legacy client authentication. In this case it needs a resource to build <iq> stanza. Logs show the next error message since a resource was not added to jid:
auth ERROR Cannot authenticate without resource
When login/password are correct and there is no problem with jabber server the authentication should succeed on the 1st supported mechanism and legacy authentication shouldn't be called. Therefore, it is safe to ignore the last error message.
Edit the below parameters in ejabbered.yml file.
auth_password_format: scram
s2s_protocol_options:
- "no_sslv3"
save the file .
Stop and start the ejabbered Server.
Now Register the user in the server side and run the bot example in the libstrophe library.
I am trying to access my Microsoft Exchange server with Coldfusion cfimap so I can move mail out of the junk mail folder. I am using CF10. I want to just test getting the folder list.
<cfscript>
variables.popAttributes = {
server = ...,
port = 995,
username = ...,
password = ...
};
</cfscript>
<cfimap action="open"
connection="variables.folders"
secure="yes"
server="#variables.popAttributes.server#"
port="#variables.popAttributes.port#"
username="#variables.popAttributes.username#"
password="#variables.popAttributes.password#" />
<cfimap action="listallfolders"
connection="variables.folders"
name="variables.folderQry" />
<cfdump var="#variables.folderQry#" />
<cfimap action="close"
connection="variables.folders" />
When I try to run the above code, I get an exception from the "open" tag.
An exception occurred when setting up mail server parameters.
This exception was caused by: javax.mail.MessagingException: +OK The Microsoft Exchange POP3 service is ready.; nested exception is: com.sun.mail.iap.ConnectionException: +OK The Microsoft Exchange POP3 service is ready..
I'd think that the message saying OK the service is ready should mean that it would move on to the next cfimap tag.
You are attempting IMAP operations on a POP3 connection. POP3 has no concept of folders.
Try port 993.
I've been doing it as follows :
Step 1. <Stream>
Step 2. <Auth> (PLAIN)
Step 3. <Session>
Stuck here.
This tutorial does not mention dialback: http://ceit.uq.edu.au/content/how-xmpp-works-step-step
However, under 8.3. Protocol of the documentation, it says to use a dialback: http://xmpp.org/rfcs/rfc3920.html
Right now, this is the full response I get from my server:
<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1027203257' from='mysite.com' version='1.0' xml:lang='en'>
<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='yy7di5kE0syuCXOQTXNBTclpJWo='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
<stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
</stream:stream>
I've seen in some peoples code, after step 2, they run <stream> again, but in others they don't. Is this needed?
Server Dialback is uses for s2s (server-to-server) connections. You don't need it for c2s (client-to-server) connections.
I am trying to set up an alert for a channel to send emails. The problem is that when a channel produces an alert, on having tried to send e-mail the mistake takes place: "Connection reset". The server of mail is external to the company.
To prove the sending of message in Mirth, I have defined a channel that when it receives a hl7 message sends a mail to a certain direction with the following code javascript:
var smtpConn = SMTPConnectionFactory.createSMTPConnection();
smtpConn.send('example1#mailserver.es', '', 'example2#mailserver.es', 'subject', 'body');
logger.info('mensaje enviado');
Producing the same mistake:
Caused by: javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1925)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1684)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525)
at javax.mail.Service.connect(Service.java:313)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
The Setting configuration is:
SMTP Host: ipsmtphostserver, Port: 465,SendTimeOut:2000,DefaultFromAccess:anyemail#mail.com, SecureConnection:I have tried with both TTL and SSL,RequiereAuthentication: Yes.
I have thought that the problem was firewall or antivirus, but I have deactivated a moment them and it follows the problem.
Could someone please help me? I am trying to create a project in project server programatically (PSI webservice) but am failing to do so because of the error below. Does anyone know what might be the issue? I am also getting this error when attempting to update the web service in VS2008.
Here is the error and it happens when I call QueueCreateProject (see code below):
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---
Here is the code:
objProject = new pstest.ProjectWS.ProjectSoapClient();
dsProjectDataSet = new pstest.ProjectWS.ProjectDataSet();
ProjectWS.ProjectDataSet.ProjectRow projectRow = dsProjectDataSet.Project.NewProjectRow();
Guid _projectGUID = Guid.NewGuid(); // new GUID for each project
projectRow.PROJ_UID = _projectGUID;
projectRow.PROJ_NAME = "My new Project";
projectRow.PROJ_INFO_START_DATE = System.DateTime.Now;
projectRow.PROJ_TYPE = 0; //0 is for project and 1 is for template
dsProjectDataSet.Project.AddProjectRow(projectRow);
//create a project using project.asmx
objProject.QueueCreateProject(Guid.NewGuid(), dsProjectDataSet,false);
Most likely your app.config is misconfigured. Depending on your security configuration, you probably need to change part of it:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm"/>
</security>
Take a look at this thread for more information.