* Renamed tools/anvil-configure-network to tools/anvil-configure-striker given that it will also now update system passwords.
* Started working on tools/anvil-update-states to properly handle a Striker with already-configured networking.
* Cleaned up tools/anvil-change-password.
* Fixed a bug in Storage->update_config to set the ownership of anvil.conf to 'apache:apache' so that the web server can read it.
Signed-off-by: Digimer <digimer@alteeve.ca>
# 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 => {
<keyname="error_0008">Failed to read the file: [#!variable!file!#]. Please see the logs for details</key>
<keyname="error_0008">Failed to read the file: [#!variable!file!#]. It doesn't appear to exist.</key>
<keyname="error_0009">Failed to add the target: [#!variable!target!#]:[#!variable!port!#]'s RSA fingerprint to: [#!variable!user!#]'s list of known hosts.</key>
<keyname="error_0010">There was a problem adding the local machine to the: [#!data!path::configs::anvil.conf!#] file. Please see the log for details.</key>
my $duplex = -e $full_path."/duplex" ? $anvil->Storage->read_file({file => $full_path."/duplex"}) : "unknown"; # full or half?
my $operational = -e $full_path."/operstate" ? $anvil->Storage->read_file({file => $full_path."/operstate"}) : "unknown"; # up or down
my $ip_address = "";
my $subnet_mask = "";
my $speed = $link_state ? $anvil->Storage->read_file({file => $full_path."/speed", debug => 2}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
my $media = "unknown";
my $is_bond = 0;
my $is_slave = 0;
if (exists $anvil->data->{sys}{network}{interface}{$interface})