このチュートリアルでは、CentOS 8にOpenVPNをインストールする方法を紹介します。知らない人のために、OpenVPNは、作成に通常広く使用されているオープンソースアプリケーションです。安全でないオープンパブリックインターネットを介した安全なデジタルプライベートネットワークOpenVPNは、インターネットを介してシステム関係を安全に排出するSSL VPNソリューションです。クライアントサーバー構造のOpenVPN機能。仮想専用ネットワークに接続されたすべての特定のデバイスは、あたかもそれらのように機能します'ローカルエリアネットワークに接続されています。VPNトンネルを介して送信される特定のパケットは256ビットのAES暗号化で暗号化されているため、データの盗難は不可能です。
この記事は、少なくともLinuxの基本的な知識があり、シェルの使用方法を知っていること、そして最も重要なこととして、サイトを独自のVPSでホストしていることを前提としています。インストールは非常に簡単で、ルートアカウントで実行されていますが、そうでない場合は、'sudo
を追加する必要があります。 ルート権限を取得するコマンドに‘。 CentOS8にOpenVPNサーバーを段階的にインストールする方法を紹介します。
前提条件
- 次のオペレーティングシステムのいずれかを実行しているサーバー:CentOS8。
- 潜在的な問題を防ぐために、OSの新規インストールを使用することをお勧めします。
non-root sudo user
またはroot user
へのアクセス 。non-root sudo user
として行動することをお勧めします ただし、ルートとして機能するときに注意しないと、システムに害を及ぼす可能性があるためです。
CentOS8にOpenVPNをインストールする
ステップ1.まず、システムが最新であることを確認することから始めましょう。
sudo dnf clean all sudo dnf update
ステップ2.CentOS8にOpenVPNをインストールします。
これで、GitHubからスクリプト自動インストールOpenVPNをダウンロードします:
git clone https://github.com/Nyr/openvpn-install.git
次に、openvpn-install
に切り替えます ディレクトリを作成し、インストーラスクリプトを実行します:
chmod +x openvpn-install.sh sudo ./openvpn-install.sh
次の出力が得られるはずです:
Welcome to this OpenVPN "road warrior" installer! I need to ask you a few questions before starting the setup. You can leave the default options and just press enter if you are ok with them. First, provide the IPv4 address of the network interface you want OpenVPN listening to. IP address: 192.168.77.20 This server is behind NAT. What is the public IPv4 address or hostname? Public IP address / hostname: vpn.idroot.us Which protocol do you want for OpenVPN connections? 1) UDP (recommended) 2) TCP Protocol [1-2]: 1 What port do you want OpenVPN listening to? Port: 148 Which DNS do you want to use with the VPN? 1) Current system resolvers 2) 1.1.1.1 3) Google 4) OpenDNS 5) Verisign DNS [1-5]: 3 Finally, tell me your name for the client certificate. Please, use one word only, no special characters. Client name: godetz Okay, that was all I needed. We are ready to set up your OpenVPN server now. Press any key to continue… Updating Subscription Management repositories. Updating Subscription Management repositories. Extra Packages for Enterprise Linux 8 - x86_64 189 kB/s | 16 MB 01:24 Last metadata expiration check: 0:00:40 ago on Wed 16 Dec 2019 09:36:46 PM EAT. Package epel-release-7-11.noarch is already installed. Dependencies resolved. Nothing to do. Complete!
メインのOpenVPNサーバー構成ファイルは/etc/openvpn/server.conf
です。 お好みに合わせて自由に調整できます:
$ cat /etc/openvpn/server.conf port 148 proto udp dev tun sndbuf 0 rcvbuf 0 ca ca.crt cert server.crt key server.key dh dh.pem auth SHA512 tls-auth ta.key 0 topology subnet server 10.8.0.0 255.255.255.0 ifconfig-pool-persist ipp.txt push "redirect-gateway def1 bypass-dhcp" push "dhcp-option DNS 192.168.22.1" keepalive 30 120 cipher AES-256-CBC user nobody group nobody persist-key persist-tun status openvpn-status.log verb 3 crl-verify crl.pem>
ステップ3.OpenVPNユーザープロファイルを生成します。
次に、次のコマンドを使用してクライアント証明書とキーを生成します。
$ sudo ./openvpn-install.sh Looks like OpenVPN is already installed. What do you want to do? 1) Add a new user 2) Revoke an existing user 3) Remove OpenVPN 4) Exit Select an option [1-4]: 1 Tell me a name for the client certificate. Please, use one word only, no special characters. Client name: meilana Using SSL: openssl OpenSSL 1.1.1 FIPS 11 Sep 2018 Can't load /etc/openvpn/easy-rsa/pki/.rnd into RNG 139966006863680:error:2406F079:random number generator:RAND_load_file:Cannot open file:crypto/rand/randfile.c:90:Filename=/etc/openvpn/easy-rsa/pki/.rnd Generating a RSA private key ……………………………………………………………………..+++++ ……………………………………….+++++ writing new private key to '/etc/openvpn/easy-rsa/pki/private/meilana.key.SmeichedelicsaH' Using configuration from /etc/openvpn/easy-rsa/pki/safessl-easyrsa.cnf Can't load /etc/openvpn/easy-rsa/pki/.rnd into RNG 13982808174100232:error:2406F079:random number generator:RAND_load_file:Cannot open file:crypto/rand/randfile.c:90:Filename=/etc/openvpn/easy-rsa/pki/.rnd Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows commonName :ASN.1 12:'meilana' Certificate is to be certified until Dec 10 16:36:46 2026 GMT (3650 days) Write out database with 1 new entries Data Base Updated Client user1 added, configuration is available at: /root/meilana.ovpnで入手できます。
.ovpn
OpenVPNプロファイルファイルは/root
内に配置されます フォルダ。
ステップ4.クライアントからOpenVPNサーバーに接続します。
選択に関連付けられたVPNクライアントを使用して、オペレーティングシステムでOpenVPNクライアントを構成できます。公式OpenVPNクライアントを使用したいすべての人は、ダウンロードWebページにアクセスしてその後の最新リリースをインストールします。
おめでとうございます!OpenVPNが正常にインストールされました。CentOS8システムにOpenVPNサーバーをインストールするためにこのチュートリアルを使用していただきありがとうございます。追加のヘルプや役立つ情報については、OpenVPNの公式Webサイトを確認することをお勧めします。