1. はじめに
Client VPN for VPCの概要や接続方法については、こちらの記事が参考になる。本稿では、落ち葉拾い的に、Client VPN for VPC利用時の接続中ユーザーを確認する方法について紹介したいと思う。
2. Customer Portalからの確認方法
Client VPN for VPCにおける認証方式は、
- クライアント証明書
- UserID/passcode
- クライアント証明書とUserID/passcodeを両方使用(「どちらかで接続できる」という意味ではない)
のいずれかから選択できる。Customer Portalからも接続中ユーザーを確認することはできるのだが、残念ながらUser ID
のフィールドしかないため、クライアント証明書
を利用した接続では、誰が接続しているかわからない(注:将来的に改善される方向性にはあるようです)。
切断されたクライアントは1時間後に自動的にこのテーブルから削除されるようです。
https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-client-to-site-connections&interface=ui
The disconnected VPN client is automatically deleted after one hour.
3. CLIからの確認方法
CLIであれば、UserIDだけでなく、クライアント証明書のCN(Common Name)
を表示する機能があるため、当面はこちらの方が役立ちそうである。
VPNサーバーの特定
# ibmcloud is vpn-servers
Listing VPN servers in all resource groups and region jp-tok under account xxx as user xxxxxxx@xx.xxx.com...
ID Name Status Protocol Host name Port Subnets Resource group
r022-35f58c82-814b-4005-a1a4-b4d882af39e3 syasuda-vpn stable udp xxxxxxxxxxxx.xx-xxx.vpn-server.appdomain.cloud 443 sub-172-16-0-0-24 Default
対象のVPNサーバーに接続中のクライアントを出力
# ibmcloud is vpn-server-clients r022-35f58c82-814b-4005-a1a4-b4d882af39e3
Listing clients of VPN server r022-35f58c82-814b-4005-a1a4-b4d882af39e3 under account xxx as user xxxxxxx@xx.xxx.com...
ID Common name User name Status Client IP Remote IP Remote port Created
b1ff973b-38bb-4750-a014-b1e2542fa333 Taro-Yamada - connected 192.168.252.2 118.x.xx.xxx 59899 2021-09-01T08:33:20+09:00