WebRTC: ICE failed since Firefox v 53 - webrtc

I got a problem with my webRTC-project. My code works well at Chrome and Firefox until version 52. Since Firefox 53 i got the error: "ICE failed, see about:webrtc for more details". This is my code:
let connection;
let dataChannel;
const initCon = (initiatorBoolean, choosenONE) => {
createConnection();
startConnection(initiatorBoolean, choosenONE);
console.log('initCon(' + initiatorBoolean + ') / choosenONE = ' +choosenONE);
}
var boolJoin = false;
var lobbies = [];
var me = prompt("Please enter your name", "Bert");
// Helper für das Errorlogging
const logErrors = err => console.log(err);
// Websockets-Verbindung herstellen
const socket = io.connect('http://7daysclub.de:8080');
/* Methode to send information between to Users
*#param
*receiver= User who get the message
*type= Type of the message: could be init, joined, getUsers, setUsers, offer, answer, candidate
*descr= Content of the message
*/
const sendMessage = (receiver, type, descr) => {
message = Object.assign({to: 'default'}, {
user: receiver,
type: type,
descr: descr,
from: me
});
socket.emit('message', message);
console.log("send: " + message.type + ". to: " + message.user);
};
const createConnection = () => {
//Verbindung erstellen
connection = new RTCPeerConnection( {
'iceServers': [
{
/*
'urls': 'stun:stun.l.google.com:19302'
*/
'urls': 'stun:185.223.29.90:3478'
},
{
'urls': 'turn:185.223.29.90:3478',
'credential': '***',
'username': '***'
}
]
});
connection.oniceconnectionstatechange = function(event) {
console.log('state: '+connection.iceConnectionState );
if (connection.iceConnectionState === "failed" ||
connection.iceConnectionState === "disconnected" ||
connection.iceConnectionState === "closed") {
// Handle the failure
}
};
}
const call = choosenONE => {
if (!boolJoin) {
sendMessage(choosenONE, 'joined', null);
}
};
// Nachricht vom Signaling-Kanal empfangen
const receiveMessage = message => {
console.log("receive: " + message.type);
//Filter messages
if (message.user != 'all' && message.user != me) {
console.log("Block= " + message.user);
return;
}
// Nachricht verarbeiten
switch (message.type) {
// Partner ist verfügbar
case 'joined':
choosenONE = message.from;
sendMessage( choosenONE, 'init', null);
boolJoin = true;
initCon(true, choosenONE);
break;
case 'getUsers':
sendMessage(message.from,'setUsers', null)
lobbies.push(message.from);
lobbylist();
console.log('add User: ' + lobbies[lobbies.length-1] + ' to List');
break;
case 'setUsers':
lobbies.push(message.from);
console.log('add User: ' + lobbies[lobbies.length-1] + ' to List');
lobbylist();
break;
// Verbindungsaufbau wurde vom Partner angefordert
case 'init':
choosenONE = message.from;
boolJoin = true;
initCon(false, choosenONE);
break;
// Ein SDP-Verbindungsangebot ist eingegangen – wir erstellen eine Antwort
case 'offer':
connection
.setRemoteDescription(new RTCSessionDescription(message.descr))
.then(() => connection.createAnswer())
.then(answer => connection.setLocalDescription(new RTCSessionDescription(answer)))
.then(() => sendMessage(message.from,'answer', connection.localDescription, me))
.catch(logErrors);
break;
// Eine SDP-Verbindungsantwort auf unsere Anfrage ist eingegangen.
case 'answer':
connection.setRemoteDescription(new RTCSessionDescription(message.descr));
break;
// Der Partner hat eine mögliche Host-Port-Kombination ("ICE Candidate") gefunden
case 'candidate':
connection.addIceCandidate(new RTCIceCandidate({candidate: message.descr}));
break;
}
};
socket.on('message', receiveMessage);
// Verbindung initialisieren
const startConnection = (isCreator, choosenONE) => {
// Wenn wir mögliche Kommunikationsendpunkte finden, diese an den Partner weitergeben
connection.onicecandidate = event => {
if (event.candidate) {
sendMessage(choosenONE, 'candidate', event.candidate.candidate);
}
};
// Wenn die Gegenseite einen Stream hinzufügt, diesen an das video-element hängen
connection.ontrack = (e) => {
document.getElementById('vidRemote').src = window.URL.createObjectURL(e.stream);
};
// Falls wir der erste Teilnehmer sind, starten wir den Verbindungsaufbau
if (isCreator) {
// Datenkanal anlegen
dataChannel = connection.createDataChannel('chat');
onDataChannelCreated(dataChannel);
connection
.createOffer()
.then(offer => connection.setLocalDescription(new RTCSessionDescription(offer)))
.then(() => sendMessage(choosenONE, 'offer', connection.localDescription))
.catch(logErrors);
} else {
// Wenn wir nicht der Initiator sind, reagieren wir nur auf das Anlegen eines Datenkanals
connection.ondatachannel = function (event) {
dataChannel = event.channel;
onDataChannelCreated(dataChannel);
};
}
};
const onDataChannelCreated = (channel, choosenONE) => {
// Sobald der Datenkanal verfügbar ist, Chateingaben zulassen
channel.onopen = () => {
const enterChat = document.getElementById('enterChat');
enterChat.disabled = false;
enterChat.onkeyup = (keyevent) => {
// Bei "Enter" absenden
if (keyevent.keyCode === 13) {
dataChannel.send(enterChat.value);
appendChatMessage(me+':', enterChat.value);
enterChat.value = '';
}
}
};
channel.onmessage = (message) => appendChatMessage(choosenONE+':', message.data);
};
const appendChatMessage = (name, text) => {
const displayChat = document.getElementById('displayChat');
const time = new Date().toString('H:i:s');
displayChat.innerHTML = `<p>${name} - ${time}<br>${text}</p>` + displayChat.innerHTML;
};
function lobbylist() {
allusers = "";
lobbies.forEach( element => {
allusers += "<li><button onclick=\"call('"+element+"')\">"+element+"</button></li>"
});
document.getElementById('lobbylist').innerHTML = allusers;
}
//Alle User bei Ankunft erfragen
sendMessage('all','getUsers', null);
lobbylist();
And about:webrtc =
(registry/INFO) insert 'ice' (registry) succeeded: ice
(registry/INFO) insert 'ice.pref' (registry) succeeded: ice.pref
(registry/INFO) insert 'ice.pref.type' (registry) succeeded: ice.pref.type
(registry/INFO) insert 'ice.pref.type.srv_rflx' (UCHAR) succeeded: 0x64
(registry/INFO) insert 'ice.pref.type.peer_rflx' (UCHAR) succeeded: 0x6e
(registry/INFO) insert 'ice.pref.type.host' (UCHAR) succeeded: 0x7e
(registry/INFO) insert 'ice.pref.type.relayed' (UCHAR) succeeded: 0x05
(registry/INFO) insert 'ice.pref.type.srv_rflx_tcp' (UCHAR) succeeded: 0x63
(registry/INFO) insert 'ice.pref.type.peer_rflx_tcp' (UCHAR) succeeded: 0x6d
(registry/INFO) insert 'ice.pref.type.host_tcp' (UCHAR) succeeded: 0x7d
(registry/INFO) insert 'ice.pref.type.relayed_tcp' (UCHAR) succeeded: 0x00
(registry/INFO) insert 'stun' (registry) succeeded: stun
(registry/INFO) insert 'stun.client' (registry) succeeded: stun.client
(registry/INFO) insert 'stun.client.maximum_transmits' (UINT4) succeeded: 7
(registry/INFO) insert 'ice.trickle_grace_period' (UINT4) succeeded: 5000
(registry/INFO) insert 'ice.tcp' (registry) succeeded: ice.tcp
(registry/INFO) insert 'ice.tcp.so_sock_count' (INT4) succeeded: 0
(registry/INFO) insert 'ice.tcp.listen_backlog' (INT4) succeeded: 10
(registry/INFO) insert 'ice.tcp.disable' (char) succeeded: \000
(generic/EMERG) Exit UDP socket connected
(generic/ERR) UDP socket error:Internal error at z:/build/build/src/dom/network/UDPSocketParent.cpp:283 this=00000000120CC400
(ice/INFO) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:IP4:185.223.29.90:3478/UDP)
(ice/INFO) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:IP4:185.223.29.90:3478/UDP)
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): failed to create passive TCP host candidate: 3
(ice/NOTICE) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) no streams with non-empty check lists
(ice/NOTICE) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) no streams with pre-answer requests
(ice/NOTICE) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) no checks to start
(ice/ERR) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate host(IP4:192.168.0.4:54605/UDP)
(ice/ERR) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate host(IP4:192.168.0.4:62417/TCP) active
(stun/INFO) Unrecognized attribute: 0x802b
(stun/INFO) STUN-CLIENT(srflx(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)): Received response; processing
(ice/ERR) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate srflx(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)
(stun/INFO) STUN-CLIENT(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Received response; processing
(stun/WARNING) STUN-CLIENT(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Error processing response: Retry may be possible, stun error code 401.
(stun/INFO) STUN-CLIENT(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Received response; processing
(stun/WARNING) STUN-CLIENT(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Error processing response: Retry may be possible, stun error code 401.
(turn/WARNING) TURN(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)): Exceeded the number of retries
(turn/WARNING) TURN(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)): mode 20, nr_turn_client_error_cb
(turn/WARNING) TURN(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)) failed
(turn/INFO) TURN(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)): cancelling
(turn/WARNING) ICE-CANDIDATE(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)): nr_turn_allocated_cb called with state 4
(turn/WARNING) ICE-CANDIDATE(relay(IP4:192.168.0.4:54605/UDP|IP4:185.223.29.90:3478/UDP)): nr_turn_allocated_cb failed
(ice/INFO) ICE(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/)): peer (PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default) Trickle grace period is over; marking every component with only failed pairs as failed.
(ice/INFO) ICE-PEER(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default)/STREAM(0-1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/) aLevel=0)/COMP(1): All pairs are failed, and grace period has elapsed. Marking component as failed.
(ice/INFO) ICE-PEER(PC:1512241952789000 (id=19327352835 url=http://7daysclub.de/webrtc2/):default): all checks completed success=0 fail=1
(generic/EMERG) Exit UDP socket connected
(generic/ERR) UDP socket error:Internal error at z:/build/build/src/dom/network/UDPSocketParent.cpp:283 this=000000000BAE3000
(ice/INFO) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:IP4:185.223.29.90:3478/UDP)
(ice/INFO) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:IP4:185.223.29.90:3478/UDP)
(ice/WARNING) z:/build/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3
(ice/WARNING) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): failed to create passive TCP host candidate: 3
(ice/NOTICE) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) no streams with non-empty check lists
(ice/NOTICE) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) no streams with pre-answer requests
(ice/NOTICE) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) no checks to start
(ice/ERR) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate host(IP4:192.168.0.4:63286/UDP)
(ice/ERR) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate host(IP4:192.168.0.4:54433/TCP) active
(stun/INFO) Unrecognized attribute: 0x802b
(stun/INFO) STUN-CLIENT(srflx(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:3478/UDP)): Received response; processing
(ice/ERR) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate srflx(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:3478/UDP)
(stun/INFO) STUN-CLIENT(relay(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Received response; processing
(stun/WARNING) STUN-CLIENT(relay(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Error processing response: Retry may be possible, stun error code 401.
(stun/INFO) STUN-CLIENT(relay(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:3478/UDP)::TURN): Received response; processing
(turn/INFO) TURN(relay(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:3478/UDP)): Succesfully allocated addr IP4:185.223.29.90:50497/UDP lifetime=3600
(ice/ERR) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) pairing local trickle ICE candidate turn-relay(IP4:192.168.0.4:63286/UDP|IP4:185.223.29.90:50497/UDP)
(ice/INFO) ICE(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/)): peer (PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default) Trickle grace period is over; marking every component with only failed pairs as failed.
(ice/INFO) ICE-PEER(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default)/STREAM(0-1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/) aLevel=0)/COMP(1): All pairs are failed, and grace period has elapsed. Marking component as failed.
(ice/INFO) ICE-PEER(PC:1512242125375000 (id=19327352836 url=http://7daysclub.de/webrtc2/):default): all checks completed success=0 fail=1
+++++++ END ++++++++
And my turnserver config looks like this:
# TURN listener port for UDP and TCP (Default: 3478).
# Note: actually, TLS & DTLS sessions can connect to the
# "plain" TCP & UDP port(s), too - if allowed by configuration.
#
listening-port=3478
# TURN listener port for TLS (Default: 5349).
# Note: actually, "plain" TCP & UDP sessions can connect to the TLS & DTLS
# port(s), too - if allowed by configuration. The TURN server
# "automatically" recognizes the type of traffic. Actually, two listening
# endpoints (the "plain" one and the "tls" one) are equivalent in terms of
# functionality; but we keep both endpoints to satisfy the RFC 5766 specs.
# For secure TCP connections, we currently support SSL version 3 and
# TLS version 1.0, 1.1 and 1.2. SSL2 "encapculation mode" is also supported.
# For secure UDP connections, we support DTLS version 1.
#
tls-listening-port=5349
# Listener IP address of relay server. Multiple listeners can be specified.
# If no IP(s) specified in the config file or in the command line options,
# then all IPv4 and IPv6 system IPs will be used for listening.
#
listening-ip=185.223.29.90
# Relay address (the local IP address that will be used to relay the
# packets to the peer).
# Multiple relay addresses may be used.
# The same IP(s) can be used as both listening IP(s) and relay IP(s).
#
# If no relay IP(s) specified, then the turnserver will apply the default
# policy: it will decide itself which relay addresses to be used, and it
# will always be using the client socket IP address as the relay IP address
# of the TURN session (if the requested relay address family is the same
# as the family of the client socket).
#
relay-ip=185.223.29.90
lt-cred-mech
# Realm for long-term credentials mechanism and for TURN REST API.
#
realm=7daysclub.de
#Local system IP address to be used for CLI server endpoint. Default value
# is 127.0.0.1.
#
cli-ip=185.223.29.90
# CLI server port. Default is 5766.
#
cli-port=5766

Looking at your online demo there is no a=candidate line in the remote SDP which suggests the candidate is never added.
sendMessage(choosenONE, 'candidate', event.candidate.candidate);
this is discarding the sdpMid and sdpMLineIndex which needs to be signalled to the remote peer. Add a .catch to your addIceCandidate to log any errors.

Related

BizTalk receiving from RabbitMQ

I'm new to RabbitMQ but I have now installed onto a Windows server and have a couple of demo console apps (C#) that happily write to a read from a queue.
The following code works to pull messages from a queue called "RabbitPoCQueue_2" on the local server:
string queueName = "RabbitPoCQueue_2";
var factory = new ConnectionFactory();
bool keepGoing = true;
factory.HostName = "127.0.0.1";
try
{
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
const bool durable = false;
channel.QueueDeclare(queueName, durable, false, false, null);
System.Console.WriteLine(" [*] Waiting for messages.");
while (keepGoing)
{
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
System.Console.WriteLine(" [x] Received {0}", message);
};
channel.BasicConsume(queue: queueName,
autoAck: true,
consumer: consumer);
channel.BasicGet(queue: queueName, autoAck: true);
System.Console.WriteLine("Press Y to continue or any other key to exit");
keepGoing = System.Console.ReadKey().Key == ConsoleKey.Y;
}
}
}
I now need to configure a BizTalk (2016 FP3 CU5) receive location to do the same. I have ensured I've stopped the console receiver and that I have messages sat on the queue for BizTalk to collect.
I followed the article https://social.technet.microsoft.com/wiki/contents/articles/7401.biztalk-server-and-rabbitmq.aspx
Problem is, when I start the receive location, I get no errors but nothing is received.
The config for the WCF receive location can be seen below:
and here:
and here's a pic from the RabbitMQ management console showing messages sat on the queue:
When I look in the RabbitMQ log file, I see 2 rows on starting the receive location. I see 3 rows when starting the .Net console app (using RabbitMQ API), as shown below - first 2 rows are from BizTalk, last 3 from the console app:
2019-08-28 16:17:45.693 [info] <0.13361.2> connection <0.13361.2> ([::1]:16807 -> [::1]:5672): user 'guest' authenticated and granted access to vhost '/' ** Start of Receive location
2019-08-28 16:19:57.958 [info] <0.13452.2> accepting AMQP connection <0.13452.2> (127.0.0.1:17173 -> 127.0.0.1:5672)
2019-08-28 16:19:58.026 [info] <0.13452.2> connection <0.13452.2> (127.0.0.1:17173 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/' ** Receive from command line
2019-08-28 18:56:26.267 [info] <0.13452.2> closing AMQP connection <0.13452.2> (127.0.0.1:17173 -> 127.0.0.1:5672, vhost: '/', user: 'guest')
2019-08-28 18:56:39.815 [info] <0.17923.2> accepting AMQP connection <0.17923.2> (127.0.0.1:41103 -> 127.0.0.1:5672)
Can anyone spot where I went wrong?

WebRTC. Does server or another peer see my internal IP address?

Is it possible to get user internal IP address by using WebRTC in browser.
Here browserleaks webrtc I can see my Local IP address but this address was extracted on client side via JS script.
Here is minimal JS example how to achieve this
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; //compatibility for firefox and chrome
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel(""); //create a bogus data channel
pc.createOffer(pc.setLocalDescription.bind(pc), noop); // create offer and set local description
pc.onicecandidate = function(ice){ //listen for candidate events
if(!ice || !ice.candidate || !ice.candidate.candidate) return;
var myIP = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
document.querySelector('#output').innerHTML=myIP
//console.log('my IP: ', myIP);
pc.onicecandidate = noop;
};
<div id="output">
</div>
As we can see in code we extract ip from onicecandidate event.
If we will look at WebRTC connection flow we can see that ICE candidates exchanges between peers via signal Channel
So is this possible for STUN/TURN server to get information of internal IP address? (I doubt this is possible, but just to check)
Does specially crafted peer client able to get internal IP address of another peer during connection phase or when it exchange ICE candidates with another peer ?
The question is mostly about security concern
Your flow looks right and secure under certain assumptions:
The browser supports Trickle ICE mechanism (all modern browsers do support)
You don't wait for ice gathering to be complete before sending the SDP
You send the SDP from createOffer/createAnswer method, instead of RTCPeerConnection.localDescription.
If the browser does not support ICE trickle, it's disabled by the code or if you wait for ice gathering to be completed. The candidates will be added also to the local SDP which might still expose your internal IP.
Here is the working snippet for current chrome (v73):
const canvas = document.createElement('canvas');
const track = canvas.captureStream(1).getTracks()[0];
const pc = new RTCPeerConnection();
pc.addTrack(track);
pc.createOffer().then(offer => pc.setLocalDescription(offer))
pc.onicecandidate = () => {};
pc.onicegatheringstatechange = () => {
if(pc.iceGatheringState === 'complete') {
const sdp = pc.localDescription.sdp;
const sdpRows = sdp.split('\n')
const candidates = sdpRows.filter(row => row.indexOf('a=candidate') === 0);
console.log(candidates)
}
}

Prevent MassTransit from creating a RabbitMQ exchange for a consumer host

Is it possible to configure MassTransit to not create a RabbitMQ exchange for a consumer host? My RabbitMQ user has not enough rights to declare an exchange at the host where the consuming queue is located, so MassTransit fails to start with the following error:
Unhandled Exception: MassTransit.RabbitMqTransport.RabbitMqConnectionException:
Operation interrupted ---> RabbitMQ.Client.Exceptions.OperationInterruptedExcept
ion: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, c
ode=403, text="ACCESS_REFUSED - access to exchange '***' i
n vhost '***' refused for user '***'", classId=
40, methodId=10, cause=
Here is the code that I use:
var bus = Bus.Factory.CreateUsingRabbitMq(sbc =>
{
var host = sbc.Host(host: "***", port: 5671, virtualHost: "***", configure: configurator =>
{
configurator.UseSsl(sslConfigurator =>
{
sslConfigurator.Certificate = certificate;
sslConfigurator.UseCertificateAsAuthenticationIdentity = true;
sslConfigurator.ServerName = "***";
});
});
sbc.ReceiveEndpoint(host, "***", endpointConfigurator =>
{
endpointConfigurator.Consumer<UpdateCustomerConsumer>();
});
});

SSL_error_SSL error on tls_read

In a production setup, randomly a opensips error comes up indicating tls_read failed due to SSL_error_SSL error.
Opensips fails the tls/tcp session and a new session is created and it works fine.
Please provide any pointers on why tls_read would fail with ssl_error_ssl return code.
Opensips code invokes,
ssl = c->extra_data;
ret = SSL_read(ssl, buf, len);
if (ret >0)
{
}
else
{
err = SSL_get_error(ssl, ret);
switch (err) {
case SSL_ERROR_ZERO_RETURN:
LM_INFO("TLS connection to %s:%d closed cleanly\n",
ip_addr2a(&c->rcv.src_ip), c->rcv.src_port);
/*
* mark end of file
*/
c->state = S_CONN_EOF;
return 0;
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
return 0;
case SSL_ERROR_SYSCALL:
LM_ERR("SYSCALL error -> (%d) <%s>\n",errno,strerror(errno));
default:
LM_ERR("TLS connection to %s:%d read failed\n", ip_addr2a(&c->rcv.src_ip), c->rcv.src_port);
LM_ERR("TLS read error: %d\n",err);
c->state = S_CONN_BAD;
tls_print_errstack();
return -1;
}
I want to highlight that TLS connection was established fine and a message is successfully received and send. When the second message is received and SSL_read is invoked there is below error,
2018-05-11T11:23:16.000-04:00 [local2] [err] ffd-alpha-zone1-ccm1.ipc.com /usr/sbin/opensipsInternal[10325]: ERROR:core:_tls_read: TLS connection to 10.204.34.62:51519 read failed
2018-05-11T11:23:16.000-04:00 [local2] [err] ffd-alpha-zone1-ccm1.ipc.com /usr/sbin/opensipsInternal[10325]: ERROR:core:_tls_read: TLS read error: 1
2018-05-11T11:23:16.000-04:00 [local2] [err] ffd-alpha-zone1-ccm1.ipc.com /usr/sbin/opensipsInternal[10325]: ERROR:core:tls_print_errstack: TLS errstack: error:140890B2:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:no certificate returned
In the pcap, there is re-transmission of every tls packet both sides and when this packet is read, there seems the packet is the second portion of fragemented packet.
Thanks,

WebRTC PeerJS Text Chat - Connect to multiple peerID at the same time

Hi friends I have been working on to connect to multiple peer id for text chat when i connect to single peer alone it is working
but i am getting problem on connecting multiple peerid at the same time
For example for connecting to single peer we will be using this
var conn = peer.connect(peerId);
conn.on('open', function() {
connect(conn);
});
When i want to connect to multiple peer ID
For ex : var peerIDs = [ 'peerid 1', 'peerid 2', 'peerid 3']
I am using loop for this
for(var i=0 ; i < peerIDs.length ; i++){
conn = peer.connect(peerIDs[i]);
conn.on('open', function() {
connect(conn);
});
}
Here is the complete code:
var userId = new Date().getTime();
//Get the ID from the server
var peer = new Peer(userId, {host: 'localhost', port: 3031, path: '/',debug: true });
var conn;
var connections = [];
//to receive id from the server
peer.on('open', function(id){
console.log('the id is' +id);
});
//in case of error
peer.on('error', function(e){
alert(e.message);
})
//Awaits for the connection
peer.on('connection', connect);
function connect(c){
conn = c;
connections[c.peer].on('data', function(data){
var mess = document.createElement('div');
mess.innerHTML = '<span class="peer">' + c.peer + '</span>: ' + data;
angular.element( document.querySelector( '.messages' ) ).append(mess);
});
connections[c.peer].on('close', function(){
alert(c.peer + 'has left the chat');
});
}
//When user clicks the chat button
$scope.chat = function(){
alert('user clicked the connect button');
var peerIDs = [ 'peerid 1', 'peerid 2', 'peerid 3']
for(var i=0 ; i < peerIDs.length ; i++){
var conn = peer.connect(peerIDs[i]);
conn.on('open', function() {
connections.push(c);
connect(conn);
});
}
}
//send message when clicked
$scope.send = function(){
// For each active connection, send the message.
var msg = angular.element( document.querySelector( '#mess' ) ).val();
//Send message to all connected peers
for(var i in connections){
connections[i].send(msg);
}
angular.element( document.querySelector( '.messages' ) ).append('<div><span class="you">You: </span>' + msg
+ '</div>');
}
Can you please give the insight of how to achieve this.Your help will be Greatly appreciated.
To be able to have multi-connections at the same time, you just need to handle multi-connections at the same time.
// Array of remote peers ID and data channel
var remotePeerIds=[],// You need this to link with specific DOM element
connections=[]; // This is where you manage multi-connections
// create a Peer
var peer = new Peer({key: 'YOUR_KEY'}); // You can use your own peerID here
// Get your local peer id
peer.on('open', function(id) {
console.log('My peer ID is: ' + id);
});
// Start connection with other peer - and handle it
getConnect(remotePeerId){
var conn = peer.connect(remotePeerId);
handleConnection(conn);
}
// Ok now you need to handle the received connection too
peer.on('connection',function(conn){
handleConnection(conn);
});
// Handle connection - this is most important part
handleConnection(conn){
remotePeerIds.push(conn.peer); // Add remote peer to list
conn.on('open', function() {
console.log("Connected with peer: "+remotePeerId);
conn.on('data',function(data){
// You can do whatever you want with the data from this connection - this is also the main part
dataHandler(conn,data);
});
conn.on('error',function(){
// handle error
connectionError(conn);
});
conn.on('close',function(){
// Handle connection closed
connectionClose(conn);
});
connections.push(conn);
});
});
}
// So now you have multi-connections. If you want to send a message to all other peer, just using for loop with all the connections
function broadcastMessage(message){
for(var i=0;i<connections.length,i++){
connections[i].send(message);
}
}
// Or if you want to send a message to a specific peer - you need to know his peerid
function privateMessage(remotePeerId,message){
for(var i=0;i<connections.length,i++){
if(connections[i].peer==remotePeerId){
connections[i].send(message);
break;
}
}
}
This is the main part, you need to add some more code for connection handler in case of error and close.
That's it !
#luongnv89 Thanks for your response.
But i am getting problem when i try to connect multiple peerID
For Ex :
// Start connection with other peer - and handle it
function getConnect(remotePeerId){
var conn = peer.connect(remotePeerId);
handleConnection(conn);
}
var peerIDS = ['cttgmy43jy30udi0', 'mhzqhpn8rj4f5hfr'];
for(var i=0 ; i < peerIDS.length ; i++){
getConnect(peerIDS[i]);
}
When i ran the above loop i can able to connect with only the last peerid which i pass in the array in this case it is 'mhzqhpn8rj4f5hfr'
Here i post the console thing
PeerJS: Creating RTCPeerConnection.
peer.min.js:1 PeerJS: Listening for ICE candidates.
peer.min.js:1 PeerJS: Listening for `negotiationneeded`
peer.min.js:1 PeerJS: Listening for data channel
peer.min.js:1 PeerJS: Listening for remote stream
peer.min.js:1 PeerJS: Creating RTCPeerConnection.
peer.min.js:1 PeerJS: Listening for ICE candidates.
peer.min.js:1 PeerJS: Listening for `negotiationneeded`
peer.min.js:1 PeerJS: Listening for data channel
peer.min.js:1 PeerJS: Listening for remote stream
2peer.min.js:1 PeerJS: `negotiationneeded` triggered
peer.min.js:1 PeerJS: Created offer.
peer.min.js:1 PeerJS: Set localDescription: offer for: cttgmy43jy30udi0
peer.min.js:1 PeerJS: Created offer.
peer.min.js:1 PeerJS: Received ICE candidates for: cttgmy43jy30udi0
peer.min.js:1 PeerJS: Set localDescription: offer for: mhzqhpn8rj4f5hfr
peer.min.js:1 PeerJS: Received ICE candidates for: mhzqhpn8rj4f5hfr
peer.min.js:1 PeerJS: Setting remote description RTCSessionDescription {sdp: "v=0
↵o=- 8190108536299128797 2 IN IP4 127.0.0.1
↵s…id:data
↵a=sctpmap:5000 webrtc-datachannel 1024
↵", type: "answer"}
peer.min.js:1 PeerJS: Added ICE candidate for: cttgmy43jy30udi0
peer.min.js:1 PeerJS: Set remoteDescription: ANSWER for: cttgmy43jy30udi0
2peer.min.js:1 PeerJS: Added ICE candidate for: cttgmy43jy30udi0
2peer.min.js:1 PeerJS: Received ICE candidates for: mhzqhpn8rj4f5hfr
peer.min.js:1 PeerJS: Data channel connection success
peer.min.js:1 PeerJS: Setting remote description RTCSessionDescription {sdp: "v=0
↵o=Mozilla-SIPUA-35.0.1 15417 0 IN IP4 0.0.0.0…ap:5000 webrtc-datachannel 1024
↵a=setup:active
↵", type: "answer"}
2peer.min.js:1 PeerJS: Added ICE candidate for: mhzqhpn8rj4f5hfr
peer.min.js:1 PeerJS: Set remoteDescription: ANSWER for: mhzqhpn8rj4f5hfr
peer.min.js:1 PeerJS: Added ICE candidate for: mhzqhpn8rj4f5hfr
peer.min.js:1 PeerJS: Data channel connection success
peer.min.js:1 PeerJS: Added ICE candidate for: mhzqhpn8rj4f5hfr
So what did is to make it work i dont know whether it is the right approach or not...
I just set the delay between connections
var peerIDS = ['cttgmy43jy30udi0', 'mhzqhpn8rj4f5hfr'];
var arrLength = peerIDS.length;
var count = 0;
(function processConnection(){
if(arrLength <= count) return;
getConnect(peerIDS[count]);
count++;
setTimeout(function(){
processConnection()
}, 5000);
})();
And now it is working properly..Can you please tell me whether i am going in a right path or is there anyother better way to accomplish this