Locked History Actions

Diff for "OpenVPN"

Differences between revisions 42 and 43
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
== Access Server(2.0.5)の動かし方 ==
Line 5: Line 4:
=== インストールと自動起動 ===

対象をCentOS6.5(64bit)とする。

 * OpenVPNのサイトから「openvpn-as-2.0.5-CentOS6.x86_64.rpm」をダウンロードし、通常通りrpmコマンドでインストール。

{{{
Preparing... ########################################### [100%]
   1:openvpn-as ########################################### [100%]
The Access Server has been successfully installed in /usr/local/openvpn_as
Configuration log file has been written to /usr/local/openvpn_as/init.log
Please enter "passwd openvpn" to set the initial
administrative password, then login as "openvpn" to continue
configuration here: https://*.*.*.*:943/admin
To reconfigure manually, use the /usr/local/openvpn_as/bin/ovpn-init tool.

Access Server web UIs are available here:
Admin UI: https://*.*.*.*:943/admin
Client UI: https://*.*.*.*:943/
}}}

この時点で以下が行われている。

 * /usr/local/openvpn_as以下に構成ファイルがインストールされている。
 * openvpn, openvpn_asというユーザが登録されている。
 * デフォルトの設定でaccess serverが起動している。
 * iptablesにも勝手に設定がされている(iptables -Lで確認)
 * /etc/rc.d/init.d/openvpnasが作成済


インストール時に自動作成されたopenvpnというユーザのパスワードを設定しておく。
{{{
passwd openvpn
}}}

=== ブラウザでの管理者ログイン ===

ブラウザで
{{{
https://*.*.*.*:943/admin/
}}}
を表示させる。使用されているのはオレオレ証明書なのでその旨警告される。
username/passwordには通常のlinuxのユーザとパスワードを入力することができるのだが、
openvpnによって権限を与えられていないユーザは「You are not authorized to use the Admin UI」というエラーになる。

ここでは先のopenvpnとそのパスワードを入力する。


=== User Management/User Permissions ===

必要であればopenvpn以外のユーザのアクセス許可を与える。あらかじめ、linux上でそのユーザを作成して、パスワードを設定する。

{{{
# useradd foobar
# passwd foobar
}}}

管理画面のUser Management/User Permissionsでそのユーザのアクセス権限を設定する。

=== Configuration/VPN Settings ===

 * Network Addressを好みに応じて変更する。<<BR>>例えば、Network Addressを「10.8.102.0」、「Number of Bits in Netmask」を「24」
 * Group Default IP Address Networkに何か設定されているので消す。
 * 「Should VPN clients have access to private subnets (non-public networks on the server side)?」を「No」にする。<<BR>>サーバは一台なので、必要無し。
 * 「Should client Internet traffic be routed through the VPN?」を「No」にする。<<BR>>「Yes」のままだとクライアントのあらゆるインターネット接続がサーバを経由してしまう(らしい)。※これをNoにすると、最新版(少なくとも2.0.5)でエラーが発生する(後述)。
 * 他のオプションはよくわからない。

=== Configuration/Server Network Settings ===

※apacheの方でSSLの設定がされていないと、443経由でAdmin Webに接続できてしまう。


 * VPN ServerのProtocolをUDPにし、port numberを1194にする。
 * Save Settingsし、Update Running Serverする。
 * https://....:943/に接続して、クライアントログインし、接続設定を取得(※後述)

 * https://....:943/admin/に接続し、再度Server Network SettingsのAdmin Web UI/Interface and IP Addressをlocalhostにする。こうすれば外部から管理画面にアクセスすることはできなくなる。元に戻す方法は後述。
 * Save Settingsし、Update Running Serverする。
 * 接続できないため、管理者画面の再表示はされない。


=== 接続設定の取得 ===


クライアントからの接続用プロファイルを取得する。

https://*.*.*.*:943/を表示し、先のユーザとパスワードを指定し、Login/Goを実行する。
一番下の「Yourself (user-locked profile)」をクリックすると、client.ovpnというファイルをダウンロードすることができる。

=== openvpn_asの設定値 ===

openvpn_asは、テキストファイルではなくsqllite3のデータベースに設定値等を保管する。以下に本家の説明がある。
[[http://openvpn.net/index.php/access-server/docs/admin-guides/381-backing-up-the-access-server.html]]
万が一の自体に備えてバックアップを行うには、この説明の通りにすればよい。

また、上に述べたように「Server Network Settings/Admin Web UI」の値を「localhost」に指定すると、サーバ自身以外のマシンから管理画面にアクセスすることはできなくなる。これを復旧する(eith0にする)には、以下のようにする。

「cd /usr/local/openvpn_as/etc/db」とし、

{{{
[root@*** db]# sqlite3 config.db
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> update config set value='eth0' where name='admin_ui.https.ip_address';
sqlite> .quit
[root@*** db]# service openvpnas restart
}}}


=== ドキュメントとログ ===

/usr/local/openvpn_as/docにある(バージョンによっては存在しない)。

ログは/var/log/openvpnas.logに固定で、デフォルトでは、1Mを超えるとローテートされるが、削除はされていない模様。
設定によってはsyslogに出力することもできる。



=== 最新版でエラーが発生する ===

{{{
Error:

service failed to start due to unresolved dependencies: set(['user'])
service failed to start due to unresolved dependencies: set(['iptables_openvpn'])
Service deferred error: IPTablesServiceBase: failed to run iptables-restore [status=2]: ["iptables-restore v1.4.7: host/network `2401:2500::1' not found", 'Error occurred at line: 18', "Try `iptables-restore -h' or 'iptables-restore --help' for more information."]: internet/defer:323,sagent/ipts:122,sagent/ipts:49,util/mycprof:11,<string>:1,sagent/sagent_entry:14,sagent/sagent_entry:11,util/daemon:28,util/daemon:69,application/app:423,scripts/_twistd_unix:202,application/app:445,application/app:348,internet/base:1166,internet/base:1178,internet/epollreactor:194,python/log:85,python/log:70,python/context:59,python/context:37,internet/epollreactor:223,internet/posixbase:191,internet/process:260,internet/process:762,internet/process:775,internet/_baseprocess:60,svc/pp:117,svc/svcnotify:32,internet/defer:238,internet/defer:307,internet/defer:323,sagent/ipts:122,sagent/ipts:49,util/error:61,util/error:44
service failed to start due to unresolved dependencies: set(['user', 'iptables_live', 'iptables_openvpn'])
}}}

== 古い情報 ==

'''※※※ 以下の情報は古いです'''

 * [[OpenVPN/Old|古い情報]]
 * [[OpenVPN/AccessServer|アクセスサーバ]]