* Changed 'database:❌:...' so that 'x' is now the database host's UUID instead of a simple integer. This will simplify sync'ing configs. Also removed default entries, and made it so that anvil-prep-database injects the local config during first setup. Renamed Database->get_local_id to get_local_uuid and changed the 'id' parameter to 'uuid'. Changed Database->initialize's 'id' parameter to 'host_uuid'. The Database->query, Database->write, Database->_mark_database_as_behind and Database->_find_behind_databases methods had their 'id' parameter changed to 'uuid'.
* Added the 'remote_user' parameter to Get->anvil_version, System->ping and System->change_shell_user_password for conencting to remote targets.
* Added the 'remote_user' parameter to all internal Remote->call uses.
* Updated Storage->backup, Storage->copy_file, Storage->make_directory,
Signed-off-by: Digimer <digimer@alteeve.ca>
* Made logging between journald and a traditional file configurable via 'sys::log_file'. Also made the file handle unbuffered when logging to a file.
* Fixed a bug with loading the anvil.conf config file in a few locations.
* Created System->stty_echo() to handle enabling/disabling shell echo, and added restoring the echo to Tools->catch_sig.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug with handling ssh fingerprints (and removed comments going to the known_hosts file).
* Added more nested debug parameter passing when methods call other methods (though more work is needed to catch up)
Signed-off-by: Digimer <digimer@alteeve.ca>
* Updated Storage->read_file and Storage->write_file to support reading and writing on remote systems (untested though)
* Created System->change_shell_user_password() that changes a shell user's password by manually generating an sha512 salted hash of the given password and uses the resulting hash to modify the target user's password, so the password should never be visible in the process list. Works on both local and remote systems, though it still needs testing.
* Created Storage->rsync() to handle moving files between the local and a remote system.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug where some '$anvil->{}' variables should have been '$anvil->data->{}'.
* Started merging message keys on 'error_xxxx', 'warning_xxxx', etc.
* The anvil-configure-network now configures the network. Commented out, the tool can reconfigure the entire network without a reboot, but a current issue with the post-configured system refusing to use the allocated interface as the default gateway is to be reviewed at a future time. For now, a closing reboot will be issued.
* Started creating 'anvil-change-password' that will update passwords, including apache (and configure .htpasswd when needed).
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got anvil-configure-network writing out the new network config properly, but renaming already-active interfaces isn't working yet.
* Updated System->get_ips() to record the interface name of a given network by MAC address using 'sys::mac::<mac_address>::iface'.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got anvil-configure-network setting the new hostname.
* Updated anvil-configure-network to exit only if the job was picked up by a still-running PID.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got tools/anvil-configure-network to exit if another instance is running. If not, it now starts (barely) the process of configuring the network.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed some logging in Get->cgi() and generally cleaned up logging levels.
* Got striker to the point where the job to reconfigure the network is saved in the database and the dashboard goes offline until it is done.
* Created the start of the new anvil-configure-network tool.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added 'file' and 'line' arguments to the Database->insert_or_update_X methods to allow for the original caller's file and line number to be recorded in the SQL call logs.
* Cleaned up how logging to 'anvil.log' logging is handled.
* Updated anvil-update-states to ignore libvirt bridges and to manually set the speed and duplex of virtio network based interfaces.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug with resync, but others remain as resync is incomplete (at least for network_interfaces).
* Currently, tools/anvil-update-states is broken while working on the above issue.
* Reworked the jobs table and removed the units/anvil-jobs.service unit. Jobs will be invoked and backgrounded in all calls.
* Started adding missing hidden form fields.
* Updated the 'server' OCF resource agent version and metadata.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Created a new tool (that may go away) for monitoring for network changes as quickly and with as few resources as possible.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added the 'debug' parameter to System->enable_daemon.
* Fixed a bug where the old 'Tools.sql' files was being referenced instead of the new 'anvil.sql'.
* Added the 'debug' parameter to Database->initialize and Database->write. Also made it enable the postgresql daemon when initializing the DB.
* Added the 'debug' parameter to Get->host_uuid.
* Fixed the old anvil.conf variable from defaults::log::db_transactions to sys::database::log_transactions.
* Fixed a bad replacement variable name in anvil.sql.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added the 'debug' parameter to System->call(). Also added a check to make sure that the called executable exists.
* Added the 'debug' parameter to System->start_daemon().
Signed-off-by: Digimer <digimer@alteeve.ca>
* Moved all executables to /usr/sbin/
* Made /root/anvil-backups/ the backup directory.
* Started debuging anvil-prep-database
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed display issues when showing a summary of what will be done if the user confirms the reconfiguration of the Striker.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Created Storage->record_md5sums() and Storage->check_md5sums for use in daemons. These will record the md5sums of the program itself, all perl modules and the words file. When check_md5sums is called, it returns '1' if any sums have changed, which daemons can trigger on to exit (and systemd will restart them). Removed the basic md5sum check from anvil-daemon and switched to this.
* Fixed how 'fatalstobrowsers' is invoked so that it only applies to programs running in a browser.
Signed-off-by: Digimer <digimer@alteeve.ca>
We've decided to give up on trying to keep ScanCore, AN::Tools and Striker as three separate things. We had originally hoped to make ScanCore easily separatable from the Anvil!, but this was adding increasing complexity to the project and complexity is the enemy of reliability.
In this release, AN::Tools becomes Anvil::Tools, all configuration files move to /etc/anvil and all programs and data files move to /usr/sbin/anvil. Words files are now merged, as are SQL schemas (ScanCore agents will still maintain their own, later). The journald tag has changed from 'an-tools' to 'anvil'.
Other changes;
* Tools.t has been updated to handle existing tests. New methods and parameters still need to have tests added though.
* Added a simple test.pl script used for testing things outside the main program. It will be removed before final release.
* Added the simple 'watch_logs' bash script to more easily tail output.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Started using Time::HiRes and recording the run time of programs using AN::Tools at log level 2.
* Added a check in tools/an-prep-database to write journald.conf.d/an.conf to disable rate limiting to allow high log levels without losing messages.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added a start-check to make sure 'home' could read the host UUID and exit if not.
* Removed network_interface_current_name / network_interface_requested_name from the network_interfaces DB table and used simply network_interface_name.
* Added caching to Storage->read_file().
* Now record form answers in the variables table as 'form::<form_name>::<variable>::value' and read the same when the form is first loaded.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Updated Database->connect to always test if hosts table exists and load the core schema if not.
* Fixed Database->write to log all SQL when 'sys::database::log_transactions' is set.
* Got tools/scancore-update-states scanning and recording network interface data to the database. Also removed it writing out the XML status file.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Changed Log->secure and Log->level to take new settings using 'set => X' parameter to bring them inline with other modules.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug in Tools.pm->_set_paths where a path set to '#!not_found!#' was being set (the existing value should have been left alone).
* Fixed some escaping in Log->entry. Also added some additional checks to error more gracefully.
* Created Storage->copy_file() that, well, copies files.
* Fixed Storage->find to not call Log->entry.
* Fixed Storage->make_directory() to only pass the first digit when passed a GID or UID with more that one digit (as can happen with GIDs).
* Updated Storage->write_file() to take 'secure' as a parameter to treat the file contents as containing secure data for logging purposes.
* Created System->check_daemon and ->start_daemon to check and start systemd daemons, as needed.
* Updated scancore-daemon to support running things just once on invocation (effectively run on boot or daemon restart). Call scancore-database. from here.
* Added reading striker.conf to scancore-update-states.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Created Convert->cidr() that will convert dotted decimal subnets to CIDR notation and vice versa.
* Created Database->get_local_id that returns the ID from striker.conf that matches the local host, if any,
* Created Get->network_details that returns the host name and a list of interfaces and their IP addresses (if any).
* Created System->call() that takes a shell call and returns the output.
* Created icon for the top-right bar that are "on" (lit up).
* Created a skeleton striker.conf file.
* Created the new scancore-database tool that will manage ScanCore databases.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug in Storage->write_file() where the parent directory wasn't created if it was missing. Also removed passing the mode to the parent directory creation as the file mode rarely applies to the directory (ie: 644 breaks directories but is common for files).
* Changed Template->skin to return just the skin name, not the path.
* Updated scancore-update-states to write the network state information to both xml (for ScanCore) and JSON (for jquery) files.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Renamed 'defaults::languages' to 'defaults::language'.
* Created Storage->change_mode(), Storage->change_owner(), Storage->make_directory() and Storage->write_file() that does what their names imply, using the shell commands instead of the built-in commands (may switch to them later). The ->make_directory() method will create any needed parent directories.
* Moved System->read_file() to the Storage module as it made more sense there. For now, System is empty.
* Created Words->language to set or check the active output language.
* Fixed Template->get() to use Words->language.
* Updated Words->string() to take the new 'string' parameter which, when set, is used instead of the 'key' parameter and is treated as a pre-retrieved string, so replacement keys are directly injected.
* Updated Template->get() to take the 'variables' parameter and then uses Words->string({string => ...}) to process the replacement keys.
* Updated tools/scancore-update-states to write out the network interface states to the status.xml file.
Signed-off-by: Digimer <digimer@alteeve.ca>