Script Respaldo de Base de Datos POSTGRESQL
export FECHA=`date +%d-%m-%Y_%H:%M:%S`
export NAME=BD_Proyecto_${FECHA}.dump
export DIR=/opt/backup/database
USER_DB=usuario
NAME_DB=BD_Proyecto
cd $DIR
> ${NAME}
export PGPASSWORD=informix
chmod 777 ${NAME}
echo "procesando la copia de la base de datos"
pg_dump -U $USER_DB -h localhost --port 5432 -f ${NAME} $NAME_DB
echo "backup terminado"
#Elimina archivos mayor a un 15 dias
find /opt/backup/database/*.dump -mtime +15 -exec rm {} \;
Freddy Perez
Computación y Sistemas
freperez98@gmail.com +58 0426-530.95.11 (0424) -381.43.91 Aragua Venezuela
miércoles, 27 de febrero de 2019
domingo, 2 de diciembre de 2018
Comprimir y descomprimir .gz, .tar.gz, y .zip por linea de comandos en Linux
Comprimir y descomprimir .gz, .tar.gz, y .zip por linea de comandos en Linux
Archivos .tar.gz:
Comprimir: tar -czvf empaquetado.tar.gz /carpeta/a/empaquetar/
Descomprimir: tar -xzvf archivo.tar.gz
Comprimir: tar -czvf empaquetado.tar.gz /carpeta/a/empaquetar/
Descomprimir: tar -xzvf archivo.tar.gz
Archivos .tar:
Empaquetar: tar -cvf paquete.tar /dir/a/comprimir/
Desempaquetar: tar -xvf paquete.tar
Empaquetar: tar -cvf paquete.tar /dir/a/comprimir/
Desempaquetar: tar -xvf paquete.tar
Archivos .gz:
Comprimir: gzip -9 index.php
Descomprimir: gzip -d index.php.gz
Comprimir: gzip -9 index.php
Descomprimir: gzip -d index.php.gz
Archivos .zip:
Comprimir: zip archivo.zip carpeta
Descomprimir: unzip archivo.zip
Comprimir: zip archivo.zip carpeta
Descomprimir: unzip archivo.zip
jueves, 22 de noviembre de 2018
Firewall iptables linux, Ejemplo
Firewall iptables linux, Ejemplo
#!/bin/bash# Firewall
# Octubre del 2004
# Firewall.
# Freddy Perez +58 0426-530.95.11
# freperez98@gmail.com
echo "1" > /proc/sys/net/ipv4/conf/all/forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/tcp_syncookies
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo "1" > $f
done
for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
echo "0" > $f
done
WAN_IFACE="enp3s1"
LAN_IFACE="enp3s2"
LAN_NET="10.0.0.0/24"
ANYWHERE="0/0"
DVR1_INT="10.0.0.20"
DVR2_INT="10.0.0.21"
DVR3_INT="10.0.0.21"
SRVWW_INT="10.0.0.25"
[ -z "$LAN_IP" ] && LAN_IP=`/sbin/ifconfig $LAN_IFACE | grep inet | cut -d : -f 2 | cut -d " " -f 1`
[ -z "$WAN_IP" ] && WAN_IP=`/sbin/ifconfig $WAN_IFACE | grep inet | cut -d : -f 2 | cut -d " " -f 1`
echo "FIREWALL `date`"
echo "WAN_IP "$WAN_IP
echo "LAN_IP "$LAN_IP
# Limpia las Reglas
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -t nat -F
/sbin/iptables -t nat -X
/sbin/iptables -P FORWARD DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P INPUT DROP
# Accept Looalhost/loopback
/sbin/iptables --append INPUT -s 127.0.0.1/32 --in-interface lo --jump ACCEPT
/sbin/iptables --append INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 --jump ACCEPT
# Paquetes Incorrectos que no Queremos Recibir
/sbin/iptables --append FORWARD -p tcp ! --syn --match state --state NEW --jump DROP
# Paquetes con mal enrutamiento
/sbin/iptables --append INPUT --source 255.255.255.255 --destination $ANYWHERE --jump DROP
# Todas las Conexiones establecidas por esta maquina (EL FW) Permitidas
/sbin/iptables --append INPUT -p all --destination $ANYWHERE -m state --state ESTABLISHED,RELATED -j ACCEPT
#Compartir el Acceso SSH al FIREWALL
/sbin/iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -m tcp --dport 2025 -j ACCEPT
# Permitir las entradas a los siguientes puertos
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $WAN_IP -p tcp -m state --dport 80 --state NEW -j ACCEPT
/sbin/iptables -A FORWARD -i $LAN_IFACE -d $LAN_IP -p tcp -m state --dport 80 --state NEW -j ACCEPT
# Todas las Conexiones que vengan de la DMZ al Firewall Permitidas
/sbin/iptables --append INPUT -p all --in-interface $LAN_IFACE --source $LAN_NET --destination $LAN_IP --jump ACCEPT
/sbin/iptables --append INPUT -p all --in-interface $LAN_IFACE --source $LAN_NET --destination $WAN_IP --jump ACCEPT
# Todas Las Conexiones que vengan al puerto 80 Permitidas
/sbin/iptables -A FORWARD --in-interface $WAN_IFACE --destination $WAN_IP -p tcp -m state --dport 80 --state NEW -j ACCEPT
/sbin/iptables -A FORWARD --in-interface $LAN_IFACE --destination $WAN_IP -p tcp -m state --dport 80 --state NEW -j ACCEPT
# ICMP, rules, Permitir los tipos de ICMP mas criticos
#/sbin/iptables --append INPUT -p icmp --icmp-type echo-reply --source $ANYWHERE --jump ACCEPT
#/sbin/iptables --append INPUT -p icmp --icmp-type echo-request --source $ANYWHERE --jump ACCEPT
#/sbin/iptables --append INPUT -p icmp --icmp-type time-exceeded --source $ANYWHERE --jump ACCEPT
#Permitir la entrada al servidor WEB
/sbin/iptables --append INPUT --in-interface $WAN_IFACE --destination $WAN_IP -p tcp -m state --dport 80 --state NEW --jump ACCEPT
/sbin/iptables --append INPUT --in-interface $LAN_IFACE --destination $WAN_IP -p tcp -m state --dport 80 --state NEW --jump ACCEPT
# WWW INT
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $SRVWW_INT -p udp -m state --dport 80 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p udp -m udp --dport 2026 -j DNAT --to-destination ${SRVWW_INT}:80
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $SRVWW_INT -p tcp -m state --dport 80 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p tcp -m tcp --dport 2026 -j DNAT --to-destination ${SRVWW_INT}:80
# DVR1
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR1_INT -p udp -m state --dport 9100 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p udp -m udp --dport 9100 -j DNAT --to-destination ${DVR1_INT}:9100
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR1_INT -p tcp -m state --dport 9100 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p tcp -m tcp --dport 9100 -j DNAT --to-destination ${DVR1_INT}:9100
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR1_INT -p udp -m state --dport 34567 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p udp -m udp --dport 34567 -j DNAT --to-destination ${DVR1_INT}:34567
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR1_INT -p tcp -m state --dport 34567 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p tcp -m tcp --dport 34567 -j DNAT --to-destination ${DVR1_INT}:34567
# DVR3
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR3_INT -p udp -m state --dport 9102 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p udp -m udp --dport 9102 -j DNAT --to-destination ${DVR3_INT}:9102
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR3_INT -p tcp -m state --dport 9102 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p tcp -m tcp --dport 9102 -j DNAT --to-destination ${DVR3_INT}:9102
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR3_INT -p udp -m state --dport 34568 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p udp -m udp --dport 34568 -j DNAT --to-destination ${DVR3_INT}:34568
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR3_INT -p tcp -m state --dport 34568 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p tcp -m tcp --dport 34568 -j DNAT --to-destination ${DVR3_INT}:34568
# DVR2
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR2_INT -p udp -m state --dport 9101 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p udp -m udp --dport 9101 -j DNAT --to-destination ${DVR2_INT}:9101
/sbin/iptables -A FORWARD -i $WAN_IFACE -d $DVR2_INT -p tcp -m state --dport 9101 --state NEW -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i $WAN_IFACE -d $WAN_IP -p tcp -m tcp --dport 9101 -j DNAT --to-destination ${DVR2_INT}:9101
# Todo lo que salga va con el IP de la WAN
/sbin/iptables --table nat --append POSTROUTING --out-interface $WAN_IFACE --source $LAN_NET --jump SNAT --to-source $WAN_IP
/sbin/iptables --append FORWARD --in-interface $LAN_IFACE --source $LAN_NET --jump ACCEPT
/sbin/iptables --append FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
# LOG
#iptables -A INPUT -j LOG
#iptables -A FORWARD -j LOG
#iptables -A OUTPUT -j LOG
echo "ACCESO COMPARTIDO"
martes, 23 de octubre de 2018
Clave Modem Router CANTV ZXHN H108N,ZXHN H108N, H108N
Modem Router CANTV ZXHN H108N
Usuario: admin
Clave: c@ntvwifi2000
http://192.168.1.1 (Generalmente es asi)
Freddy Perez Computacion y Sistemas freperez98@gmail.com 0426-530.95.11 Aragua Venezuela
Usuario: admin
Clave: c@ntvwifi2000
http://192.168.1.1 (Generalmente es asi)
Freddy Perez Computacion y Sistemas freperez98@gmail.com 0426-530.95.11 Aragua Venezuela
martes, 16 de octubre de 2018
Script No-IP para Mikrotik
Script No-IP para Mikrotik
# Actualización automatica de DNS con servicio de No-IP
#--------------- Cambia los siguientes valores para las variables ------------------
:local noipuser ""
:local noippass ""
:local noiphost ""
:local inetinterface ""
#--------------------------------YA No cambies ningún archivo-------------------------
:global previousIP [:resolve $noiphost];
:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interface
:local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]
# Strip the net mask off the IP address
:for i from=( [:len $currentIP] - 1) to=0 do={
:if ( [:pick $currentIP $i] = "/") do={
:set currentIP [:pick $currentIP 0 $i]
}
}
:if ($currentIP != $previousIP) do={
:log info "No-IP: La actual IP $currentIP no es igual a la anterior, necesita actualizar!"
:set previousIP $currentIP
# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
:local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
:local noiphostarray
:set noiphostarray [:toarray $noiphost]
:foreach host in=$noiphostarray do={
:log info "No-IP: Se envio actualizacion para el siguiente Host $host"
/tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt")
:log info "No-IP: El siguiente Host $host fue actualizado en No-IP con la siguiente direccion IP $currentIP"
}
} else={
:log info "No-IP: La anterior IP $previousIP es igual que la actual, no es necesario actualizar"
}
} else={
:log info "No-IP: No fue necesario actualizar la siguiente Interface: $inetinterface esta aun no ha cambiado."
}
Freddy Perez Computacion y Sistemas freperez98@gmail.com 0426-530.95.11 Aragua Venezuela
# Actualización automatica de DNS con servicio de No-IP
#--------------- Cambia los siguientes valores para las variables ------------------
:local noipuser ""
:local noippass ""
:local noiphost ""
:local inetinterface ""
#--------------------------------YA No cambies ningún archivo-------------------------
:global previousIP [:resolve $noiphost];
:if ([/interface get $inetinterface value-name=running]) do={
# Get the current IP on the interface
:local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]
# Strip the net mask off the IP address
:for i from=( [:len $currentIP] - 1) to=0 do={
:if ( [:pick $currentIP $i] = "/") do={
:set currentIP [:pick $currentIP 0 $i]
}
}
:if ($currentIP != $previousIP) do={
:log info "No-IP: La actual IP $currentIP no es igual a la anterior, necesita actualizar!"
:set previousIP $currentIP
# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
:local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
:local noiphostarray
:set noiphostarray [:toarray $noiphost]
:foreach host in=$noiphostarray do={
:log info "No-IP: Se envio actualizacion para el siguiente Host $host"
/tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt")
:log info "No-IP: El siguiente Host $host fue actualizado en No-IP con la siguiente direccion IP $currentIP"
}
} else={
:log info "No-IP: La anterior IP $previousIP es igual que la actual, no es necesario actualizar"
}
} else={
:log info "No-IP: No fue necesario actualizar la siguiente Interface: $inetinterface esta aun no ha cambiado."
}
Freddy Perez Computacion y Sistemas freperez98@gmail.com 0426-530.95.11 Aragua Venezuela
martes, 3 de abril de 2018
Desarrollo De Aplicaciones A La Medida, Programas, Web
Desarrollo De Aplicaciones A La Medida, Programas, Web
Freddy Perez Computacion y Sistemas freperez98@gmail.com 58 0426-530.95.11 Aragua Venezuela
domingo, 1 de abril de 2018
Emails GMail PHPMailer en PHP
Emails GMail PHPMailer en PHP
Agradecer no cuesta nada,,,deje su comentario
Freddy Perez Computacion y Sistemas freperez98@gmail.com 0426-530.95.11 Aragua Venezuela
Suscribirse a:
Entradas (Atom)
ODBC NO SE VE. MAPEANDO COMO UNIDAD DE RED
ODBC NO SE VE. MAPEANDO COMO UNIDAD DE RED Para configurar el EnableLinkedConnections valor de registro: Haga clic en Inicio, escriba rege...
-
Como configurar un Router TP-LINK 300 Mbps Wireless N ADSL2+ Modem Router Model Nro. TD-W8961ND Parámetros de ABA CANTV, Venezuela ...
-
Clave o Contraseña Modem/Router ZTE ZXHN H108N (Versión cuadrada) de CANTV La solución ha llegado: USUARIO: admin PASSWORD: c@ntvwifi2000...
-
Wilcom ES 2006 V10 Wilcom ES 2006 V10, el más avanzado programa de software para la fabricación y el diseño en el sector del bordado, Wi...


