Locked History Actions

Diff for "OpenVPN"

Differences between revisions 33 and 34
Deletions are marked like this. Additions are marked like this.
Line 56: Line 56:
==== Server Network Settings ==== ==== Configuration/Server Network Settings ====
Line 61: Line 61:
==== VPN Settings ==== ==== Configuration/VPN Settings ====
Line 64: Line 64:
 * Group Default IP Address Networkに何か設定されているので消す。
Line 66: Line 67:
 * 他のオプションはよくわからない。

※最新版でエラーが発生する(後述)。
Line 121: Line 125:
==== 最新版でエラーが発生する ====

{{{
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

Access Server(1.7.0)の動かし方

インストールと自動起動

対象をCentOS5.5(32bit)とする。

  • OpenVPNのサイトから「openvpn-as-1.7.0-CentOS5.i386.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_asではovpn-initを行わないと動作させることができなかったのだが、 このバージョンではインストールすると同時にデフォルトの設定で起動され、ブラウザからの管理者ログインが可能な状態になっている。

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

ブラウザで

https://*.*.*.*:943/admin/

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

インストール時に自動作成されたopenvpnというユーザのパスワードを設定し、これでログインすることにより管理画面にアクセスすることができる。

passwd openvpn

管理画面での設定

管理画面を開き、あらかじめ設定されたデフォルト値を変更する。もちろんこれは好みの問題もある。

Configuration/Server Network Settings

  • Admin Web UI:管理画面でのすべての設定が終わった後で「localhost」にしておく。

こうすれば外部から管理画面にアクセスすることはできなくなる。元に戻す方法は後述。

Configuration/VPN Settings

  • Network Addressを好みに応じて変更する。
    例えば、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」にする。
    サーバは一台なので、必要無し。

  • 「Should client Internet traffic be routed through the VPN?」を「No」にする。
    「Yes」のままだとクライアントのあらゆるインターネット接続がサーバを経由してしまう(らしい)。

  • 他のオプションはよくわからない。

※最新版でエラーが発生する(後述)。

ユーザの追加

openvpn以外のユーザのアクセス許可を与える。まず、そのユーザを作成して、パスワードを設定する。

# useradd foobar
# passwd foobar

User Management/User Permissionsにてそのユーザを追加する。

プロファイルの取得

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

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

Server Network Settingsについて追加(2012/8/7)

apacheの方でSSLの設定がされていないと、443経由でAdmin Webに接続できてしまう。 これをやめさせるには、以下のようにする(あくまでも例)。

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

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'])

古い情報

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