ファイルとディレクトリの隠蔽

出典: SugarForum.jp

Sugarでは、DocumentRootにライブラリも含めた全てのファイルが置かれるスタイルを取っている。そのため、適切にディレクトリやファイルがユーザから隠蔽される必要があり、SugarRoot/.htaccessを使った方法が採用されている。セキュリティ上見られてはいけないものについて、SugarRoot/index.phpなどへリダイレクトしている。

.htaccessの例

# BEGIN SUGARCRM RESTRICTIONS
RedirectMatch /sugarcrm.log.* http://yoursugarserver.com/log_file_restricted.html
RedirectMatch /emailman.log http://yoursugarserver.com/log_file_restricted.html
RedirectMatch /not_imported_(.*).txt http://yoursugarserver.com/log_file_restricted.html
RedirectMatch /XTemplate/(.*)/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /data/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /examples/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /include/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /include/(.*)/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /log4php/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /log4php/(.*)/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /metadata/(.*)/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /modules/(.*)/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /soap/(.*).php http://yoursugarserver.com/index.php
RedirectMatch /emailmandelivery.php http://yoursugarserver.com/index.php
# END SUGARCRM RESTRICTIONS

※上記は、Sugarが自動的に生成するため、手作業で書く必要はない。サーバ名が変わった場合などは、管理画面で「.htaccessの再構築」 を実行すると良いだろう。


最終更新 12:44, 2008年1月22日 (火)。   このページは 2,558 回アクセスされました。