Показаны сообщения с ярлыком tunneling. Показать все сообщения
Показаны сообщения с ярлыком tunneling. Показать все сообщения

воскресенье, 11 мая 2014 г.

PPTP. network behind client.

Две площадки объединены туннелем. На одной стоит PPTP сервер на линуксе, на другой микротик, который цепляется к первому клиентским туннелем. За микротиком сетка 192.168.3.0/24. В линуксе нужно прописать маршрут. Делаем это динамически при подключении определенного пира. IP-адрес для пира постоянный. Итак, в файл /etc/ppp/ip-up дописываем:

#!/bin/sh
#
# This script is run by the pppd after the link is established.
# It uses run-parts to run scripts in /etc/ppp/ip-up.d, so to add routes,
# set IP address, run the mailq etc. you should create script(s) there.
#
# Be aware that other packages may include /etc/ppp/ip-up.d scripts (named
# after that package), so choose local script names with that in mind.
#
# This script is called with the following arguments:
#    Arg  Name                          Example
#    $1   Interface name                ppp0
#    $2   The tty                       ttyS1
#    $3   The link speed                38400
#    $4   Local IP number               12.34.56.78
#    $5   Peer  IP number               12.34.56.99
#    $6   Optional ``ipparam'' value    foo

# The  environment is cleared before executing this script
# so the path must be reset
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
export PATH

# These variables are for the use of the scripts run by run-parts
PPP_IFACE="$1"
PPP_TTY="$2"
PPP_SPEED="$3"
PPP_LOCAL="$4"
PPP_REMOTE="$5"
PPP_IPPARAM="$6"
export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM

# as an additional convenience, $PPP_TTYNAME is set to the tty name,
# stripped of /dev/ (if present) for easier matching.
PPP_TTYNAME=`/usr/bin/basename "$2"`
export PPP_TTYNAME

case "$5" in
        172.26.100.42)
                /sbin/route add 192.168.3.161/32 gw 172.26.100.42
                ;;
        *)
esac

# If /var/log/ppp-ipupdown.log exists use it for logging.
if [ -e /var/log/ppp-ipupdown.log ]; then
  exec > /var/log/ppp-ipupdown.log 2>&1
  echo $0 $*
  echo
fi

# This script can be used to override the .d files supplied by other packages.
if [ -x /etc/ppp/ip-up.local ]; then
  exec /etc/ppp/ip-up.local "$*"
fi

run-parts /etc/ppp/ip-up.d \
  --arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"

# if pon was called with the "quick" argument, stop pppd
if [ -e /var/run/ppp-quick ]; then
  rm /var/run/ppp-quick
  wait
  kill $PPPD_PID
fi

Тут есть описание переменных, можно сделать это в отдельном файле ip-up.local. Да, чтобы одинаковые маршруты не плодились не забудьте прописать аналогичное в ip-down (route del).

четверг, 28 ноября 2013 г.

Как создается IPSEC туннель, примеры Cisco IOS

Готовлюсь к экзамену 642-637 Secure. Читаю одноименную книжку. Теперь всё ясно и понятно про IPSec и GRE. Зарисовки из конфигов рутеров в GNS.

IKE фаза 1 (Main mode or Aggressive mode)
1. Negotiate phase (согласование опций)
1.1 Hashing: MD5, SHA
1.2 Authentikation: PSK, RSA Sigs
1.3 Group (DH): 1,2,5
1.4 Lifetime of tunnel wo traffic seconds
1.5 Encryption: DES, 3DES, AES
2. Setup Keys (DH)
3. Authenticate
4. IKE phase 1 SA/tunnel ready


IKE фаза 2
1. Negotiate phase 2 (Quick mode)
1.1 Hashing: MD5/SHA HMAC
1.2 (Already authenticated)
1.3 Group/PFS (DH) Можно выбрать ещё раз
1.4 Lifetime: time or data (для туннеля 2)
1.5 Encryption
2. IKE phate 2 SA/Tunnel ready


---
Вариант 1 - обычный IPsec


!
crypto isakmp policy 100
encr aes
authentication pre-share
group 5
lifetime 360
crypto isakmp key GnsTest address 172.16.2.2
!
!
crypto ipsec transform-set GNSTEST esp-aes esp-sha-hmac
!
crypto map GNS-CM 10 ipsec-isakmp
set peer 172.16.2.2
match address 101
!
!

пятница, 25 января 2013 г.

Site-to-site туннель GRE через IPSEC на маршрутизаторе Cisco 2911R с использованием модуля шифрования NME-RVPN


Первая схема

Казалось бы, обыденная задача - объединить два офиса шифрованным каналом. Всего-то нужно построить site-to-site VPN и зашифровать с помощью crypto map. Все так и есть, если речь идет не о государственной структуре. Нельзя использовать вражеские шифровальные алгоритмы и железо. Именно под эту задачу были выбраны маршрутизаторы ISR второго поколения 2911R. Буква R в конце названия говорит о том, что данные рутеры были произведены на территории РФ. Для шифрования трафика будем использовать модули для этих рутеров - NME RVPN, выполненные в качестве карты расширения для ISR. Они несут на борту русский софт от компании S-Terra и, конечно же, «Крипто про». По сути, платы представляют собой отдельную машинку под управлением redhat linux с несколькими кастомными софтинами. Имеет один внешний порт помимо общей коммутационной шины, которой подключаются все подобные модули в ISR.

пятница, 28 мая 2010 г.

SSH tunnelling

Сначала своими словами. Простой пример. Необходимо зайти на веб сервер по шифрованому соединению... ну или воспользоваться любой другой службой этого сервера секьюрно. Там стоит sshd.



На машине клиенте ssh -L 1234:localhost:80 om@192.168.1.1. Это означает, что с 1234 порта ip адреса 127.0.0.1 пакет будет перенаправлен на адрес 192.168.1.1 порт 80 внутри SSH трубы. Для проверки вбейте в адресной строке браузера http://localhost:1234.

Далее оригинал статьи. http://www.brandonhutchinson.com/ssh_tunnelling.html



ssh tunnelling is an excellent way to tunnel insecure protocols through a secure communication channel. In this example, I'll tunnel POP3 traffic using ssh. Traditional POP3 traffic, including username and password information, travels clear-text across the network.

OpenSSH is used in the following examples.

To tunnel POP3 traffic using ssh:

1. Make sure an ssh client is installed on your machine and an ssh server is installed on the POP3 server.

2. Create a local ssh tunnel on your machine (port 1234 for this example) to the POP3 server's port 110. You will need to be the root user to bind to "privileged" ports (< 1024).
# ssh -f -N -L 1234:localhost:110 user@POP3_server

3. Test the tunnel.
$ telnet localhost 1234
You should see the POP3 server's banner information.

4. Configure your mail client to access your mail via POP3 using mail server localhost and port 1234.

"Reverse" ssh tunnel
It is possible to create a "reverse" ssh tunnel. The reverse tunnel will allow you to create an ssh tunnel from your work computer to your home computer, for example, and then login to your work machine from your home machine even if your work firewall does not permit ssh traffic initiated from your home machine!

For this to work, an ssh server must be installed on your work and home computer, and ssh (TCP port 22) must be allowed outbound from your work computer to your home computer.

$ ssh -R remote_port:localhost:22 your_home_computer

ex. $ ssh -R 2048:localhost:22 home.computer.com

At home, you would then run ssh -p 2048 localhost to log into your work computer via ssh.