FortiGate で SSL-VPN 設定をして外部から VPN 接続する方法

ファイアウォール(UTM)

はじめに

FortiGate を SSL-VPN ゲートウェイとして使用できるよう設定し、外部の VPN クライアントから FortiGate へ SSL-VPN 接続することで、外部 VPN クライアントから内部 NW へ通信できるようにするための設定方法について記載します。

なお、VPN クライアントソフトについては FortiClient を使用します。

作業環境

  • FortiGate 型番:FortiGate 60E
    • バージョン:v6.4.2
  • クライアント OS:Windows 10

SSL-VPN 設定手順

以下の手順で設定します。

  1. SSL-VPN 設定
  2. SSL-VPN ユーザ及びグループの作成
  3. ポリシー設定

SSL-VPN 設定

GUI で設定する場合

SSL-VPN 設定を GUI で行う場合は、[VPN] → [SSL-VPN設定] と選択した画面で行います。

以下画像では赤枠で囲った項目については明示的に設定変更し、その他の項目はデフォルト値のままとしています。

  • リッスンするインターフェース
    • VPN クライアントからの接続を待ち受けるインターフェースを指定
  • リッスンするポート
    • VPN クライアントからの接続を待ち受けるポート番号を指定
    • デフォルトでは 443 となっていて HTTPS とバッティングするため空きポートへ変更
  • 認証/ポータルマッピング
    • VPN ユーザに割り当てるポータル(権限)を指定
    • ポータルは以下の 3 つがデフォルトで定義されている
      • full-access
      • tunnel-access
      • web-access
    • 手動で新規にポータルを定義することも可能
    • 上画像で設定している tunnel-access の内容は以下画像の通り

SSL-VPN 設定について各項目を設定できたら画面下部の [適用] をクリックします。

以上で SSL-VPN 設定は完了です。

CLI で設定する場合

CLI で設定する場合は、config vpn ssl settings にて設定します。

前項の GUI での設定例の通り設定した場合のコンフィグは以下の通りです。

FW (settings) # show
config vpn ssl settings
    set servercert "Fortinet_Factory"
    set tunnel-ip-pools "SSLVPN_TUNNEL_ADDR1"
    set tunnel-ipv6-pools "SSLVPN_TUNNEL_IPv6_ADDR1"
    set port 11443
    set source-interface "internal1"
    set source-address "all"
    set source-address6 "all"
    set default-portal "tunnel-access"
end

FW (settings) # show full-configuration
config vpn ssl settings
    set reqclientcert disable
    set ssl-max-proto-ver tls1-3
    set ssl-min-proto-ver tls1-2
    unset banned-cipher
    set ssl-insert-empty-fragment enable
    set https-redirect disable
    set x-content-type-options enable
    set ssl-client-renegotiation disable
    set force-two-factor-auth disable
    set servercert "Fortinet_Factory"
    set algorithm high
    set idle-timeout 300
    set auth-timeout 28800
    set login-attempt-limit 2
    set login-block-time 60
    set login-timeout 30
    set dtls-hello-timeout 10
    set tunnel-ip-pools "SSLVPN_TUNNEL_ADDR1"
    set tunnel-ipv6-pools "SSLVPN_TUNNEL_IPv6_ADDR1"
    set dns-suffix ''
    set dns-server1 0.0.0.0
    set dns-server2 0.0.0.0
    set wins-server1 0.0.0.0
    set wins-server2 0.0.0.0
    set ipv6-dns-server1 ::
    set ipv6-dns-server2 ::
    set ipv6-wins-server1 ::
    set ipv6-wins-server2 ::
    set url-obscuration disable
    set http-compression disable
    set http-only-cookie enable
    set port 11443
    set port-precedence enable
    set auto-tunnel-static-route enable
    set header-x-forwarded-for add
    set source-interface "internal1"
    set source-address "all"
    set source-address-negate disable
    set source-address6 "all"
    set source-address6-negate disable
    set default-portal "tunnel-access"
    set dtls-tunnel enable
    set check-referer disable
    set http-request-header-timeout 20
    set http-request-body-timeout 30
    set auth-session-check-source-ip enable
    set tunnel-connect-without-reauth disable
    set hsts-include-subdomains disable
    set transform-backward-slashes disable
    set encode-2f-sequence disable
    set encrypt-and-store-password disable
    set dtls-max-proto-ver dtls1-2
    set dtls-min-proto-ver dtls1-0
end

各設定項目のヘルプは以下の通りです。

reqclientcert                    Enable/disable to require client certificates for all SSL VPN users.
ssl-max-proto-ver                SSL maximum protocol version.
ssl-min-proto-ver                SSL minimum protocol version.
banned-cipher                    Select one or more cipher technologies that cannot be used in SSL VPN negotiations.
ssl-insert-empty-fragment        Enable/disable insertion of empty fragment.
https-redirect                   Enable/disable redirect of port 80 to SSL VPN port.
x-content-type-options           Add HTTP X-Content-Type-Options header.
ssl-client-renegotiation         Enable/disable to allow client renegotiation by the server if the tunnel goes down.
force-two-factor-auth            Enable/disable only PKI users with two-factor authentication for SSL VPNs.
servercert                       Name of the server certificate to be used for SSL VPNs.
algorithm                        Force the SSL VPN security level. High allows only high. Medium allows medium and high. Low allows any.
idle-timeout                     SSL VPN disconnects if idle for specified time in seconds.
auth-timeout                     SSL VPN authentication timeout (1 - 259200 sec (3 days), 0 for no timeout).
login-attempt-limit              SSL VPN maximum login attempt times before block (0 - 10, default = 2, 0 = no limit).
login-block-time                 Time for which a user is blocked from logging in after too many failed login attempts (0 - 86400 sec, default = 60).
login-timeout                    SSLVPN maximum login timeout (10 - 180 sec, default = 30).
dtls-hello-timeout               SSLVPN maximum DTLS hello timeout (10 - 60 sec, default = 10).
tunnel-ip-pools                  Names of the IPv4 IP Pool firewall objects that define the IP addresses reserved for remote clients.
tunnel-ipv6-pools                Names of the IPv6 IP Pool firewall objects that define the IP addresses reserved for remote clients.
dns-suffix                       DNS suffix used for SSL VPN clients.
dns-server1                      DNS server 1.
dns-server2                      DNS server 2.
wins-server1                     WINS server 1.
wins-server2                     WINS server 2.
ipv6-dns-server1                 IPv6 DNS server 1.
ipv6-dns-server2                 IPv6 DNS server 2.
ipv6-wins-server1                IPv6 WINS server 1.
ipv6-wins-server2                IPv6 WINS server 2.
url-obscuration                  Enable/disable to obscure the host name of the URL of the web browser display.
http-compression                 Enable/disable to allow HTTP compression over SSL VPN tunnels.
http-only-cookie                 Enable/disable SSL VPN support for HttpOnly cookies.
port                             SSL VPN access port (1 - 65535).
port-precedence                  Enable/disable, Enable means that if SSL VPN connections are allowed on an interface admin GUI connections are blocked on that interface.
auto-tunnel-static-route         Enable/disable to auto-create static routes for the SSL VPN tunnel IP addresses.
header-x-forwarded-for           Forward the same, add, or remove HTTP header.
source-interface                 SSL VPN source interface of incoming traffic.
source-address                   Source address of incoming traffic.
source-address-negate            Enable/disable negated source address match.
source-address6                  IPv6 source address of incoming traffic.
source-address6-negate           Enable/disable negated source IPv6 address match.
default-portal                   Default SSL VPN portal.
dtls-tunnel                      Enable/disable DTLS to prevent eavesdropping, tampering, or message forgery.
dtls-max-proto-ver               DTLS maximum protocol version.
dtls-min-proto-ver               DTLS minimum protocol version.
check-referer                    Enable/disable verification of referer field in HTTP request header.
http-request-header-timeout      SSL VPN session is disconnected if an HTTP request header is not received within this time (1 - 60 sec, default = 20).
http-request-body-timeout        SSL VPN session is disconnected if an HTTP request body is not received within this time (1 - 60 sec, default = 20).
auth-session-check-source-ip     Enable/disable checking of source IP for authentication session.
tunnel-connect-without-reauth    Enable/disable tunnel connection without re-authorization if previous connection dropped.
hsts-include-subdomains          Add HSTS includeSubDomains response header.
transform-backward-slashes       Transform backward slashes to forward slashes in URLs.
encode-2f-sequence               Encode \2F sequence to forward slash in URLs.
encrypt-and-store-password       Encrypt and store user passwords for SSL VPN web sessions.

SSL-VPN 設定の削除について

SSL-VPN 設定の削除は CLI でのみ実施できます。方法としては config vpn ssl settings の各項目を unset でデフォルト設定に戻します。

SSL-VPN ユーザ及びグループの作成

SSL-VPN 接続時に使用するユーザ及びグループを作成します。

GUI で設定する場合

■ユーザの作成

[ユーザ & 認証] → [ユーザ定義] → [新規作成] と選択します。

以下の設定ウィザードが表示されます。ユーザタイプは [ローカルユーザ] として [次へ] をクリックします。

以下画面ではユーザ名とパスワードを設定し [次へ] をクリックします。

以下画面では二要素認証を設定できますが、一旦は二要素認証は OFF のまま [次へ] をクリックします。

以下画面では、ユーザアカウントステータスが [有効化済み] であることを確認します。ユーザグループについては一旦 OFF のままとします。確認できたら [サブミット] をクリックします。

ユーザが作成されたことを確認します。

■ユーザグループの作成

[ユーザ & 認証] → [ユーザグループ] → [新規作成] と選択します。

以下画面が表示されるため、各項目を設定します。

  • 名前:グループ名
  • タイプ:ファイアウォール
  • メンバー:あらかじめ作成した SSL-VPN 用ユーザを指定

設定できたら [OK] をクリックします。

グループが作成されたことを確認します。

CLI で設定する場合

■ユーザの作成

CLI で設定する場合は、config user local にて設定します。

前項の GUI での設定例の通り設定する場合の投入コンフィグは以下の通りです。

config user local
    edit "sslvpnuser"
        set status enable
        set type password
        set passwd "パスワード文字列"
    next
end

設定後のコンフィグは以下の通りです。パスワードは暗号化表示されます。

FW (local) # show
config user local
    edit "sslvpnuser"
        set type password
        set passwd-time yyyy-mm-dd hh:mm:ss
        set passwd ENC OddfBikpknf5Ii6kslIH4g/LsNNBosTw+Vk9nyll6habJRUsi07UpT8dMWPmCRjUMvk0R7jzFlgTdALgRnjhn70ciaWW3veWELdVT/riv506Lf1HJxRFiKsqMJFW/6sjSluN8e7YrS+E67JMK7USRGJBMLgcRQF3lwOR8vzvQLneb4shnc/2z/6jo78mObig5BnzTQ==
    next
end

FW (local) # show full-configuration
config user local
    edit "sslvpnuser"
        set status enable
        set type password
        set two-factor disable
        set email-to ''
        set sms-server fortiguard
        set sms-phone ''
        set passwd-policy ''
        set passwd-time yyyy-mm-dd hh:mm:ss
        set authtimeout 0
        set auth-concurrent-override disable
        set ppk-secret ENC FY9nxcSk0iM4D5BRx9/Wbg5aGuweSyrMiZobJOjLtmUDO2J1Q7lUtdkiW5snKLimJbaW0d94UqfCxoYhymH+hr0Stg/DjJKqiqQ4pMw2SSipfDYdyQMG3KPUXHJl36m+K0rtm9jBuhAraT9C/u2lRzIwiRL1/hgPY49TZfSxpU5MhzfdqZUnARoHDj6z1HBbUoPdpA==
        set ppk-identity ''
        set passwd ENC OddfBikpknf5Ii6kslIH4g/LsNNBosTw+Vk9nyll6habJRUsi07UpT8dMWPmCRjUMvk0R7jzFlgTdALgRnjhn70ciaWW3veWELdVT/riv506Lf1HJxRFiKsqMJFW/6sjSluN8e7YrS+E67JMK7USRGJBMLgcRQF3lwOR8vzvQLneb4shnc/2z/6jo78mObig5BnzTQ==
    next
end

設定項目のヘルプは以下の通りです。

*status                      Enable/disable allowing the local user to authenticate with the FortiGate unit.
*type                        Authentication method.
*passwd                      User's password.
two-factor                  Enable/disable two-factor authentication.
email-to                    Two-factor recipient's email address.
sms-server                  Send SMS through FortiGuard or other external server.
sms-phone                   Two-factor recipient's mobile phone number.
passwd-policy               Password policy to apply to this user, as defined in config user password-policy.
passwd-time                 Time of the last password update.
authtimeout                 Time in minutes before the authentication timeout for a user is reached.
auth-concurrent-override    Enable/disable overriding the policy-auth-concurrent under config system global.
ppk-secret                  IKEv2 Postquantum Preshared Key (ASCII string or hexadecimal encoded with a leading 0x).
ppk-identity                IKEv2 Postquantum Preshared Key Identity.

■ユーザグループの作成

CLI で設定する場合は、config user group にて設定します。

前項の GUI での設定例の通り設定する場合の投入コンフィグは以下の通りです。

config user group
    edit "SSL-VPN-Group"
        set group-type firewall
        set member "sslvpnuser"
    next
end

設定後のコンフィグは以下の通りです。パスワードは暗号化表示されます。

FW (group) # show
config user group
    edit "SSL-VPN-Group"
        set member "sslvpnuser"
    next
end

FW (group) # show full-configuration
config user group
    edit "SSL-VPN-Group"
        set group-type firewall
        set authtimeout 0
        set auth-concurrent-override disable
        set http-digest-realm ''
        set member "sslvpnuser"
    next
end

設定項目のヘルプは以下の通りです。

group-type                  Set the group to be for firewall authentication, FSSO, RSSO, or guest users.
authtimeout                 Authentication timeout in minutes for this user group. 0 to use the global user setting auth-timeout.
auth-concurrent-override    Enable/disable overriding the global number of concurrent authentication sessions for this user group.
http-digest-realm           Realm attribute for MD5-digest authentication.
member                      Names of users, peers, LDAP severs, or RADIUS servers to add to the user group.

ポリシー設定

SSL-VPN トンネルからの通信を許可するポリシーを設定します。

GUI で設定する場合

GUI で SSL-VPN 設定画面で [適用] をクリックした後、SSL-VPN 設定画面にて以下画像の赤枠部分の表示がされるため、そこをクリックします。

新規ポリシー作成画面となるため、各項目を設定します。以下画像では手動で設定変更した箇所に赤枠を付けています。

  • [送信元] には対象のアドレスオブジェクトと SSL-VPN 用に作成したユーザグループを指定します

ポリシー設定後はポリシー画面でポリシーが追加されていることを確認します。

CLI で設定する場合

CLI で設定する場合は、config firewall policy にて設定します。

前項の GUI での設定例の通り設定する場合の投入コンフィグは以下の通りです。

config firewall policy
    edit "任意の空き番号"
        set name "SSL-VPN_to_Internal2"
        set srcintf "ssl.root"
        set dstintf "internal2"
        set srcaddr "all"
        set dstaddr "all"
        set action accept
        set schedule "always"
        set service "ALL"
        set groups "SSL-VPN-Group"
    next
end

※ポリシーの設定方法について詳しくは以下の記事を参照してください。
 - FortiGate のポリシー設定についての基礎知識(v6.0.6)

クライアント側の準備と接続

FortiClient のインストール

クライアント側では Fortinet 社が提供している VPN クライアントソフトである FortiClient をインストールして使用します。

インストーラは以下のページからダウンロードできます。

FortiClient Fabric Agent for Endpoint Security | Fortinet
FortiClient Fabric Agent integrates endpoints into the Security Fabric and provides endpoint telemetry, including user identity, protection status, risk scores,...

Windows 用のインストーラをダウンロードする場合は以下画像の赤枠の部分をクリックします。

ダウンロードしたインストーラをクライアントにて実行してインストールします。

インストーラの流れは以下の通りです。

FortiClient の設定

インストールが完了したら FortiClient を起動します。[VPN設定] をクリックします。

新規VPN接続の設定をします。

  • VPN:SSL-VPN を選択
  • 接続名:任意の接続名を入力
  • リモートGW:FortiGate の IP アドレスを入力
  • ポートの編集:FortiGate の待ち受けポート番号を入力

設定できたら [保存] をクリックします。

SSL-VPN 接続の実施

以下の画面になるため、FortiGate で設定した SSL-VPN 用のユーザ情報を入力し [接続] をクリックします。

以下の画面が表示されたら [はい] をクリックします。

接続に成功すると以下の画面となります。

クライアントで ipconfig を確認します。

トンネルインターフェースが作成されてネットワーク情報を取得できていることが分かります。

SSL-VPN 確認コマンド

接続リストの表示

  • get vpn status ssl list
  • diagnose vpn ssl list
FW # get vpn status ssl list
[1994:root]sconn=0x55072400, from(192.168.1.1) task=tunnel_loop, fd=13(1:1),37(1:1),-1(0:0),-1(0:0),-1(0:0), pending=0, asic_pending=0.

FW # diagnose vpn ssl list
[1994:root]sconn=0x55072400, from(192.168.1.1) task=tunnel_loop, fd=13(1:1),37(1:1),-1(0:0),-1(0:0),-1(0:0), pending=0, asic_pending=0.

セッション情報の表示

  • get vpn ssl monitor
FW # get vpn ssl monitor
SSL VPN Login Users:
 Index   User    Group   Auth Type      Timeout         From     HTTP in/out    HTTPS in/out
 0       sslvpnuser      SSL-VPN-Group  1(1)             284     192.168.1.1    0/0     0/0

SSL VPN sessions:
 Index   User    Group   Source IP      Duration        I/O Bytes       Tunnel/Dest IP
 0       sslvpnuser       SSL-VPN-Group 192.168.1.1      1577    427994/133485  10.212.134.200

統計情報の表示

  • diagnose vpn ssl statistics
FW # diagnose vpn ssl statistics
SSLVPN statistics (root):
------------------
Memory unit:               1
System total memory:       1957044224
System free memory:        1272901632
SSLVPN memory margin:      195704422
SSLVPN state:              normal

Max number of users:       1
Max number of tunnels:     1
Max number of connections: 2

Current number of users:       1
Current number of tunnels:     1
Current number of connections: 1

設定の表示

  • get vpn ssl settings
FW # get vpn ssl settings
reqclientcert       : disable
ssl-max-proto-ver   : tls1-3
ssl-min-proto-ver   : tls1-2
banned-cipher       :
ssl-insert-empty-fragment: enable
https-redirect      : disable
x-content-type-options: enable
ssl-client-renegotiation: disable
force-two-factor-auth: disable
servercert          : Fortinet_Factory
algorithm           : high
idle-timeout        : 300
auth-timeout        : 28800
login-attempt-limit : 2
login-block-time    : 60
login-timeout       : 30
dtls-hello-timeout  : 10
tunnel-ip-pools     : "SSLVPN_TUNNEL_ADDR1"
tunnel-ipv6-pools   : "SSLVPN_TUNNEL_IPv6_ADDR1"
dns-suffix          :
dns-server1         : 0.0.0.0
dns-server2         : 0.0.0.0
wins-server1        : 0.0.0.0
wins-server2        : 0.0.0.0
ipv6-dns-server1    : ::
ipv6-dns-server2    : ::
ipv6-wins-server1   : ::
ipv6-wins-server2   : ::
url-obscuration     : disable
http-compression    : disable
http-only-cookie    : enable
port                : 11443
port-precedence     : enable
auto-tunnel-static-route: enable
header-x-forwarded-for: add
source-interface    : "internal1"
source-address      : "all"
source-address-negate: disable
source-address6     : "all"
source-address6-negate: disable
default-portal      : tunnel-access
authentication-rule:
dtls-tunnel         : enable
check-referer       : disable
http-request-header-timeout: 20
http-request-body-timeout: 30
auth-session-check-source-ip: enable
tunnel-connect-without-reauth: disable
hsts-include-subdomains: disable
transform-backward-slashes: disable
encode-2f-sequence  : disable
encrypt-and-store-password: disable
dtls-max-proto-ver  : dtls1-2
dtls-min-proto-ver  : dtls1-0

その他コマンド一覧

FW # get vpn status ssl
hw-acceleration-status    SSL hardware acceleration status.
list                      List current connections.

FW # get vpn ssl
monitor     SSL VPN session.
settings    Configure SSL VPN.
web         web

FW # diagnose vpn ssl
list                      List current connections.
mux                       Show mux information.
mux-stat                  Show mux statistics.
statistics                SSL VPN statistics
hw-acceleration-status    SSL hardware acceleration status.
tunnel-test               Enable/disable SSL VPN old tunnel mode IP allocation method.
web-mode-test             Enable/disable random session ID in proxy URL for testing.
info                      SSL VPN information
debug-filter              SSL-VPN debug message filter.

ユーザの二要素認証によるセキュリティ強化

SSL-VPN で使用するユーザに対して二要素認証を設定することでセキュリティを強化することができます。詳しくは以下の記事を参照してください。

参考資料

SSL VPN | Administration Guide
FortiGateでリモートアクセス設定 SSL-VPN編(初級者向け)|技術ブログ|C&S ENGINEER VOICE
C&S Engineer Voiceは、技術者向けの最新技術情報発信ポータルサイトです。FortiGateでリモートアクセス設定 SSL-VPN編(初級者向け)です。

―――――――――――――

タイトルとURLをコピーしました