Created
October 22, 2024 08:09
-
-
Save fepitre/7c9a0ceeb7f5b8f33e0c9a4be279b689 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
set -e | |
xl network-attach 0 ip=10.137.99.1 script=/etc/xen/scripts/vif-route-qubes backend=sys-net | |
sleep 2 | |
dev=$(ls /sys/class/net|sort|head -1) | |
ip a a 10.137.99.1/24 dev $dev | |
ip l s $dev up | |
ip r a default dev $dev | |
rm -f /etc/resolv.conf | |
echo -e 'nameserver 10.139.1.1\nnameserver 10.139.1.2' > /etc/resolv.conf | |
qvm-run -p --no-gui -u root sys-net systemctl stop qubes-firewall | |
sleep 2 | |
qvm-run -p --no-gui -u root sys-net iptables -t nat -I PREROUTING '!' -i vif+ -p tcp --dport 22 -j DNAT --to 10.137.99.1 | |
qvm-run -p --no-gui -u root sys-net iptables -I FORWARD -p tcp --dport 22 -d 10.137.99.1 -j ACCEPT || : | |
qvm-run -p --no-gui -u root sys-net nft add rule ip qubes custom-forward tcp dport ssh accept || : | |
systemctl start sshd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment