Azure / azure-relay-bridge

Azure Relay Bridge - A cross-platform command line tool to create VPN-less TCP tunnels from and to anywhere
MIT License
121 stars 48 forks source link

Install on new Windows 11 laptop An attempt was made to access a socket in a way forbidden by its access permissions #67

Closed colinrippeyfinarne closed 1 year ago

colinrippeyfinarne commented 1 year ago

I've installed azbridge on a new windows 11 laptop that has almost no additional software installed. I've configured my HOSTS file and azbridge_config.yml the exact same way as another windows 11 laptop I have, but when I run azbridge I am getting the following (I upped the log level to VERBOSE to get more details):

dbug: azbridge[0] [07/21/2023 17:03:15], RemoteForwardHostStarting, 8ca1e53d-1737-4a28-96eb-fd3da74c06dd, info: azbridge[0] [07/21/2023 17:03:15], RemoteForwardHostStart, 8ca1e53d-1737-4a28-96eb-fd3da74c06dd, dbug: azbridge[0] [07/21/2023 17:03:15], LocalForwardHostStarting, d6b4d66d-2456-4397-bdf2-e3140b94dbdf, dbug: azbridge[0] [07/21/2023 17:03:15], LocalForwardBridgeStarting, 9461e9c6-15a3-4726-b97f-852643427118, { localForward = Microsoft.Azure.Relay.Bridge.Configuration.LocalForward } dbug: azbridge[0] [07/21/2023 17:03:15], LocalForwardListenerStarting, 33bf8ba8-332e-4395-9df6-1ea7ce51e1b9, { listenEndpoint = 127.1.0.3:3389 } fail: azbridge[0] [07/21/2023 17:03:15], LocalForwardListenerStartFailed, 33bf8ba8-332e-4395-9df6-1ea7ce51e1b9, { exception = System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions. at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName) at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at System.Net.Sockets.TcpListener.Start() at Microsoft.Azure.Relay.Bridge.TcpLocalForwardBridge.Run(IPEndPoint listenEndpoint) in D:\a\azure-relay-bridge\azure-relay-bridge\src\Microsoft.Azure.Relay.Bridge\TcpLocalForwardBridge.cs:line 107 } fail: azbridge[0] [07/21/2023 17:03:15], LocalForwardBridgeStartFailure, 9461e9c6-15a3-4726-b97f-852643427118, { localForward = Microsoft.Azure.Relay.Bridge.Configuration.LocalForward, exception = System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions. at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName) at System.Net.SocketsAn attempt was made to access a socket in a way forbidden by its access permissions. .Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at System.Net.Sockets.TcpListener.Start() at Microsoft.Azure.Relay.Bridge.TcpLocalForwardBridge.Run(IPEndPoint listenEndpoint) in D:\a\azure-relay-bridge\azure-relay-bridge\src\Microsoft.Azure.Relay.Bridge\TcpLocalForwardBridge.cs:line 107 at Microsoft.Azure.Relay.Bridge.LocalForwardHost.StartEndpoint(LocalForward localForward, LocalForwardBinding binding) in D:\a\azure-relay-bridge\azure-relay-bridge\src\Microsoft.Azure.Relay.Bridge\LocalForwardHost.cs:line 119 }

Guessing this is not an azbridge issue but more to do with some rudimentary config of the laptop.

I can rdp onto this laptop from a different machine so I know RDP to the laptop is working.

colinrippeyfinarne commented 1 year ago

Fixed (being a bit daft but will add in case anyone else faces same issue).

My "laptop that was working" has an intune policy that prevents rdp connections, and as such the various services that run and (of course) listen on 3389 are not running.

My azbridge_config.yml on this working laptop had the following config:

LocalForward :

I am using a single relay as a "router" for 2 remote VMs. On the "router" running azbridge I am listening on the logical ports and sending the packets to the two VMs.

On my new laptop it has not been enrolled into intune and I had turned on remote desktop so doh the Remote Desktop Services service was listening on 3389.

Lesson learned "remember that in the azbridge docs it does say use something other than 3389".