* Fixed how passwords are supressed in logs.

* Fixed config step 2 display.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 7 years ago
parent 2d88502f6a
commit 1539ef72a8
  1. 4
      Anvil/Tools/Account.pm
  2. 24
      Anvil/Tools/Database.pm
  3. 4
      Anvil/Tools/Get.pm
  4. 6
      Anvil/Tools/Remote.pm
  5. 20
      Anvil/Tools/Storage.pm
  6. 6
      Anvil/Tools/System.pm
  7. 16
      cgi-bin/home
  8. 2
      tools/anvil-change-password
  9. 2
      tools/anvil-configure-striker

@ -128,7 +128,7 @@ sub encrypt_password
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
algorithm => $algorithm,
hash_count => $hash_count,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
salt => $salt,
}});
@ -711,7 +711,7 @@ sub validate_password
my $valid = 0;
my $hash = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
user => $user,
}});

@ -676,7 +676,7 @@ sub connect
port => $port,
name => $name,
user => $user,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
# Some places will want to pull up the database user, so in case it isn't set (which is
@ -715,7 +715,7 @@ sub connect
port => $port,
name => $name,
user => $user,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
### TODO: Can we do a telnet port ping with a short timeout instead of a shell ping call?
@ -986,7 +986,7 @@ sub connect
"database::${uuid}::port" => $anvil->data->{database}{$uuid}{port},
"database::${uuid}::name" => $database_name,
"database::${uuid}::user" => $database_user,
"database::${uuid}::password" => $anvil->Log->secure ? $anvil->data->{database}{$uuid}{password} : "#!string!log_0186!#",
"database::${uuid}::password" => $anvil->Log->secure ? $anvil->data->{database}{$uuid}{password} : $anvil->Words->string({key => "log_0186"}),
}});
# Copy my alert hash before I delete the uuid.
@ -1045,7 +1045,7 @@ sub connect
"database::${uuid}::port" => $anvil->data->{database}{$uuid}{port},
"database::${uuid}::name" => $database_name,
"database::${uuid}::user" => $database_user,
"database::${uuid}::password" => $anvil->Log->secure ? $anvil->data->{database}{$uuid}{password} : "#!string!log_0186!#",
"database::${uuid}::password" => $anvil->Log->secure ? $anvil->data->{database}{$uuid}{password} : $anvil->Words->string({key => "log_0186"}),
}});
### TODO: Is this still an issue? If so, then we either need to require that the DB host
@ -3377,7 +3377,7 @@ sub insert_or_update_users
line => $line,
user_uuid => $user_uuid,
user_name => $user_name,
user_password_hash => (($anvil->Log->secure) or ($user_salt)) ? $user_password_hash : "#!string!log_0186!#" ,
user_password_hash => (($anvil->Log->secure) or ($user_salt)) ? $user_password_hash : $anvil->Words->string({key => "log_0186"}) ,
user_salt => $user_salt,
user_algorithm => $user_algorithm,
user_hash_count => $user_hash_count,
@ -3427,7 +3427,7 @@ sub insert_or_update_users
$user_algorithm = $answer->{user_algorithm};
$user_hash_count = $answer->{user_hash_count};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
user_password_hash => (($anvil->Log->secure) or ($user_salt)) ? $user_password_hash : "#!string!log_0186!#" ,
user_password_hash => (($anvil->Log->secure) or ($user_salt)) ? $user_password_hash : $anvil->Words->string({key => "log_0186"}) ,
user_salt => $user_salt,
user_algorithm => $user_algorithm,
user_hash_count => $user_hash_count,
@ -4347,7 +4347,7 @@ sub query
uuid => $uuid,
"cache::db_fh::${uuid}" => $anvil->data->{cache}{db_fh}{$uuid},
line => $line,
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : "#!string!log_0186!#",
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : $anvil->Words->string({key => "log_0186"}),
secure => $secure,
source => $source,
}});
@ -4394,14 +4394,14 @@ sub query
# Do the query.
my $DBreq = $anvil->data->{cache}{db_fh}{$uuid}->prepare($query) or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0075", variables => {
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : "#!string!log_0186!#",
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : $anvil->Words->string({key => "log_0186"}),
server => $say_server,
db_error => $DBI::errstr,
}});
# Execute on the query
$DBreq->execute() or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0076", variables => {
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : "#!string!log_0186!#",
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : $anvil->Words->string({key => "log_0186"}),
server => $say_server,
db_error => $DBI::errstr,
}});
@ -4919,7 +4919,7 @@ sub write
uuid => $uuid,
"cache::db_fh::${uuid}" => $anvil->data->{cache}{db_fh}{$uuid},
line => $line,
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : "#!string!log_0186!#",
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : $anvil->Words->string({key => "log_0186"}),
secure => $secure,
source => $source,
reenter => $reenter,
@ -5068,7 +5068,7 @@ sub write
# Do the do.
$anvil->data->{cache}{db_fh}{$uuid}->do($query) or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0090", variables => {
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : "#!string!log_0186!#",
query => ((not $secure) or (($secure) && (not $anvil->Log->secure))) ? $query : $anvil->Words->string({key => "log_0186"}),
server => $say_server,
db_error => $DBI::errstr,
}});
@ -5286,7 +5286,7 @@ sub _find_behind_databases
"database::${uuid}::port" => $anvil->data->{database}{$uuid}{port},
"database::${uuid}::name" => $database_name,
"database::${uuid}::user" => $database_user,
"database::${uuid}::password" => $anvil->Log->secure ? $anvil->data->{database}{$uuid}{password} : "#!string!log_0186!#",
"database::${uuid}::password" => $anvil->Log->secure ? $anvil->data->{database}{$uuid}{password} : $anvil->Words->string({key => "log_0186"}),
}});
# Loop through the tables in this DB. For each table, we'll record the most recent time

@ -125,7 +125,7 @@ sub anvil_version
my $target = defined $parameter->{target} ? $parameter->{target} : "local";
my $version = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
port => $port,
remote_user => $remote_user,
target => $target,
@ -327,7 +327,7 @@ sub cgi
if ((($variable =~ /passwd/) or ($variable =~ /password/)) && (not $anvil->Log->secure))
{
# This is a password and we're not logging sensitive data, obfuscate it.
$censored_value = "#!string!log_0186!#";
$censored_value = $anvil->Words->string({key => "log_0186"});
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => {
"cgi::${variable}::$say_value" => $censored_value,

@ -294,9 +294,9 @@ sub call
# NOTE: The shell call might contain sensitive data, so we show '--' if 'secure' is set and $anvil->Log->secure is not.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $log_level, list => {
'close' => $close,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
secure => $secure,
shell_call => ((not $anvil->Log->secure) && ($secure)) ? "#!string!log_0186!#" : $shell_call,
shell_call => ((not $anvil->Log->secure) && ($secure)) ? $anvil->Words->string({key => "log_0186"}) : $shell_call,
ssh_fh => $ssh_fh,
start_time => $start_time,
remote_user => $remote_user,
@ -467,7 +467,7 @@ sub call
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $log_level, list => {
remote_user => $remote_user,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
if (not $ssh_fh->auth_password($remote_user, $password))
{

@ -144,7 +144,7 @@ sub backup
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
fatal => $fatal,
port => $port,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
target => $target,
remote_user => $remote_user,
source_file => $source_file,
@ -609,7 +609,7 @@ sub copy_file
my $target = defined $parameter->{target} ? $parameter->{target} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
overwrite => $overwrite,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
remote_user => $remote_user,
source_file => $source_file,
target_file => $target_file,
@ -904,7 +904,7 @@ sub make_directory
group => $group,
mode => $mode,
port => $port,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
remote_user => $remote_user,
target => $target,
user => $user,
@ -1234,7 +1234,7 @@ sub read_file
file => $file,
force_read => $force_read,
port => $port,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
remote_user => $remote_user,
secure => $secure,
target => $target,
@ -1546,7 +1546,7 @@ sub rsync
my $failed = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
destination => $destination,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
port => $port,
source => $source,
switches => $switches,
@ -1860,11 +1860,11 @@ sub update_config
my $update = 0;
my $new_file = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
port => $port,
secure => $secure,
target => $target,
value => ((not $secure) or ($anvil->Log->secure)) ? $value : "#!string!log_0186!#",
value => ((not $secure) or ($anvil->Log->secure)) ? $value : $anvil->Words->string({key => "log_0186"}),
variable => $variable,
remote_user => $remote_user,
}});
@ -1901,7 +1901,7 @@ sub update_config
my $is_secure = $this_variable =~ /passw/i ? 1 : 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
this_variable => $this_variable,
this_value => ((not $is_secure) or ($anvil->Log->secure)) ? $this_value : "#!string!log_0186!#",
this_value => ((not $is_secure) or ($anvil->Log->secure)) ? $this_value : $anvil->Words->string({key => "log_0186"}),
}});
if ($this_variable eq $variable)
{
@ -2060,7 +2060,7 @@ sub write_file
mode => $mode,
overwrite => $overwrite,
port => $port,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
secure => $secure,
target => $target,
user => $user,
@ -2326,7 +2326,7 @@ sub _create_rsync_wrapper
my $target = defined $parameter->{target} ? $parameter->{target} : "";
my $password = defined $parameter->{password} ? $parameter->{password} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 0, list => {
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
target => $target,
}});

@ -251,8 +251,8 @@ sub change_shell_user_password
target => $target,
port => $port,
remote_user => $remote_user,
new_password => $anvil->Log->secure ? $new_password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
new_password => $anvil->Log->secure ? $new_password : $anvil->Words->string({key => "log_0186"}),
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
# Do I have a user?
@ -1335,7 +1335,7 @@ sub ping
count => $count,
fragment => $fragment,
payload => $payload,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
ping => $ping,
port => $port,
remote_user => $remote_user,

@ -297,19 +297,19 @@ sub process_sync_page
foreach my $uuid (keys %{$anvil->data->{database}})
{
next if $uuid eq $host_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { uuid => $uuid }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { uuid => $uuid }});
my $host = $anvil->data->{database}{$uuid}{host} ? $anvil->data->{database}{$uuid}{host} : ""; # This should fail
my $port = $anvil->data->{database}{$uuid}{port} ? $anvil->data->{database}{$uuid}{port} : 5432;
my $name = $anvil->data->{database}{$uuid}{name} ? $anvil->data->{database}{$uuid}{name} : $anvil->data->{sys}{database}{name};
my $user = $anvil->data->{database}{$uuid}{user} ? $anvil->data->{database}{$uuid}{user} : $anvil->data->{sys}{database}{user};
my $password = $anvil->data->{database}{$uuid}{password} ? $anvil->data->{database}{$uuid}{password} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host => $host,
port => $port,
name => $name,
user => $user,
password => $anvil->Log->secure ? $password : "#!string!log_0186!#",
password => $anvil->Log->secure ? $password : $anvil->Words->string({key => "log_0186"}),
}});
}
@ -336,7 +336,7 @@ sub configure_striker
{
# Sanity check step1.
my $sane = sanity_check_step1($anvil);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { sane => $sane }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { sane => $sane }});
if ($sane)
{
# Step 1 was sane, show step 2.
@ -718,8 +718,10 @@ ORDER BY
### Show the bonded ifaces form.
# BCN
my $bcn_count = $anvil->data->{cgi}{bcn_count}{value} ? $anvil->data->{cgi}{bcn_count}{value} : 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bcn_count => $bcn_count }});
foreach my $bcn (1..$bcn_count)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bcn => $bcn }});
push @{$links}, "bcn_link".$bcn;
my $this_ip_key = "bcn".$bcn."_ip";
my $this_subnet_key = "bcn".$bcn."_subnet";
@ -767,8 +769,10 @@ ORDER BY
# IFN
my $ifn_count = $anvil->data->{cgi}{ifn_count}{value} ? $anvil->data->{cgi}{ifn_count}{value} : 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ifn_count => $ifn_count }});
foreach my $ifn (1..$ifn_count)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ifn => $ifn }});
push @{$links}, "ifn_link".$ifn;
my $this_ip_key = "ifn".$ifn."_ip";
my $this_subnet_key = "ifn".$ifn."_subnet";
@ -798,7 +802,7 @@ ORDER BY
});
# Assemble the form
$interface_form .= $anvil->Template->get({file => "main.html", name => "bonded_interface_form", variables => {
$interface_form .= $anvil->Template->get({file => "config.html", name => "bonded_interface_form", variables => {
field => $anvil->Words->string({key => "striker_0022", variables => { number => $ifn }}),
description => "#!string!striker_0023!#",
ip_key => $this_ip_key,
@ -960,7 +964,7 @@ ORDER BY
id => "striker_user",
field => "#!string!striker_0031!#",
description => "#!string!striker_0032!#",
value => defined $anvil->data->{cgi}{striker_user}{value} ? $anvil->data->{cgi}{striker_user}{value} : $anvil->data->{sys}{user},
value => defined $anvil->data->{cgi}{striker_user}{value} ? $anvil->data->{cgi}{striker_user}{value} : $anvil->data->{sys}{user}{name},
default_value => "",
class => $striker_user_class,
extra => "",

@ -220,7 +220,7 @@ sub update_local_passwords
print $anvil->Words->string({key => "message_0026", variables => { user => $user }});
my $query = "ALTER ROLE ".$user." WITH PASSWORD ".$dbh->quote($anvil->data->{switches}{'new-password'});
$dbh->do($query) or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0090", variables => {
query => $anvil->Log->secure ? $query : "#!string!log_0186!#",
query => $anvil->Log->secure ? $query : $anvil->Words->string({key => "log_0186"}),
server => "localhost",
db_error => $DBI::errstr,
}});

@ -258,7 +258,7 @@ sub reconfigure_network
my $link1_mac = $anvil->data->{variables}{form}{config_step2}{$link1_key}{value};
my $link2_mac = defined $anvil->data->{variables}{form}{config_step2}{$link2_key}{value} ? $anvil->data->{variables}{form}{config_step2}{$link2_key}{value} : "";
my $old_link1_iface = $anvil->data->{sys}{mac}{$link1_mac}{iface} ? $anvil->data->{sys}{mac}{$link1_mac}{iface} : "";
my $old_link2_iface = $link2_mac ? $anvil->data->{sys}{mac}{$link2_mac}{iface} : "";
my $old_link2_iface = defined $anvil->data->{sys}{mac}{$link2_mac}{iface} ? $anvil->data->{sys}{mac}{$link2_mac}{iface} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
ip_key => $ip_key,
is_gateway => $is_gateway,

Loading…
Cancel
Save