* Fixed a bug in anvil.js where the state of a link always said 'up', even when it was down.

* Fixed a couple logging bugs in System->call().
* Fixed a bug in anvil-daemon where it was trying to setup setuid-C wrappers on non-dashboards.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent 90f5bf49d5
commit e8d15112da
  1. 4
      Anvil/Tools/System.pm
  2. 2
      html/skins/alteeve/anvil.js
  3. 6
      share/words.xml
  4. 38
      tools/anvil-daemon
  5. 4
      tools/anvil-update-states

@ -248,7 +248,7 @@ sub call
if (not -e $program) if (not -e $program)
{ {
$found = 0; $found = 0;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0141", variable => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0141", variables => {
program => $program, program => $program,
shell_call => $shell_call, shell_call => $shell_call,
}}); }});
@ -256,7 +256,7 @@ sub call
elsif (not -x $program) elsif (not -x $program)
{ {
$found = 0; $found = 0;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0142", variable => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "log_0142", variables => {
program => $program, program => $program,
shell_call => $shell_call, shell_call => $shell_call,
}}); }});

@ -182,7 +182,7 @@ $( window ).on( "load", function()
// Only real interfaces have a 'changed_order' value. // Only real interfaces have a 'changed_order' value.
if (nic.changed_order) { if (nic.changed_order) {
var say_link_state = say_down; var say_link_state = say_down;
if (nic.link_state) { if (nic.link_state == 1) {
say_link_state = say_up; say_link_state = say_up;
} }
body += '<tr class="data_row">'; body += '<tr class="data_row">';

@ -432,8 +432,8 @@ The database connection error was:
<key name="log_0138"><![CDATA[[ Error ] - The method: [#!variable!method!#] was with an invalid 'job_progress': [#!variable!job_progress!#]. It needs to be a whole-number value between 0 and 100, inclusive.]]></key> <key name="log_0138"><![CDATA[[ Error ] - The method: [#!variable!method!#] was with an invalid 'job_progress': [#!variable!job_progress!#]. It needs to be a whole-number value between 0 and 100, inclusive.]]></key>
<key name="log_0139"><![CDATA[[ Error ] - Failed to initialized the database! The file: [#!variable!file!#] already exists, which should not be the case when initializing the database.]]></key> <key name="log_0139"><![CDATA[[ Error ] - Failed to initialized the database! The file: [#!variable!file!#] already exists, which should not be the case when initializing the database.]]></key>
<key name="log_0140"><![CDATA[[ Error ] - Failed to initialized the database! Information on why this failed might be found in: [#!variable!file!#].]]></key> <key name="log_0140"><![CDATA[[ Error ] - Failed to initialized the database! Information on why this failed might be found in: [#!variable!file!#].]]></key>
<key name="log_0141"><![CDATA[[ Error ] - The system call: [#!variable!system_call!#] will fail because the program: [#!variable!program!#] doesn't exist.]]></key> <key name="log_0141"><![CDATA[[ Error ] - The system call: [#!variable!shell_call!#] will fail because the program: [#!variable!program!#] doesn't exist.]]></key>
<key name="log_0142"><![CDATA[[ Error ] - The system call: [#!variable!system_call!#] will fail because the program: [#!variable!program!#] isn't executable.]]></key> <key name="log_0142"><![CDATA[[ Error ] - The system call: [#!variable!shell_call!#] will fail because the program: [#!variable!program!#] isn't executable.]]></key>
<key name="log_0143">Failed to find a local ID, no databases are stored on this machine.</key> <key name="log_0143">Failed to find a local ID, no databases are stored on this machine.</key>
<key name="log_0144">PostgreSQL server is not installed, unable to proceed.</key> <key name="log_0144">PostgreSQL server is not installed, unable to proceed.</key>
<key name="log_0145"><![CDATA[[ Warning ] - Unable to use the database on the host: [#!variable!host!#]. The local Anvil! version is: [#!variable!local_version!#], and the target host's is: [#!variable!target_version!#]. If you are upgrading, we will resync and use it once the host and our version is again the same.]]></key> <key name="log_0145"><![CDATA[[ Warning ] - Unable to use the database on the host: [#!variable!host!#]. The local Anvil! version is: [#!variable!local_version!#], and the target host's is: [#!variable!target_version!#]. If you are upgrading, we will resync and use it once the host and our version is again the same.]]></key>
@ -822,7 +822,7 @@ Here we will inject 't_0006', which injects 't_0001' which has a variable: [#!st
<key name="header_0003">Name</key> <key name="header_0003">Name</key>
<key name="header_0004">State</key> <key name="header_0004">State</key>
<key name="header_0005">Speed</key> <key name="header_0005">Speed</key>
<key name="header_0006">Up Order</key> <key name="header_0006">Change Order</key>
<key name="header_0007">Inbound Connections</key> <key name="header_0007">Inbound Connections</key>
<key name="header_0008">Via network:</key> <key name="header_0008">Via network:</key>
<key name="header_0009">Peer Connections</key> <key name="header_0009">Peer Connections</key>

@ -69,7 +69,7 @@ $| = 1;
my $anvil = Anvil::Tools->new(); my $anvil = Anvil::Tools->new();
$anvil->Log->level({set => 2}); $anvil->Log->level({set => 2});
$anvil->Log->secure({set => 1}); $anvil->Log->secure({set => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
# Connect to the database(s). If we have no connections, we'll proceed anyway as one of the 'run_once' tasks # Connect to the database(s). If we have no connections, we'll proceed anyway as one of the 'run_once' tasks
# is to setup the database server. # is to setup the database server.
@ -108,10 +108,10 @@ if (not $anvil->data->{sys}{database}{connections})
$anvil->refresh(); $anvil->refresh();
$anvil->Database->connect({debug => 3, check_if_configured => 1}); $anvil->Database->connect({debug => 3, check_if_configured => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections}) if (not $anvil->data->{sys}{database}{connections})
{ {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 0, level => 2, secure => 0, key => "log_0439"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 0, level => 3, secure => 0, key => "log_0439"});
} }
} }
} }
@ -297,7 +297,7 @@ sub handle_periodic_tasks
### don't use '--force' and let striker-manage-install-target skip the repo update if it happened ### don't use '--force' and let striker-manage-install-target skip the repo update if it happened
### recently enough. ### recently enough.
my $type = $anvil->System->get_host_type(); my $type = $anvil->System->get_host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { type => $type }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { type => $type }});
if ($type eq "dashboard") if ($type eq "dashboard")
{ {
@ -385,7 +385,7 @@ sub check_ssh_keys
# Create it. # Create it.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0272", variables => { user => $user, directory => $ssh_directory }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0272", variables => { user => $user, directory => $ssh_directory }});
$anvil->Storage->make_directory({ $anvil->Storage->make_directory({
debug => 2, debug => 3,
directory => $ssh_directory, directory => $ssh_directory,
user => $user, user => $user,
group => $user, group => $user,
@ -425,7 +425,7 @@ sub check_ssh_keys
# Now read in the key. # Now read in the key.
my $users_public_key = $anvil->Storage->read_file({ my $users_public_key = $anvil->Storage->read_file({
debug => 2, debug => 3,
file => $ssh_public_key_file, file => $ssh_public_key_file,
}); });
$users_public_key =~ s/\n$//; $users_public_key =~ s/\n$//;
@ -449,7 +449,7 @@ sub check_ssh_keys
if (-e $known_hosts_file) if (-e $known_hosts_file)
{ {
$known_hosts_file_body = $anvil->Storage->read_file({ $known_hosts_file_body = $anvil->Storage->read_file({
debug => 2, debug => 3,
file => $known_hosts_file, file => $known_hosts_file,
}); });
$known_hosts_old_body = $known_hosts_file_body; $known_hosts_old_body = $known_hosts_file_body;
@ -465,7 +465,7 @@ sub check_ssh_keys
if (-e $authorized_keys_file) if (-e $authorized_keys_file)
{ {
$authorized_keys_file_body = $anvil->Storage->read_file({ $authorized_keys_file_body = $anvil->Storage->read_file({
debug => 2, debug => 3,
file => $authorized_keys_file, file => $authorized_keys_file,
}); });
$authorized_keys_old_body = $authorized_keys_file_body; $authorized_keys_old_body = $authorized_keys_file_body;
@ -893,6 +893,14 @@ sub check_setuid_wrappers
{ {
my ($anvil) = @_; my ($anvil) = @_;
my $host_type = $anvil->System->get_host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { host_type => $host_type }});
if ($host_type ne "dashboard")
{
# Not a dashboard, setuid scripts aren't needed.
return(0);
}
# Does the call_striker-get-peer-data wrapper exist yet? # Does the call_striker-get-peer-data wrapper exist yet?
if (-e $anvil->data->{path}{exe}{'call_striker-get-peer-data'}) if (-e $anvil->data->{path}{exe}{'call_striker-get-peer-data'})
{ {
@ -904,7 +912,7 @@ sub check_setuid_wrappers
# What is the admin user and group ID? # What is the admin user and group ID?
my $admin_uid = getpwnam('admin'); my $admin_uid = getpwnam('admin');
my $admin_gid = getgrnam('admin'); my $admin_gid = getgrnam('admin');
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
admin_uid => $admin_uid, admin_uid => $admin_uid,
admin_gid => $admin_gid, admin_gid => $admin_gid,
}}); }});
@ -921,13 +929,13 @@ sub check_setuid_wrappers
$call_striker_get_peer_data_body .= " execv(REAL_PATH, av);\n"; $call_striker_get_peer_data_body .= " execv(REAL_PATH, av);\n";
$call_striker_get_peer_data_body .= "}\n"; $call_striker_get_peer_data_body .= "}\n";
my $error = $anvil->Storage->write_file({ my $error = $anvil->Storage->write_file({
debug => 2, debug => 3,
file => $anvil->data->{path}{exe}{'call_striker-get-peer-data'}.".c", file => $anvil->data->{path}{exe}{'call_striker-get-peer-data'}.".c",
body => $call_striker_get_peer_data_body, body => $call_striker_get_peer_data_body,
mode => '644', mode => '644',
overwrite => 1, overwrite => 1,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { error => $error }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { error => $error }});
# If it wrote out, compile it. # If it wrote out, compile it.
if (not -e $anvil->data->{path}{exe}{'call_striker-get-peer-data'}.".c") if (not -e $anvil->data->{path}{exe}{'call_striker-get-peer-data'}.".c")
@ -939,7 +947,7 @@ sub check_setuid_wrappers
{ {
# Compile it # Compile it
my ($output, $return_code) = $anvil->System->call({ my ($output, $return_code) = $anvil->System->call({
debug => 2, debug => 3,
shell_call => $anvil->data->{path}{exe}{gcc}." -o ".$anvil->data->{path}{exe}{'call_striker-get-peer-data'}." ".$anvil->data->{path}{exe}{'call_striker-get-peer-data'}.".c", shell_call => $anvil->data->{path}{exe}{gcc}." -o ".$anvil->data->{path}{exe}{'call_striker-get-peer-data'}." ".$anvil->data->{path}{exe}{'call_striker-get-peer-data'}.".c",
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
@ -956,13 +964,13 @@ sub check_setuid_wrappers
else else
{ {
$anvil->Storage->change_owner({ $anvil->Storage->change_owner({
debug => 2, debug => 3,
path => $anvil->data->{path}{exe}{'call_striker-get-peer-data'}, path => $anvil->data->{path}{exe}{'call_striker-get-peer-data'},
user => 'root', user => 'root',
group => 'root', group => 'root',
}); });
$anvil->Storage->change_mode({ $anvil->Storage->change_mode({
debug => 2, debug => 3,
path => $anvil->data->{path}{exe}{'call_striker-get-peer-data'}, path => $anvil->data->{path}{exe}{'call_striker-get-peer-data'},
mode => '4755', mode => '4755',
}); });
@ -1094,7 +1102,7 @@ sub prep_database
}); });
if ($database_output) if ($database_output)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { database_output => $database_output }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { database_output => $database_output }});
} }
} }

@ -474,7 +474,7 @@ sub update_network
} }
my $bond_uuid = $anvil->Database->insert_or_update_bonds({ my $bond_uuid = $anvil->Database->insert_or_update_bonds({
debug => 2, debug => 3,
file => $THIS_FILE, file => $THIS_FILE,
line => __LINE__, line => __LINE__,
bond_name => $interface, bond_name => $interface,
@ -536,7 +536,7 @@ sub update_network
}}); }});
} }
my $network_interface_uuid = $anvil->Database->insert_or_update_network_interfaces({ my $network_interface_uuid = $anvil->Database->insert_or_update_network_interfaces({
debug => 2, debug => 3,
file => $THIS_FILE, file => $THIS_FILE,
line => __LINE__, line => __LINE__,
network_interface_bond_uuid => $say_bond_uuid, network_interface_bond_uuid => $say_bond_uuid,

Loading…
Cancel
Save