restrict firewall commands to host IP and expose service on all interfaces

This commit is contained in:
CPTN Cosmo 2026-04-18 16:43:44 +02:00
parent 000aa5710b
commit 340f8e5bef
2 changed files with 10 additions and 6 deletions

View file

@ -5,7 +5,7 @@ services:
build: . build: .
container_name: xivlauncher-remote-otp container_name: xivlauncher-remote-otp
ports: ports:
- "127.0.0.1:${WEB_PORT:-8814}:8080" - "${WEB_PORT:-8814}:8080"
volumes: volumes:
- ./data:/app/data - ./data:/app/data
environment: environment:

View file

@ -6,11 +6,15 @@ document.addEventListener('DOMContentLoaded', () => {
const ufwCmd = document.getElementById('ufw-cmd'); const ufwCmd = document.getElementById('ufw-cmd');
const iptablesCmd = document.getElementById('iptables-cmd'); const iptablesCmd = document.getElementById('iptables-cmd');
portInput.addEventListener('input', (e) => { const updateFirewallCmds = () => {
const port = e.target.value || '4646'; const port = portInput.value || '4646';
ufwCmd.textContent = `sudo ufw allow ${port}/tcp`; const hostIp = window.location.hostname;
iptablesCmd.textContent = `sudo iptables -I INPUT -p tcp --dport ${port} -j ACCEPT`; ufwCmd.textContent = `sudo ufw allow from ${hostIp} to any port ${port} proto tcp`;
}); iptablesCmd.textContent = `sudo iptables -I INPUT -p tcp -s ${hostIp} --dport ${port} -j ACCEPT`;
};
portInput.addEventListener('input', updateFirewallCmds);
updateFirewallCmds();
const fetchInstances = async () => { const fetchInstances = async () => {
try { try {