27.3.3.1. Linux server a Mac OS-X klient

rcsinfo=$Header: /home/radek/cvs/unix-book/input/unix/sec-l2tp.xml,v 1.1.1.1 2009-01-24 15:42:51 radek Exp $

FIXME:

Obrázek 27.6. Obrázek konfigurace Linux server — Mac OS-X roadwarrior

                    I  N  T  E  R  N  E  T
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          |                               |
          |                               |
eth1: 212.96.165.122/28        lan: 212.96.165.121/28
     +---------+                    +-----------+
     | pikachu |                    |   ibis    |
     +---------+                    +-----------+
eth0: 10.16.66.53/19           virt: 10.16.65.1-20
          |
        L A N

Začneme serverem. Na tom je nainstalován Racoon a jeho konfigurace v souboru /etc/racoon/racoon.conf je:

  1 # pikachu:/etc/racoon/racoon.conf
    
    log debug;      #notify/debug/debug2
    path pre_shared_key "/etc/racoon/psk.txt";
  5 
    listen {
            isakmp 212.96.165.122;
    }
    
 10 remote anonymous
    {
            exchange_mode main;
            generate_policy on;
    
 15         proposal {
                    encryption_algorithm 3des;
                    hash_algorithm sha1;
                    authentication_method pre_shared_key;
                    dh_group modp1024;
 20         }
    }
    
    sainfo anonymous {
            encryption_algorithm 3des;
 25         authentication_algorithm hmac_md5;
            compression_algorithm deflate;
    }

Sekce remote anonymous může být nastavena jako remote 212.96.165.121.

Soubor /etc/racoon/psk.txt jenž obsahuje sdílená tajemství:

  1 # pikachu:/etc/racoon/psk.txt
  2 # IPv4/v6 addresses
  3 212.96.165.121  hloupeheslo

Databázi politik inicializuju souborem /etc/racoon/ipsec.start

  1 #!/bin/sh
    # pikachu:/etc/racoon/ipsec.start
    
    /usr/sbin/setkey -c <<EOF
  5 
    ### Flush all
    flush;
    spdflush;
    
 10 spdadd 212.96.165.122[1701] 0.0.0.0/0 any -P out ipsec esp/transport//require;
    
    EOF

Skript /etc/racoon/ipsec.start spouštíme buďto ručně, nebo si jeho spouštění zakomponujeme do skriptu /etc/init.d/racoon jak jsem to udělal já. Tím máme zabezpečeno že po restartu routeru bude korektně nakonfigurován i VPN server. Tím jsme dokončili konfiguraci IPsec vrstvy a můžeme přikročit k dalšímu.

Dalším krokem je konfigurace l2tpd. Ta se nachází v souboru /etc/l2tpd/l2tpd.conf:

  1 ; pikachu:/etc/l2tpd/l2tpd.conf
    
    ; Nastaveni serveru
    [lns default]                           ; Our fallthrough LNS definition
  5 ip range = 10.16.65.1-10.16.65.20       ; * Allocate from this IP range
    local ip = 10.16.66.53                  ; * Our local IP to use
    require chap = yes                      ; * Require CHAP auth. by peer
    refuse pap = yes                        ; * Refuse PAP authentication
    require authentication = yes            ; * Require peer to authenticate
 10 name = LinuxVPNserver                   ; * Report this as our hostname
    ppp debug = yes                         ; * Turn on PPP debugging
    pppoptfile = /etc/ppp/options.l2tpd     ; * ppp options file

Konfigurace pro ppp je v souboru /etc/ppp/options.l2tpd.

ipcp-accept-local
ipcp-accept-remote
ms-dns  10.16.66.18
ms-dns  10.16.66.19
noccp
auth
crtscts
idle 1800
mtu 1410
mru 1410
nodefaultroute
debug
lock
deflate 9
proxyarp
connect-delay 5000

Ještě nadefinujeme účet pro klienta s názvem ibis a heslem spojme.

  1 # pikachu:/etc/ppp/chap-secrets
  2 # Secrets for authentication using CHAP
  3 # client        server  secret                  IP addresses
  4 ibis            *       spojme                  *

Server nakonfigurovaný máme, teď nakonfigurujeme klienta.

FIXME: tady bych měl uvést obrázky jednotlivých dialogů. Než to udělám tak je popíši aspoň slovy.

VPN (L2TP) Moraviapress Configuration

Description: Moraviapress
Server Address: 212.96.165.122
Account Name: ibis  →/etc/ppp/chap-secrets
Authentication: Use Password: spojme  →/etc/ppp/chap-secrets
Shared Secret: hloupeheslo  →/etc/racoon/psk.txt

Připojení z klienta ibis proběhne úspěšně a jsem schopen komunikovat s počitači uvnitř firemní sítě.

Program l2tpd vypíše protokol:

ourtid = 54705, entropy_buf = d5b1
ourcid = 45983, entropy_buf = b39f
check_control: control, cid = 0, Ns = 0, Nr = 0
handle_avps: handling avp's for tunnel 54705, call 45983
message_type_avp: message type 1 (Start-Control-Connection-Request)
protocol_version_avp: peer is using version 1, revision 0.
framing_caps_avp: supported peer frames:async sync
hostname_avp: peer reports hostname ''
assigned_tunnel_avp: using peer's tunnel 16
receive_window_size_avp: peer wants RWS of 4.  Will use flow control.
check_control: control, cid = 0, Ns = 1, Nr = 1
handle_avps: handling avp's for tunnel 54705, call 45983
message_type_avp: message type 3 (Start-Control-Connection-Connected)
control_finish: Connection established to 212.96.165.121, 51646.  Local: 54705,\
 Remote: 16.  LNS session is 'default'
check_control: control, cid = 0, Ns = 2, Nr = 1
handle_avps: handling avp's for tunnel 54705, call 45983
message_type_avp: message type 10 (Incoming-Call-Request)
message_type_avp: new incoming call
ourcid = 54332, entropy_buf = d43c
assigned_session_avp: assigned session id: 23589
call_serno_avp: serial number is 1
check_control: control, cid = 23589, Ns = 3, Nr = 2
handle_avps: handling avp's for tunnel 54705, call 54332
message_type_avp: message type 12 (Incoming-Call-Connected)
tx_speed_avp: transmit baud rate is 1000000
frame_type_avp: peer uses:async frames
start_pppd: I'm running:  "/usr/sbin/pppd" "passive" "-detach"\
 "10.16.66.53:10.16.65.1" "refuse-pap" "auth" "require-chap" "name"\
 "LinuxVPNserver" "debug" "file" "/etc/ppp/options.l2tpd" "/dev/ttyp0"
control_finish: Call established with 212.96.165.121, Local: 54332,\
 Remote: 23589, Serial: 1