Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save roberto-mardeni/40852e9caa8f950cec09e1f3a6394377 to your computer and use it in GitHub Desktop.
Save roberto-mardeni/40852e9caa8f950cec09e1f3a6394377 to your computer and use it in GitHub Desktop.
# Configure Firewall
ufw allow from any to any port 1433 proto tcp
ufw allow from any to any port 135 proto tcp
ufw allow from any to any port 51000 proto tcp
# Configure Port Routing
ip=$(curl ifconfig.me)
iptables -t nat -A PREROUTING -d $ip -p tcp --dport 135 -m addrtype --dst-type LOCAL -j DNAT --to-destination $ip:13500 -m comment --comment RpcEndPointMapper
iptables -t nat -A OUTPUT -d $ip -p tcp --dport 135 -m addrtype --dst-type LOCAL -j DNAT --to-destination $ip:13500 -m comment --comment RpcEndPointMapper
iptables-save > /etc/iptables.conf
echo "iptables-restore < /etc/iptables.conf" > /etc/rc.local
# Run SQL Server
name=$(hostname)
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Password!123' -e 'MSSQL_RPC_PORT=135' -e 'MSSQL_DTC_TCP_PORT=51000' -p 1433:1433 -p 135:135 -p 51000:51000 --name $name -d mcr.microsoft.com/mssql/server:2019-latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment