Skip to content

Drupal Installation

Patchstack Security connects your Drupal site to Patchstack App and reports known vulnerabilities in installed software. A site with an active protection license also receives mitigation rules and firewall request logging.

  • Patchstack Security 1.1 declares compatibility with Drupal core 9, 10, 11, and 12. Run a Drupal release that receives security updates on production sites. Drupal 9 has reached end of life. Patchstack 1.1.0 release
  • Use a PHP version supported by your Drupal core release. Drupal 11 requires PHP 8.3 or later and Drupal 12 requires PHP 8.5 or later. Drupal PHP requirements
  • A Drupal site in Patchstack App and its site API token. Add your site
  • Drupal administrator access and a deployment process that can run Composer. Drush is optional.
  1. Run this command from the Drupal project root.

    Terminal window
    composer require 'drupal/patchstack:^1.1'

    Composer installs the module and its firewall dependency. If Composer cannot find the package, check your project’s Drupal.org Composer repository settings. Drupal module installation guide

  2. In Drupal, go to Extend at /admin/modules, select Patchstack Security, and click Install. With Drush, run drush en patchstack.

  3. Open Configuration → System → Patchstack, or go to /admin/config/development/patchstack. Enter the API token for this Drupal site from Patchstack App, then save. If the site has a protection license, leave Firewall enabled selected.

  4. In Connection Status, confirm that API Connection shows Connected. For a site with a protection license, also confirm that License Status shows Active. Check that Patchstack App lists the connected site.

Use Composer and Drush from the root of an installed Drupal project. Supply the site’s API token in the PATCHSTACK_API_TOKEN environment variable through your deployment secrets.

Terminal window
composer require 'drupal/patchstack:^1.1' --no-interaction
drush en patchstack -y
drush patchstack:status

On first install, the connector reads PATCHSTACK_API_TOKEN and attempts to activate the connection. Installation can finish while activation is pending. Confirm that API Connected shows Yes. On a site with a protection license, also confirm that License Active and Firewall Enabled show Yes.

If Patchstack is already enabled or you need to retry with a valid token, run the activation command. Keep shell tracing disabled when passing the token.

Terminal window
drush patchstack:activate "$PATCHSTACK_API_TOKEN"
drush patchstack:status

If a new install could not activate because of a temporary API error, Drupal cron can retry while the token is available in the cron environment. Use drush patchstack:sync to sync once the connection is working.

Provision the site token through the App API

Section titled “Provision the site token through the App API”

If you have an App API key with write access, you can provision a Drupal site without opening the App. Send POST /monitor/site/add with your App API key in the UserToken header, the site’s URL in urls, and cms_id set to 2 for Drupal. Store sites[<site URL>].oauth.apikey from the response as the deployment secret PATCHSTACK_API_TOKEN. App API reference

For an existing site, use its saved token. If your App API key can read site credentials, you can also retrieve them with GET /monitor/site/oauth/{siteid}. Use the returned secret followed by a hyphen and the returned id as the site token.

Back up your site and database before updating. Update the package and run the database updates in the same maintenance window before resuming cron.

Terminal window
composer update drupal/patchstack --with-all-dependencies
drush updatedb
drush cr

If Patchstack is missing from your project’s Composer dependencies or the constraint pins an older release, run composer require 'drupal/patchstack:^1.1' --with-all-dependencies in place of the update command. For an older ZIP installation, keep the module installed and make sure Drupal has only one copy of its code in the module search paths before running database updates. You can apply database updates through Drupal’s update.php if you use the web interface.

When upgrading from 1.0.0 to 1.1.0, database update 9003 adds retry storage for firewall logs and the data used to reject repeated signed connector requests. Apply it before relying on those features or resuming scheduled tasks. Patchstack 1.1.0 release

Schedule Drupal cron to run regularly. A system cron running drush cron every 15 minutes is one option. Patchstack uses Drupal cron to refresh firewall rules, report installed software, check the site’s license, and upload firewall logs. The Scheduled Tasks panel in Patchstack settings shows when these jobs last ran and when they are next due. Drupal cron setup · Drupal sync intervals

If the site shows Not connected, verify its API token and outbound HTTPS access to Patchstack. Use Reconnect to Patchstack in Patchstack settings when available. With Drush, use drush patchstack:status to check the connection or drush patchstack:sync to run a sync.

The module inspects requests that pass through Drupal’s normal HTTP middleware. The standalone browser installer at /core/install.php runs outside that middleware. On an installed site, block public access to the installer at the web server and keep Drupal core up to date. Drupal guide to securing the installer