Search code examples
azureazure-files

How to mount Azure File Share in an environment where port 445 is blocked


I'm trying to mount an Azure File Share in an environment where the Proxy settings block port 445 for the global IP address.

As shown in the figure below, port forwarding is done with Azure Virtual Matchine (Linux), connecting to localhost: 1445, and 445 communication to Azure File Share is possible.

enter image description here

However, the mount command cannot use any port other than 445.

I have set the netsh interface portproxy to forward communication on port 445 to localhost: 1445, but the port on 445 does not listen.

$ netsh interface portproxy add v4tov4 listenport = 445 listenaddr = xxx-storage.file.core.windows.net connectport = 1445 connectaddress = 127.0.0.1
$ netstat -ano | findstr: 445

How to mount Azure File Share in an environment where port 445 is blocked?

Also, File Sync cannot be used in my environment.


Solution

  • I have not tried this scenario but you might be able to accomplish this with SSH local port forwarding. The key is if your proxy is blocky localhost connections to port 445.

    ssh -L 127.0.0.1:445:FILE_SHARE_URL:445 YOUR_LINUX_BOX_IP
    

    Forwarding (AllowTcpForwarding) needs to be enabled on the Linux SSH server (the jump host).

    Server-Side Configuration

    I think you also will need to enable the Linux VM IP forwarding but I am not sure.

    Since the software will be connecting to port 445 on localhost (127.0.0.1) most firewalls ignore that connection. Then the connection on port 445 is forwarded over SSH which the firewall cannot see. The Linux jump host then opens a connection to the FILE_SHARE_URL.

    Local Forwarding