标签 一句话 下的文章

使用Suhosin保护PHP

1、下载
PHP 5.2.X:https://download.suhosin.org/suhosin-0.9.37.1.tar.gz
PHP 5.X:https://download.suhosin.org/suhosin-0.9.38.tar.gz
2、安装

wget http://download.suhosin.org/suhosin-0.9.37.1.tar.gz
tar zxvf suhosin-0.9.37.1.tar.gz
cd suhosin-0.9.37.1/
phpize
./configure  --with-php-config=/usr/local/php/bin/php-config
make
make install

编辑/usr/local/php/etc/php.ini文件,在最后一行下方插入:

[Suhosin]
extension=suhosin.so
suhosin.executor.eval.blacklist = base64_decode,system,exec,shell_exec,passthru,proc_open,proc_close, proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport, syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept, socket_connect, stream_socket_server, stream_socket_accept,stream_socket_client,ftp_connect, ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space, disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
suhosin.log.file.name = /usr/local/php/logs/suhosin-alert.log

对于php7.x及以上版本,可以试试使用Snuffleupagus保护PHP