|
|
|
|
@ -6,26 +6,26 @@ Configure::set('passwords', ['length' => rand(16, 26)]); |
|
|
|
|
|
|
|
|
|
$root_password = make_password(Configure::get('passwords', 'length')); |
|
|
|
|
|
|
|
|
|
Configure::set('post_actions', [ |
|
|
|
|
'chmod_file_or_dir' => [ $cwd . '/mysecret' => 'secret' ] |
|
|
|
|
Configure::set('pre_actions', [ |
|
|
|
|
'make_dir' => [$cwd . '/my_vaults'=>'', '/etc/neato_secrets'=>''], |
|
|
|
|
'chmod_file_or_dir' => |
|
|
|
|
[ $cwd . '/my_vaults' => 'secret', '/etc/neato_secrets' => 'secret' ], |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
//do_command('service', 'mysql', 'stop'); |
|
|
|
|
|
|
|
|
|
force_root(); |
|
|
|
|
|
|
|
|
|
$my_key = Enc::make_key_file("/etc/secrets_mysql"); |
|
|
|
|
file_loop(Configure::get('pre_actions')); |
|
|
|
|
|
|
|
|
|
$my_key = Enc::make_key_file("/etc/neato_secrets/mysql_data"); |
|
|
|
|
|
|
|
|
|
$obj = new stdClass(); |
|
|
|
|
$obj->root = $root_password; |
|
|
|
|
Enc::encode_file("mysecret", $obj, $my_key); |
|
|
|
|
Enc::encode_file($cwd . "/my_vaults/my_secrets", $obj, $my_key); |
|
|
|
|
|
|
|
|
|
//$my_key = read_file("/etc/secrets_mysql"); |
|
|
|
|
//$o = Enc::decode_file("mysecret", $my_key); |
|
|
|
|
//$my_key = read_file("/etc/neato_secrets/mysql_data"); |
|
|
|
|
//$o = Enc::decode_file($cwd . "/my_vaults/my_secrets", $my_key); |
|
|
|
|
//echo $o->root; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//write_file('mysecret', $root_password); |
|
|
|
|
//file_loop(Configure::get('post_actions')); |
|
|
|
|
|
|
|
|
|
//do_command('service', 'mysql', 'start'); |