When a Magento Open Source encryption key rotation is worth planning
Rotating the encryption key is worth planning when you have reason to believe the current key has left its controlled location, or when a hardening review or staff change makes you doubt who can still read it. The key in env.php is what Magento uses to encrypt sensitive stored values, such as certain payment and integration credentials and some customer-related data, and to sign parts of the store's internal session and token handling. Anyone holding a copy of that key together with a copy of the database can decrypt those stored values offline. That is why a copy of the key in a former developer's laptop, an old backup or a ticket attachment is a reasonable trigger for rotation, even when you have seen no sign of intrusion.
Treat rotation as a planned change, not a quick edit. Changing the key alters how stored values are read, so values that were encrypted under the old key must be re-encrypted, and sessions tied to the old key will be invalidated. Before you schedule anything, confirm with your own environment which integrations store encrypted values, which admin and customer sessions will be affected, and whether a maintenance window with cron and indexer handling is available. Check the Adobe documentation for your exact release, since the supported procedure for your version determines whether you use the admin or the command line. Also confirm that you hold a verified, restorable backup of both the codebase and the database before you start.
A useful pre-planning check is to inventory where the key is stored and who can read it: the server file, deployment pipeline variables, backups, and any shared password vault. If you find copies outside those controls, or cannot say who has accessed them, rotation is worth doing even if you have no evidence of misuse. Record your decision and the reason in the change record, because auditors and assessors will ask how you responded to a possible key exposure. The companion controls on locking sensitive configuration values and admin access reduce how often rotation becomes necessary.
Which rotation route fits your release line and situation
This table compares the admin-led and command-line rotation routes, and a key-only change against a key change paired with credential rotation. Read each row against your release line and your reason for rotating, then check the maintenance, cron and backup needs before you schedule the change. The main takeaway is that from 2.4.8 the command-line route is the one to plan around, and a key change alone does not clear credentials already exposed.
| Option | When it fits | What it needs | Main trade-off |
|---|---|---|---|
| Admin-led route on older lines | Your store runs a release line before 2.4.8 and you can confirm the admin-led steps in that version's documentation | Maintenance mode, a verified full backup, admin access, and confirmation that cron is running for queued work | Fewer command-line steps, but you must confirm the exact procedure for your version and it is not the route to plan for from 2.4.8 |
| Command-line route from 2.4.8 | Your store runs 2.4.8 or later, including 2.4.8-p5 and 2.4.9, and you rotate the key with the documented bin/magento commands | Shell access on the server, maintenance mode, a verified backup, and cron access to finish re-encryption and cache work | More operator steps and higher risk of error, so a tested runbook on staging is needed first |
| Key-only change | The key may have been copied but no admin, integration or database credentials are believed exposed | Maintenance window, backup of the env.php file and database, and a post-change check of stored values | Leaves existing passwords, API tokens and integration secrets unchanged, so an earlier leak can still be used |
| Key change with credential rotation | You suspect compromise, a departing administrator had key access, or a backup or config file leaked | Everything in the key-only row, plus a list of admin users, integration tokens, payment and ERP credentials to reset | Longer change window and coordination with ERP, payment and agency partners, but it closes the wider exposure |
| Routine scheduled change | No known exposure and your policy calls for periodic rotation | Agreed change calendar, rollback plan, and a staging rehearsal on a copy of production data | Low urgency allows careful planning, but each rotation adds work and session disruption for staff |
| Rotation after a suspected compromise | Signs of admin takeover or injected code are present | Containment first, forensic review of logs, then the key change paired with credential rotation | Rotation alone does not remove attacker access, so it must follow containment and patching |
How to rotate the key in a planned maintenance window
This sequence changes the Magento Open Source encryption key without losing stored values or the store's ability to run. Each step ends with a check, so the change record shows that the key works on every node before the store reopens to customers.
Confirm the release line and patch level
The engineer on the change checks the installed version with
bin/magento --versionand compares it with Adobe's released versions page and lifecycle policy. The command-line key route applies from 2.4.8 onward, so the store must be on that line or later, and the line must still be supported. Done when the version output, the change ticket and the lifecycle entry agree, and any gap is logged as a prerequisite before the window opens.Back up code, database and configuration
The store owner and the engineer take a full copy of the codebase and Composer files, a database dump, the media directories and the environment configuration, including
app/etc/env.phpand any deployment overrides that hold the current key. Store the old key in your secrets vault with restricted access, because a rollback depends on it. Done when the dump restores to a staging copy and the restored store loads with the old key.Enable maintenance mode and pause background work
The engineer runs
bin/magento maintenance:enableon the primary node and confirms the storefront shows the maintenance page. Cron jobs and queue consumers are paused or drained so no background process writes encrypted values during the change. Checkbin/magento maintenance:statusand confirm in your process manager that cron and consumers are idle before continuing.Run the key change through the command line
From 2.4.8 onward, run the key change through the command-line route documented for your release. Confirm the exact syntax in Adobe's configuration guide for that version before running it, and do not reuse commands from older releases. Capture the full command output in the change record and keep the new key in the secrets vault. Done when the command reports success and the primary node's
app/etc/env.phpholds the new key while the old key remains in the vault.Verify dependent stored values
Use the inventory built during planning to list stored values that depend on the key, such as payment method credentials, integration settings and connector secrets kept in the database. Open the payment and integration configuration screens in admin and run one read-only test call per connector. Done when every connector responds and no field shows a decryption error. Where a value cannot be decrypted, re-enter it from the source system and retest.
Apply the new key on every node
Apply the same new key to every web, CLI, cron and queue node through the environment or deployment configuration, so no process still reads the old key. Compare a checksum of the configuration file on each node and run a read-only decryption test from each host. Done when all nodes return matching results and none reports a decryption error. The mechanism varies by layout, so confirm the setting in your own deployment tool.
Flush caches and confirm session behavior
Run
bin/magento cache:flushso no cached configuration holds values read with the old key. Expect logged-in customers and admin users to be signed out, and confirm this session behavior in the release documentation for your version before the window. Check that an old session cookie is rejected and that a fresh admin login succeeds. Done when both checks pass on the primary node and a storefront request returns normally.Restart services and reopen the store
Restart PHP-FPM, the web server, cron and queue consumers in the order your deployment uses, then run
bin/magento maintenance:disable. Test admin login with a named test user, search the storefront and place a test order in your payment provider's test mode. Done when the admin, storefront and test order all complete, the logs show no new encryption errors, and the change record is closed with the command output and verification results attached.
Handling session invalidation and re-encrypting stored values
Rotating the encryption key changes how Magento reads values it has already saved, so the work after the change matters as much as the change itself. Plan for users to log in again and for every stored value that depends on the key to be re-encrypted and checked before the store returns to normal traffic. Confirm in Adobe's documentation for your exact version how sessions are affected, because session storage (files, Redis or database) and the cookie handling in your setup determine whether customers and admin users are signed out, and whether the change needs a cache flush to take effect.
Tell customers and staff before the window opens. A short notice on the storefront and an email to admin users should say that sign-in will be required again, that saved carts or wishlists may need to be checked, and whose account to contact if a login fails. Agencies and integration owners need the same message, because a failed session can look like an outage to them. Keep the wording factual and avoid suggesting the key change was caused by a breach unless that is true.
Stored values that depend on the key need their own verification step. Payment gateway credentials, shipping and ERP connector secrets, and any API or integration credentials stored in core_config_data or sensitive configuration must be read back after the change and tested with a real call to the provider in a sandbox or low-risk transaction. Check that the store still decrypts each value, that new values are written with the new key, and that old backups remain usable under the previous key. Record which values you checked and who signed off, because auditors and your own compliance team will ask for that evidence.
Security and operational risks during rotation
Rotating the encryption key touches stored secrets, running nodes, shared files and live integrations at the same time. Each risk below is a way the rotation can leave the store unable to decrypt data, exposed to misuse, or running in a state nobody verified.
Losing the old key early
If the new key is activated before every stored value has been re-encrypted, and the previous key is discarded, encrypted fields such as payment credentials and integration secrets become unreadable. Keep the old key in a secured, access-logged location until re-encryption and verification are complete. Before any change, take a full backup of the database and the env.php file, and confirm you can restore both to a separate environment. Ask your team to name who holds the old key and where it is stored.
Partial rollout across nodes
A multi-node Magento installation can end up with some web or worker nodes using the new key while others still use the old one. Requests then fail intermittently, and cron or queue consumers may write values encrypted under a key other nodes cannot read. Confirm that every node reads the same shared configuration before the change, and stop cron and consumers during the window. Check each node after the change before reopening traffic.
New key exposed in shared files
The new key is a secret equal in sensitivity to the database password. Pasting it into a ticket, chat thread, deployment log, CI variable visible to all developers, or a shared spreadsheet spreads it beyond the people who need it. Generate the key on the target server, store it in your secrets manager, and make sure the command output is not captured by CI logs or shell history. Review who can read the deployment pipeline output for the change window.
Lingering admin sessions
Sessions created under the old key may remain valid after the change, so a stolen session cookie or an admin left logged in on an unattended machine can continue to work during or after the rotation. Plan to invalidate sessions as part of the change and require staff to sign in again. Review the admin user list for accounts that should no longer exist, and confirm that two-factor prompts still apply after the change.
Integrations failing after decryption stops
ERP, payment, shipping and marketplace connectors often store API credentials in encrypted fields. If those values are not re-encrypted correctly, the connector fails silently or with generic errors, and orders or stock updates stop flowing. Before the change, list every integration with a stored credential, record which ones are working, and schedule a test transaction for each after the rotation. Ask your integration owners to confirm the test results in writing.
Skipping post-change verification
A rotation can appear complete because the command returned without error while some stored values, cached configuration or nodes still behave incorrectly. Verification should cover a login, an admin configuration page that uses a protected value, a test payment or integration call, cron execution and a check of logs for decryption errors. Record the results against a written checklist and keep the evidence with the change record, so the team can show what was verified and when.
How the rotation sequence and checks fit together
The sequence starts with a release line check, because the command-line route is required from 2.4.8, and a backup taken before anything changes. Maintenance mode then stops writes while the key is changed on each node, and stored values that depend on the key are re-encrypted. The cache flush and verification come last, and a failed check leads to a rollback decision rather than a forward fix. Confirm each step against the Adobe documentation for your release before running it.
The rotation sequence, from release check to the rollback decision point.
Limits to confirm before you rotate
Key rotation touches the command you run, the values it re-encrypts, the way your nodes share configuration, and the stack underneath. Each item below is something to confirm in your own environment before a maintenance window is booked, because a gap in any one of them can leave the store half-rotated.
Command syntax for your version
Confirm the exact command syntax and supported options for your release in Adobe's documentation before you script anything. From 2.4.8 the command-line route is the required method, so the procedure you followed on an older release may not apply. Check whether the command re-encrypts stored values or only writes a new key, and whether it expects a reference to the old key. Test the exact command on a staging copy of production first.
Released versionsWhich stored values are encrypted
Establish which values your installation actually encrypts with the key. Payment gateway credentials, integration secrets and some system configuration may be stored encrypted, while other fields are plain text. Export a list of encrypted configuration paths from your own database and compare it with what the rotation process reports. Any value the process misses will fail after the change, so record the count before and after.
Shared key storage across nodes
Find out where the key lives in a multi-node or pipeline-built layout. If the key sits in a shared environment file, a secrets store or a build artifact, updating one node will not update the others. Confirm which files each web, cron and worker node reads, and whether your pipeline overwrites the key on every deployment. A stale copy on one node is a common reason for intermittent decryption errors after rotation.
PHP and database combination
Check the system requirements for your exact release and confirm that your PHP and database versions are a listed combination. Adobe supports only the listed combinations, so a rotation run on an unsupported pairing may behave unpredictably. If the rotation coincides with an upgrade, complete the platform change first and rotate on the supported stack, so a failure has one cause to investigate.
System requirementsExtension-owned encrypted values
Ask each extension vendor whether it stores its own encrypted values, such as API tokens for ERP, shipping or marketplace connectors, and whether it uses the store key or its own. The core command does not know about values an extension encrypts independently. Inventory your installed extensions, request written answers from vendors, and plan a separate re-encryption or re-entry step for any value that does not follow the core key.
Session and backup impact
Rotation can invalidate active sessions and changes what a backup can restore. Confirm how your version handles existing customer and admin sessions, and keep a backup taken with the old key alongside the matching key file. Without that pairing, an encrypted backup restored later may not decrypt. Record who holds the old key and where it is retained, under your own key custody policy.
Questions buyers ask before rotating the encryption key
Can our in-house team rotate the Magento encryption key without a partner?
Often yes, if the team already runs Magento deployments and can work through the command-line route for its release line. The job is mostly careful sequencing: confirm the backup and rollback path, plan a maintenance window, rehearse the rotation in a staging copy that mirrors production, then repeat it in production with someone watching the logs. Teams that have never changed the encryption key, or that run several nodes sharing one configuration, usually gain the most from a rehearsed runbook. Ask who will own the change if a step fails halfway, and whether that person has done it before. An in-house team can also bring in a partner only for the parts it has not run before.
What drives the effort and cost of an encryption key rotation?
The main drivers are the shape of the environment and how much stored data depends on the key. Count the nodes first, because every web, cron and worker host that reads the configuration must be checked. Integrations matter, since ERP, payment and shipping connectors may store encrypted values that need re-encryption or re-entry. Installed extensions add review work, especially custom modules that encrypt their own data. The release line sets which command-line route applies and which system requirements must still hold. Cost is mostly one-time unless you rotate on a recurring schedule. A quote should list each driver with its count so you can see what changes if the environment is larger than described.
What does the encryption key work need from our team?
Plan four things before any engineer starts. First, access: shell access to every application node, database credentials, and the repository or pipeline that holds the configuration. Second, a maintenance window agreed with the business, because the store should be in maintenance mode while values are re-encrypted. Third, verified backups of the database, file system and configuration, proven by a restore in a non-production environment. Fourth, named owners for each integration, such as the ERP or payment provider contact, who can confirm the connector works after the change and supply new credentials if a stored value must be re-entered.
How long does encryption key rotation take in our environment?
No duration is set here because it depends on the environment, and a single figure would mislead. Ask any provider, including DeployOpen, to state the duration in the written scope and to list the assumptions behind it: node count, number of integrations, database size, whether a staging copy exists, and how many change windows the business can offer. Separate preparation, the staging rehearsal, the production window and the post-change checks, since each takes a different amount of time. Ask for the planned sequence and the point at which the team would stop and roll back if a check fails.
How does a partner quote follow from the written scope?
A quote follows from the written scope. DeployOpen does not publish a price list, and most engagements are fixed-scope, so scope, deliverables and timelines are agreed in writing before work starts. For key rotation, the scope should name the environments covered, the nodes and integrations in scope, the release line, the backup and rollback steps, the staging rehearsal, the production change and the post-change checks. Work outside that list, such as repairing a broken integration or reviewing custom extension code, is a separate line that can be quoted once it is identified. Each quoted item should map to a scope line.
Does rotating the encryption key log out admins and customers?
Changing the key affects values that depend on it, so plan for session invalidation and for re-encrypting stored values, then confirm the exact effect on your release line before the window. Sessions and tokens protected by the old key may stop working, so admin and integration users may need to sign in again. Stored values, such as integration credentials and some configuration entries, must be re-encrypted or re-entered so the store can read them. Test admin login, customer login, checkout and each integration in staging. Tell support staff which users will be affected and when, so they can answer questions during the window.
Which Magento Open Source release line should we be on before rotating?
Rotate on a release line that still receives support, because the command-line route and supported platform versions depend on it. Adobe's lifecycle policy gives each 2.4.x release three years of standard support from general availability. The documented end of regular support is August 11, 2026 for 2.4.6, May 31, 2027 for 2.4.7, May 31, 2028 for 2.4.8 and May 31, 2029 for 2.4.9. Check the system requirements for your release, since Adobe supports only the listed combinations of PHP, database, search, cache and web server. If the store is behind on patches, upgrading first and rotating afterward may mean the work is done once.
Does rotating the encryption key help with PCI DSS compliance?
Rotation supports key management hygiene, but it does not by itself satisfy a PCI DSS requirement. DeployOpen does not issue audit reports, attestations or certifications, and an independent assessor decides what the evidence shows. What you can prepare is the record: a dated change plan, the approval, the backup proof, the staging test results, the post-change checks and the list of integrations re-verified. Confirm with your assessor which records they expect, and whether they want rotation treated as a recurring control or as a one-time response. Keep the evidence with the change ticket so the next review can trace each step.
How DeployOpen scopes a key rotation in your environment
DeployOpen starts a key rotation engagement with the facts that decide how the change runs: the Magento Open Source release line and PHP version, the node layout (single host or multi-node with shared sessions, cache and queues), every integration that stores or reads encrypted values, and the maintenance window your business accepts. Those answers go into a written scope that names what is in and out, who approves the window, who holds the backup, and who signs off the result. Confirm the exact release line against the Adobe system requirements for 2.4.9 and your current version before you agree the command route, because the rotation procedure depends on it. Ask for the written scope to name every encrypted value holder, including payment and ERP connectors.
Before the production window, DeployOpen rehearses the rotation on a non-production copy built from a recent production backup, with the same code, configuration files, search, cache and message queue versions. The rehearsal checks that the key change completes, that stored values still decrypt in the admin, payment and integration screens, that cron and indexers run afterwards, and that customer and admin sessions behave as planned. It also measures how long the steps took on that copy, so the production window is planned from observed work rather than guesses. Any value that fails to decrypt is logged with its table and configuration path, and the fix is agreed before production is touched.
The handover is a runbook specific to your store and an evidence pack. The runbook lists the exact commands in order, the backup and rollback point, the cron and maintenance steps, the session invalidation effect on administrators and customers, and the checks that define success. The evidence pack holds the rehearsal log, the before and after configuration state with secrets excluded, the change record and the list of integrations you must re-test. Your team keeps the new key in its approved secrets store, and the runbook says who may read it. Confirm with your compliance lead which records your change process needs, since DeployOpen prepares that evidence but does not issue any audit opinion.
How DeployOpen works on this
DeployOpen plans and carries out encryption key rotation inside your own infrastructure, with the maintenance window, backups and re-encryption steps agreed before any change is made. Engagements are fixed-scope, so the written scope sets what is changed, tested and handed over.
How we scope
- Confirm the Magento Open Source version and whether the store runs the command-line rotation route
- Inventory which stored values, integrations and payment settings depend on the current key
- Agree the maintenance window, rollback point and who approves the change in writing
How we build
- Run the rotation first on a copy of production to check configuration and encrypted values
- Re-encrypt stored values and confirm admin sessions and integration tokens behave as expected
- Test checkout, admin login and connector calls on staging before production is changed
How we hand over
- Deliver a runbook with the exact commands, order of steps, and where the previous key is kept
- Record the evidence of the change for your security and compliance reviewers
- Walk your operations team through the steps so the next rotation can be run in-house
How we support
- Offer ongoing support and upgrades as a retainer when the store needs regular patching and rotation
- Include rotation checks in retesting after later Magento Open Source patch releases
- Confirm support terms, response expectations and included retests in the written scope before work starts

