Mostrando entradas con la etiqueta netfilter. Mostrar todas las entradas
Mostrando entradas con la etiqueta netfilter. Mostrar todas las entradas

miércoles, 5 de noviembre de 2014

Introducción a iptables

iptables es la herramienta de espacio de usuario para la configuración de reglas de firewall en el kernel de GNU/Linux.

En realidad, es una parte del framework netfilter. Tal vez porque iptables es la parte más visible del sistema netfilter, el framework es comúnmente referido colectivamente como iptables.
iptables ha sido la solución de firewall de GNU/Linux desde el kernel 2.4.


En GNU/Linux la configuración del firewall iptables consta de un conjunto de cadenas integradas (agrupadas en cuatro tablas) que comprenden cada una una lista de "reglas". Por cada paquete, y en cada etapa del proceso, el kernel consulta la cadena adecuada para determinar el destino del mismo.

Las cadenas se consultan en orden, sobre la base de la "dirección" del paquete (remoto-a-local, remoto-a-remoto o local-a-remoto) y su actual estado de procesamiento (antes o después del enrutamiento) .


Fuente:
http://www.linuxjournal.com/content/advanced-firewall-configurations-ipset

miércoles, 4 de julio de 2012

QoS - WebHTB - Control de ancho de banda

http://www.webhtb.ro/features/
http://www.webhtb.ro/how-to/details/q/1/
http://www.webhtb.ro/how-to/details/q/2/

http://es.scribd.com/doc/80856181/117/D-1-Instalacion-de-la-aplicacion-WebHTB
www.linux-magazine.es/issue/52/047-049_WebHTBLM52.pdf


WebHTB es una interfaz web muy sencilla, construida en PHP, Java Script / Ajax, y trabaja con MySQL.

WebHTB es una suite de software que ayuda a simplificar el difícil proceso de asignación de ancho de banda, tanto para el tráfico de carga como descarga. Genera y comprueba los archivos de configuración y muestra  el tráfico en tiempo real para cada cliente.



QoS - Control de ancho de banda con Prometheus


http://freecode.com/projects/prometheus-qos

http://www.ecualug.org/2009/05/17/blog/razametal/limitar_ancho_de_banda_con_prometheusqos?page=1

Prometeo QoS (Quality of Service) es una herramienta orientada a ISPs para la administracion  fácil del tráfico IP. Genera múltiples clases HTB de control de tráfico con valores de techo y ajuste fino. Es compatible con NAT (asimétrica y simétrica), ofrece una buena clasificacion de paquetes (shaping) en ambos sentidos y da prioridad  tanto para cargas como descargas.


lunes, 25 de junio de 2012

SEQUREISP ¿el Mejor Software de Gestión de ISPs?


SequreISP es un software de gestión de ISP (Proveedores de Servicios de Internet).
El software permite gestionar el acceso a Internet garantizando calidad de servicio para los clientes
y maximizando la rentabilidad para el proveedor.



https://github.com/sequre/sequreisp


sequreisp

sequreisp is an ISP management software.
  • Has a really nice and powerful web interface
  • Can handle up to 3000 or more clients in a single server, thus it is oriented to small/medium ISPs
  • Can group multiple internet providers and do load balancing and failover between them (current record is 32 DSL lines balanced in a single server)
  • Supports all kind of internet providers, dedicated, DSL lines, cable-modem, etc.
  • Does a meticulous bandwidth control and traffic prioritization
    • Allows to set maximum and minimum(guaranteed) for download/upload traffic
    • Efficiently detects P2P traffic and allows to set a maximum as a percent of client’s bandwidth
    • Prioritization can be customized even to a per client basis
  • Integrates with Squid proxy to do transparent web cache(optional)
  • Has a plug-in interface, you can write your custom functionality in top of sequreisp
  • It is written in Ruby on Rails
  • And a lot more
    • Instant and historical graphs
    • Backup & restore from the web interface with a single and lightweight file
    • Port forwarding, full DNAT, and proxy ARP to clients
    • VLAN support
    • E-mail notifications
    • Role based authentication, with audit system
    • Multilingual support (currently Spanish and English, contributions are welcome)

Demo

There is an online demo of the application available
Url: http://demo.sequreisp.com/
User: admin@sequre.com.ar
Pass: 1234

jueves, 14 de junio de 2012

Iptables - Bloquear por String


Iptables - Bloquear por String

iptables -I  FORWARD -i vlan110 -p tcp --dport 443 -m string --string
"facebook" --algo kmp -j DROP


# iptables -nvL
Chain FORWARD (policy DROP 433 packets, 149K bytes)
 pkts bytes target     prot opt in     out     source
destination
   0     0 DROP       tcp  --  vlan110 *       0.0.0.0/0
0.0.0.0/0           tcp dpt:443 STRING match "facebook" ALGO name bm
TO 65535

Esto funciona de esta manera:

si el usuario busca "facebook" en https://google.com.ar encuentra y
accede a todo lo que este permitido.
por ejemplo

webtomich.com.ar/?tag=facebook

que es el quinto elemento mostrado en esa búsqueda.

Ahora, si el usuario tiene su facebook para conectarse automáticamente
al abrir el sitio, esta acción procede y se logea pero no puede ver el
contenido multimedia que esta bloqueado en el squid.


http://wiztelsys.com/Article_iptables_bob2.html
http://rhcelinuxguide.wordpress.com/2008/08/05/iptables-string-match-to-drop-malicious-urls/




System Requirements.

Preferred kernel version : 2.6.18 or later.
The iptables program(1.3.5 or later) installed on your machine.
The kernel should be compiled with string matching support. To do this, the following line should be added to the .config file prior to compiling the kernel:
CONFIG_NETFILTER_XT_MATCH_STRING=m

cat /proc/modules|grep xt_string

iptables -I INPUT -p tcp --dport 25 -m string --string "Subject" --algo bm -j DROP
**Do it now with an optimised rule!

The same rule might be modified to one with less overhead (that is, it uses less resources) by limiting the search specifying offset values, and by assuming that the SMTP subject header will be within an offset limit of 15000 in the packet.
iptables -I INPUT -p tcp --dport 25 -m string --string "Subject"  --algo bm --to 15000 -j DROP

miércoles, 23 de mayo de 2012

Iptables - bloquear Torrent

http://www.adminsehow.com/2011/04/block-bittorrent-traffic-on-your-linux-firewall-using-iptables/

Bloquear torrents con iptables

iptables -N DROPTORRENT > /dev/null 2> /dev/null
iptables -F DROPTORRENT
iptables -A DROPTORRENT -j LOG --log-prefix "DROPTORRENT "
iptables -A DROPTORRENT -j DROP

#Torrent
iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string "torrent" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string "announce" -j DROPTORRENT
iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROPTORRENT

# DHT keyword
iptables -A FORWARD -m string --string "get_peers" --algo bm -j DROPTORRENT
iptables -A FORWARD -m string --string "announce_peer" --algo bm -j DROPTORRENT
iptables -A FORWARD -m string --string "find_node" --algo bm -j DROPTORRENT

lunes, 5 de marzo de 2012

limitar por tiempo iptables


Allow connections to webserver, 512/sec, as I said, small server
-A INPUT -m tcp -p tcp --dport 80 -m state --state NEW -m limit --limit 512/s --limit-burst 512 -j ACCEPT
# Allow SSL connections to webservers, same as port 80
-A INPUT -m tcp -p tcp --dport 443 -m state --state NEW -m limit --limit 512/s --limit-burst 512 -j ACCEPT
# Allow connections to mail server, small traffic, 10/s should be more than enough
-A INPUT -m tcp -p tcp --dport 25 -m state --state NEW -m limit --limit 10/s --limit-burst 10 -j ACCEPT
# Allow TLS connections to mail server
-A INPUT -m tcp -p tcp --dport 465 -m state --state NEW -m limit --limit 10/s --limit-burst 10 -j ACCEPT
# Allow connections to IMAP4 server
-A INPUT -m tcp -p tcp --dport 143 -m state --state NEW -m limit --limit 10/s --limit-burst 10 -j ACCEPT
# Allow connections to IMAPS server
-A INPUT -m tcp -p tcp --dport 993 -m state --state NEW -m limit --limit 10/s --limit-burst 10 -j ACCEPT
# Allow connections to sieve server
-A INPUT -m tcp -p tcp --dport 4190 -m state --state NEW -m limit --limit 3/min --limit-burst 3 -j ACCEPT
COMMIT