Actions

Installation security hints/ja: Difference between revisions

From LimeSurvey Manual

(Created page with "セキュリティ")
 
No edit summary
 
(56 intermediate revisions by 3 users not shown)
Line 2: Line 2:
__TOC__
__TOC__


==General==
=概要=


LimeSurvey relies on its own security system which is activated by default. The authors of this software takes no responsibility and makes no claims in relation to the appropriateness or secureness of this software. However we take security issues very serious and react quickly - if you know of any security problems with LimeSurvey please let us know: info@limesurvey.org or open a bug report at our [http://bugs.limesurvey.org bug tracker] (please mark it as private).
LimeSurveyはデフォルトで有効になっている独自のセキュリティに依存しています。このソフトウェアの開発者は、このソフトウェアの妥当性またはセキュリティレベルに関して、一切の責任を負いません。しかし、我々はセキュリティ問題を非常に真剣に受け止め、迅速に対応します。したがって、LimeSurveyにセキュリティ上の問題がある場合は、[mailto:info@limesurvey.org info@limesurvey.org]に電子メールを送信するか、[http://bugs.limesurvey.org バグトラッカー]でバグレポートを提出してください(プライベートとしてマークしてください)。


==Linux file permissions==
==Webサーバーの制限==


If you are using a Linux server, setting according file permissions is required to secure your LimeSurey installation.
Apacheを使用する場合、LimeSurverは制限のために別のhtaccessファイルを使用します。<code>AllowOverride</code>によってhtaccessが使用できるようになっているか確認してください。


===Basic facts about Linux/*nix file permissions===
他のウェブサーバーまたは<code>AllowOverride None</code>を使用したい場合は、以下のようにすべきです。


A Linux/*nix operating system is multi-user. This means that, apart from your personal account, other user accounts may exist on the system and you should take care of what permissions you give to other users.
* (任意)application、protected、framework、themes/*/viewsにあるすべてのアクセスを不可にする
* ユーザーによる /upload/surveys/.*/fu_[a-z0-9] へのアップロードを不可にする
* (任意)uploadディレクトリーの実行可能ファイルへのアクセスを不可にする


<div class="simplebox">[[File:help.png]] '''Hint:''' Setting file permissions is especially important in order to secure configuration files holding critical data such as passwords.</div>
nginxのサンプルは[[General_FAQ/ja#nginx_webserver.E3.81.AE.E4.BD.BF.E7.94.A8|よくある質問]]にあります。


''Note however that the 'root' account will always be granted permission to access your files (no matter what file permissions you set) as it is the super-admin user.''
===Linuxのファイル権限===


The webserver (which runs LimeSurvey), is also running under a given identity (user). On Linux, this is usually the 'www','www-data' (on Debian/Ubuntu), 'apache' or 'nobody' user. However, some hosting companies use systems (such as suexec) which make it possible to run LimeSurvey scripts with your personal user. Of course the webserver user must have the right to read LimeSurvey files. However, only a small subset of LimeSurvey subdirectories must be writeable by the webserver user.
Linuxサーバーを使用している場合は、LimeSureyのインストールを保護するため、ファイルのアクセス権を設定する必要があります。


<div class="simplebox">[[File:help.png]] '''Hint''': It is very valuable to revoke write permission for the webserver user to these LimeSurvey subdirectories that do not require it. Indeed, even if a LimeSurvey vulnerability might be discovered, the main files will still be protected from an illicit modification thanks to the file system permissions.</div>
===Linux/*nixにおけるファイル権限の基本===


===Setting file permissions on a self-managed Linux system===
Linux/*nixオペレーティングシステムはマルチユーザーです。これは、あなたの個人アカウントとは別に、システム上に他のユーザーアカウントが存在する可能性があることを意味し、他のユーザーにどのようなアクセス許可を与えるかを管理する必要があります。


If you're managing your webserver and operating system configuration (you are the owner of the physical server or are renting a virtual server on which you have root access), you can follow these recommendations.
<div class="simplebox">[[File:help.png]] '''ヒント:''' パスワードのような重要なデータを保持している設定ファイルを安全に保つには、ファイルアクセス権を設定することが特に重要です。</div>


You can first set the owner and group of your LimeSurvey files so that it will ease the file permissions setup.
''''root'アカウントはスーパー管理ユーザーであるため、ファイルにアクセスするためのアクセス権が常に与えられます(設定したファイルアクセス権に関係なく)。'''


A possible strategy is to set the owner of the LimeSurvey files to your personal username, and the group of the LimeSurvey files to the webserver group. Usually this webserver group only contains the webserver account (and possibly another webmaster account).
LimeSurveyを実行しているWebサーバーも特定のID(ユーザー)で実行されています。Linuxでは通常、'www'、'www-data'(Debian / Ubuntu上)、'apache'または'nobody'というユーザーです。しかし、ホスティング業者によっては、あなたの個人ユーザーでLimeSurveyスクリプトを実行できるシステム(suexecなど)を使用しているものもあります。もちろん、ウェブサーバーユーザーは、LimeSurveyファイルに対する読み取り権限が必要です。ただし、LimeSurveyサブディレクトリーのごく一部は、ウェブサーバーユーザーによって書き込み可能である必要があります。


For instance if your username is 'myaccount' and the webserver user is 'apache' in the 'apache' group, then, from a shell access, you can use the following command:
<div class="simplebox">[[File:help.png]] '''ヒント''': ウェブサーバーユーザーの書き込み権限が必要ないLimeSurveyのサブディレクトリーでは、その権限を取り消すことが非常に重要です。仮にLimeSurveyの脆弱性が発見されても、ファイルシステムのアクセス権限によって、メインファイルが不正に変更されることがなくなります、</div>


$ chown -R myaccount:apache limesurvey/
===自己管理型Linuxシステムでのファイルアクセス権の設定===


Then set the file and subdirectories permissions.
ウェブサーバーとオペレーティングシステムの構成を管理している(物理サーバーの所有者であるか、ルートアクセス権を持つ仮想サーバーを借りている)場合は、以下の推奨事項を検討してください。


For the script to work properly it needs write access to some directories:
最初に、LimeSurveyファイルの所有者とグループを設定して、ファイルのアクセス権限設定を簡略化することができます。例えば、LimeSurveyファイルの所有者を個人のユーザー名に設定し、LimeSurveyファイルのグループをウェブサーバーグループに設定します。通常、このウェブサーバーグループには、ウェブサーバーアカウント(および、場合によって別のウェブマスターアカウント)のみが含まれます。例えば、あなたのユーザー名が'myaccount'で、ウェブサーバーユーザーが'apache'グループの'apache'であれば、シェルアクセスから次のコマンドを使います。<code>$ chown -R myaccount:apache limesurvey/</code>。その後、ファイルとサブディレクトリーのアクセス権限を設定します。
*The "/limesurvey/tmp" directory and its subdirectories are used for imports/uploads and should be set to ''Read & Write'' for your webserver.
*The upload/ directory and all its subdirectories must also have ''Read & Write'' for your webserver in order to enable picture and media files upload.
* All other directories and files can be set to ''Read Only''


<div class="simplebox">[[File:help.png]] '''Hint:''' Supposing you've followed the above recommendations on owner/group, these settings can be applied by the following commands:
スクリプトが正常に動作するためには、いくつかのディレクトリーへの書き込み権限が必要です。
*/limesurvey/application/configディレクトリーには、アプリケーションの構成設定を保存するための''読み書き''の権限が必要です。
*/limesurvey/tmpディレクトリーとそのサブディレクトリーはインポート/アップロードに使用され、ウェブサーバーが''読み書き''の権限を持つ必要があります。
*upload/directoryとそのすべてのサブディレクトリーについても、画像とメディアファイルをアップロードできるようにするため、''読み書き''権限設定する必要があります。
* その他のディレクトリーとファイルはすべて''読み取り専用''に設定します。


$ chmod -R o-r-w-x limesurvey/
<div class="simplebox">[[File:help.png]] '''ヒント:''' 所有者/グループについて、上記の推奨事項に従った場合、設定は次のコマンドによって適用できます。


$ chmod -R -w limesurvey/
<code>$ chmod -R o-r-w-x limesurvey/</code>


$ chmod -R 770 limesurvey/tmp
<code>$ chmod -R -w limesurvey/</code>


$ chmod -R 770 limesurvey/upload
<code>$ chmod -R 770 limesurvey/application/config</code>
 
<code>$ chmod -R 770 limesurvey/tmp</code>
 
<code>$ chmod -R 770 limesurvey/upload</code>


</div>
</div>


===Setting file permissions on a hosted webserver===
===ホストされているウェブサーバーでのファイルアクセス権の設定===
 
ホストされた環境でウェブアプリケーションを保護するための標準的な手順は、ホストされた環境がさまざまな点で異なるため、非常に難しい問題です。
 
管理されているサーバーの場合、スクリプトが正常に動作するためにはいくつかのディレクトリーへの書き込み権限が必要です。
*/limesurvey/tmpディレクトリーはインポート/アップロードに使用するため、ウェブサーバーに''読み書き''権限を設定する必要があります。
*upload/directoryとそのすべてのサブディレクトリーにも画像/メディアファイルのアップロードを有効にするため、ウェブサーバーに''読み書き''権限を設定する必要があります。
* その他のディレクトリーとファイルはすべて''読み取り専用''に設定します。
 
<div class="simplebox">[[File:help.png]] '''ヒント:'''
* ウェブサーバーの設定によっては、ウェブサーバーが書き込みを行うフォルダーの権限を755または777に変更する必要があります。最初に755を試してください。動作しない場合は、777にしてください。
* config.phpへのアクセス権を750にすることにより、他のユーザーのアクセスを制限することができますが、動作しない場合は755と設定します。</div>
 
===Windowsのファイル権限===


Giving a standard procedure to secure a web application on a hosted environment is rather difficult because hosted environments differ in so many ways.
Windowsサーバーを使用している場合は、管理者フォルダでウェブサーバープロセスの所有者がディレクトリーにファイルを書き込むことができるようにする必要があります。残りのファイルは読み取り専用に設定して実行できます。


As in the managed server case, for the script to work properly it needs write access to some directories:
==その他のセキュリティ問題==
*The "/limesurvey/tmp" directory is used for imports/uploads and should be set to ''Read & Write'' for your webserver.
*The upload/ directory and all its sub directories must also have ''Read & Write'' for your webserver in order to enable picture and media files upload.
* The other directories and files should be set to ''Read Only''


<div class="simplebox">[[File:help.png]] '''Hint:'''
以下は推奨事項です。LimeSurveyは一般的に、これらの追加の対策がなくても非常に安全です。ただし、非常に機密性の高いデータを収集する場合は、セキュリティーを強化するとよいでしょう。
* Depending on your webserver configuration you will have to chmod the rights on the writable folders to 755 or 777 to make it writable for the webserver. Try 755 first - if it does not work 'upgrade' to 777.
* You can also try to remove read access to config.php to others by setting this file's permissions to 750 - if it does not work 'upgrade' to 755.</div>


==Windows file permissions==
===SSLの使用===
機密性の高いアンケートデータにはSSLの使用を推奨します。通常は、ウェブサーバーを正しく構成し、SSQL証明書を使用してSSLを有効にします。SSLを有効にしている場合は、LimeSurveyの[[Global_settings/ja|全体設定]]で常にSSLを適用するよう設定します。さらに、config.phpの[[Optional_settings/ja|それぞれのオプション]]を編集することにより、 '安全な'cookieを使用するように設定することもできます。


If you are using a windows server your should ensure that the admin folder allows the owner of the webserver process to write files to this directory, however all other files can be set to read-only and execute.
=== config.phpファイルへのアクセス ===


==Other security issues==
{{Alert| 最初のインストールが完了し、それが動作した後にのみapplication/config/'''config.php'''を更新してください。}}


The following are recommendations only. LimeSurvey in general is very safe without these additional measure. If you however collect extremely sensitive data a little additional security can help:
/application/config/config.phpファイルには、データベースサーバーのユーザー名とパスワードが含まれています。特に、データベースに管理アクセスレベルが高いユーザーでログインしている場合は、セキュリティ上の問題が発生します。何らかのエラーが発生し、このPHPファイルの内容がユーザーのブラウザに表示された場合、データベースのパスワードやその他の詳細情報が漏洩する可能性があります(ただし、これはまれなシナリオです)。リスクを最小限に抑えるには、LimeSurveyデータベースに特定の権限しか持たない特定のログインユーザーを設定することです。


The /application/config/config.php file contains a user name and password for your database server. This poses certain security issues, particularly if you are using a login that has high level administrative access to your database. In the event of some error returning the content of this PHP file to a user's browser, your database password and other details could be compromised (please note, that this is a very unlikely scenario). The best way to minimize risk is to set up a specific login that has specific rights only to your limesurvey database.
この情報を保護するもう1つの方法は、/application/config/config.phpファイルの情報をウェブディレクトリー以外のディレクトリーに入れることです。つまり、Apacheユーザーの場合、これはhtdocs(public_htmlまたはwwwの場合もある)フォルダよりも上のディレクトリーです。基本的にはconfig.phpを使用しますが、その中には実際の設定情報を含むファイルを含む行を1行加えます(例:<code><?php return include("/home/hostfolder/safedata/configreal.php"); ?></code>)。/application/config/config.phpから実際の設定情報をすべて削除し、/application/config/config.phpファイルに記述されている別のファイル(configreal.php)に貼り付けます。このファイルは、ウェブ以外のディレクトリーに配置する必要があります。これにより、/application/config/config.phpにはデータベースのパスワードなどがなくなり、データベースの情報を含むファイルの名前だけが書かれていることになります。


Another way to secure this information can be to put the certain information from the /application/config/config.php file in a non-web directory, i.e. for Apache users this is the directory above the htdocs (aka public_html or www) folder. So you will use config.php, but have one line in it - a line that includes the file with ACTUAL configuration information (ex: <?php return include("/home/hostfolder/safedata/configreal.php"); ?>). Remove all actual configuration information from /application/config/config.php, and paste it into the other file (configreal.php) that is included by /application/config/config.php. This other file should be located in a non-Web directory. Then /application/config/config.php will not contain database passwords, etc. - just the name of the file that DOES contain the database info. This avoids having to change all the other files that include /application/config/config.php, since they can still include it, and it will include the real config information. However you will need to edit configreal.php and change the follow parameters
これにより、/application/config/config.phpを含む他のすべてのファイルを変更する必要がなくなります。これは、config.phpがウェブ以外のディレクトリーにある本物の設定情報を含む設定ファイルに向けて'リダイレクト'するためです。ただし、configreal.phpを編集して、絶対パスを使用するようにパラメータを変更する必要があります。


<syntaxhighlight lang="php" enclose="div">
<syntaxhighlight lang="php">


'basePath' => dirname(dirname('''FILE''')),
'basePath' => dirname(dirname('''FILE''')),
'runtimePath' => dirname(dirname(dirname('''FILE'''))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'runtime',
'runtimePath' => dirname(dirname(dirname('''FILE'''))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'runtime',
[...]
[...]


'urlManager' => array(
'urlManager' => array(
   [...]
   [...]
   'rules' => require('routes.php'),
   'rules' => require('routes.php'),
   [...]
   [...]
);
);
</syntaxhighlight>
</syntaxhighlight>


to use absolute directory paths to work properly. Example:
:
 
<syntaxhighlight lang="php" enclose="div">


<syntaxhighlight lang="php">
'basePath' => '/var/www/htdocs/limesurvey',
'basePath' => '/var/www/htdocs/limesurvey',
'runtimePath' => '/var/www/htdocs/limesurvey/tmp/runtime',
'runtimePath' => '/var/www/htdocs/limesurvey/tmp/runtime',
[...]
[...]


'urlManager' => array(
'urlManager' => array(
   [...]
   [...]
   'rules' => require('/var/www/htdocs/limesurvey/config/routes.php'),
   'rules' => require('/var/www/htdocs/limesurvey/config/routes.php'),
   [...]
);
</syntaxhighlight>


   [...]
また、'''既定のユーザーとして "admin"を使用しないでください'''。MySQLデータベース(またはLimeSurveyをインストールしたデータベース)で、既定のユーザー名"admin"を好きなもの(例えば "admin_xyz")に変更してください。これにより、管理者の新しいユーザー名を推測するのがずっと難しくなります。ユーザー名は、侵入者がアクセスするために使用する2つの変数の1つです。もう一つは管理者パスワードです。とりわけ注意を払ってそれぞれを設定してください。


);


</syntaxhighlight>
===コンテンツセキュリティポリシー(CSP)===


Also don't use "admin" as the default user. Go to your MySQL database (or other one if you installed LimeSurvey on different database) and change default user name "admin" to whatever you prefer (e.g. "admin_xyz"). It will be now much harder to guess administrator's new user name. Remember, this is one of the two variables intruders can use to gain access. The admin password is the other variable. So choose it with extreme care.
'''免責事項 - ここに掲載されているCSPはあくまでも例であり、そのまま使用することを意図していません。これはあくまでも出発点であり、ニーズに合わせて徹底的に試験する必要があります。'''
<nowiki><IfModule mod_headers.c>
        Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests" "expr=%{CONTENT_TYPE} =~ m#text\/(html|javascript)|application\/pdf|xml#i"
</IfModule></nowiki>

Latest revision as of 02:28, 19 February 2022

概要

LimeSurveyはデフォルトで有効になっている独自のセキュリティに依存しています。このソフトウェアの開発者は、このソフトウェアの妥当性またはセキュリティレベルに関して、一切の責任を負いません。しかし、我々はセキュリティ問題を非常に真剣に受け止め、迅速に対応します。したがって、LimeSurveyにセキュリティ上の問題がある場合は、info@limesurvey.orgに電子メールを送信するか、バグトラッカーでバグレポートを提出してください(プライベートとしてマークしてください)。

Webサーバーの制限

Apacheを使用する場合、LimeSurverは制限のために別のhtaccessファイルを使用します。AllowOverrideによってhtaccessが使用できるようになっているか確認してください。

他のウェブサーバーまたはAllowOverride Noneを使用したい場合は、以下のようにすべきです。

  • (任意)application、protected、framework、themes/*/viewsにあるすべてのアクセスを不可にする
  • ユーザーによる /upload/surveys/.*/fu_[a-z0-9] へのアップロードを不可にする
  • (任意)uploadディレクトリーの実行可能ファイルへのアクセスを不可にする

nginxのサンプルはよくある質問にあります。

Linuxのファイル権限

Linuxサーバーを使用している場合は、LimeSureyのインストールを保護するため、ファイルのアクセス権を設定する必要があります。

Linux/*nixにおけるファイル権限の基本

Linux/*nixオペレーティングシステムはマルチユーザーです。これは、あなたの個人アカウントとは別に、システム上に他のユーザーアカウントが存在する可能性があることを意味し、他のユーザーにどのようなアクセス許可を与えるかを管理する必要があります。

ヒント: パスワードのような重要なデータを保持している設定ファイルを安全に保つには、ファイルアクセス権を設定することが特に重要です。

'root'アカウントはスーパー管理ユーザーであるため、ファイルにアクセスするためのアクセス権が常に与えられます(設定したファイルアクセス権に関係なく)。

LimeSurveyを実行しているWebサーバーも特定のID(ユーザー)で実行されています。Linuxでは通常、'www'、'www-data'(Debian / Ubuntu上)、'apache'または'nobody'というユーザーです。しかし、ホスティング業者によっては、あなたの個人ユーザーでLimeSurveyスクリプトを実行できるシステム(suexecなど)を使用しているものもあります。もちろん、ウェブサーバーユーザーは、LimeSurveyファイルに対する読み取り権限が必要です。ただし、LimeSurveyサブディレクトリーのごく一部は、ウェブサーバーユーザーによって書き込み可能である必要があります。

ヒント: ウェブサーバーユーザーの書き込み権限が必要ないLimeSurveyのサブディレクトリーでは、その権限を取り消すことが非常に重要です。仮にLimeSurveyの脆弱性が発見されても、ファイルシステムのアクセス権限によって、メインファイルが不正に変更されることがなくなります、

自己管理型Linuxシステムでのファイルアクセス権の設定

ウェブサーバーとオペレーティングシステムの構成を管理している(物理サーバーの所有者であるか、ルートアクセス権を持つ仮想サーバーを借りている)場合は、以下の推奨事項を検討してください。

最初に、LimeSurveyファイルの所有者とグループを設定して、ファイルのアクセス権限設定を簡略化することができます。例えば、LimeSurveyファイルの所有者を個人のユーザー名に設定し、LimeSurveyファイルのグループをウェブサーバーグループに設定します。通常、このウェブサーバーグループには、ウェブサーバーアカウント(および、場合によって別のウェブマスターアカウント)のみが含まれます。例えば、あなたのユーザー名が'myaccount'で、ウェブサーバーユーザーが'apache'グループの'apache'であれば、シェルアクセスから次のコマンドを使います。$ chown -R myaccount:apache limesurvey/。その後、ファイルとサブディレクトリーのアクセス権限を設定します。

スクリプトが正常に動作するためには、いくつかのディレクトリーへの書き込み権限が必要です。

  • /limesurvey/application/configディレクトリーには、アプリケーションの構成設定を保存するための読み書きの権限が必要です。
  • /limesurvey/tmpディレクトリーとそのサブディレクトリーはインポート/アップロードに使用され、ウェブサーバーが読み書きの権限を持つ必要があります。
  • upload/directoryとそのすべてのサブディレクトリーについても、画像とメディアファイルをアップロードできるようにするため、読み書き権限設定する必要があります。
  • その他のディレクトリーとファイルはすべて読み取り専用に設定します。
ヒント: 所有者/グループについて、上記の推奨事項に従った場合、設定は次のコマンドによって適用できます。

$ chmod -R o-r-w-x limesurvey/

$ chmod -R -w limesurvey/

$ chmod -R 770 limesurvey/application/config

$ chmod -R 770 limesurvey/tmp

$ chmod -R 770 limesurvey/upload

ホストされているウェブサーバーでのファイルアクセス権の設定

ホストされた環境でウェブアプリケーションを保護するための標準的な手順は、ホストされた環境がさまざまな点で異なるため、非常に難しい問題です。

管理されているサーバーの場合、スクリプトが正常に動作するためにはいくつかのディレクトリーへの書き込み権限が必要です。

  • /limesurvey/tmpディレクトリーはインポート/アップロードに使用するため、ウェブサーバーに読み書き権限を設定する必要があります。
  • upload/directoryとそのすべてのサブディレクトリーにも画像/メディアファイルのアップロードを有効にするため、ウェブサーバーに読み書き権限を設定する必要があります。
  • その他のディレクトリーとファイルはすべて読み取り専用に設定します。
ヒント:
  • ウェブサーバーの設定によっては、ウェブサーバーが書き込みを行うフォルダーの権限を755または777に変更する必要があります。最初に755を試してください。動作しない場合は、777にしてください。
  • config.phpへのアクセス権を750にすることにより、他のユーザーのアクセスを制限することができますが、動作しない場合は755と設定します。

Windowsのファイル権限

Windowsサーバーを使用している場合は、管理者フォルダでウェブサーバープロセスの所有者がディレクトリーにファイルを書き込むことができるようにする必要があります。残りのファイルは読み取り専用に設定して実行できます。

その他のセキュリティ問題

以下は推奨事項です。LimeSurveyは一般的に、これらの追加の対策がなくても非常に安全です。ただし、非常に機密性の高いデータを収集する場合は、セキュリティーを強化するとよいでしょう。

SSLの使用

機密性の高いアンケートデータにはSSLの使用を推奨します。通常は、ウェブサーバーを正しく構成し、SSQL証明書を使用してSSLを有効にします。SSLを有効にしている場合は、LimeSurveyの全体設定で常にSSLを適用するよう設定します。さらに、config.phpのそれぞれのオプションを編集することにより、 '安全な'cookieを使用するように設定することもできます。

config.phpファイルへのアクセス

  最初のインストールが完了し、それが動作した後にのみapplication/config/config.phpを更新してください。


/application/config/config.phpファイルには、データベースサーバーのユーザー名とパスワードが含まれています。特に、データベースに管理アクセスレベルが高いユーザーでログインしている場合は、セキュリティ上の問題が発生します。何らかのエラーが発生し、このPHPファイルの内容がユーザーのブラウザに表示された場合、データベースのパスワードやその他の詳細情報が漏洩する可能性があります(ただし、これはまれなシナリオです)。リスクを最小限に抑えるには、LimeSurveyデータベースに特定の権限しか持たない特定のログインユーザーを設定することです。

この情報を保護するもう1つの方法は、/application/config/config.phpファイルの情報をウェブディレクトリー以外のディレクトリーに入れることです。つまり、Apacheユーザーの場合、これはhtdocs(public_htmlまたはwwwの場合もある)フォルダよりも上のディレクトリーです。基本的にはconfig.phpを使用しますが、その中には実際の設定情報を含むファイルを含む行を1行加えます(例:<?php return include("/home/hostfolder/safedata/configreal.php"); ?>)。/application/config/config.phpから実際の設定情報をすべて削除し、/application/config/config.phpファイルに記述されている別のファイル(configreal.php)に貼り付けます。このファイルは、ウェブ以外のディレクトリーに配置する必要があります。これにより、/application/config/config.phpにはデータベースのパスワードなどがなくなり、データベースの情報を含むファイルの名前だけが書かれていることになります。

これにより、/application/config/config.phpを含む他のすべてのファイルを変更する必要がなくなります。これは、config.phpがウェブ以外のディレクトリーにある本物の設定情報を含む設定ファイルに向けて'リダイレクト'するためです。ただし、configreal.phpを編集して、絶対パスを使用するようにパラメータを変更する必要があります。

'basePath' => dirname(dirname('''FILE''')),
'runtimePath' => dirname(dirname(dirname('''FILE'''))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'runtime',
[...]

'urlManager' => array(
   [...]
   'rules' => require('routes.php'),
   [...]
);

例:

'basePath' => '/var/www/htdocs/limesurvey',
'runtimePath' => '/var/www/htdocs/limesurvey/tmp/runtime',
[...]

'urlManager' => array(
   [...]
   'rules' => require('/var/www/htdocs/limesurvey/config/routes.php'),
   [...]
);

また、既定のユーザーとして "admin"を使用しないでください。MySQLデータベース(またはLimeSurveyをインストールしたデータベース)で、既定のユーザー名"admin"を好きなもの(例えば "admin_xyz")に変更してください。これにより、管理者の新しいユーザー名を推測するのがずっと難しくなります。ユーザー名は、侵入者がアクセスするために使用する2つの変数の1つです。もう一つは管理者パスワードです。とりわけ注意を払ってそれぞれを設定してください。


コンテンツセキュリティポリシー(CSP)

免責事項 - ここに掲載されているCSPはあくまでも例であり、そのまま使用することを意図していません。これはあくまでも出発点であり、ニーズに合わせて徹底的に試験する必要があります。

<IfModule mod_headers.c>
        Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests" "expr=%{CONTENT_TYPE} =~ m#text\/(html|javascript)|application\/pdf|xml#i"
</IfModule>