セッションの保護とadmin

□未翻訳

□翻訳中

□翻訳完了(Omi Chiba)

■レビュー(中垣健志)

セッションの保護とadmin

Securing Sessions and admin

security

admin

HTTPS経由で実行されている場合を除き、adminアプリケーションとappadminコントローラを公開することはとても危険です。そして、パスワードとクレデンシャルは暗号化無しで通信されるべきではありません。これはweb2pyと全てのwebアプリケーションに当てはまります。

It is very dangerous to publicly expose the admin application and the appadmin controllers unless they run over HTTPS. Moreover, your password and credentials should never be transmitted unencrypted. This is true for web2py and any other web application.

あなたのアプリケーションで、認証が必要な場合は以下のようにセッションクッキーを保護するべきです:

In your applications, if they require authentication, you should make the session cookies secure with:

1.

session.secure()

サーバ上で安全な本番環境をセットアップする簡単な方法は、まずweb2pyを停止しweb2pyをインストールしたフォルダから全てのparameters_*.pyを削除することです。そしてパスワード無しでweb2pyを起動します。これでadminとappadminは完全に無効になります。

An easy way to setup a secure production environment on a server is to first stop web2py and then remove all the parameters_*.py files from the web2py installation folder. Then start web2py without a password. This will completely disable admin and appadmin.

1.

nohup python web2py --nogui -p 8001 -i 127.0.0.1 -a '' &

次に、ローカルホストからだけアクセス可能な二つ目のweb2pyインスタンスを起動します。

Next, start a second web2py instance accessible only from localhost:

1.

nohup python web2py --nogui -p 8002 -i 127.0.0.1 -a '<ask>' &

そしてローカルマシン(管理画面にアクセスしたいマシン)からサーバー(web2pyが実行されている、example.com)へSSHトンネルを作成します:

and create an SSH tunnel from the local machine (the one from which you wish to access the administrative interface) to the server (the one where web2py is running, example.com), using:

1.

ssh -L 8002:127.0.0.1:8002 username@example.com

これでブラウザ経由のlocalhost:8002で管理画面へローカルに接続することができます。

Now you can access the administrative interface locally via the web browser at localhost:8002.

トンネルが閉じているとき(ユーザがログアウト時)はadminへ接続できないので、設定は安全になります。

This configuration is secure because admin is not reachable when the tunnel is closed (the user is logged out).

この方法は他のユーザがweb2pyを含むフォルダへの読み取りアクセスを持たないホスティング環境では安全です。そうでないときは、ユーザがサーバから直接セッションクッキーを盗むことが可能です。

This solution is secure on shared hosts if and only if other users do not have read access to the folder that contains web2py; otherwise users may be able to steal session cookies directly from the server.