File "libera_acesso.sh"

Full path: /www/wwwroot/fabriciovc.eti.br/downloads/scripts/ltsp/libera_acesso.sh
File size: 1.11 KiB (1133 bytes)
MIME-type: text/x-shellscript
Charset: 8 bit

Download   Open   Back

#!/bin/bash

IPTABLES=/sbin/iptables

Principal () {
  clear
  echo
  echo "Script IPTABLES para liberar VNC via DNAT"
  echo "-----------------------------------------"
  echo "Opções:"
  echo
  echo "1. Liberar VNC"
  echo "2. Bloquear VNC"
  echo "3. Sair"
  echo
  echo -n "Qual a opção desejada? "; read OPCAO
  case ${OPCAO} in
    1) Liberar ;;
    2) Bloquear ;;
    3) exit ;;
    *) echo; echo "Opção inválida !! Aguarde . . ."; sleep 5; Principal ;;
  esac
}
Liberar () {
  echo -n "Digite o IP de origem (ip valido): "; read IPORIGEM
  echo -n "Digite o IP de destino (ip interno): "; read IPDESTINO
  echo -n "Digite a PORTA de acesso (porta interno): "; read PORTA
  ${IPTABLES} -t nat -I PREROUTING 1 -s ${IPORIGEM} -p tcp --dport ${PORTA} -j DNAT --to-destination ${IPDESTINO}:${PORTA}
  echo
  echo "Regra adicionada com sucesso !! Aguarde . . ."; sleep 5; Principal
}
Bloquear () {
  ${IPTABLES} -L -n -t nat --line-numbers
  echo
  echo -n "Qual regra deseja remover? "; read NUM
  ${IPTABLES} -t nat -D PREROUTING ${NUM}
  echo
  echo "Regra removida com sucesso !! Aguarde . . ."; sleep 5; Principal
}
Principal

PHP File Manager