Firewall e SELinux
Questa è solo una raccolta di snippet che potrebbero esserti utili. Salta pure le parti.
SELinux
INFO
I seguenti comandi funzionano solo su Ubuntu, Debian e CentOS. Se usi una distribuzione diversa.
sh
sudo chcon -Rv --type=httpd_sys_content_t /opt/zammad/public/sh
sudo setsebool httpd_can_network_connect on -Psh
sudo semanage fcontext -a -t httpd_sys_content_t /opt/zammad/public/sh
sudo restorecon -Rv /opt/zammad/public/sh
sudo chmod -R a+r /opt/zammad/public/Firewall
Assicurati di aprire le porte 80 e 443 (TCP e UDP) oltre alle porte di cui hai bisogno.
Tieni presente che gli esempi seguenti coprono solo il firewall predefinito della distribuzione.
sh
sudo ufw allow 80sh
sudo ufw allow 443sh
sudo ufw relo
::: info
Trattiamo `nftables` in questa parte - `iptables` è sconsigliato
a partire da Debian 10.
:::
Add the following lines to `/etc/nftables.conf` or your specific rule file.
Ensure to add these lines to your input-chain.
```sh
sudo tcp dport { http, https } acceptsh
sudo udp dport { http, https } acceptThe result can look like the following. Keep in mind that your environment could require different / more rules.
sh
table inet filter {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
tcp dport ssh log accept
tcp dport { http, https } accept
udp dport { http, https } accept
}
chain forward {
type filter hook forward priority 0; policy accept;
}
chain output {
type filter hook output priority 0; policy accept;
}
}To load the rules, run:
sh
sudo systemctl reload nftables