* Decided to abandon using apache security and to integrate it into Striker itself. This will allow for layers of access, easier account sync'ing, etc. Further, there is no proper way to handle logging out on apache, and they use md5 * 1000 iterations (with a salt, to be fair) for security... Not exactly the strongest.
* Created the new Account.pm module for handling account related tasks.
* Moved 'sys::stty' to 'sys::terminal:stty'.
* Created Get->_salt which generates a (pseudo) random salt for internal passwords and Get->_wrap_to that checks the current terminal width.
* Added the parameter 'redirect_stderr' (default '1') to System->call to optionally not redirect STDERR to STDOUT (needed for tput to be useful as STDERR is a terminal of sorts).
* Disabled System->change_apache_password (to be removed entirely later).
* Created Words->_wrap_string to wrap text strings to the active terminal width.
* Added the user's table to the core SQL. Also deleted the empty Anvil/Tools.sql file.
Signed-off-by: Digimer <digimer@alteeve.ca>
ThischangesthepasswordusedtoconnettoStriker's web interface. If the C<< .htpasswd >> file isn'tfound,thismethodwilleffectivelyenablethepasswordfeature.
# This changes the password used to connet to Striker's web interface. If the C<< .htpasswd >> file isn't found, this method will effectively enable the password feature.
#
# The return code will be C<< 255 >> on internal error. Otherwise, it will be the code returned from the C<< passwd >> call.
#
# Parameters;
#
# =head3 new_password (required)
#
# This is the new password to set. The user should be encouraged to select a good (long) password.
#
# =head3 password (optional)
#
# If you are changing the apache password on a remote machine, this is the password used to connect to that machine. If not passed, an attempt to connect with passwordless SSH will be made (but this won't be the case in most instances). Ignored if C<< target >> is not given.
#
# =head3 port (optional, default 22)
#
# This is the TCP port number to use if connecting to a remote machine over SSH. Ignored if C<< target >> is not given.
#
# =head3 remote_user (optional, default root)
#
# If C<< target >> is set and we're changing the password for a remote user, this is the user we B<< log into >> the remote machine as, B<< not >> the user whose password we will change.
#
# =head3 target (optional)
#
# This is the IP address or (resolvable) host name of the target machine whose user account you want to change the password
#
# =head3 user (optional, default 'sys::apache::user' or 'admin')
#
# This is the apache user name to use. If another name existed before in C<< .htpasswd >>, that old user name will be removed.
#
# =cut
# sub change_apache_password
# {
# my $self = shift;
# my $parameter = shift;
# my $anvil = $self->parent;
# my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
#
# my $new_password = defined $parameter->{new_password} ? $parameter->{new_password} : "";
# my $password = defined $parameter->{password} ? $parameter->{password} : "";
# my $port = defined $parameter->{port} ? $parameter->{port} : "";
# my $remote_user = defined $parameter->{remote_user} ? $parameter->{remote_user} : "";
# my $target = defined $parameter->{target} ? $parameter->{target} : "";
# my $user = defined $parameter->{user} ? $parameter->{user} : $anvil->data->{sys}{apache}{user};
# my $return_code = 255;
# $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
-- Note that is all permissions are left false, the user can still interact with the Anvil! doing safe things, like changing optical media, perform migrations, start servers (but not stop them), etc.
CREATETABLEusers(
user_uuiduuidnotnullprimarykey,-- This is the single most important record in Anvil!. Everything links back to here.
user_nametextnotnull,
user_passwordtext,-- A user without a password is disabled.
user_salttext,-- This is used to enhance the security of the user's password.
user_languagetext,-- If set, this will choose a different language over the default.
user_is_adminbooleannotnulldefaultfalse,-- If true, all aspects of the program are available to the user.
user_is_experiencedbooleannotnulldefaultfalse,-- If true, user is allowed to delete a server, alter disk size, alter hardware and do other potentially risky things. They will also get fewer confirmation dialogues.
user_is_trustedbooleannotnulldefaultfalse,-- If true, user is allowed to do things that would cause interruptions, like force-reset and gracefully stop servers, withdraw nodes, and stop the Anvil! entirely.