This article is about blocking IPs in Pantheon for sites using the WordPress CMS. Prevent unwanted traffic incidents that might result in site outages and billing overages.
Review the nginx-access.log.
Download the nginx-access.log on the LIVE environment. The logs can be accessed using SFTP or by using the provided script from Pantheon’s documentation. Be sure to combine all the logs for a day if the site plan has multiple application containers. Identify the IP that has the highest number of visits and verify it with https://www.abuseipdb.com/
Be sure to install the plugin WP Traffic Jammer that can be downloaded at WordPress.org https://wordpress.org/plugins/traffic-jammer. The plugin has a wp-cli command that can be used on a remote wp-cli call using Terminus. It also has a settings page to add a single IP or an IP range.
Block the IP using Terminus.
Use remote wp-cli via terminus to block the IP.
$ terminus wp <sitename>.<env> -- jam block <ip>
To unblock the IP.
$ terminus wp <sitename>.<env> -- jam unblock <ip>
Block the IP on the WordPress Admin Dashboard.
On the Admin Dashboard, you would see the left side menu, click “Traffic Jammer” and add a single IP or IPs, CIDR format can be also used for IP ranges.
Block the IP using a PHP Snippet
Use a PHP snippet that can be added to wp-config.php file. This offers an advantage since it would be triggered before loading all the plugins and themes.
What a great way to start a new year with releases, as this is the same for the company offering the best WebOps SAAS (Software as a Service) Platform which is Pantheon. During the last week of December, a new version tag of Terminus has been released, comes version 3.
What is Terminus?
The Terminus command-line interface provides advanced interaction with Pantheon. Terminus enables you to do almost everything in a terminal that you can do in the Pantheon Dashboard, and much more. In practice, some of the features missing on the Dashboard are included in Terminus. Developers can also include in development workflow or as part of a script for deployment using continuous integration.
Operating System Compatibility
As of this writing tested to work on the following platforms
Windows 10 – WSL 2 Ubuntu 20.0
Ubuntu 20.0 – this would include Ubuntu under Docker or VirtualBox
Before getting frustrated, included also are the list of platforms that Terminus would not work:
Windows 10 – Command Line
Windows 10 – Git Bash (MingW)
Ubuntu 18.0 and later versions
Linux system with coreutils equal to or less than 8.28
PHP 7.4 or above
PHP Extensions (mbstring, xml, curl, cli)
git (if you need to include plugins)
As for the prior version of Terminus, it can be installed in many ways, the new version is limited to work only on the standalone PHAR package. Assuming all the requirements are met. Start the installation on the home folder
mkdir ~/terminus && cd ~/terminus
curl -L https://github.com/pantheon-systems/terminus/releases/download/`curl --silent "https://api.github.com/repos/pantheon-systems/terminus/releases/latest" | perl -nle'print $& while m#"tag_name": "\K[^"]*#g'`/terminus.phar --output terminus
chmod +x terminus
sudo ln -s ~/terminus/terminus /usr/local/bin/terminus
The new version of Terminus comes with a plugin manager, installation now can be done using the terminus command
Apache Log4j is a logging utility that is part of the Apache Logging Services. The nature of this logging service is that it accepts logged messages to contain format strings that can be referenced remotely thru Java Naming and Directory Interface (JNDI). Information can be obtained remotely via a variety of protocols, including the Lightweight Directory Access Protocol (LDAP), Remote Method Invocation (RMI), and Domain Name Service (DNS).
Does websites using cPanel are affected?
A basic cPanel service is not affected, some services have the Apache Solr on it since the Solr service cannot be accessed remotely. All big companies that utilize cPanel like GoDaddy, Bluehost, and Hostgator are not affected by this vulnerability.
Is Pantheon affected by log4j vulnerability?
No, Pantheon is not affected by the log4j vulnerability. Here’s the information from their status page:
Pantheon has verified that the platform is not vulnerable to the security issue related to the open-source Apache “Log4j2″ utility.
Log4j is a Java-based logging utility found in a large number of software products.
The CVE-2021-44228  vulnerability (aka the “Log4Shell” vulnerability) was disclosed by the Apache Log4j project. If exploited, this vulnerability could potentially allow a remote attacker to execute code on the server.
Once this vulnerability was publicly disclosed on the 9th December 2021, Pantheon began an audit of our infrastructure, as well as engaging with our software vendors, to determine potential impact. While our exposure to the vulnerability has been minimal, we have directly remediated components and verified that existing defense in depth measures prevent exploitation as researchers have published.
No, WPEngine does not utilize the log4j on their platform stack.
Is Platform.sh affected by log4j vulnerability?
No by default but if the site has custom Java code better contact the development team to review the code. Here’s their official statement:
A thorough investigation of our products and services has led us to believe our services are protected from the worst form of remote code execution. The threat of information disclosure is reduced because we aren’t sending application variables to these services. To further reduce that threat, these services are also receiving updates to disable the undesired behavior of Log4j. We’ve confirmed with our backend IaaS providers and with Fastly that they’ve either been unaffected or have mitigated any exposures.
If your project is running custom JAVA code in an app container, please immediately ask your developers to review your code for Lib4j2 usage and update it to the latest 2.15 branch.
WinSCP is a popular free SFTP and FTP client for Windows, a powerful file manager that allows you to upload and download files on the Pantheon server. It provides a user-friendly interface for copying files between a local and remote computer using the FTP or SFTP protocol. This software is available only on Microsoft Windows.
All common operations with files
Integrated text editor
Scripting and task automation
Translated into many languages
A complete WinSCP guide and an active user forum are freely accessible at the WinSCP site.
If you don’t already have WinSCP installed on your computer, download the most recent update and install it from their website.
Open WinSCP by accessing the application on the Windows Start menu. Make sure you have your site’s Pantheon SFTP connection information on hand. See the guidelines on how to find the SFTP credentials for your site if you need to get the connection details.
Enter the details from the Site Dashboard Connection Info from Pantheon. Use the password that is being used when logging into the Pantheon User Dashboard. Do check the protocol must be in SFTP and the port number is 2222.
Alternatively, you can also have passwordless access by using an SSH private key. Pantheon doesn’t offer SSH access to a shell environment but it allows it to be used on SFTP protocol.
You should add your public SSH key into your Pantheon account to get the most out of it. SSH keys are a better option for authentication than a basic password since they provide additional security protection. No matter how many sites you work on, you will only need to do this once. See Generate and Add SSH Keys for further information.
Click the Advanced select button, under SSH then click Authentication. Enter a private key in PPK format.
To get the site’s root simply navigate to the code folder and you will be able to download and upload files as normal.