Changeset 1522317
- Timestamp:
- 10/26/2016 09:49:57 AM (9 years ago)
- Location:
- ivguard
- Files:
-
- 3 added
- 2 edited
-
tags/1.2.2 (added)
-
tags/1.2.2/IVGuard.php (added)
-
tags/1.2.2/readme.txt (added)
-
trunk/IVGuard.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ivguard/trunk/IVGuard.php
r1471472 r1522317 5 5 Description: IVGuard is one of the most powerful protection and monitoring services for WordPress. You will be informed immediately for any changes and discrepancies in your website and our team will be always on standby to help you resolve any security threats. Have full control of your website once and for all. 6 6 Author: Ignite Vision Ltd 7 Version: 1.2. 17 Version: 1.2.2 8 8 Author URI: http://www.ignitevision.bg 9 9 */ … … 24 24 add_action('login_form', array('IVGuard', 'onLoginForm')); 25 25 add_action('password_reset', array('IVGuard', 'onPasswordReset'), 10, 2); 26 add_action('admin_post_ivguard_settings', array('IVGuard', 'setSettings')); 26 27 add_filter('login_redirect', array('IVGuard', 'onLoginRedirect'), 10, 3); 27 28 add_filter('authenticate', array('IVGuard', 'onAuthenticate'), 30, 3); … … 30 31 const CRAWLER = 'crawler.ivguard.net'; 31 32 const APIKEY = 'ivGuardKey'; 33 const API_VERIFY_IP = 'ivGuardAPIVerifyIP'; 32 34 const ALLOWED_IPS_KEY = 'ivGuardAllowedIPs'; 33 35 const WEBSITE = 'https://ivguard.net/'; … … 48 50 add_option(IVGuard::APIKEY, md5((rand(999, 9999) * rand(666, 6666)) + time())); 49 51 52 if(!get_option(IVGuard::API_VERIFY_IP)) 53 add_option(IVGuard::API_VERIFY_IP, 1); 54 50 55 if(!function_exists('dbDelta')) 51 56 require_once(ABSPATH.DIRECTORY_SEPARATOR.'wp-admin'.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'upgrade.php'); … … 120 125 $wpdb->query('DROP TABLE IF EXISTS `'.$wpdb->prefix.IVGuard::DB_TABLE_LOGIN_FAIL.'`'); 121 126 delete_option(IVGuard::APIKEY); 127 delete_option(IVGuard::API_VERIFY_IP); 122 128 } 123 129 … … 146 152 echo ' <div class="welcome-panel" style="background-color:rgba(255,255,255,.5)">'; 147 153 echo ' <h2>Activation</h2>'; 148 echo ' <p style="font-size:1.1em">To start the monitoring process copy the following code, and paste it in the Activation Code field on the "Secure Site" Tab. Remember you must be registered and logged in <a target="_blank" href="'.IVGuard::WEBSITE.'">'.IVGuard::WEBSITE.'</a> before you proceed with this step.</p>'; 154 echo ' <hr>'; 155 echo ' <p style="font-size:1.1em">'; 156 echo ' To start the monitoring process copy the following code, and paste it in the Activation Code field on the "Secure Site" Tab. Remember you must be registered and logged in <a target="_blank" href="'.IVGuard::WEBSITE.'">'.IVGuard::WEBSITE.'</a> before you proceed with this step.'; 157 echo ' <br><br><b>Never share this activation code with anyone else</b>'; 158 echo ' </p>'; 149 159 echo ' <label for="activationCode">Activation Code:</label>'; 150 160 echo ' <textarea id="activationCode" style="width:100%" readonly>' . $activationCode . '</textarea>'; 151 161 echo ' <p style="text-align:center"><button data-clipboard-target="#activationCode" class="button">Copy To Clipboard</button></p>'; 152 162 echo ' </div>'; 163 echo ' <div class="welcome-panel" style="background-color:rgba(255,255,255,.5)">'; 164 echo ' <h2>Settings</h2>'; 165 echo ' <hr>'; 166 echo ' <label for="apiVerifyIp">Enable requests behind proxy</label>'; 167 echo ' <select id="apiVerifyIp" name="apiVerifyIp">'; 168 echo ' <option value="1">No</option>'; 169 echo ' <option value="0"'.(get_option(IVGuard::API_VERIFY_IP, 1) == 0 ? ' selected' : null).'>Yes</option>'; 170 echo ' </select>'; 171 echo ' <p style="font-size:1.1em">If your website is running behind a proxy like CloudFlare or this is not your IP address <b>'.$_SERVER['REMOTE_ADDR'].'</b> you need to set this option to "Yes".</p>'; 172 echo ' </div>'; 153 173 echo '</div>'; 154 174 echo '<script>'; 155 175 echo 'jQuery(function() {'; 156 echo 'jQuery("body").css({"background-image":"url('.IVGuard::getLogo().')","background-size":"80%","background-repeat":"no-repeat","background-position":"center 10vh","background-attachment":"fixed"});'; 157 echo 'new Clipboard("button[data-clipboard-target]");'; 176 echo ' jQuery("body").css({"background-image":"url('.IVGuard::getLogo().')","background-size":"80%","background-repeat":"no-repeat","background-position":"center 10vh","background-attachment":"fixed"});'; 177 echo ' new Clipboard("button[data-clipboard-target]");'; 178 echo ' jQuery("select#apiVerifyIp").on("change", function() {'; 179 echo ' jQuery.post("'.admin_url('admin-post.php').'", {action: "ivguard_settings", '.IVGuard::API_VERIFY_IP.': jQuery(this).val()});'; 180 echo ' });'; 158 181 echo '})'; 159 182 echo '</script>'; 183 } 184 185 public static function setSettings() { 186 if(array_key_exists(IVGuard::API_VERIFY_IP, $_POST) && in_array($_POST[IVGuard::API_VERIFY_IP], array(0, 1))) 187 update_option(IVGuard::API_VERIFY_IP, $_POST[IVGuard::API_VERIFY_IP]); 160 188 } 161 189 … … 360 388 361 389 public static function authorize() { 362 if(!in_array($_SERVER['REMOTE_ADDR'], IVGuard::getAllowedIPs())) 363 throw new Exception('Unauthorized actions have been detected! [BAD IP]'); 390 if(get_option(IVGuard::API_VERIFY_IP, 1) != 0) { 391 if(!in_array($_SERVER['REMOTE_ADDR'], IVGuard::getAllowedIPs())) 392 throw new Exception('Unauthorized actions have been detected! [BAD IP]'); 393 } 364 394 if(!($ivGuardKey = get_option(IVGuard::APIKEY))) 365 395 throw new Exception('Unauthorized actions have been detected! [NO KEY]'); … … 375 405 if(!$data) { 376 406 $allowedIPs = dns_get_record(IVGuard::CRAWLER, DNS_A + DNS_AAAA); 377 if(!is_array($allowedIPs) )407 if(!is_array($allowedIPs) || empty($allowedIPs)) 378 408 throw new Exception('Unable to get a list with allowed IP addresses! [DNS Error]'); 379 409 array_walk($allowedIPs, function(&$item, $key) { $item = $item['type'] == 'A' ? $item['ip'] : $item['ipv6']; }); 380 $data = array('expire' => time() + 3 600, 'allowedIPs' => $allowedIPs);410 $data = array('expire' => time() + 300, 'allowedIPs' => $allowedIPs); 381 411 update_option(IVGuard::ALLOWED_IPS_KEY, json_encode($data)); 382 412 } -
ivguard/trunk/readme.txt
r1471472 r1522317 4 4 Tags: security, secure, protection, protect, prevention, guard, monitoring, backup, ban, block, bots, hack, anti-virus, malware, attack, injection, brute-force 5 5 Requires at least: 4.4 6 Tested up to: 4.6 7 Stable tag: 1.2. 16 Tested up to: 4.6.1 7 Stable tag: 1.2.2 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 96 96 == Changelog == 97 97 98 = 1.2.2 = 99 * Add - Option to disable IP verification (for the API Requests) 100 98 101 = 1.2.1 = 99 102 * Add - DNS Cache
Note: See TracChangeset
for help on using the changeset viewer.