AgilisIT
Forum Replies Created
-
Hey guys
So this is due to the security implemented with CloudFlare’s Free Universal SSL and lack of those ciphers being turned on by default in certain cURL versions.
Please see my post here for a proper fix and ref URL: https://ww.wp.xz.cn/support/topic/unknown-error-log-ssl-connect-error-error-35?replies=8#post-8253831
Cheers
-KeithForum: Plugins
In reply to: [Broken Link Checker] Unknown Error : Log: SSL connect error [Error #35]Oh and full ref to the how and why: https://www.reddit.com/r/Wordpress/comments/35tdo7/ecdsa_ssl_curl_oneline_fix_for_cloudlares/
Forum: Plugins
In reply to: [Broken Link Checker] Unknown Error : Log: SSL connect error [Error #35]Hi guys
We ended up implementing a fix for this. It’s to do with cURL on the hosting system, and the security implemented by CF. You’ll find that this error is also present in BackWPUp and similar plugins that scrape the site.
I’ll be releasing our whole security plugin soon, just refining it a bit more first, but here’s some code snippets you can put in your own plugin:
$ciphersArrayOpenSSL = array( 'HIGH', // NEED PROPER LIST '!3DES', '!aNULL', '!MD5', '!DSS', '!CAMELLIA' ); $ciphersArrayNSS = array( // Add 384 bit variants here if supported by your cURL 'ecdhe_ecdsa_aes_128_gcm_sha_256', 'ecdhe_rsa_aes_128_gcm_sha_256', 'ecdhe_rsa_aes_256_sha' // Add fallback like rsa_aes_256_sha here for PayPal IPN etc if required ); function agilisit_ssl_fix($ch) { global $ciphersArrayNSS, $ciphersArrayOpenSSL; /* Bail if no curl handle */ if(! $ch) return; $curl_ver = curl_version(); if (stripos($curl_ver['ssl_version'], 'openssl') === false) { /* NSS */ curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, implode(',', $ciphersArrayNSS)); } else { /* OpenSSL */ curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, implode(':', $ciphersArrayOpenSSL)); } /* Remove SSL v1-3 */ /* Ref https://gist.github.com/franz-josef-kaiser/260bd3d19cffd4a61fa9 */ if (! defined( 'CURL_SSLVERSION_TLSv1_0') || ! defined( 'CURL_SSLVERSION_TLSv1_1') || ! defined( 'CURL_SSLVERSION_TLSv1_2')) return; curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_TLSv1_0); } add_action('http_api_curl', 'agilisit_ssl_fix');Cheers
-KeithForum: Plugins
In reply to: [Broken Link Checker] Unknown Error : Log: SSL connect error [Error #35]Same issue here. Repro case:
1. Site on CloudFlare
2. Site set to force HTTPS in .htaccess
2. SSL certificate provided by CloudFlare’s free SSL service.Note not all URLs fail. About 1 in 20 come up with “Unknown error” no matter what API is used.
Log: SSL connect error [Error #35]
=== (No response) ===Response headers
================Link is broken.
When I try a wget from the host via SSH, it works fine. Not sure what is going on here.
Thanks
Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportHey Viktor,
Sht nice work.
Yeah we log to syslog using
if(defined('LOG_AUTHPRIV')) { openlog('wordpress(' . $_SERVER['HTTP_HOST'] . ')', LOG_NDELAY|LOG_PID, LOG_AUTHPRIV); } else { openlog('wordpress(' . $_SERVER['HTTP_HOST'] . ')', LOG_NDELAY|LOG_PID, LOG_AUTH); } syslog(LOG_NOTICE, $message); closelog();I think we may need to FOSS our plugin soon so we can collaborate on it.
Currently out list of support is:
- Alert admin on different attack options, eg: blocked user/useragent/IP or successful login
- Block commonly spammed usernames like ‘test’ and ‘admin’ – customisable list
- Block known bad user-agents such as “Go 1.1 package http” and more
- Block IPs that other hosting instances on the server have banned for repeated failed logins
- Block XMLRPC attacks
Cheers
Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportHey
Ah okay so yeah as others have pointed out, it’s a whole different game at that point.
Viktor’s last link will work really well if you only have one CF account, however if this is for a multi-user site, the solution will not work. The key in what he has though, is making WP failed logins and xmlrpc attacks log to the system log, so fail2ban can pick them up.
What we have with Fail2Ban + Apache + CF is a mod_security rule that blocks the visitors IP, and there is a fail2ban action that triggers the rule. You cannot use iptables as that’s layer 3 and only see’s the CF IP.
Being nginx, I don’t think you can use mod_security, but there’s probably a way to configure an X-Forwarded-For IP blacklist that nginx uses and fail2ban just to append to that list.
Another option would be that you modify wp-fail2ban to also log the users email and API key, and then setup a fail2ban action that reads that token from the log and uses it in action_ban and action_unban. Sort of like the f2b-tarpit-CF-apache-WP-LLA-itsec-LSEC link above.
We’ve been working on a WordPress plugin that does login/xmlrpc syslogging, user-agent and username blocking, along with CF integration, however it’s not quite complete yet. When it is I’ll share the source code here or put it in the WordPress directory. Hopefully we could all start working it and build something really powerful.
Cheers
Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportHey Damian,
Ah okay the Apache module won’t be a huge help to you there – nginx uses it’s own modules.
I’m not too up to scratch on nginx, but https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx- show’s that you can use the RealIP module and then give it the CF IP range and header attribute 🙂
I hope that helps!
Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportHey Damian,
Yeah we would be happy to help you out – want to PM me some more details and I’ll send you some instructions specific to your situation?
eg: operating system and version, use case, server type, etc.
Cheers
Forum: Plugins
In reply to: [WooCommerce Product Archive Customiser] Set 5 columns, get 4Looks like they need to update CSS.
To make 4 columns into 3, I had to add this CSS:
/* Fix up 3-products-per-line */ .woocommerce ul.products li.product:nth-child(4n+1), .woocommerce-page ul.products li.product:nth-child(4n+1) { clear: none; } .woocommerce ul.products li.product:nth-child(4n), .woocommerce-page ul.products li.product:nth-child(4n) { margin-right: 1.818181818181818%; } @media only screen and (max-width: 1100px) { .woocommerce ul.products li.product:nth-child(4n), .woocommerce-page ul.products li.product:nth-child(4n) { margin-right: 2.947368421052632%; width: 30.75%; } } @media only screen and (max-width: 600px) { .woocommerce ul.products li.product:nth-child(4n), .woocommerce-page ul.products li.product:nth-child(4n) { width: 48.33333333333333%; } }Forum: Plugins
In reply to: [WooCommerce Product Archive Customiser] Set 3 columns, get 2Looks like they need to update CSS.
To make 4 columns into 3, I had to add this CSS:
/* Fix up 3-products-per-line */ .woocommerce ul.products li.product:nth-child(4n+1), .woocommerce-page ul.products li.product:nth-child(4n+1) { clear: none; } .woocommerce ul.products li.product:nth-child(4n), .woocommerce-page ul.products li.product:nth-child(4n) { margin-right: 1.818181818181818%; } @media only screen and (max-width: 1100px) { .woocommerce ul.products li.product:nth-child(4n), .woocommerce-page ul.products li.product:nth-child(4n) { margin-right: 2.947368421052632%; width: 30.75%; } } @media only screen and (max-width: 600px) { .woocommerce ul.products li.product:nth-child(4n), .woocommerce-page ul.products li.product:nth-child(4n) { width: 48.33333333333333%; } }Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportOh and nice code, I might pinch some of that.
I’ll probably create a Google Code project for this plugin when it grows.
Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportHi,
When I get the CF API working reliably I will, I don’t want to share shoddy code. Haha.
The main bit that’s working well is an action that logs IPS to a file, then a WP filter that prevents PHP execution:
actionban = echo <ip> | awk -F\. '{print ($4)+($3*256)+($2*256*256)+($1*256*256*256) d}' "d=,$(date)" >> /etc/agilis-banned-ips(storing in int format for speed)
function agilis_login_filter_ips() { $handle = fopen("/etc/agilis-banned-ips", "r"); if($handle) { while(($line = fgets($handle)) !== false) { $linearray = explode(',', $line); if(count($linearray) > 0 && ip2long(agilis_get_ip()) == $linearray[0]) { echo '<h2>Banned</h2>'; echo '<p><strong>IP:</strong> ' . long2ip($linearray[0]) . '</p>'; if(count($linearray) > 1) { echo '<p><strong>Since:</strong> ' . $linearray[1] . '</p>'; } echo '<br/><em>Agilis Login Filter</em>'; if(function_exists('http_response_code')) { http_response_code(503); } else { header((isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0') . ' 503 Service Unavailable'); $GLOBALS['http_response_code'] = 503; } exit; } } } else { echo 'Error reading file'; } fclose($handle); } add_action('login_form_login', 'agilis_login_filter_ips');Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportCheers. Currently we’re doing about 16,000 unique IPs per week but that’s manageable.
We also have another WP plugin that stops PHP executing for any IPs after 3 failed login attempts – as sometime CF can take a few minutes to update.
The combination of CF blocking fail2ban IPs and PHP not responding seems to work well 🙂
Thanks for the link!
Forum: Plugins
In reply to: [WP fail2ban - Advanced Security] CloudFlare SupportHi,
Fix and fixed – mod_cloudflare makes Apache2 log the real visitor IP. Then we’ve mad a fail2ban action that bans the IP using the CF API since iptables is no longer effective.
Thanks