Vyatta

Материал из RSU WiKi
Перейти к: навигация, поиск
Pen.pngЭта статья находится в процессе написания.
Если вы считаете, что её стоило бы доработать как можно быстрее, пожалуйста, скажите об этом.
Tower of babel.png外國 language!
В статье используется несколько языков. Необходимо использовать один. Совсем неплохо, если это будет русский.
Vyatta logo.png
Vyatta — сетевая операционная система, основанная на Debian GNU/Linux. Работает на оборудовании x86 и позволяет использовать обычный персональный компьютер или сервер в качестве маршрутизатора, межсетевого экрана или VPN-концентратора. Vyatta также может работать в виртуальной машине, предоставляя традиционные сетевые сервисы для виртуальной инфраструктуры (официально поддерживаются VMware ESX Server и Citrix XenServer, теоретически может работать в любом гипервизоре).

Разработчиком является компания Vyatta inc., расположенная в городе Белмонт, Калифорния. Она позиционирует Vyatta как конкурента продуктам Cisco уровня ISR 1800 — VXR 7200[1].

Vyatta inc. также предоставляет услуги по технической поддержке своих продуктов, консультации по их настройке и продаёт аппаратное обеспечение с предустановленной Vyatta. По заявлению разработчиков, название продукта происходит от санскритского слова «открытый»[2].

Содержание

Правила именования записей в ДНС для маршрутизаторов и коммутаторов

Основная статья: Правила именования записей в ДНС для маршрутизаторов и коммутаторов

Установка

What do you need for ?

  • Any x86 based (PC) computer (you can read more on the Vyatta site)
  • One Network engineer for experiments (He must be crazy (-8 )
  • Access to the Internet (to initialy download .iso, documentation)
  • 10-30 minutes to Basic install (install, configuring IP, access)
  • Any of Virtual product if you want to try it on Virtual Environment (VmWare Workstation or Player for example)
  1. Download .iso from vyatta.org
  2. Creating CD from ISO (or using .iso as CD in Virtual ENV)
  3. Boot from CD until "login:"
  4. Use default login/password (for 6.2 the default is vyatta/vyatta)
  5. type "install-image" and press enter
  6. wait until it finished
  7. Remove CD (or disable boot from it)
  8. wait until it successfully boot ("login:")
  9. use vyatta/vyatta
  10. you will be in operation mode ($)
  11. type "show show interfaces ethernet" to find your interfaces names. Remember it (for example eth0)
  12. type "configure" and press enter. You will be in configuration mode (#).
  13. create user crazy with password crazypwd
    1. type "set system login user crazy level admin "
    2. type "set system login user crazy authentication plaintext-password crazypwd "
    3. type "show system login" or "show system" to show system configuration
  14. configuring ip address of our interface. Eth0 - is the name, which we remember.
    1. type "set interface ethernet eth0 description "My first interface" "
    2. type "set interface ethernet eth0 address 192.168.0.1/24 "
  15. enable ssh by typing "set service ssh"
  16. look to overal configuration by "show"
  17. Commit and save

There are three different configs in the vyatta: Current (running) config. This config is used for any real operation like forwarding traffic, access, ... This is opertaion config. Saved (stored) config. This config is used then router is booting after power-on or reboot cmd. Really, this is the fie on the file system. Temporary config. This config is used then we make any configuration changes. It (config) is unique for any configuring session.

There are some commads in vyatta to work with configs:

in configuration mode:

commit command is moving temporary config to current. But not to save it to the disk. there is one interesting command commit-confirm save command is saving current config to disk for the next boot.

in operation mode:

show configuration
show configuration commands
    1. commit our changes by typing "commit"
    2. save our new committed configuration to disk by "save" command
    3. exit to operation mode by "exit"

9999 Profit

Работа с системой

show configuration commands | match 91.203.181.130
show configuration commands | match 91.203.181.128
save ~/111015.cfg
Saving configuration to '/home/user/111015.cfg'

Вот эти строчки добавляют хост в BGP:

set protocols bgp 47124 network 91.203.180.252/32 route-map 'RmExportComm'
set protocols static route 91.203.180.252/32 next-hop '91.203.180.254'

Открываем SSH для машин в DMZ с защитой от перебора паролей (BruteForce)

set firewall name outside_in rule 115 action 'drop'
set firewall name outside_in rule 115 description 'Limit SSH against BruteForce'
set firewall name outside_in rule 115 destination address '198.51.100.0/24'
set firewall name outside_in rule 115 destination port 'ssh'
set firewall name outside_in rule 115 protocol 'tcp'
set firewall name outside_in rule 115 recent count 4
set firewall name outside_in rule 115 recent time 60
set firewall name outside_in rule 115 state new enable

set firewall name outside_in rule 120 action 'accept'
set firewall name outside_in rule 120 description 'permit ssh for all RealIP'
set firewall name outside_in rule 120 destination address '198.51.100.0/24'
set firewall name outside_in rule 120 destination port 'ssh'
set firewall name outside_in rule 120 protocol 'tcp'

Основная статья: Борьба с брутфорсом SSH

Сервер VPN

VPN (Virtual Private Network — виртуальная частная сеть[3]) — обобщённое название технологий, позволяющих обеспечить одно или несколько сетевых соединений (логическую сеть) поверх другой сети (например, Интернет). Несмотря на то, что коммуникации осуществляются по сетям с меньшим неизвестным уровнем доверия (например, по публичным сетям), уровень доверия к построенной логической сети не зависит от уровня доверия к базовым сетям благодаря использованию средств криптографии (шифрования, аутентификации, инфраструктуры открытых ключей, средств для защиты от повторов и изменений передаваемых по логической сети сообщений).

Настройка PPTP

At work clipart.pngЭто незавершённая статья, требующая доработки.
Илья, ты обещал!!!
vpn {
    pptp {
        remote-access {
            authentication {
                mode radius
                radius-server RADIUS_SERVER_IP {
                    key !secretkey!
                }
            }
            client-ip-pool {
                start IP_ADDRESS
                stop IP_ADDRESS
            }
            dns-servers {
                server-1 DNS_SERVER_IP_1
                server-2 DNS_SERVER_IP_2
            }
            outside-address OUTSIDE_ADDRESS_IP
        }
    }
}

Настройка L2TP/IPSec

Генерацию всех необходимых сертификатов и ключей производим по инструкции: Using XCA to configure the PKI part needed for L2TP/IPsec VPN connections using certificates for IKE main mode authentification

vpn {
    ipsec {
        ipsec-interfaces {
            interface eth0
        }
        nat-networks {
            allowed-network aa.bb.cc.0/24 {
            }
        }
        nat-traversal enable
    }
    l2tp {
        remote-access {
            authentication {
                mode radius
                radius-server RADIUS_SERVER_IP {
                    key RADIUS_SERVER_KEY
                }
            }
            client-ip-pool {
                start IP_ADDRESS
                stop IP_ADDRESS
            }
            dns-servers {
                server-1 DNS_SERVER_IP_1
                server-2 DNS_SERVER_IP_2
            }
            ipsec-settings {
                authentication {
                    mode x509
                    x509 {
                        ca-cert-file /config/auth/Vyatta_L2TP_CA.crt
                        server-cert-file /config/auth/L2TP_vpn_srv.crt
                        server-key-file /config/auth/L2TP_vpn_srv_SSLKEY.pem
                        server-key-password KEY_PASSWORD
                    }
                }
                ike-lifetime 3600
            }
            outside-address IP_ADDRESS
            outside-nexthop IP_ADDRESS
        }
    }
}

настройка NAT для функционирования VPN:

service {
    nat {
        rule 10 {
            outbound-interface eth0
            source {
                address aa.bb.cc.0/24
            }
            type masquerade
        }
    }
}

настройка статических маршрутов:

protocols {
    static {
        route 172.16.0.0/16 {
            next-hop 172.20.1.1 {
            }
        }
        route 172.20.0.0/16 {
            next-hop 172.20.1.1 {
            }
        }
    }
}

При экспорте приватного серверного ключа программой XCA, экспорт производится в формате PKCS#8, который несовместим с традиционным форматом SSL, используемым Vyatta. Конвертацию ключа производим следующим образом:

openssl rsa -in 'exportedXCAprivatekey' -out 'SSLeaycompatibleformat'

Настройка Firewall на пограничном маршрутизаторе

Подробная и большая статья: http://www.carbonwind.net/VyattaOFR/Firewall/Firewall.htm

Если VPN сервер находится внутри DMZ за пограничным маршрутизатом (на базе Vyatta) необходимы следующие настройки. Предположим, что VPN сервер имеет адрес 198.51.100.100.

PPTP

set firewall name outside_in rule 5080 action 'accept'
set firewall name outside_in rule 5080 description 'INPUT From Outside. Permit TCP access to VPN Server'
set firewall name outside_in rule 5080 destination address '198.51.100.100/32'
set firewall name outside_in rule 5080 destination port '1723'
set firewall name outside_in rule 5080 protocol 'tcp'

set firewall name outside_in rule 5082 action 'accept'
set firewall name outside_in rule 5082 description 'INPUT From Outside. Permit GRE access to VPN Server'
set firewall name outside_in rule 5082 destination address '198.51.100.100/32'
set firewall name outside_in rule 5082 protocol 'gre'
set firewall name outside_in rule 5082 state established 'enable'
set firewall name outside_in rule 5082 state new 'enable'
set firewall name outside_in rule 5082 state related 'enable'

set firewall name outside_out rule 1180 action 'accept'
set firewall name outside_out rule 1180 description '******************* vpn.example.com Server  access to Internet *********************'
set firewall name outside_out rule 1180 'disable'
set firewall name outside_out rule 1181 action 'accept'
set firewall name outside_out rule 1181 description 'vpn.example.com PPTP Server  permit access to GRE'
set firewall name outside_out rule 1181 protocol 'gre'
set firewall name outside_out rule 1181 source address '198.51.100.100/32'

L2TP/IPsec

set firewall name outside_in rule 5090 action 'accept'
set firewall name outside_in rule 5090 description 'INPUT From Outside. Permit L2TP access to VPN Server'
set firewall name outside_in rule 5090 destination address '198.51.100.100/32'
set firewall name outside_in rule 5090 destination port '500,1701,4500'
set firewall name outside_in rule 5090 protocol 'udp'

set firewall name outside_in rule 5092 action 'accept'
set firewall name outside_in rule 5092 description 'INPUT From Outside. Permit ESP access to VPN Server'
set firewall name outside_in rule 5092 destination address '198.51.100.100/32'
set firewall name outside_in rule 5092 protocol 'esp'
set firewall name outside_in rule 5092 state established 'enable'
set firewall name outside_in rule 5092 state new 'enable'
set firewall name outside_in rule 5092 state related 'enable'

set firewall name outside_out rule 1183 action 'accept'
set firewall name outside_out rule 1183 description 'vpn.rsu.edu.ru L2TP Server  permit access to ESP'
set firewall name outside_out rule 1183 protocol 'esp'
set firewall name outside_out rule 1183 source address '198.51.100.100/32'

set firewall name outside_in rule 5094 action 'accept'
set firewall name outside_in rule 5094 description 'INPUT From Outside. Permit AH access to VPN Server'
set firewall name outside_in rule 5094 destination address '198.51.100.100/32'
set firewall name outside_in rule 5094 protocol 'ah'
set firewall name outside_in rule 5094 state established 'enable'
set firewall name outside_in rule 5094 state new 'enable'
set firewall name outside_in rule 5094 state related 'enable'

set firewall name outside_out rule 1185 action 'accept'
set firewall name outside_out rule 1185 description 'vpn.rsu.edu.ru L2TP Server  permit access to AH'
set firewall name outside_out rule 1185 protocol 'ah'
set firewall name outside_out rule 1185 source address '198.51.100.100/32'

set firewall name outside_out rule 1188 action 'accept'
set firewall name outside_out rule 1188 description 'vpn.rsu.edu.ru L2TP Server  permit access to ISAKMP'
set firewall name outside_out rule 1188 protocol 'udp'
set firewall name outside_out rule 1188 destination port '500,4500'
set firewall name outside_out rule 1188 source address '198.51.100.100/32'

Пример конфига с группами адресов в правилах

firewall {
     group {
         address-group proxy-a {
             address 10.125.3.2
         }
         network-group proxy-n {
             network 213.226.63.0/24
             network 10.0.0.0/8
             network 93.155.130.0/23
             network 93.155.162.0/24
             network 93.155.169.0/24
         }
     }
     name eth0.523.local {
         default-action accept
         rule 1 {
             action accept
             destination {
                 port 8080
             }
             protocol tcp
             source {
                 group {
                     address-group proxy-a
                 }
             }
         }
         rule 2 {
             action accept
             destination {
                 port 8080
             }
             protocol tcp
             source {
                 group {
                     network-group proxy-n
                 }
             }
         }
         rule 3 {
             action drop
             destination {
                 port 8080
             }
             protocol tcp
         }
     }
 }

Открываем RDP на машину в DMZ:

set firewall group address-group remote-admins address 198.51.100.165
set firewall group address-group remote-admins address 203.0.113.227
delete firewall name outside_in rule 5061
set firewall name outside_in rule 5061 action 'accept'
set firewall name outside_in rule 5061 description 'INPUT From Outside. Permit RDP access to IIS web server'
set firewall name outside_in rule 5061 destination address '192.0.2.136/32'
set firewall name outside_in rule 5061 destination port '3389'
set firewall name outside_in rule 5061 protocol 'tcp'
set firewall name outside_in rule 5061 source group address-group remote-admins

Основы работы с командной строкой

Удаление правила firewall:

set firewall name RULENAME rule RULENUMBER disable

Смотрим конкретное правило:

show configuration commands | match 5070

Резервная копия конфигурационного файла

Сохранение текущей конфигурации:

(configure) commit

Создание резервной копии файла конфигурации:

(configure) save config.boot

Файл config.boot будет размещен на сервере vyatta в /opt/vyatta/etc/config/

Копирование файла выполняется с сервера резервирования:

scp backup@vyatta.example.com:/opt/vyatta/etc/config/config.boot config.boot-YYYY-MM-DD

Рутина

Список IP-сетей г. Рязани

set firewall group network-group rzn-nets network '31.44.48.0/20'
set firewall group network-group rzn-nets network '78.31.72.0/21'
set firewall group network-group rzn-nets network '80.72.112.0/20'
set firewall group network-group rzn-nets network '86.110.160.0/19'
set firewall group network-group rzn-nets network '88.86.64.0/23'
set firewall group network-group rzn-nets network '89.106.192.0/21'
set firewall group network-group rzn-nets network '91.219.188.0/22'
set firewall group network-group rzn-nets network '91.203.64.0/22'
set firewall group network-group rzn-nets network '91.203.180.0/22'
set firewall group network-group rzn-nets network '92.39.136.0/21'
set firewall group network-group rzn-nets network '93.189.8.0/22'
set firewall group network-group rzn-nets network '94.231.112.0/20'
set firewall group network-group rzn-nets network '95.83.128.0/18'
set firewall group network-group rzn-nets network '95.106.0.0/17'
set firewall group network-group rzn-nets network '109.69.72.0/22'
set firewall group network-group rzn-nets network '109.195.160.0/20'
set firewall group network-group rzn-nets network '176.96.224.0/19'
set firewall group network-group rzn-nets network '176.241.224.0/21'
set firewall group network-group rzn-nets network '176.212.180.0/22'
set firewall group network-group rzn-nets network '176.212.160.0/21'
set firewall group network-group rzn-nets network '176.104.192.0/19'
set firewall group network-group rzn-nets network '178.255.120.0/21'
set firewall group network-group rzn-nets network '188.187.228.0/24'
set firewall group network-group rzn-nets network '193.34.8.0/22'
set firewall group network-group rzn-nets network '212.26.224.0/19'

Примечания

  1. Cisco Replacement Guide
  2. About Vyatta
  3. Устоявшийся термин; правильнее «виртуальная закрытая сеть». Слово private, в числе прочего, имеет значение «персональный», «секретный», «закрытый», и негосударственная (частная) собственность тут ни к чему.

См. также

Cсылки

Личные инструменты
Пространства имён
Варианты
Действия
Навигация
Инструменты