Integrating Nuclei into CI/CD on VPS: Automating Daily Website Security Scans
A detailed guide on integrating Nuclei into CI/CD workflows on a VPS for automated daily security vulnerability scanning. Covers installation, configuration, testing, and...
Introduction to Nuclei and CI/CD Integration
Nuclei is a powerful, open-source security scanner designed for automated detection of vulnerabilities in web applications. Integrating Nuclei into your CI/CD (Continuous Integration/Continuous Deployment) pipeline on a VPS enables daily, automated security scanning of your websites, ensuring that potential security risks are identified and addressed promptly.
Installing and Configuring Nuclei on VPS
To get started, you need to install Nuclei on your VPS. Use the following command to download and install Nuclei:
curl -s https://api.github.com/repos/projectdiscovery/nuclei/releases/latest | grep "browser_download_url.*nuclei-linux-amd64" | cut -d : -f 2,3 | tr -d \" | wget -i -
chmod +x nuclei
sudo mv nuclei /usr/local/bin/
After installation, verify the Nuclei version using the command:
nuclei -version
Integrating Nuclei with GitHub Actions
To integrate Nuclei into your CI/CD workflow, use GitHub Actions. Below is an example of a workflow file `.github/workflows/nuclei-scan.yml`:
name: Nuclei Security Scan
on:
schedule:
- cron: '0 8 * * *' # Runs daily at 8 AM
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nuclei
run: |
curl -s https://api.github.com/repos/projectdiscovery/nuclei/releases/latest | grep "browser_download_url.*nuclei-linux-amd64" | cut -d : -f 2,3 | tr -d \" | wget -i -
chmod +x nuclei
sudo mv nuclei /usr/local/bin/
- name: Run Nuclei Scan
run: |
nuclei -u ${{ secrets.WEBSITE_URL }} -t templates/ -o results.json
- name: Upload Scan Results
uses: actions/upload-artifact@v4
with:
name: nuclei-results
path: results.json
Testing and Reviewing Results
Once configured, GitHub Actions will automatically run the Nuclei scan daily at 8 AM. You can review the results by checking the uploaded artifact in the GitHub Actions interface.
Alerting and Troubleshooting
To handle potential issues, set up alerts when vulnerabilities are detected. You can use services like Slack or Email to receive notifications. For example, add a step to the workflow to send a notification when a vulnerability is found:
- name: Send Slack Notification
if: steps.scan.outputs.has_vulnerabilities == 'true'
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text": "A security vulnerability has been detected on the website!"}' ${{ secrets.SLACK_WEBHOOK_URL }}
Official References
- Nuclei Official Website
- Nuclei GitHub Repository
- Automating ACME SSL/TLS Certificate Renewal with ECDSA P-256 and Non-Disruptive Nginx Reload
- Hardening Ubuntu 24.04 VPS Against SSH Brute-Force with Key-Only Auth
Integrating Nuclei into your CI/CD pipeline on a VPS is a critical step in maintaining website security. With the steps outlined above, you can automate vulnerability scanning and receive timely alerts when risks are detected.
Related infrastructure & engineering guides: Cloud VPS with L3/L4/L7 Anycast Anti-DDoS
Recommended NVMe Cloud VPS Plans to Deploy This Setup
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-3E
10% VAT included
- CPU: 2 vCPU
- RAM: 4 GB
- SSD: 50 GB NVMe
