VPN Serverを立ち上げているEC2でAWSエンドポイントへの接続失敗
Posted: Fri Nov 27, 2020 6:12 am
vpnserverを立ち上げているEC2インスタンスにてAWS CLIを使用すると一部のサービスで
AWSエンドポイントへの接続が失敗します。(Connection refused)
HTTPSへの接続で証明書がamazonのRoot証明書ではなくsoftetherの証明書が選択されることが原因と思われますが
対処の仕方がわかりません。
どなたかご教示頂けますと幸いです。
Softetherで証明書を固定するようなオプション、仕様があるのか、
ユーザアプリで使用する証明書を固定をしているのかがわかりません。
これをamazonの証明書で接続するようにしたいのですが可能でしょうか。
また、その場合既存のvpnserver側(VPNクライアントからの接続)へは影響がでないでしょうか。
下記にCurlの実行結果と使用環境などのテンプレート回答を貼付致します。
Curl結果の
* Server certificate:
* subject: C=US,OU=vpn497981003.softether.net,O=vpn497981003.softether.net,CN=vpn497981003.softether.net
の部分が問題だと考えております。
~]# cat /etc/pki/tls/certs/ca-bundle.crt|grep -i amazon
# Amazon Root CA 1
# Amazon Root CA 2
# Amazon Root CA 3
# Amazon Root CA 4
~]# curl --cacert /etc/pki/tls/certs/ca-bundle.crt -v https://email.ap-northeast-1.amazonaws.com/
* About to connect() to email.ap-northeast-1.amazonaws.com port 443 (#0)
* Trying 54.199.216.130...
* Connected to email.ap-northeast-1.amazonaws.com (54.199.216.130) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* Server certificate:
* subject: C=US,OU=vpn497981003.softether.net,O=vpn497981003.softether.net,CN=vpn497981003.softether.net
* start date: Dec 07 11:52:49 2017 GMT
* expire date: Dec 31 11:52:49 2037 GMT
* common name: vpn497981003.softether.net
* issuer: C=US,OU=vpn497981003.softether.net,O=vpn497981003.softether.net,CN=vpn497981003.softether.net
* NSS error -8101 (SEC_ERROR_INADEQUATE_CERT_TYPE)
* Certificate type not approved for application.
* Closing connection 0
curl: (60) Certificate type not approved for application.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
以下にテンプレートを記載致します。
1. オペレーティングシステムの名前および CPU ビット
CentOS 7..7 x64
2. "ifconfig -a" (UNIX) または "ipconfig /all" (Windows) の結果
$ ifconfig -a
eth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
inet 172.31.30.31 netmask 255.255.240.0 broadcast 172.31.31.255
inet6 fe80::c1b:acff:fe36:970e prefixlen 64 scopeid 0x20<link>
ether 0e:1b:ac:36:97:0e txqueuelen 1000 (Ethernet)
RX packets 805629 bytes 117106089 (111.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 855038 bytes 83185447 (79.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 348535 bytes 202600246 (193.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 348535 bytes 202600246 (193.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo:0: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 54.199.183.104 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
tap_vpn: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.200.0.2 netmask 255.255.0.0 broadcast 10.200.255.255
inet6 fe80::2ac:a2ff:fe79:fafd prefixlen 64 scopeid 0x20<link>
ether 00:ac:a2:79:fa:fd txqueuelen 1000 (Ethernet)
RX packets 58880 bytes 4077702 (3.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48636 bytes 4026844 (3.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
3. "uname -a" (UNIX) または "systeminfo" (Windows) の結果
$ uname -a
Linux ip-172-31-30-31.ap-northeast-1.compute.internal 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
4. SoftEther VPN のビルド番号
Ver 4.24, Build 9651
5. どの SoftEther VPN のコンポーネントを使用していますか?
すみません。わかりません。
6. VPN サーバーとインターネットとの間に NAT やファイアウォールデバイスはありますか?
(もし NAT またはファイアウォールがある場合、VPN サーバーの TCP リスナポートに対して TCP ポートを開く必要があります。)
AWS EC2なのでSGがありますが今回はping、curlが届いているので問題ないと思われます。
7. SecureNAT 機能を使用していますか?
すみません。わかりません
8. 現在の vpn_server.config または vpn_bridge.config ファイルの内容を投稿に添付してください。
vpn_server.config を一部マスキングして添付いたします。
AWSエンドポイントへの接続が失敗します。(Connection refused)
HTTPSへの接続で証明書がamazonのRoot証明書ではなくsoftetherの証明書が選択されることが原因と思われますが
対処の仕方がわかりません。
どなたかご教示頂けますと幸いです。
Softetherで証明書を固定するようなオプション、仕様があるのか、
ユーザアプリで使用する証明書を固定をしているのかがわかりません。
これをamazonの証明書で接続するようにしたいのですが可能でしょうか。
また、その場合既存のvpnserver側(VPNクライアントからの接続)へは影響がでないでしょうか。
下記にCurlの実行結果と使用環境などのテンプレート回答を貼付致します。
Curl結果の
* Server certificate:
* subject: C=US,OU=vpn497981003.softether.net,O=vpn497981003.softether.net,CN=vpn497981003.softether.net
の部分が問題だと考えております。
~]# cat /etc/pki/tls/certs/ca-bundle.crt|grep -i amazon
# Amazon Root CA 1
# Amazon Root CA 2
# Amazon Root CA 3
# Amazon Root CA 4
~]# curl --cacert /etc/pki/tls/certs/ca-bundle.crt -v https://email.ap-northeast-1.amazonaws.com/
* About to connect() to email.ap-northeast-1.amazonaws.com port 443 (#0)
* Trying 54.199.216.130...
* Connected to email.ap-northeast-1.amazonaws.com (54.199.216.130) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* Server certificate:
* subject: C=US,OU=vpn497981003.softether.net,O=vpn497981003.softether.net,CN=vpn497981003.softether.net
* start date: Dec 07 11:52:49 2017 GMT
* expire date: Dec 31 11:52:49 2037 GMT
* common name: vpn497981003.softether.net
* issuer: C=US,OU=vpn497981003.softether.net,O=vpn497981003.softether.net,CN=vpn497981003.softether.net
* NSS error -8101 (SEC_ERROR_INADEQUATE_CERT_TYPE)
* Certificate type not approved for application.
* Closing connection 0
curl: (60) Certificate type not approved for application.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
以下にテンプレートを記載致します。
1. オペレーティングシステムの名前および CPU ビット
CentOS 7..7 x64
2. "ifconfig -a" (UNIX) または "ipconfig /all" (Windows) の結果
$ ifconfig -a
eth0: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
inet 172.31.30.31 netmask 255.255.240.0 broadcast 172.31.31.255
inet6 fe80::c1b:acff:fe36:970e prefixlen 64 scopeid 0x20<link>
ether 0e:1b:ac:36:97:0e txqueuelen 1000 (Ethernet)
RX packets 805629 bytes 117106089 (111.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 855038 bytes 83185447 (79.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 348535 bytes 202600246 (193.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 348535 bytes 202600246 (193.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo:0: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 54.199.183.104 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
tap_vpn: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.200.0.2 netmask 255.255.0.0 broadcast 10.200.255.255
inet6 fe80::2ac:a2ff:fe79:fafd prefixlen 64 scopeid 0x20<link>
ether 00:ac:a2:79:fa:fd txqueuelen 1000 (Ethernet)
RX packets 58880 bytes 4077702 (3.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 48636 bytes 4026844 (3.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
3. "uname -a" (UNIX) または "systeminfo" (Windows) の結果
$ uname -a
Linux ip-172-31-30-31.ap-northeast-1.compute.internal 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
4. SoftEther VPN のビルド番号
Ver 4.24, Build 9651
5. どの SoftEther VPN のコンポーネントを使用していますか?
すみません。わかりません。
6. VPN サーバーとインターネットとの間に NAT やファイアウォールデバイスはありますか?
(もし NAT またはファイアウォールがある場合、VPN サーバーの TCP リスナポートに対して TCP ポートを開く必要があります。)
AWS EC2なのでSGがありますが今回はping、curlが届いているので問題ないと思われます。
7. SecureNAT 機能を使用していますか?
すみません。わかりません
8. 現在の vpn_server.config または vpn_bridge.config ファイルの内容を投稿に添付してください。
vpn_server.config を一部マスキングして添付いたします。