openVPN設定 №1
今回はopenVPNについて書きたいと思います。
書く内容が多いので、何回か区切りさせて頂きます。
自宅内のネットワークに接続が出来たらと思って構築してみました。
VPNサーバを構築することにあたり “Sakura Ineternet VPS" で使用します。
また、今回は自宅内にあるSambaサーバに接続ができるように設定を行っていきます。
【最初に】
今回の設定は、インターネット上で調べてから構築を行い実行を行っています。
参考させて頂いた文献については、最後の"参考文献"としてご紹介させて頂きます。
構築が出来たことに本当に感謝です。
【設定環境】
・VPNサーバ[SakuraVPS]OS:centOS 6.4
【設定方法】
※1 root権限で作業作業をしていきます。
※2 “rpmforge" リポジトリ を追加していることを前提にしています。
1. “openvpn" をインストールする。
[user@localhost] yum install --enablerepo=rpmforge -y install openvpn
2. SSL/TSLの認証手続きを行うため、"easy-rsa" を使用します。
“openvpn" のサイトよりファイルをダウンロードします。
自分が解りやすい指定のディレクトリ先に保存を行ってください。
[user@localhost] wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.6.tar.gz
3. “openvpn-2.3.6.tar.gz" を解凍し、解凍したディレクトリ内にある"easy-rsa" を “/etc/openvpn/" にコピーします。
[user@localhost] tar -zxvf openvpn-2.3.6.tar.gz : : 解凍中 : : [user@localhost] [user@localhost] cp -fr openvpn-2.3.6/easy-rsa/2.0 /etc/openvpn/easy-rsa
4. 認証局(CA) を基本情報を編集して保存する。
[user@localhost] vi /etc/openvpn/easy-rsa/vars
[ファイル内容]
# easy-rsa parameter settings # NOTE: If you installed from an RPM, # don't edit this file in place in # /usr/share/openvpn/easy-rsa -- # instead, you should copy the whole # easy-rsa directory to another location # (such as /etc/openvpn) so that your # edits will not be wiped out by a future # OpenVPN package upgrade. # This variable should point to # the top level of the easy-rsa # tree. export EASY_RSA="`pwd`" # # This variable should point to # the requested executables # export OPENSSL="openssl" export PKCS11TOOL="pkcs11-tool" export GREP="grep" # This variable should point to # the openssl.cnf file included # with easy-rsa. export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA` # Edit this variable to point to # your soon-to-be-created key # directory. # # WARNING: clean-all will do # a rm -rf on this directory # so make sure you define # it correctly! export KEY_DIR="$EASY_RSA/keys" # Issue rm -rf warning echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR # PKCS11 fixes export PKCS11_MODULE_PATH="dummy" export PKCS11_PIN="dummy" # Increase this to 2048 if you # are paranoid. This will slow # down TLS negotiation performance # as well as the one-time DH parms # generation process. export KEY_SIZE=1024 # In how many days should the root CA key expire? export CA_EXPIRE=3650 # In how many days should certificates expire? export KEY_EXPIRE=3650 # These are the default values for fields # which will be placed in the certificate. # Don't leave any of these fields blank. #---[↓↓コメント化↓↓]--- #export KEY_COUNTRY="US" #export KEY_PROVINCE="CA" #export KEY_CITY="SanFrancisco" #export KEY_ORG="Fort-Funston" #export KEY_EMAIL="me@myhost.mydomain" #export KEY_EMAIL=mail@host.domain #---[↑↑コメント化↑↑]--- #---[↓↓追加↓↓]--- export KEY_COUNTRY="JP" # 国:日本 export KEY_PROVINCE="Tokyo" # 都道府県:東京 export KEY_CITY="Hachiouzi" # 地町村区:八王子 export KEY_ORG="tmyinsight.net" # サイト情報:ドメイン export KEY_EMAIL="postmaster@tmyinsight.net" # メールアドレス:管理者メールアドレス #---[↑↑追加↑↑]--- export KEY_CN=changeme export KEY_NAME=changeme export KEY_OU=changeme export PKCS11_MODULE_PATH=changeme export PKCS11_PIN=1234
5. “vars" をスクリプト実行する
[user@localhost] source vars
6. “vars" と “./clean-all" を実行する。
[user@localhost] ./vars [user@localhost] ./clean-all
7. プライベートCA構築[CA証明書・CA秘密鍵 作成]
[user@localhost] ./build-ca
[ファイル内容]
Generating a 1024 bit RSA private key .............................................................++++++ .............................................................................................................++++++ writing new private key to 'ca.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [JP]: 【ENTER】 State or Province Name (full name) [Tokyo]:【ENTER】 Locality Name (eg, city) [Hachiouzi]:【ENTER】 Organization Name (eg, company) [tmyinsight.net]:【ENTER】 Organizational Unit Name (eg, section) [changeme]:【ENTER】 Common Name (eg, your name or your server's hostname) [changeme]:【ENTER】 Name [changeme]:【ENTER】 Email Address [postmaster@tmyinsight.net]:【ENTER】
※"【ENTER】" はエンターキーを押していることを表しています。
作成されたのか確認する場合は・・・
[user@localhost] ls keys/
[確認内容]
ca.crt ca.key ・・・
【素材】
フリー素材を使用させて頂きました。
Digipot さん – パソコン・サーバ・ルータ
ディスカッション
コメント一覧
まだ、コメントがありません