SoftEther VPN サーバの IPsec 事前共有鍵 (pre-shared key) をコマンド操作で変更する方法

前書き

ソフトイーサによると、2021 年 8 月 15 日に大規模なブルートフォース攻撃が日本で観測されたという。詳細は以下のリンクから確認してほしい。

2021/08/16 日本の広範囲のグローバル IP の IPsec VPN 装置宛へのサイバー攻撃の注意喚起と「SoftEther VPN」/「PacketiX VPN」への影響を防ぐための設定の確認のお願い・新ビルドのお知らせ

要点の 1 つは、IPsec の事前共有鍵に vpn を指定している場合、非推奨のため変更することが説明されている。

本投稿では、それをコマンド操作でどうやるのか?についての方法である。

事前共有鍵 (pre-shared key) をコマンド操作で変更する

[1] vpncmd コマンドで VPN サーバーに管理接続する

$ cd /usr/local/vpnserver
$ sudo ./vpncmd
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.34 Build 9745   (English)
Compiled 2020/04/05 23:39:56 by buildsan at crosswin
Copyright (c) SoftEther VPN Project. All Rights Reserved.

By using vpncmd program, the following can be achieved. 

1. Management of VPN Server or VPN Bridge 
2. Management of VPN Client
3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool)

Select 1, 2 or 3: 1

Specify the host name or IP address of the computer that the destination VPN Server or VPN Bridge is operating on. 
By specifying according to the format 'host name:port number', you can also specify the port number. 
(When the port number is unspecified, 443 is used.)
If nothing is input and the Enter key is pressed, the connection will be made to the port number 8888 of localhost (this computer).
Hostname of IP Address of Destination: 

If connecting to the server by Virtual Hub Admin Mode, please input the Virtual Hub name. 
If connecting by server admin mode, please press Enter without inputting anything.
Specify Virtual Hub Name: 
Password: ********

Connection has been established with VPN Server "localhost" (port 443).

You have administrator privileges for the entire VPN Server.

VPN Server>

[2] 現状の事前共有鍵を確認する

IPsecGet コマンドを使うと事前共有鍵を含む設定を確認することができる。

VPN Server>ipsecget
IPsecGet command - Get the Current IPsec VPN Server Settings
Item                                               |Value
---------------------------------------------------+-----------
L2TP over IPsec Server Function Enabled            |Yes
Raw L2TP Server Function Enabled                   |No
EtherIP / L2TPv3 over IPsec Server Function Enabled|No
IPsec Pre-Shared Key String                        |hogekey
Name of Default Virtual Hub                        |hogehoge-vhub
The command completed successfully.

VPN Server>

事前共有鍵を忘れてしまって VPN 接続できなくなってしまった時、この IPsecGet コマンドで確認すれば良いことがわかる。

[3] 事前共有鍵を変更する

以下のように IPsecEnable コマンドを実行し、対話的に入力するのが簡単だ。事前共有鍵だけを変更することはできないので、以下のように変更する箇所のみ変更し、それ以外は現状のままとなるように入力してやれば良い。

VPN Server>ipsecenable
IPsecEnable command - Enable or Disable IPsec VPN Server Function
Enable L2TP over IPsec Server Function (yes / no): yes

Enable Raw L2TP Server Function (yes / no): no

Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no): no

Pre Shared Key for IPsec (Recommended: 9 letters at maximum): hogekey2

Default Virtual HUB in a case of omitting the HUB on the Username: hogehoge-vhub

The command completed successfully.

VPN Server>exit
$

VPN 接続した状態で事前共有鍵を変更しても、その VPN セッションが切れることはない。

しかし、その VPN セッションを終了すると、次に VPN 接続するときには新しい事前共有鍵を使用して VPN 接続する必要がある。(当たり前ですが)

事前共有鍵を変えた後に確認すること

[1] それまでに使用していた L2TP/IPsec の設定では VPN サーバーに接続できないことを確認する。

[2] 変更した事前共有鍵を使った L2TP/IPsec の設定を使って、VPN サーバーに接続できることを確認する。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください