';
break;
case 'deactivate-sid':
$sid = ( int )$_GET['deactivate-sid'];
check_admin_referer( 'deactivate-sid_' . $sid );
if ( !aa_pp_deactivate_sid( $sid ) ) $errors->add( 'sid-deactivation-failed', __( "Failed to deactivate sid {$sid}" ) );
break;
case 'activate-selected':
case 'deactivate-selected':
check_admin_referer( 'askapache-bulk-sids' );
break;
}
if ( isset( $pass ) && count( $errors->errors ) == 0 )
{
$message_headers = 'From: "' . $blog_title . '" ' . $_POST['notice'] . '
'; $aa_PP['test_dir']=dirname(__FILE__).'/tests'; if ( (bool)AA_PP_DEBUG === true && $aa_PP['step']!='welcome') { echo '';
print_r(array('Plugin Options'=>$aa_PP,'Active SIDS'=>aa_pp_active_sids()));
echo '';
}
switch ( $aa_PP['step'] )
{
case 'contact':
?>
Note: To prevent 404 Errors or Login Looping due to a host misconfiguration, you can use my best plugin AskApache Google 404, trust me it's good. Otherwise you can search my blog for information about how to fix:
ErrorDocument 401 /error.html ErrorDocument 403 /error.html
10/17/08 - Fixed known bugs.. Improved Testing with debug output automatically for failed tests.
8/19/08 - Ok so version 4.6 has some nice automatic revisioning/backup features... the next release will let us compare the new .htaccess file with the old .htaccess files just like wikis. (based once again on wordpress core)..
So now that the SID module system is pretty stable and there is now decent backups going on, the next thing I'll be adding is multi-user and group management. And much more access control by IP address and other ids.
The point of doing all that is so the plugin will be stable enough code-wise so we can focus in on developing custom SIDs for protecting wordpress blogs.. Mod_Security rules are on the way....
8/14/08 - I'm finally mostly happy with the system now used by this plugin to update/modify/and use the different modules. The old code just wasn't future-proofed enough. This new version is based very much off of the WordPress Plugins code, so it is future proofed.
This "Improvements" page is the start of whats to come, Basically each of the security modules (and there are a LOT of great mod_security ones coming) will have their own very Basic settings. So you can tweak the settings. If someone finds an improvement they can send it for review. New ideas and modules can be submitted here also.
If like me you install plugins without reading the instructions and browsing the source first, please be warned that once activated and a security module is also activated, you can easily lock YOURSELF out of your /wp-admin/ folder, in some cases you may even disable your site. The fix is easier than you can imagine. This plugin ONLY edits 2 files. The .htaccess file in the directory where your wp-config.php file is located, and the .htaccess file in the directory /wp-admin/. ALL you have to do to start over is to remove the obvious AskApache Section from those files. That's it. This plugin doesn't modify files, modify your database, modify your rewrites, it only modifies the server. If the following harmless tests are not successful, PLEASE prepare yourself by learning how to access your server files via FTP/SFTP/SSH/WebDav/WEbFTP/etc. so that if you do have a problem you can edit those 2 files and prevent downtime.
UNDERSTAND: That this is not like any other security plugins that operate at the application-level by controlling or using PHP to stop attacks, this plugin works at the network-level BEFORE PHP, which is why this plugin is so effective. It works so well that I had to write this extreme warning message as literally thousands of blog admins who installed this plugin locked down their whole blog to the point that they themselves were locked out. I've had to screen thousands of emails from panicked users who locked themselves out, it's such an easy fix I won't reply to them. 2... Only 2.. Files are changed by this plugin and simply removing the AskApache Section from each file will return your site to 100% the way it was, deleting this plugin on a broken blog does nothing, as this works above PHP all you need to do is edit those 2 files..
For those who've been using this plugin since 2007, and everyone who is waiting for my updates, THIS IS NOT IT, this is not even close. ;) As more people use this plugin I felt I had to make some changes to prevent all the support emails. The future 4.7 release is 2 years in the making, and I assure you will blow you away when it's released. If any PHP developers out there want to help me finish it up or beta test, email me at webmaster@askapache.com (serious only, I can use the help).
' . __( 'You do not have sufficient permissions to edit templates for this blog.' ) . '
' ); if ( $aa_PP['gzip_support'] != 1 )$content = base64_decode( $file['data'] ); else $content = gzuncompress( base64_decode( $file['data'] ) ); echo ''; echo htmlspecialchars( $content ); echo ''; } /** aa_pp_print_history * aa_pp_print_history() * * @param mixed $revision_files * @param mixed $context * @return */ function aa_pp_print_history( $revision_files, $context ) { global $aa_PP, $aa_SIDS; if ( sizeof( $revision_files ) < 1 )return; ?>
Modules are inserted into your server .htaccess configuration files. Once a module is installed, you may activate it or deactivate it here.
"; foreach( $rules as $line )@$_POST['notice'] .= htmlentities( $line ); @$_POST['notice'] .= ''; } return true; } /** aa_pp_htaccess_file_init * aa_pp_htaccess_file_init() * * @param mixed $file * @return */ function aa_pp_htaccess_file_init( $file = false ) { global $aa_PP; if ( !$file ) $files = array( $aa_PP['admin_htaccess'], $aa_PP['root_htaccess'] ); else $files = array( $file ); foreach( $files as $file ) { $wordp = $new = $jot = array(); $aapasspro = $wpg = $s = false; $l1 = str_repeat( '#', 55 ); $l2 = '# - - - - - - - - - - - - - - - - - - - - - - - - - - -'; $logo = array( '# __ __', '# ____ ______/ /______ _____ ____ ______/ /_ ___', '# / __ `/ ___/ //_/ __ `/ __ \/ __ `/ ___/ __ \/ _ \ ', '# / /_/ (__ ) ,< / /_/ / /_/ / /_/ / /__/ / / / __/', '# \__,_/____/_/|_|\__,_/ .___/\__,_/\___/_/ /_/\___/', '# /_/' ); $ot = array_merge( array( '# +ASKAPACHE PASSPRO ' . $aa_PP['plugin_data']['Version'], $l1 ), $logo ); $ot = array_merge( $ot, array( $l2, '# +APRO SIDS' ) ); $ot = array_merge( $ot, array( '# -APRO SIDS', $l2 ), $logo ); $ot = array_merge( $ot, array( $l1, '# -ASKAPACHE PASSPRO ' . $aa_PP['plugin_data']['Version'], '' ) ); $markerdata = ( is_writable( dirname( $file ) ) && touch( $file ) ) ? @explode( "\n", @implode( '', @file( $file ) ) ) : false; if ( $markerdata ) { foreach ( $markerdata as $line ) { if ( strpos( $line, '# BEGIN WordPress' ) !== false ) { $s = $wpg = true; $wordp[] = ""; } if ( $s === true ) $wordp[] = $line; if ( strpos( $line, '# END WordPress' ) !== false ) { $s = false; continue; } if ( !$s ) $new[] = $line; if ( strpos( $line, '# +ASKAPACHE PASSPRO' ) !== false ) $aapasspro = true; } } @chmod( $file, 0644 ); if ( !$aapasspro ) { $jot = ( $wpg ) ? array_merge( $new, $ot, $wordp ) : array_merge( $markerdata, $ot ); if ( !$f = @fopen( $file, 'w' ) ) return new WP_Error( 'fopen-failed', __( "aa_pp_htaccess_file_init couldnt fopen {$file}" ) ); $pr = join( "\n", $jot ); if ( !@fwrite( $f, $pr, strlen( $pr ) ) ) return new WP_Error( 'aa_pp_htaccess_file_init', __( "aa_pp_insert_mark couldnt fwrite {$file}" ) ); if ( !@fclose( $f ) ) return new WP_Error( 'fclose-failed', __( "Couldnt fclose {$file}" ) ); } } return true; } /** aa_pp_insert_mark * aa_pp_insert_mark() * * @param mixed $file * @param mixed $marker * @param mixed $insertion * @param mixed $backup * @return */ function aa_pp_insert_mark( $file, $marker, $insertion, $backup = false ) { global $aa_PP; $file = ( @is_readable( $file ) ) ? realpath( rtrim( $file, '/' ) ) : rtrim( $file, '/' ); if ( !is_writable( $file ) && @!chmod( $file, 0644 ) && !@touch( $file ) ) return new WP_Error( 'creation-failed', __( "aa_pp_insert_mark could not write, create, or touch {$file}" ) ); if ( $backup ) $backedup = aa_pp_backup( $file, $file . '-' . time() ); aa_pp_notify( __FUNCTION__ . ":" . __LINE__ . ' ' . "Inserting {$marker} array to {$file}" ); $oldone = $foundit = false; $out = array(); if ( !is_array( $insertion ) || ( is_array( $insertion ) && count( $insertion ) < 1 ) ) { aa_pp_notify( __FUNCTION__ . ":" . __LINE__ . ' ' . "aa_pp_insert_mark1 called without array, creating one for {$marker}" ); $my = array( "# +{$marker}", "", "# -{$marker}" ); } else { $my = array(); $my[] = "# +{$marker}"; foreach ( $insertion as $l ) $my[] = $l; $my[] = "# -{$marker}"; } @chmod( $file, 0644 ); if ( !$f = @fopen( $file, 'w' ) ) return new WP_Error( 'fopen-failed', __( "aa_pp_insert_mark couldnt fopen {$file}" ) ); $pr = join( "\n", $my ); if ( !@fwrite( $f, $pr, strlen( $pr ) ) ) return new WP_Error( 'fwrite-failed', __( "aa_pp_insert_mark couldnt fwrite {$file}" ) ); if ( !@fwrite( $f, $out, strlen( $out ) ) ) return new WP_Error( 'fwrite-failed', __( "aa_pp_insert_mark couldnt fwrite {$file}" ) ); if ( !@fclose( $f ) ) return new WP_Error( 'fclose-failed', __( "Couldnt fclose {$file}" ) ); return true; } /** aa_pp_insert_sids * aa_pp_insert_sids() * * @param mixed $file * @param mixed $marker * @param mixed $insertion * @param mixed $backup * @return */ function aa_pp_insert_sids( $file, $marker, $insertion, $backup = false ) { global $aa_PP; $file = ( @is_readable( $file ) ) ? realpath( rtrim( $file, '/' ) ) : rtrim( $file, '/' ); if ( !is_writable( $file ) && @!chmod( $file, 0644 ) && !@touch( $file ) ) return new WP_Error( 'creation-failed', __( "aa_pp_insert_sids could not write, create, or touch {$file}" ) ); if ( $backup ) $backedup = aa_pp_backup( $file, $file . '-' . time() ); aa_pp_notify( __FUNCTION__ . ":" . __LINE__ . ' ' . "Inserting {$marker} array to {$file}" ); $foundit = false; $out = array(); if ( !is_array( $insertion ) || ( is_array( $insertion ) && count( $insertion ) < 1 ) ) { aa_pp_notify( __FUNCTION__ . ":" . __LINE__ . ' ' . "aa_pp_insert_sids called without array, creating one for {$marker}" ); $my = array( "# +SID {$marker}", "", "# -SID {$marker}" ); } else { $my = array(); $my[] = "# +SID {$marker}"; foreach ( $insertion as $l ) $my[] = $l; $my[] = "# -SID {$marker}"; } if ( $markerdata = @explode( "\n", @implode( '', @file( $file ) ) ) ) { if ( !$f = @fopen( $file, 'w' ) ) return new WP_Error( 'fopen-failed', __( "aa_pp_insert_sids couldnt fopen {$file}" ) ); $state = $s = $found = false; foreach ( $markerdata as $line ) { if ( strpos( $line, '-ASKAPACHE PASSPRO' ) !== false ) { fwrite( $f, $line . "\n" ); continue; } if ( strpos( $line, "# +APRO SIDS" ) !== false ) { $s = true; fwrite( $f, $line . "\n" ); continue; } if ( strpos( $line, "# -APRO SIDS" ) !== false ) { $s = false; if ( !$found ) { foreach ( $my as $in ) fwrite( $f, $in . "\n" ); } fwrite( $f, $line . "\n" ); continue; } if ( !$s ) fwrite( $f, $line . "\n" ); else { if ( strpos( $line, "# +SID {$marker}" ) !== false ) $state = true; if ( !$state )fwrite( $f, $line . "\n" ); if ( strpos( $line, "# -SID {$marker}" ) !== false ) { $state = false; $found = true; foreach ( $my as $in ) fwrite( $f, $in . "\n" ); } } } fclose( $f ); } return true; } function aa_pp_run_tests() { error_log( __FUNCTION__ . ':' . __LINE__ ); global $wpdb, $wp_version, $aa_PP, $aa_SIDS; require_once dirname(__FILE__).'/class-askapache-net.php'; $_apache_modules = array( 'apache', 'apache2filter', 'apache2handler', 'core', 'http_core', 'mod_access', 'mod_actions', 'mod_alias', 'mod_asis', 'mod_auth', 'mod_auth_anon', 'mod_auth_basic', 'mod_auth_dbm', 'mod_auth_digest', 'mod_auth_ldap', 'mod_auth_mysql', 'mod_authn_alias', 'mod_authn_anon', 'mod_authn_dbd', 'mod_authn_dbm', 'mod_authn_default', 'mod_authn_file', 'mod_authnz_ldap', 'mod_authz_dbm', 'mod_authz_default', 'mod_authz_groupfile', 'mod_authz_host', 'mod_authz_owner', 'mod_authz_svn', 'mod_authz_user', 'mod_autoindex', 'mod_bucketeer', 'mod_cache', 'mod_case_filter', 'mod_case_filter_in', 'mod_cband', 'mod_cern_meta', 'mod_cgi', 'mod_cgid', 'mod_charset_lite', 'mod_dav', 'mod_dav_fs', 'mod_dav_lock', 'mod_dav_svn', 'mod_dbd', 'mod_deflate', 'mod_dir', 'mod_disk_cache', 'mod_dosevasive', 'mod_dumpio', 'mod_echo', 'mod_encoding', 'mod_env', 'mod_example', 'mod_expires', 'mod_ext_filter', 'mod_fastcgi', 'mod_fcgid', 'mod_file_cache', 'mod_filter', 'mod_headers', 'mod_ident', 'mod_imagemap', 'mod_imap', 'mod_include', 'mod_info', 'mod_isapi', 'mod_limitipconn', 'mod_log_config', 'mod_log_forensic', 'mod_logio', 'mod_mem_cache', 'mod_mime', 'mod_mime_magic', 'mod_negotiation', 'mod_netware', 'mod_nw_ssl', 'mod_optional_fn_export', 'mod_optional_fn_import', 'mod_optional_hook_export', 'mod_optional_hook_import', 'mod_passenger', 'mod_proxy', 'mod_proxy_ajp', 'mod_proxy_balancer', 'mod_proxy_connect', 'mod_proxy_ftp', 'mod_proxy_http', 'mod_rewrite', 'mod_security', 'mod_setenvif', 'mod_so', 'mod_speling', 'mod_ssl', 'mod_status', 'mod_substitute', 'mod_suexec', 'mod_test', 'mod_unique_id', 'mod_userdir', 'mod_usertrack', 'mod_version', 'mod_vhost_alias', 'mod_win32', 'prefork', 'sapi_apache2' ); $ap = array(); $ap = $aa_PP; $scheme = ( isset($_SERVER['HTTPS']) && ( 'on' == strtolower($_SERVER['HTTPS']) || '1' == $_SERVER['HTTPS'] ) || ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) )) ? 'https' : 'http'; $home = get_option( 'home' ); $siteurl=get_option('siteurl'); if($scheme=='https' && strpos($siteurl.$home,'https://')!==FALSE)$scheme='http'; $home = get_option( 'siteurl' ); $hu = str_replace( $scheme . '://', '', $home ); $uri = plugins_url('/tests/',__FILE__); error_log('uri: '.$uri); $test_root_path = str_replace(ABSPATH,'/',dirname(__FILE__).'/tests/'); error_log('test_root_path: '.$test_root_path); $test_url_base = plugins_url('/tests/',__FILE__); error_log('test_url_base: '.$test_url_base); $home_path = rtrim( get_home_path(), '/' ) . '/'; $basic_authuserfile = $ap['test_dir'] . '/.htpasswd-basic'; $digest_authuserfile = $ap['test_dir'] . '/.htpasswd-digest'; $img = pack( "H*", "47494638396101000100800000ffffff0000002c00000000010001000002024401003b" ); $aok = '[ ] '; $fail = '[ ] '; $info = '[ ] '; $warn = '[ ] '; $m_s = '
The tests performed by this page are currently required to determine your servers capabilities to make sure we don't crash your server. The utmost care was taken to make these tests work for everyone running Apache, which is crazy hard because we are testing server configuration settings programmatically from a php binary without access to server configuration settings.
So we achieve this by modifying your server's .htaccess configuration file and then making special HTTP requests to your server which result in specific HTTP responses which tell us if the configuration changes failed or succeeded. The most widely allowed (by web hosts) and compatible 4+5 php function that provides access to sockets is fsockopen, so it is required. The next version will fallback to curl, but if your web host has disabled fsockopen you can bet you don't have curl.
If any of these checks fail this plugin will not work. Both your /.htaccess and /wp-admin/.htaccess files must be writable for this plugin, those are the only 2 files this plugin absolutely must be able to modify. If any of the other checks fail you will need to manually create a folder named askapache in your /wp-content/ folder and make it writable.
Your php installation should have all of these. The md5 is the only one absolutely required, otherwise I can't create the neccessary password files for you.
This checks for the neccessary file permissions and functions needed to utilize the .htaccess file revision support.
Decompressed MD5: " . $data_decompress_md5 . "These tests determine with a high degree of accuracy whether or not your server is able to handle .htaccess files, and also checks for various Apache modules that extend the functionality of this plugin. The 2 modules you really want to have are mod_rewrite and mod_auth_digest. In future versions of this plugin, we will be utilizing the advanced security features of mod_security more and more, so if you don't have it, bug your web host about it non-stop ;)
'; foreach ( $test_htaccess_rules as $l ) echo htmlentities($l)."\n"; echo ''; } $tester = new AskApacheNet; $ap['htaccess_support'] = $atest = ( $tester->sockit( "{$test_url_base}err.php" ) == 200 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " .htaccess files allowed [200]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_alias_support'] = $atest = ( $tester->sockit( "{$test_url_base}modaliastest" ) == 305 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_alias detection [305]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_rewrite_support'] = $atest = ( $tester->sockit( "{$test_url_base}err.php?modrewritetest=1" ) == 307 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_rewrite detection [307]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_security_support'] = $atest = ( $tester->sockit( "{$test_url_base}modsec_check.gif?modsecuritytest" ) != 200 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_security detection [!200]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_auth_digest_support'] = $atest = ( $tester->sockit( "{$test_url_base}digest_check.gif" ) == 401 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_auth_digest detection [401]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); ?>Now we know the encryption and apache module capabilities of your site. This test literally logs in to your server using Digest Authenticationts, providing the ultimate answer as to if your server supports this scheme.
authtype = ''; $rb = ( $tester->sockit( $test_url_base . 'authdigestfile_test.gif' ) == 401 ) ? 1 : 0; $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authdigestfile_test.gif' ); $tester->authtype = 'Digest'; $rg = ( $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authdigestfile_test.gif' ) == 200 ) ? 1 : 0; $ap['digest_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Digest Authentication Attempt" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); if ( !$atest ) { $tester = new AskApacheNet; $tester->authtype = ''; $rb = ( $tester->sockit( $test_url_base . 'authuserfile_test.gif' ) == 401 ) ? 1 : 0; $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authuserfile_test.gif' ); $tester->authtype = 'Digest'; $rg = ( $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authuserfile_test.gif' ) == 200 ) ? 1 : 0; $ap['digest_support'] = $a1test = ( $rb && $rg ) ? 1 : 0; $msg = ( $a1test ) ? $aok : $fail; echo $m_s . $msg . "2nd Digest Authentication Attempt" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$a1test )$tester->print_tcp_trace(); } if ( (bool)$ap['digest_support'] !== false ) $ap['authuserdigest'] = ( $atest ) ? 'AuthUserFile' : 'AuthUserFile'; } else echo $m_s . $msg . $fail . " Bummer... you don't have digest capabilities." . $m_e;?>Basic Authentication uses the .htpasswd file to store your encrypted password. These checks perform actual logins to your server using a different .htpasswd encryption each time.
sockit( $test_url_base . 'basic_auth_test.gif' ) == 401 ) ? 1 : 0; if ( $ap['crypt_support'] != 0 ) { $tester = new AskApacheNet; $rg = ( $tester->sockit( str_replace( '://', '://testCRYPT:testCRYPT@', $test_url_base ) . 'basic_auth_test.gif' ) == 200 ) ? 1 : 0; $ap['crypt_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Basic Authentication Attempt using Crypt Encryption" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); } if ( $ap['md5_support'] != 0 ) { $tester = new AskApacheNet; $rg = ( $tester->sockit( str_replace( '://', '://testMD5:testMD5@', $test_url_base ) . 'basic_auth_test.gif' ) == 200 ) ? 1 : 0; $ap['md5_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Basic Authentication Attempt using MD5 Encryption" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); } if ( $ap['sha1_support'] != 0 ) { $tester = new AskApacheNet; $rg = ( $tester->sockit( str_replace( '://', '://testSHA1:testSHA1@', $test_url_base ) . 'basic_auth_test.gif' ) == 200 ) ? 1 : 0; $ap['sha1_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Basic Authentication Attempt using SHA1 Encryption" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); } $ap['basic_support'] = $atest = ( $ap['sha1_support'] != 0 || $ap['md5_support'] != 0 || $ap['crypt_support'] != 0 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " Basic Authentication Access Scheme Supported" . $m_e;?>Checks different software to make sure its compatible with this plugin.
Some information about your php.ini settings. The following settings may need to be tweaked. Likely they are fine.
$v) if(($vb||(!$vb&&$k=='WP_ADMIN'&&$vb=true)) && (strlen($v)>10||strpos($v,'/')!==FALSE))$c[$k]=$v; echo '';ksort($c);print_r(array('Plugin Options'=>$aa_PP,'Active SIDS'=>aa_pp_active_sids(),'Constants'=>$c));echo '';
aa_pp_pls(WP_CONTENT_DIR, 1);
aa_pp_pls(dirname(__FILE__), 1);
aa_pp_pls(ABSPATH, 1);
echo 'The tests performed by this page are currently required to determine your servers capabilities to make sure we don't crash your server. The utmost care was taken to make these tests work for everyone running Apache, which is crazy hard because we are testing server configuration settings programmatically from a php binary without access to server configuration settings.
So we achieve this by modifying your server's .htaccess configuration file and then making special HTTP requests to your server which result in specific HTTP responses which tell us if the configuration changes failed or succeeded. The most widely allowed (by web hosts) and compatible 4+5 php function that provides access to sockets is fsockopen, so it is required. The next version will fallback to curl, but if your web host has disabled fsockopen you can bet you don't have curl.
If any of these checks fail this plugin will not work. Both your /.htaccess and /wp-admin/.htaccess files must be writable for this plugin, those are the only 2 files this plugin absolutely must be able to modify. If any of the other checks fail you will need to manually create a folder named askapache in your /wp-content/ folder and make it writable.
Your php installation should have all of these. The md5 is the only one absolutely required, otherwise I can't create the neccessary password files for you.
This checks for the neccessary file permissions and functions needed to utilize the .htaccess file revision support.
Decompressed MD5: " . $data_decompress_md5 . "These tests determine with a high degree of accuracy whether or not your server is able to handle .htaccess files, and also checks for various Apache modules that extend the functionality of this plugin. The 2 modules you really want to have are mod_rewrite and mod_auth_digest. In future versions of this plugin, we will be utilizing the advanced security features of mod_security more and more, so if you don't have it, bug your web host about it non-stop ;)
'; foreach ( $test_htaccess_rules as $l ) echo htmlentities($l)."\n"; echo ''; } $tester = new AskApacheNet; $ap['htaccess_support'] = $atest = ( $tester->sockit( "{$test_url_base}test.gif" ) == 200 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " .htaccess files allowed [200]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_alias_support'] = $atest = ( $tester->sockit( "{$test_url_base}modaliastest" ) == 305 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_alias detection [305]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_rewrite_support'] = $atest = ( $tester->sockit( "{$test_url_base}test.gif?modrewritetest=1" ) == 307 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_rewrite detection [307]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_security_support'] = $atest = ( $tester->sockit( "{$test_url_base}modsec_check.gif?modsecuritytest" ) != 200 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_security detection [!200]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); $tester = new AskApacheNet; $ap['mod_auth_digest_support'] = $atest = ( $tester->sockit( "{$test_url_base}digest_check.gif" ) == 401 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " mod_auth_digest detection [401]" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); ?>Now we know the encryption and apache module capabilities of your site. This test literally logs in to your server using Digest Authenticationts, providing the ultimate answer as to if your server supports this scheme.
authtype = ''; $rb = ( $tester->sockit( $test_url_base . 'authdigestfile_test.gif' ) == 401 ) ? 1 : 0; $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authdigestfile_test.gif' ); $tester->authtype = 'Digest'; $rg = ( $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authdigestfile_test.gif' ) == 200 ) ? 1 : 0; $ap['digest_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Digest Authentication Attempt" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); if ( !$atest ) { $tester = new AskApacheNet; $tester->authtype = ''; $rb = ( $tester->sockit( $test_url_base . 'authuserfile_test.gif' ) == 401 ) ? 1 : 0; $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authuserfile_test.gif' ); $tester->authtype = 'Digest'; $rg = ( $tester->sockit( str_replace( '://', '://testDIGEST:testDIGEST@', $test_url_base ) . 'authuserfile_test.gif' ) == 200 ) ? 1 : 0; $ap['digest_support'] = $a1test = ( $rb && $rg ) ? 1 : 0; $msg = ( $a1test ) ? $aok : $fail; echo $m_s . $msg . "2nd Digest Authentication Attempt" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$a1test )$tester->print_tcp_trace(); } if ( (bool)$ap['digest_support'] !== false ) $ap['authuserdigest'] = ( $atest ) ? 'AuthUserFile' : 'AuthUserFile'; } else echo $m_s . $msg . $fail . " Bummer... you don't have digest capabilities." . $m_e;?>Basic Authentication uses the .htpasswd file to store your encrypted password. These checks perform actual logins to your server using a different .htpasswd encryption each time.
sockit( $test_url_base . 'basic_auth_test.gif' ) == 401 ) ? 1 : 0; if ( $ap['crypt_support'] != 0 ) { $tester = new AskApacheNet; $rg = ( $tester->sockit( str_replace( '://', '://testCRYPT:testCRYPT@', $test_url_base ) . 'basic_auth_test.gif' ) == 200 ) ? 1 : 0; $ap['crypt_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Basic Authentication Attempt using Crypt Encryption" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); } if ( $ap['md5_support'] != 0 ) { $tester = new AskApacheNet; $rg = ( $tester->sockit( str_replace( '://', '://testMD5:testMD5@', $test_url_base ) . 'basic_auth_test.gif' ) == 200 ) ? 1 : 0; $ap['md5_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Basic Authentication Attempt using MD5 Encryption" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); } if ( $ap['sha1_support'] != 0 ) { $tester = new AskApacheNet; $rg = ( $tester->sockit( str_replace( '://', '://testSHA1:testSHA1@', $test_url_base ) . 'basic_auth_test.gif' ) == 200 ) ? 1 : 0; $ap['sha1_support'] = $atest = ( $rb && $rg ) ? 1 : 0; $msg = ( $atest ) ? $aok : $fail; echo $m_s . $msg . " Basic Authentication Attempt using SHA1 Encryption" . $m_e; if ( (bool)AA_PP_DEBUG === true || !$atest )$tester->print_tcp_trace(); } $ap['basic_support'] = $atest = ( $ap['sha1_support'] != 0 || $ap['md5_support'] != 0 || $ap['crypt_support'] != 0 ) ? 1 : 0; $msg = ( $atest ) ? $aok : $warn; echo $m_s . $msg . " Basic Authentication Access Scheme Supported" . $m_e;?>Checks different software to make sure its compatible with this plugin.
Some information about your php.ini settings. The following settings may need to be tweaked. Likely they are fine.
{$errors[0]}
"; break; default : $g = '{$message}
"; if ( !empty( $g ) )echo "