You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
<?php
|
|
configure::set('display', true); // Show Output
|
|
configure::set('logfile', false); // Save to log folder
|
|
configure::set('syslog', false);
|
|
configure::set('passwords', ['length' => rand(16, 26)]);
|
|
|
|
configure::set('pre_actions', [
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
'make_dir' => [$cwd . '/my_vaults'=>'', '/etc/neato_secrets'=>''],
|
|
'chmod_file_or_dir' =>
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
[ $cwd . '/my_vaults' => 'keydir', '/etc/neato_secrets' => 'keydir' ],
|
|
]);
|
|
|
|
force_root();
|
|
|
|
//do_command('service', 'mysql', 'stop');
|
|
|
|
file_loop(configure::get('pre_actions'));
|
|
|
|
$my_key = enc::make_key_file("/etc/neato_secrets/mysql_key");
|
|
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
if (!file_exists($cwd . "/my_vaults/mysql_secrets")) {
|
|
$root_password = make_password(configure::get('passwords', 'length'));
|
|
$obj = new stdClass();
|
|
$obj->root = $root_password;
|
|
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
enc::encode_file($cwd . "/my_vaults/mysql_secrets", $obj, $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;
|
|
|
|
//do_command('service', 'mysql', 'start');
|
|
$ret = do_command('service', 'mysql', 'status');
|
|
if ($ret === 0) {
|
|
echo "Status Running ;-)";
|
|
} else {
|
|
echo "Status Not Running!";
|
|
} |