Skip to content

Instantly share code, notes, and snippets.

View Canx's full-sized avatar

Ruben Cancho Canx

View GitHub Profile
@Canx
Canx / fireqos.conf
Last active May 9, 2018 06:38
Archivo de configuración de FireQos
FIREQOS_CONNMARK_RESTORE="act_connmark"
# Download
interface veth2 lan output balanced rate 30Mbit
# 1SMR
class group 1SMR rate 20% ceil 80%
match dstmac 00:04:23:88:be:ee # MAC WAN del servidor de 1SMR
class youtube prio 7
@Canx
Canx / iptables.sh
Last active October 15, 2020 22:06
Configuración iptables Qos + Cache
# PARTE 2: Reglas IPTABLES
IPT=/sbin/iptables
EBT=/sbin/ebtables
# Activamos el forwarding
sysctl net.ipv4.ip_forward=1
# Limpiamos todas las reglas
$IPT -t nat -F
@Canx
Canx / interfaces.sh
Last active May 10, 2018 19:50
Configuración de los interfaces en servidor Qos + Cache
source ./config.cfg
######################################################
#
# 1. Creamos los puentes y añadimos los interfaces
ip link add name br0 type bridge
for interface in "${LAN[@]}"
do
ip link set $interface up
ip link set $interface master br0
# Configuración
LAN=(enp13s0f0 enp13s0f1 enp14s0f0)
WAN=enp3s0
DNS=(172.27.111.5 172.27.111.6)
IP=172.28.128.6
MASK=23
GATEWAY=172.28.128.1
acl localnet src 172.28.128.0/23
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.logging";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
logging {
channel default_log {
file "/var/log/bind/default" versions 3 size 20m;
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
channel auth_servers_log {
file "/var/log/bind/auth_servers" versions 100 size 20m;
options {
directory "/var/cache/bind";
zone-statistics yes;
statistics-file "/var/log/bind/named.stats";
// TODO: Actualizar bind para que esté soportado!
//statistics-channels {
// inet 127.0.0.1 port 8888 allow { 127.0.0.1; };
// inet ::1 port 8888 allow { ::1; };
@Canx
Canx / reset_courses.sh
Created August 22, 2018 14:41
Script to reset courses and unenrol students.
#!/bin/bash
#
# 'reset_courses' is a script to bulk reset all courses and unenrol their students.
# by Ruben Cancho (@canx)
#
# DEPENDENCIES: moosh installed.
# NOTE: for deleting old students is recommended to install "Inactive User Cleanup" plugin
#
############ CONFIG #############
userdb='root' # add your moodle db user
#!/bin/bash
exec 3>&1;
ips=$(dialog --title "IPs internas permitidas" --inputbox "Indica las IPs que podrán navegar sin restricciones (192.168.0.X)" 0 0 2>&1 1>&3);
exec 3>&1;
for ip in $ips; do
echo "iptables -I FORWARD -s 192.168.0.$ip -j ACCEPT";
done