Category: Scripting

Enabling TLS for CodeIgniter (MySQLi) on Amazon RDS

Transport Layer Security (TLS) encrypts traffic between your app and database, protecting credentials and data in transit. This guide shows how to enable and verify TLS for a CodeIgniter 4 app using the MySQLi driver against Amazon RDS/Aurora MySQL—whether you have root on the host or not. It also covers enforcing TLS at the database and common pitfalls. What you’ll do Download the Amazon RDS CA bundle Point CodeIgniter’s MySQLi connection at that CA Verify the connection is encrypted (with either MySQL or MariaDB clients) Optionally require TLS at the DB parameter group level 1) Get the Amazon RDS CA bundle Use either the global bundle (works for all commercial regions) or a region-specific bundle (e.g., us-east-1). Global (covers any commercial region): https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem Regional example (N. Virginia): https://truststore.pki.rds.amazonaws.com/us-east-1/us-east-1-bundle.pem With root (system-wide location)

Without root (per-site location, safe for Plesk)

Sanity checks:

Plesk note: if PHP has open_basedir

Read More »

Automating GitHub Actions Workflows with the gh CLI

  GitHub Actions is a powerful feature of GitHub that enables automation of software workflows directly in your repository. Whether you’re running tests, deploying code, or performing scheduled tasks, Actions can help streamline your DevOps process. But did you know you can trigger these workflows directly from the command line using the GitHub CLI (gh)? This opens the door to scripting, local automation, and rapid testing of manual workflows—all without leaving your terminal. In this post, we’ll walk through how to use the gh CLI to trigger a GitHub Actions workflow and pass inputs dynamically. What Is GitHub Actions? GitHub Actions is a CI/CD (Continuous Integration/Continuous Deployment) platform built into GitHub. It allows you to define workflows in YAML files located in your repository’s .github/workflows/ directory. Each workflow can respond to different triggers, such as: Push or pull request events Scheduled cron jobs Manual triggers via workflow_dispatch Workflows are composed

Read More »

Automating File Cleanup: Removing Old Files with a Bash Script

Managing server storage efficiently is crucial for maintaining performance and ensuring that unnecessary files do not take up valuable disk space. One effective way to keep your system clean is by automatically removing old files that are no longer needed. In this guide, we’ll explore how to use a Bash script to delete files matching a specific pattern that are older than 7 days. Why Automate File Cleanup? As servers run over time, they accumulate logs, temporary files, and other data that may not be necessary for long-term storage. Regularly cleaning up these files can help: Free up disk space Improve server performance Reduce backup sizes Ensure compliance with data retention policies Rather than manually deleting old files, an automated Bash script can handle the task efficiently. Writing a Bash Script for File Cleanup The following script finds and removes files that match a given pattern and are older than

Read More »

“One-liner” To Change Plesk Admin Port

Here’s a Bash one-liner to change the Plesk admin port:

Replace XXXX with the desired port number. Explanation sed -i ‘s/listen 8443 ssl;/listen 8444 ssl;/’ /etc/sw-cp-server/conf.d/plesk.conf Searches for listen 8443 ssl; in the configuration file and replaces it with listen 8444 ssl;. sudo systemctl restart sw-cp-server Restarts the Plesk control panel server to apply the new port configuration.            

Read More »

Find Sites With Most Requests In Logs

Find top sites by requests over a time period:

Replace “DD/MMM/YYYY:HH:MM” with desired period like “01/Aug/2024:15”.  

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.