Having 'fixed' cron keys for each Drupal installation is kind of limitation. If for any reason is required to change the default cron key generated by Drupal, the admin should be able to generate a new one. The patch adds this feature.

See screen shots attached.

EDIT: There's a module for this: Cron key.

Issue fork drupal-256965

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Susurrus’s picture

I really vote against this as it's more code and more user interface for very little gain. This discussion existed in the original issue to add the cron_key and it wasn't added originally. There are practically no reasons to change the cron_key first of all. If it needs to be changed, it's a simple SQL query that can be run in a db_query() somewhere in a custom PHP input field or through the DB backend that. If we were to do anything about this, I would vote to add a code snippet to that area of the handbooks.

dropcube’s picture

it's more code and more user interface for very little gain

There are no more than 12 lines of new code. My intention is to avoid the crontib module cron_keys-7.x-x-x that for sure will appear in the future.

lilou’s picture

Status: Needs review » Closed (won't fix)

-1 unnecessary in core.

amontero’s picture

Assigned: dropcube » Unassigned
Status: Closed (won't fix) » Active
Issue tags: +cron

How about checking if cron key present in the 'Status report' page?
I see 2 possible use cases for this:
1. Something went bad in db/config (the obvious case). It would be nice to alert the site owner of such problem. Sh** happens and this can be tricky to troubleshoot.
2. Site is a local/staging/developer db dump and has been sanitized by removing cron_key var. Since cron_key seems a value to protect, it's not that strange to do it.

2nd case is what I'm now doing manually now, but devs should be aware fo it. Making Drupal a bit more self-healing here would allow an easier workflow here.
Additionally, an easy hook_drush_sql_sync_sanitize implementation could be added to drush to automate this for "drush sql-sync --sanitize" invocations. I think this use case is worth accounting for, specially for dev workflows meant to be secure. Disclosing the cron_key for each db dump may not be always desirable.
Optionally, the error message in the status page could let the site owner to regenerate it by clicking a 'generate now' link. I'm not talking of generating new cron_key at will, but regenerate it if missing.
I'm already aware that this should be first implemented in 8.x, but I still think it's a feature worth having also in 7.x.
What do you think?

amontero’s picture

Version: 7.x-dev » 8.x-dev
marcingy’s picture

Status: Active » Closed (won't fix)

This was closed in 2008 it is simply not needed in core

amontero’s picture

Hi marcingy.
What would be the problem in having such thing in core? Can you elaborate on this, please?
Maybe I should open a new issue? I searched first and since found this closely similar, thought it would be better to not spawn a new issue.
TIA.

amontero’s picture

Status: Closed (won't fix) » Active

Reopening for further input.
As an added use case, how about cron key being compromised?

amontero’s picture

Issue tags: +Security

Tagging 'security' to attract review in case of cron_key compromise.

amontero’s picture

Component: base system » cron system

Categorizing.

amontero’s picture

Issue summary: View changes
christefano’s picture

Thanks for pointing me to this issue, amontero. I agree this should be in Drupal core and will review this and related issues when I have a free moment.

greggles’s picture

Status: Active » Needs review
Issue tags: -cron, -Security

Removing the tags. Cron is a component so no need to tag with it.

I'm not sure I see how this is security related, so removing that. Can you expand on that?

The last submitted patch, cron_generate_key.patch, failed testing.

greggles’s picture

Status: Needs review » Needs work

The menu callback needs some protection against CSRF.

nevergone’s picture

tstoeckler’s picture

If for example the cron key to a site was in some way accidentally publically disclosed and is now actively being used to DoS the site, I would consider it a security improvement to be able to change the key in an easy way. So I think the "security" tag (or "Security Improvement") is warranted. But maybe I'm missing something.

nevergone’s picture

#17:

1.) disable outside cron url (htaccess or other alternative)
2.) use drush
3.) PROFIT! :)

greggles’s picture

Issue tags: +Security improvements

OK, I can see that. Security improvements is the main tag used for security related items in the public queue.

christefano’s picture

@nevergone, the Cron Key module does this, too. Would you like to combine forces or obsolete one of our modules? My preference would be to EOL mine as you already have a D8 version.

   https://www.drupal.org/project/cron_key

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

oturpin’s picture

Hello,
I am using Elysia cron. Is this module compatible with it ? I cannot see the "change key" interface on parameter page ?
Thx

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joachim namyslo’s picture

Maybe it is easier to bring this into core

https://www.drupal.org/project/cronkeychange

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

prudloff made their first commit to this issue’s fork.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.