porta redirect
+3
Diaszz
PALINHAS
labina63
7 participantes
- ConvidadoConvidado
porta redirect
Ter 28 Nov 2017 - 14:26
boas alguem tem o tuto das portas redirect
obg
obg
- ConvidadoConvidado
Re: porta redirect
Ter 28 Nov 2017 - 15:52
vitorCW escreveu:boas alguem tem o tuto das portas redirect
obg
- labina63
- Mensagens : 20
Data de inscrição : 22/11/2017
Re: porta redirect
Qua 29 Nov 2017 - 19:49
Não sei o que quer dizer isso'
- PALINHAS
- Mensagens : 22
Data de inscrição : 29/03/2018
Re: porta redirect
Qui 5 Jul 2018 - 0:03
O port_redirect aplica as regras em tempo real e de forma permanente, de modo que quando o servidor reiniciar ele continua a aplicar as regras.
Para este script funcionar é necessário ter um linux com bash e suporte a iptables.
Para instalar o script em anexo efectuar o seguinte procedimento admitindo que se tem o ficheiro no servidor na home do utilizador (no caso de root está na directoria /root): ######NÃo na raiz root######
- descomprimir o zip e transferir o ficheiro port_redirect.tgz para o servidor
- executar os seguintes comandos
cd /
tar zxf ~/port_redirect.tgz
$0 force_redirect <1500> <25>
===== para editar as portas ir ficheiro ir a user/sbin/port_redirect
depois colocar em etc/rclocal
/usr/sbin/port_redirect clean
sleep 30
/usr/sbin/port_redirect redirect 1500 25
Para este script funcionar é necessário ter um linux com bash e suporte a iptables.
Para instalar o script em anexo efectuar o seguinte procedimento admitindo que se tem o ficheiro no servidor na home do utilizador (no caso de root está na directoria /root): ######NÃo na raiz root######
- descomprimir o zip e transferir o ficheiro port_redirect.tgz para o servidor
- executar os seguintes comandos
cd /
tar zxf ~/port_redirect.tgz
$0 force_redirect <1500> <25>
===== para editar as portas ir ficheiro ir a user/sbin/port_redirect
depois colocar em etc/rclocal
/usr/sbin/port_redirect clean
sleep 30
/usr/sbin/port_redirect redirect 1500 25
gallo, oteb, ppais e foxhd541 gostam desta mensagem
- Diaszz
- Mensagens : 107
Data de inscrição : 24/12/2017
Re: porta redirect
Dom 8 Jul 2018 - 17:19
bom poste
sera q ja testo se fonciona como esta postado ??
q conheço bem o script e como foi feito
cumps
sera q ja testo se fonciona como esta postado ??
q conheço bem o script e como foi feito
cumps
- tg1987
- Mensagens : 25
Data de inscrição : 16/08/2017
Localização : PT
Re: porta redirect
Dom 21 Jul 2019 - 14:05
ola, tenho um problema qualquer no meu port redirect (de 12000 para 25), deixou de dar sem mais nem menos. alguem pode dizer-me como corrigir? em usr/sbin tenho o file port_redirect:
#!/bin/bash
##
# Author: Samuel Bernardo
# Last modification: 2015 Jun 13
##
function help {
cat <<-EOF
This script will redirect CCcam server port to another port of your choice.
For this use the command with the following sintaxe:
$0 redirect
or to force overwrite existing rules
$0 force_redirect
To redirect UDP port use the following:
$0 redirect_udp
or to force overwrite existing rules
$0 force_redirect_udp
To clean existing rules run the following command:
$0 clean
To get help run with following sintaxe
$0 --help
or
$0 -h
EOF
}
function redirect {
iptables -t nat -A PREROUTING -p tcp --dport $1 -j REDIRECT --to-port $2
iptables -t nat -I OUTPUT --src 0/0 -p tcp --dport $1 -j REDIRECT --to-ports $2
}
function redirect_udp {
iptables -t nat -A PREROUTING -p udp --dport $1 -j REDIRECT --to-port $2
iptables -t nat -I OUTPUT --src 0/0 -p udp --dport $1 -j REDIRECT --to-ports $2
}
function save_iptables {
mkdir -p /etc/iptables
iptables-save >> /etc/iptables/rules.v4
}
function iptables_exist {
if [ -f /etc/iptables/rules.v4 ]; then
cat <<-EOF
Configuration rules already exists (/etc/iptables/rules.v4)!
Please run the following command to force rewrite new rules:
$0 force_redirect
or if redirecting udp
$0 force_redirect_udp
or the following if you pretend to remove all existing saved rules:
$0 clean
EOF
exit 1
fi
}
function test_args {
if [ $1 -ne 3 ]; then
help
cat <<-EOF
ERROR: arguments not provided as expected!
EOF
exit 1;
fi
}
function clean_iptables {
iptables -t nat -F
iptables -t nat -X
rm /etc/iptables/rules.v4
}
function theend {
cat <<-EOF
Enjoy it and don't forget to share without profit!
EOF
}
case "$1" in
"--help" )
help
;;
"-h" )
help
;;
"redirect" )
test_args $#
iptables_exist
redirect $3 $2
save_iptables
theend
;;
"force_redirect" )
test_args $#
redirect $3 $2
save_iptables
theend
;;
"redirect_udp" )
test_args $#
iptables_exist
redirect_udp $3 $2
save_iptables
theend
;;
"force_redirect_udp" )
test_args $#
redirect_udp $3 $2
save_iptables
theend
;;
"clean" )
clean_iptables
echo "iptables rules removed!"
;;
* )
help
;;
esac
e no etc/rc.local tenho:
#!/bin/sh -e
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 164.132.45.219
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/local/bin/multics -C /var/etc/multics.cfg -b
sleep 1
/usr/sbin/port_redirect clean
sleep 1
/usr/sbin/port_redirect redirect 12000 25
exit 0
#!/bin/bash
##
# Author: Samuel Bernardo
# Last modification: 2015 Jun 13
##
function help {
cat <<-EOF
This script will redirect CCcam server port to another port of your choice.
For this use the command with the following sintaxe:
$0 redirect
or to force overwrite existing rules
$0 force_redirect
To redirect UDP port use the following:
$0 redirect_udp
or to force overwrite existing rules
$0 force_redirect_udp
To clean existing rules run the following command:
$0 clean
To get help run with following sintaxe
$0 --help
or
$0 -h
EOF
}
function redirect {
iptables -t nat -A PREROUTING -p tcp --dport $1 -j REDIRECT --to-port $2
iptables -t nat -I OUTPUT --src 0/0 -p tcp --dport $1 -j REDIRECT --to-ports $2
}
function redirect_udp {
iptables -t nat -A PREROUTING -p udp --dport $1 -j REDIRECT --to-port $2
iptables -t nat -I OUTPUT --src 0/0 -p udp --dport $1 -j REDIRECT --to-ports $2
}
function save_iptables {
mkdir -p /etc/iptables
iptables-save >> /etc/iptables/rules.v4
}
function iptables_exist {
if [ -f /etc/iptables/rules.v4 ]; then
cat <<-EOF
Configuration rules already exists (/etc/iptables/rules.v4)!
Please run the following command to force rewrite new rules:
$0 force_redirect
or if redirecting udp
$0 force_redirect_udp
or the following if you pretend to remove all existing saved rules:
$0 clean
EOF
exit 1
fi
}
function test_args {
if [ $1 -ne 3 ]; then
help
cat <<-EOF
ERROR: arguments not provided as expected!
EOF
exit 1;
fi
}
function clean_iptables {
iptables -t nat -F
iptables -t nat -X
rm /etc/iptables/rules.v4
}
function theend {
cat <<-EOF
Enjoy it and don't forget to share without profit!
EOF
}
case "$1" in
"--help" )
help
;;
"-h" )
help
;;
"redirect" )
test_args $#
iptables_exist
redirect $3 $2
save_iptables
theend
;;
"force_redirect" )
test_args $#
redirect $3 $2
save_iptables
theend
;;
"redirect_udp" )
test_args $#
iptables_exist
redirect_udp $3 $2
save_iptables
theend
;;
"force_redirect_udp" )
test_args $#
redirect_udp $3 $2
save_iptables
theend
;;
"clean" )
clean_iptables
echo "iptables rules removed!"
;;
* )
help
;;
esac
e no etc/rc.local tenho:
#!/bin/sh -e
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 164.132.45.219
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/local/bin/multics -C /var/etc/multics.cfg -b
sleep 1
/usr/sbin/port_redirect clean
sleep 1
/usr/sbin/port_redirect redirect 12000 25
exit 0
- djbertinho84
- Mensagens : 114
Data de inscrição : 12/05/2019
Re: porta redirect
Sex 13 Ago 2021 - 2:52
Belo tópico. Gostava era de entender o que é e para o que realmente serve
Nao levem a mal o comentário de um pobre noob.
Alguém sabe como Camuflar o meu ip público no multics?
Nao levem a mal o comentário de um pobre noob.
Alguém sabe como Camuflar o meu ip público no multics?
- foxhd541
- Mensagens : 25
Data de inscrição : 03/08/2021
Re: porta redirect
Qua 5 Out 2022 - 17:15
unzip the zip and transfer the port_redirect.tgz file to the server
unzip again uplaod in root right?
unzip again uplaod in root right?
- oteb
- Mensagens : 15
Data de inscrição : 08/12/2017
Re: porta redirect
Sex 3 Mar 2023 - 1:38
Gostava de testar
Permissões neste sub-fórum
Não podes responder a tópicos