Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antoonline/bash-script-wordpress-docker-verify-checksums
This script checks the integrity of WordPress installations running in Docker containers by verifying their checksums using wp-cli. It identifies containers running WordPress instances, installs wp-cli if necessary, and runs the wp core verify-checksums command.
https://github.com/antoonline/bash-script-wordpress-docker-verify-checksums
docker malware slack ubuntu verify-checksums wordpress wp-cli
Last synced: 13 days ago
JSON representation
This script checks the integrity of WordPress installations running in Docker containers by verifying their checksums using wp-cli. It identifies containers running WordPress instances, installs wp-cli if necessary, and runs the wp core verify-checksums command.
- Host: GitHub
- URL: https://github.com/antoonline/bash-script-wordpress-docker-verify-checksums
- Owner: AntoOnline
- Created: 2023-04-25T04:55:00.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-21T00:52:35.000Z (over 1 year ago)
- Last Synced: 2024-11-14T14:42:11.800Z (2 months ago)
- Topics: docker, malware, slack, ubuntu, verify-checksums, wordpress, wp-cli
- Language: Shell
- Homepage: https://anto.online
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# WordPress Docker Verify Checksums
This script, `wordpress-docker-verify-checksums.sh`, checks the integrity of WordPress core files within Docker containers running the WordPress image. It verifies the checksums of the files using `wp-cli`, and sends notifications to a specified Slack channel if any issues are detected or if `wp-cli` is not installed in the container.
## Prerequisites
- Docker
- Docker containers running the WordPress image## Usage
```bash
./wordpress-docker-verify-checksums.sh --slack-webhook-url [--wordpress-image-name ] [--install-wp-cli ]
```Options:
- `--slack-webhook-url`: The Slack webhook URL for the channel you want to receive notifications in (required).
- `--wordpress-image-name`: The name of the WordPress image to check (default: "wordpress").
- `--install-wp-cli`: Specify whether to install `wp-cli` if not installed in the container. Accepted values are "yes" or "no" (default: "yes").Example:
```bash
./wordpress-docker-verify-checksums.sh --slack-webhook-url --wordpress-image-name custom-wordpress --install-wp-cli no
```## How It Works
The script performs the following steps:
1. Parses the command line arguments to get the Slack webhook URL, WordPress image name, and `INSTALL_WP_CLI` value.
2. Checks if the Slack webhook URL is set and enables Slack notifications accordingly.
3. Checks if `wp-cli` is installed in the system. If not, and `INSTALL_WP_CLI` is set to "yes", it downloads and installs `wp-cli`.
4. Updates `wp-cli` to the latest version.
5. Retrieves the names of all Docker containers running the specified WordPress image (or default "wordpress" if not provided).
6. Loops through each container and performs the following checks:
- Verifies the integrity of the WordPress core files using `wp-cli`.
- Sends a Slack notification if the checksum verification fails (and Slack notifications are enabled).
7. Completes the loop and finishes the script execution.## Want to connect?
Feel free to contact me on [Twitter](https://twitter.com/OnlineAnto), [DEV Community](https://dev.to/antoonline/) or [LinkedIn](https://www.linkedin.com/in/anto-online) if you have any questions or suggestions.
Or just visit my [website](https://anto.online) to see what I do.