Enviado em 14/02/2018 - 13:34h
Senhores boa tarde,#!/bin/bash ### BEGIN INIT INFO # Provides: firewall # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Firewall # Description: Enable service provided by daemon. ### END INIT INFO #-------------------- # FIREWALL IPTABLES # #-------------------- # CARREGANDO MODULOS NO KERNEL modprobe ip_conntrack_ftp modprobe ip_conntrack modprobe ip_nat_ftp modprobe ip_tables modprobe ipt_MARK modprobe ipt_MASQUERADE modprobe ipt_REJECT modprobe ipt_TCPMSS modprobe ipt_TOS modprobe ipt_limit modprobe ipt_mac modprobe ipt_multiport modprobe ipt_owner modprobe ipt_LOG modprobe ipt_REDIRECT modprobe ipt_state modprobe iptable_nat modprobe iptable_mangle modprobe iptable_filter # VARIAVEIS DE REDE IF_WAN="enp0s3" IF_LAN="enp0s8" REDE_LOCAL="172.16.200.0/24" # CASE PARA INICIAR FIREWALL IniciarFirewall () { # LIMPANDO REGRAS iptables -F iptables -F -t filter iptables -F -t mangle iptables -F -t nat iptables -Z # POLITICA PADRAO DROP iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD DROP # HABILITANDO ROTEAMENTO echo "1" > /proc/sys/net/ipv4/ip_forward # LIBERANDO CONEXOES PARA CHAINS iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT #---------------- # REGRAS DE NAT # #---------------- # MASCARAMENTO DE REDE iptables -t nat -A POSTROUTING -s $REDE_LOCAL -o $IF_WAN -j MASQUERADE #------------------ # REGRAS DE INPUT # #------------------ # LOOPBACK iptables -A INPUT -i lo -j ACCEPT # SSH iptables -A INPUT -p tcp --dport 22 -j ACCEPT # APACHE iptables -A INPUT -p tcp --dport 80 -j ACCEPT # SQUID iptables -A INPUT -p tcp --dport 1082 -j ACCEPT # PING iptables -A INPUT -s $REDE_LOCAL -p icmp --icmp-type 8 -j ACCEPT #-------------------- # REGRAS DE FORWARD # #-------------------- # PING iptables -A FORWARD -p icmp --icmp-type 8 -j ACCEPT # DNS iptables -A FORWARD -p udp --dport 53 -j ACCEPT # IP TI iptables -A FORWARD -s 172.16.200.2 -o $IF_WAN -j ACCEPT } # CASE PARA PARAR O FIREWALL PararFirewall () { # LIMPANDO REGRAS iptables -F iptables -F -t filter iptables -F -t mangle iptables -F -t nat iptables -Z # POLITICA PADRAO COMO ACCEPT iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT # HABILITANDO ROTEAMENTO echo "1" > /proc/sys/net/ipv4/ip_forward #---------------- # REGRAS DE NAT # #---------------- # MASCARAMENTO DE REDE iptables -t nat -A POSTROUTING -s $REDE_LOCAL -o $IF_WAN -j MASQUERADE } case $1 in start) echo "FIREWALL INICIADO.......[OK]" IniciarFirewall ;; stop) echo "FIREWALL PARADO..........[OK]" PararFirewall ;; restart) echo "FIREWALL REINICIADO...[OK]" PararFirewall IniciarFirewall ;; esac #--------------- # FIM FIREWALL # #---------------
Enviado em 19/02/2018 - 12:08h
Olá, não sou nenhum expert, mas vou te passar o que eu sei.Enviado em 19/02/2018 - 13:00h
#!/bin/bash ### BEGIN INIT INFO # Provides: firewall # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Firewall # Description: Enable service provided by daemon. ### END INIT INFO #-------------------- # FIREWALL IPTABLES # #-------------------- # CARREGANDO MODULOS NO KERNEL modprobe ip_conntrack_ftp modprobe ip_conntrack modprobe ip_nat_ftp modprobe ip_tables modprobe ipt_MARK modprobe ipt_MASQUERADE modprobe ipt_REJECT modprobe ipt_TCPMSS modprobe ipt_TOS modprobe ipt_limit modprobe ipt_mac modprobe ipt_multiport modprobe ipt_owner modprobe ipt_LOG modprobe ipt_REDIRECT modprobe ipt_state modprobe iptable_nat modprobe iptable_mangle modprobe iptable_filter # VARIAVEIS DE REDE IF_WAN="enp0s3" IF_LAN="enp0s8" REDE_LOCAL="172.16.200.0/24" # CASE PARA INICIAR FIREWALL IniciarFirewall () { # LIMPANDO REGRAS iptables -F iptables -F -t filter iptables -F -t mangle iptables -F -t nat iptables -Z # POLITICA PADRAO DROP iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD DROP # HABILITANDO ROTEAMENTO echo "1" > /proc/sys/net/ipv4/ip_forward # LIBERANDO CONEXOES PARA CHAINS iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT #---------------- # REGRAS DE NAT # #---------------- # MASCARAMENTO DE REDE iptables -t nat -A POSTROUTING -s $REDE_LOCAL -o $IF_WAN -j MASQUERADE #------------------ # REGRAS DE INPUT # #------------------ # LOOPBACK iptables -A INPUT -i lo -j ACCEPT # SSH iptables -A INPUT -p tcp --dport 22 -j ACCEPT # APACHE iptables -A INPUT -p tcp --dport 80 -j ACCEPT # SQUID iptables -A INPUT -p tcp --dport 1082 -j ACCEPT # PING iptables -A INPUT -s $REDE_LOCAL -p icmp --icmp-type 8 -j ACCEPT #-------------------- # REGRAS DE FORWARD # #-------------------- # PING iptables -A FORWARD -p icmp --icmp-type 8 -j ACCEPT # DNS iptables -A FORWARD -p udp --dport 53 -j ACCEPT # IP TI iptables -A FORWARD -s 172.16.200.2 -o $IF_WAN -j ACCEPT } # CASE PARA PARAR O FIREWALL PararFirewall () { # LIMPANDO REGRAS iptables -F iptables -F -t filter iptables -F -t mangle iptables -F -t nat iptables -Z # POLITICA PADRAO COMO ACCEPT iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT # HABILITANDO ROTEAMENTO echo "1" > /proc/sys/net/ipv4/ip_forward #---------------- # REGRAS DE NAT # #---------------- # MASCARAMENTO DE REDE iptables -t nat -A POSTROUTING -s $REDE_LOCAL -o $IF_WAN -j MASQUERADE } case $1 in start) echo "FIREWALL INICIADO.......[OK]" IniciarFirewall ;; stop) echo "FIREWALL PARADO..........[OK]" PararFirewall ;; restart) echo "FIREWALL REINICIADO...[OK]" PararFirewall IniciarFirewall ;; esac #--------------- # FIM FIREWALL # #---------------
Enviado em 19/02/2018 - 13:48h
Boa tarde.Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Criando uma Infraestrutura para uma micro Empresa
Criar entrada (menuentry) ISO no Grub
Como gerar qualquer emoji ou símbolo unicode a partir do seu teclado
Instalando o Pi-Hole versão v5.18.4 depois do lançamento da versão v6.0
Instalar o VIM 9.1 no Debian 12
Como saber o range de um IP público?
Muitas dificuldades ao instalar distro Linux em Notebook Sony Vaio PCG-6131L (VPCEA24FM)
Dock do debian está muito pequena (1)
Instalei Windows 11 e não alterou o Grub do Debian (0)
Linux Mint (21.2) não reconhece teclado mecanico RASEC da PCYES (2)