I use this code keystor is .bks file (Android):
secure(KEYSTORE_FILE.getAbsolutePath(), KEYSTORE_PASSWORD,null,null);
get("/hello", (req, res) -> "Hello World");
When i try to access https://192.168.0.24/hello on my browser, i get connexion failed.
Also, i try:
curl -v --tlsv1.2 --tls-max 1.3 https://192.168.0.24/hello
Trying 192.168.0.24:443...
* TCP_NODELAY set
* connect to 192.168.0.24 port 443 failed: Connexion refusée
* Failed to connect to 192.168.0.24 port 443: Connexion refusée
* Closing connection 0
curl: (7) Failed to connect to 192.168.0.24 port 443: Connexion refusée
Do you know what is the problem please?
Without secure, it's works fine with http protocol.
Thank you.
TLS only works with domain names, not IP addresses or localhost.
Use the hostname in your certificate.
Related
I've a raspberrypi with pihole and wireguard installed. Pihole works fine, same for wireguard except Signal Messenger for Android. When I'm connected over VPN I always get a timeout.
java.net.ConnectException: Failed to connect to /192.168.210.1 (port 8080) from /10.6.0.2 (port *****) after *****ms: isConnected failed: ETIMEDOUT (Connection timed out) ...
I installed wiregurad with PiVPN script, hence I've a very simple config which looks like this:
[Interface]
PrivateKey = ***
Address = 10.6.0.1/24
ListenPort = ***
[Peer]
PublicKey = ***
PresharedKey ***
AllowedIPs = 10.6.0.2/32
PersistentKeepalive = 25
The configuration on my mobile phone is also pretty straight forward.
My routing table looks like:
default via 192.168.1.1 dev eth0 src 192.168.1.2 metric 202
10.6.0.0/24 dev wg0 proto kernel scope link src 10.6.0.1
192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.2 metric 202
192.168.1.2 is my raspi and also my default DNS. I' don't understand why Signal is trying to connect to 192.168.210.1 and I get this exception only when connected over VPN. Does anyone have an idea? Thanks!
When I post data from my native script angular app which will be running on my android device to my local API which is using dotnet core API. I get an error Error: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 59521): connect failed: ECONNREFUSED. I can hit my API using postman.
I change from using the Httpclient module to HTTP common, with no luck and I have added android:usesCleartextTraffic="true" to the android manifest.
login(user: User) {
return this.http.post(
BackendService.baseUrl + "user/login",
JSON.stringify({
username: user.email,
password: user.password
}),
{ headers: this.getCommonHeaders() }
)
.pipe(
tap((data: any) => {
BackendService.token = data._kmd.authtoken;
}),
catchError(this.handleErrors)
);
}
I expect to get an success but I get
Error: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 59521): connect failed: ECONNREFUSED.
In order to connect your Android Emulator (or USB-connected Android device) to your dev server, you need to supply the IP-address of the server, since localhost will not point to it from your Emulator/Device.
Today I found out you have to use 10.0.2.2 as your endpoint in order to reach the localhost from the emulator.
Question asked about running on the device, yes. But people land here for other keywords too.
I have installed ejabberd in windows 10 and I want my android application(running in android device in same network) to login to the locally hosted ejabberd server.
Note: I could access ejabberd admin portal in port 5280 ie. [192.168.x.x:5280/admin] from the android device but couldn't connect to port 5222.
Code for XMPPTCPConnection :
XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();
builder.setXmppDomain("192.168.x.x");
builder.setDebuggerEnabled(true);
builder.setUsernameAndPassword("username", "password");
builder.setResource("smack");
XMPPTCPConnection mConnection = new XMPPTCPConnection(builder.build());
I get the following error:
I/DNSUtil: Could not resolve DNS SRV resource records for _xmpp-client._tcp.192.168.x.x. Consider adding those. W/System.err: org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '_xmpp-client._tcp.192.168.x.x:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for _xmpp-client._tcp.192.168.x.x. IN SRV yielded an error response NX_DOMAIN, '192.168.x.x:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for 192.168.x.x. IN A yielded an error response NX_DOMAIN, '192.168.x.x:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for 192.168.x.x. IN AAAA yielded an error response NX_DOMAIN
I have also modified the ejabberd.yml file in order to listen to all the ipv4 ports as described in ejabberd documentation
listen:
-
port: 5222
ip: "0.0.0.0"
module: ejabberd_c2s
starttls: true
certfile: 'CERTFILE'
protocol_options: 'TLSOPTS'
max_stanza_size: 65536
shaper: c2s_shaper
access: c2s
-
port: 5269
ip: "0.0.0.0"
module: ejabberd_s2s_in
max_stanza_size: 131072
shaper: s2s_shaper
-
port: 5280
ip: "0.0.0.0"
module: ejabberd_http
request_handlers:
"/websocket": ejabberd_http_ws
"/api": mod_http_api
web_admin: true
http_bind: true
## register: true
captcha: false
Any work around is highly appreciated.
we are trying to connect to an ipv6 local server address. This is the code snippet
_st := IdHTTP1.Get('http://[fe80::a6ee:57ff:fe5c:7de6]:8000/reparti');
The issue is the following:
If we compile for Windows -> It works and we get the json response
if we compile for either Android or iOS -> we get
"socket error #22 invalid argument"
and no response and the server do not receive any request
What are we missing?
Thank you for the support
The IP address you are attempting to connect to is incomplete. It is missing the mandatory scope ID.
I recently setup ejabberd server on macos X 10.7. The server seems to be running fine and admin page is accessible via internet using http://abc.example.com:5280/admin.
I installed "simple XMPP client", "ChatSecure" and other xmpp chat client in my android phone to connect to my ejabberd server. All of them failed. When I try to connect, I can see following line in ejabberd logs
2015-07-29 23:28:58.380 [info] <0.573.0>#ejabberd_listener:accept:299 (#Port<0.7250>) Accepted connection 182.70.123.139:55402 -> 192.168.1.4:5280
2015-07-29 23:37:51.844 [info] <0.571.0>#ejabberd_listener:accept:299 (#Port<0.7277>) Accepted connection 182.70.123.139:10751 -> 192.168.1.4:5222
however, login times out on xmpp chat client. Not sure what's causing this issue. When I install similar xmpp clients on the same box where ejabberd server is running and try to connect using bob#abc.example.com , it works fine.
The issue is only coming when I use some remote machine or phone. Login doesn't work even though request is reaching to ejabberd server.
Please help
Updated post after below suggestion from raymond
Hi, Raymond
Here is the updated logs post debug mode. It is stuck at last line. Please suggest.
2015-07-30 21:16:46.450 [info] <0.566.0>#ejabberd_listener:accept:299 (#Port<0.7012>) Accepted connection 1.39.10.237:46913 -> 192.168.1.4:5222
2015-07-30 21:16:46.889 [debug] <0.586.0>#ejabberd_receiver:process_data:349 Received XML on stream = <<"<stream:stream to=\"abc.example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
2015-07-30 21:16:46.889 [debug] <0.587.0>#ejabberd_c2s:send_text:1901 Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='129956901' from='abc.example.com' version='1.0' xml:lang='en'>">>
2015-07-30 21:16:46.890 [debug] <0.587.0>#ejabberd_c2s:send_text:1901 Send XML on stream = <<"<stream:features><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='5m6LdO+13BLJZeS37oD5PF54bGY='/><register xmlns='http://jabber.org/features/iq-register'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms></stream:features>">>
when I try to connect using xmpp client on the same machine as ejabberd is running, its working and below is log snippet of it.I am not getting "Auth" line when I try to connect using remote machine or android device over internet.
2015-07-30 21:47:46.149 [info] <0.566.0>#ejabberd_listener:accept:299 (#Port<0.7017>) Accepted connection 182.70.123.139:55949 -> 192.168.1.4:5222
2015-07-30 21:47:46.150 [debug] <0.617.0>#ejabberd_receiver:process_data:349 Received XML on stream = <<"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<stream:stream to=\"abc.example.com\" xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\">">>
2015-07-30 21:47:46.150 [debug] <0.618.0>#ejabberd_c2s:send_text:1901 Send XML on stream = <<"<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1273758616' from='abc.example.com' version='1.0' xml:lang='en'>">>
2015-07-30 21:47:46.152 [debug] <0.618.0>#ejabberd_c2s:send_text:1901 Send XML on stream = <<"<stream:features><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='5m6LdO+13BLJZeS37oD5PF54bGY='/><register xmlns='http://jabber.org/features/iq-register'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms></stream:features>">>
2015-07-30 21:47:46.156 [debug] <0.617.0>#ejabberd_receiver:process_data:349 Received XML on stream = <<"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"DIGEST-MD5\">dXNlcm5hbWU9ImFkbWluIixyZWFsbT0iY2hhdC52b3Rlc3VwLmNvbSIsbm9uY2U9IjM3OTYwNjcwNDYiLGNub25jZT0iQitjNDNpZkZ1d3NvN2JzYXRrMGRGT3N6dDJNTGhrZ2o3YkF2bWJGVyt3Yz0iLG5jPTAwMDAwMDAyLHFvcD1hdXRoLG1heGJ1Zj02NTUzNixkaWdlc3QtdXJpPSJ4bXBwL2NoYXQudm90ZXN1cC5jb20iLHJlc3BvbnNlPWE0Nzg1MTc2ZGE0MzdkOWYyNzBmMjhmODc5ZmZhYjQx</auth>">>
If the connection is just slow (timeout), it could be because of carrier slowing down the traffic on port 5222.
To validate this hypothesis, you should:
Use ejabberd debug log level to see if the negociation is progressing (even slowly).
Try to connect on port 5223 in pure SSL to see if it faster.
Try to run ejabberd on another port like 443 that is unlikely to be slowed down by your mobile provider.