

GitHub - sektioneins/pcc: PHP Secure Configuration Checker
source link: https://github.com/sektioneins/pcc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PHP Secure Configuration Checker
Check current PHP configuration for potential security flaws.
Simply access this file from your webserver or run on CLI.
Author
This software was written by Ben Fuhrmannek, SektionEins GmbH, in an effort to automate php.ini checks and spend more time on cheerful tasks.
- one single file for easy distribution
- simple tests for each security related ini entry
- a few other tests - not too complicated though
- compatible with PHP >= 5.4, or if possible >= 5.0
- NO complicated/overengineered code, e.g. no classes/interfaces, test-frameworks, libraries, ... -> It is supposed to be obvious on first glance - even for novices - how this tool works and what it does!
- NO (or very few) dependencies
Usage / Installation
-
CLI: Simply call
php phpconfigcheck.php
. That's it. Add-a
to see hidden results as well,-h
for HTML output and-j
for JSON output. -
WEB: Copy this script to any directory accessible by your webserver, e.g. your document root. See also 'Safeguards' below.
The output in non-CLI mode is HTML by default. This behaviour can be changed by setting the environment variable
PCC_OUTPUT_TYPE=text
orPCC_OUTPUT_TYPE=json
.Some test cases are hidden by default, specifically skipped, ok and unknown/untested. To show all results, use
phpconfigcheck.php?showall=1
. This does not apply to JSON output, which returns all results by default.To control the output format in WEB mode use
phpconfigcheck.php?format=...
, where the value offormat
maybe one oftext
,html
orjson
. For example:phpconfigcheck.php?format=text
. Theformat
parameter takes precedence over PCC_OUTPUT_TYPE.
Safeguards
Most of the time it is a good idea to keep security related issues such as your PHP configuration to yourself. The following safeguards have been implemented:
-
mtime check: This script stops working in non-CLI mode after two days. Re-arming the check can be done by
touch phpconfigcheck.php
or by copying the script to your server again (e.g. via SCP). This check can be disabled by setting the environment variable:PCC_DISABLE_MTIME=1
, e.g.SetEnv PCC_DISABLE_MTIME 1
in apache's.htaccess
. -
source IP check: By default only localhost (127.0.0.1 and ::1) can access this script. Other hosts may be added by setting
PCC_ALLOW_IP
to a your IP address or a wildcard pattern, e.g.SetEnv PCC_ALLOW_IP 10.0.0.*
in.htaccess
. You may also choose to access your webserver via SSH Port forwarding, e.g.ssh -D
orssh -L
.
Troubleshooting
-
disabled functions: This scripts needs a few functions to work properly, such as
ini_get()
andstat()
. If one of these functions is blacklisted (or not whitelisted) then execution will fail or produce invalid output. In these cases it is possible to temporarily put Suhosin in simulation mode and omit disable_functions. To be on the safe side, relaxed security configuration can be done with .htaccess in a separate directory. Also, this script may be called from command line with your webserver's configuration, e.g.php -n -c /etc/.../php.ini phpconfigcheck.php
. -
CLI: Older PHP versions don't known about SAPI name 'cli' and use CGI style output even on cli. Workaround:
PCC_OUTPUT_TYPE=text /opt/php/php-5.1.6/bin/php phpconfigcheck.php
WARNING
This tool will only support you setting up a secure PHP environment. Nothing else. Your setup, software or any related configuration may still be vulnerable, even if this tool's output suggests otherwise.
Notes
- For copyright and license information, see phpconfigcheck.php and the LICENSE file.
- Issues, comments, enhancements? Please use the Github issue tracker: https://github.com/sektioneins/pcc/issues
Recommend
-
204
phpseclib - PHP Secure Communications Library Supporting phpseclib Introduction MIT-licensed pure-PHP implementations of the following: SSH-2, SFTP, X.509, an arbitrary-precision integer arithmetic library, Ed255...
-
138
glice Golang license and dependency checker. Prints list of all dependencies, their URL, license and saves all the license files in /licenses. Introduction glice analyzes the go.mod file of your project and prints it in a...
-
114
dpelle/vim-LanguageTool master
-
94
README.md Muffet
-
96
README.md
-
5
大家好!我是预编译合约专项兴趣小组(Pre-compiled Contract Special Interest Group,PCC-SIG)发起人曾桐桥,也是世纪鼎利C++开发工程师。由于机缘巧合,开始了区块链技术学习之路,经过多重底层框架的对比分析之后,我选择了FISCO BCOS作为主要研究...
-
2
<?xml encoding="utf-8" ??>Introduction Throughout this tutorial you will learn how to configure a basic level of security on a brand new Vultr VC2 virtual machine running Ubuntu 18.04. ...
-
8
Azure App Configuration and .NET API: a smart and secure way to manage configurations ...
-
3
Porting the Portable C Compiler (PCC) to Illumos [prev] [next] 2023-07-05Porting the Portable...
-
5
Lincolnshire PCC wants more AI to fight crime
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK