Localhost Service Discovery For a Custom XEP-0114 Component in Prosody or ejabberd - xmpp

I have written a silly hello-world XEP-0114 component and got it connected to Prosody and ejabberd. Now I want to use service discovery to announce presence of the service and provide instructions about its usage.
So I seek a way to make it discoverable for anyone with a JID, remote or local, to provide more details about it.
For Prosody I do:
Component "foo.localhost"
component_secret = "secret"
disco_items = {
{ "foo.localhost", "FOO BAR" };
}
For ejabberd I do:
modules:
mod_disco:
extra_domains:
- "foo.localhost"
- "localhost"
server_info:
-
modules: all
name: "abuse-addresses"
urls:
- "foo.com"
listen:
-
port: 8888
module: ejabberd_service
access: all
shaper_rule: fast
ip: "127.0.0.1"
hosts:
"foo.localhost":
password: "secret"
Then in Gajim I start service discovery on localhost and get error:
There is no service at the address you entered, or it is not responding. Check the address and try again.
What do I miss?

First thing to check when in trouble is a XML-console of a xmpp-client (Gajim), there I found this:
<iq xmlns="jabber:client" to="localhost" type="get" id="546">
<query xmlns="http://jabber.org/protocol/disco#info" />
</iq>
<iq xml:lang='en' to='mynickhere#jabb.im/Gajim' from='localhost' type='error' id='546'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
<error code='504' type='wait'>
<remote-server-timeout xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Stream closed by peer: host-unknown</text>
</error>
</iq>
It shows that discovery requests are sent to the server where currently used account is located (jabb.im). I don't know how things work, but this should prompt you to disconnect from remote server, create account on local server and login with it instead, then discovery will work as expected.

Related

KeyCloak fails to send email using SMTP with status 500

I have Keycloak running in a Kubernetes cluster. Authentication works but I need to set up e-mail to be able to send e-mails for verification and password reset.
I have SendGrid set up as an SMTP Relay. These settings (host, port and api key) work when I send mail using the SendGrid java client. However, when pressing Test connection in KeyCloak I get:
[Error] Failed to load resource: the server responded with a status of 500 ()
[Debug] Remove message (services.js, line 14)
[Debug] Added message (services.js, line 15)
[Error] Can't find variable: error
https://<domain>/auth/resources/ong8v/admin/keycloak/js/controllers/realm.js:76 – "Possibly unhandled rejection: {}"
[Debug] Remove message (services.js, line 14)
There isn't much to go on here. I have an e-mail address set up for the currently logged in user. I've also tried resetting the password in case the Test connection functionality was broken but that didn't work either.
The Realm Settings settings user for email are as such:
host: smtp.sendgrid.net
port: 587
from: test#<domain>
Enable StartTLS: true
Username: "apikey"
Password: <api key>
Any idea what can be wrong? Or how to find out? For instance, maybe I can get a more meaningful error message somehow.
Edit:
I got the server logs.
Failed to send email: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.sendgrid.net, 587; timeout 10000;
nested exception is: java.net.SocketTimeoutException: connect timed out
Edit 2:
I've tried sending mail using Telnet using the exact same settings and that works. So apparently it's something with Keycloak or its underlying Java libraries that's causing issues sending e-mail.
Turns out that Keycloak works and that emails were blocked by the hosting provider.

Unable to send messages to a MUC room

When I try to send a message to an XMPP MUC Room such as:
<message to="room#conference.chat.example.com" type="groupchat">
<body>TEST</body>
</message>
The message will not be delivered to other participants in the room and I get this response from the server:
<message
xmlns="jabber:client" lang="en" to="karim#chat.example.com/resource" from="room#conference.chat.example.com" type="error">
<error code="503" type="cancel">
<service-unavailable
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
</service-unavailable>
<text
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" lang="en">User session not found
</text>
</error>
<body>TEST</body>
Im using ejabberd Community Server v20.07 installed into Docker using the official image.
The full ejabberd.yml configuration file that Im using can be found here.
The full server log can be found here.
The above error happen with different clients and not only one.
You have configured this, and this is completely wrong:
hosts:
- chat.example.com
- conference.chat.example.com
modules:
mod_muc:
...
I guess you didn't notice the option HOSTS in the MOD_MUC documentation: https://docs.ejabberd.im/admin/configuration/modules/#mod-muc
Try something like this:
hosts:
- chat.example.com
modules:
mod_muc:
hosts:
- conference.#HOST#
...

Consume a restful service without port in Mule

I have a restful service deployed in public IP, and thus does not have a port number associated with it. I need to invoke that service, in mule and create a workflow.
I can consume a service with port number as specified below but am unable to do the same for a service which does not have a port number associated.
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8105" doc:name="HTTP Listener Configuration" />
<http:request-config name="HTTP_Request_Configuration" host="localhost" port="8080" basePath="/onlineexam" doc:name="HTTP Request Configuration"/>
Please help
It will always have a port. If the URL does not have one specified then it is using the default http port '80' so set the port attribute to 80.
I was also facing the issue despite adding default port 443 for my HTTPS request. Usually this issue persists when the hostname ends with .io or .org. Mine was .io
Adding this inside the <http:request > block helped:
<http:request-builder>
<http:header headerName="Host" value="hostname"/>
</http:request-builder>
This will overrirde the configuration host and port. So you would still have to mention host and port number in the request configuration which will be overridden.
For http, use port 80 and for HTTPS, use port 443

PubSub module returning error

I'm working on getting Jappix running. I'm using ejabberd as my XMPP server and I've got everything working except comments and viewing attachments - group chat, single chat, external authentication, private messages, friend lists, presence and other works as intended.
My configuration is the same as the one the Jappix project provides on their jappix/jappix-tools github repository. I have no errors in my ejabberd log, the only thing I got while debugging and digging everything up is that this is an example stanza sent to the server:
<iq xmlns="jabber:client" type="get" id="get_31-30" to="pubsub.mydomain.com" xml:lang="en">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
</iq>
And this is the response I get from the server:
<iq xmlns="jabber:client" from="pubsub.mydomain.com" to="arqu#mydomain.com/jappix (1378149270017)" type="error" id="get_31-30" xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="urn:xmpp:microblog:0:comments/3aca5f972fe7198805bdd1a20f502f35"/>
</pubsub>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>
And in Jappix I just get the usual "Service Unavailable" error message.
Additional info:
My BOSH is the internal one of ejabberd and works fine as far as i know, I've setup the reverse proxy and everything else to make it work. Still could be something related to this and not reaching the service on some other port maybe?
It looks like you do not have pubsub enabled/installed on your server.
Have you tried any other pubsub request?

Configure proxy in xmpp file transfer (Extension EXP-0065)

Server: testXyz
 <br>
Senderjid:user1#testXyz <br>
Receiverjid:user2#testXyz
RECV:
<iq xmlns="jabber:client" id="C8B91358-179B-4883-9EEC-A251D99E9AB5" to="user1#testXyz" from="user2#testXyz/Spark 2.6.3" type="error">
<query xmlns="http://jabber.org/protocol/bytestreams" sid="C8B91358-179B-4883-9EEC-A251D99E9AB5" mode="tcp">
<streamhost jid="proxy.Server" host="172.16.3.73" port="7777"/>
</query><error code="406" type="MODIFY">
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>`
I have set the [TURNSocket setProxyCandidates:[NSArray arrayWithObjects:Server,nil]];
From one of answer on stack overflow I came to know that On OpenFire, I needed to set the ip of the proxy using a system property of xmpp.proxy.externalip. But I have installed open fire on my one of machine of local network. So, what should be the value of xmpp.proxy.externalip here this property?
Following already tried as a value of 'xmpp.proxy.externalip'
1. PC's IP(local ip shown by ipconfig command)
2. IP shown by what's myip website.
Any help would be appreciated.