Created
January 24, 2013 19:09
-
-
Save chronon/4626569 to your computer and use it in GitHub Desktop.
A CakePHP 2.x console command that prints random Security.salt and Security.cipherSeed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* SecurityGenShell - prints randmom Security.salt and Security.cipherSeed for | |
* Config/core.php | |
* | |
* See lib/Cake/Console/Command/Task/ProjectTask.php securitySalt() and | |
* securityCipherSeed(). | |
* | |
* Installation: put this file, named `SecurityGenShell.php`, in `APP/Console/Command`. | |
* Usage: run `Console/cake security_gen` - copy and pasted the values to | |
* APP/Config/core.php. | |
*/ | |
App::uses('Security', 'Utility'); | |
class SecurityGenShell extends AppShell { | |
public function main() { | |
$this->stdout->styles('red', array('text' => 'red')); | |
$securitySalt = Security::generateAuthKey(); | |
$this->out('Security.salt: <red>' . $securitySalt . '</red>'); | |
$securityCipherSeed = substr(bin2hex(Security::generateAuthKey()), 0, 30); | |
$this->out('Security.cipherSeed: <red>' . $securityCipherSeed . '</red>'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment