Line 24: |
Line 24: |
| | | |
| # Author: Normando Hall (PicsOne) | | # Author: Normando Hall (PicsOne) |
− | # Version: 1.0 | + | # Version: 1.1 |
− | # 06/06/2007 | + | # 07/06/2007 (d/m/Y) |
− | | + | # |
| + | # |
| + | # Changelog |
| + | # |
| + | # 1.1 (by Normando Hall) |
| + | # Added php open_basedir restriction |
| + | # Set debug variable |
| + | # |
| + | # 1.0 (by Normando Hall) |
| + | # Initial release |
| + | |
| clear | | clear |
| echo "========================================================" | | echo "========================================================" |
Line 44: |
Line 54: |
| read x | | read x |
| custom_httpd_dir=/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf | | custom_httpd_dir=/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf |
| + | f_dbg=0 #Set to 1 to view the variabls content at the end. |
| clear | | clear |
| ######################### - Site ROOT - ##################################3 | | ######################### - Site ROOT - ##################################3 |
Line 253: |
Line 264: |
| esac | | esac |
| fi | | fi |
| + | |
| + | obd="$f_root" |
| + | clear |
| + | echo |
| + | echo "Do you want to modify open_basedir restriction?" |
| + | echo "Default give php access only to local siteroot (f_root)" |
| + | echo "Use with care, this is a security risk" |
| + | echo "(Y/N/Enter)" |
| + | echo ":" |
| + | read YESNO |
| + | case "$YESNO" in |
| + | "Y" | "y" ) |
| + | f_obd="1";; |
| + | "N" | "n" ) |
| + | f_obd="0";; |
| + | *) |
| + | f_obd="0";; |
| + | esac |
| + | |
| + | if [ "f_obd" = "1" ] |
| + | then |
| + | clear |
| + | |
| + | ANSWER=1 |
| + | while [ $ANSWER = 1 ] |
| + | do |
| + | clear |
| + | echo |
| + | echo "Please enter the directory you want to allow PHP can access." |
| + | echo "If you specify more than one, separate with \":\"" |
| + | echo "Example: /dir_one:/dir_two" |
| + | echo ":" |
| + | |
| + | read open_bd |
| + | if [ "$open_bd" != "" ] |
| + | then |
| + | obd=$open_bd |
| + | ANSWER=0 |
| + | else |
| + | clear |
| + | echo |
| + | echo "You have not provide a directory name. Hit enter to try again" |
| + | read x |
| + | fi |
| + | done |
| + | fi |
| + | |
| ###################### - CGI - ####################################### | | ###################### - CGI - ####################################### |
| clear | | clear |
Line 445: |
Line 503: |
| echo 'php_admin_value eaccelerator.enable 1' >> $c_file | | echo 'php_admin_value eaccelerator.enable 1' >> $c_file |
| fi | | fi |
| + | |
| + | echo "php_admin_value open_basedir $obd" >> $c_file |
| | | |
| fi | | fi |
Line 450: |
Line 510: |
| | | |
| clear | | clear |
− | # for debug only | + | #################- DEBUG -############################ |
− | # echo "$files_root" | + | if [ "$dbg" = "1" ] |
− | # echo "$f_root"
| + | then |
− | # echo "$alias_root"
| + | echo "$files_root" |
− | # echo "$a_root"
| + | echo "$f_root" |
− | # echo "$f_ssl"
| + | echo "$alias_root" |
− | # echo "$f_idx"
| + | echo "$a_root" |
− | # echo "$f_aov"
| + | echo "$f_ssl" |
− | # echo "$f_inc"
| + | echo "$f_idx" |
− | # echo "$php"
| + | echo "$f_aov" |
− | # echo "$f_fop"
| + | echo "$f_inc" |
− | # echo "$f_eac"
| + | echo "$php" |
− | # echo "$f_rgl"
| + | echo "$f_fop" |
− | # echo "$cgi"
| + | echo "$f_eac" |
− | # echo "$cgi_root"
| + | echo "$f_rgl" |
− | # echo "$c_root"
| + | echo "$cgi" |
− | # echo "$calias_root"
| + | echo "$cgi_root" |
− | # echo "$ca_root"
| + | echo "$c_root" |
− | # echo "$conf_name"
| + | echo "$calias_root" |
− | # echo "$c_name"
| + | echo "$ca_root" |
− | # echo "$custom_httpd_dir"
| + | echo "$conf_name" |
− | # echo "$c_file"
| + | echo "$c_name" |
− | # echo "$fopt"
| + | echo "$custom_httpd_dir" |
− | | + | echo "$c_file" |
| + | echo "$fopt" |
| + | echo "$f_obd" |
| + | echo "$open_bd" |
| + | echo "$obd" |
| + | fi |
| expand-template /etc/httpd/conf/httpd.conf | | expand-template /etc/httpd/conf/httpd.conf |
| /etc/init.d/httpd-e-smith restart | | /etc/init.d/httpd-e-smith restart |