* Fixed some bugs in Database->insert_or_update_files() and the 'files' table/procedure in the SQL schema.
* Got more work done on anvil-manage-files.
* Created Job->get_job_details().
* Added an executable check for files in Storage->scan_directory().
* Cleaned up some logging and switched to Job->get_job_details() in anvil-update-states and striker-configure-host.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added a 'test' parameter to Log->entry, Storage->make_directory and Words->key to help debug in places that Log->x may not be usable.
* Converted many $anvil->Log->x calls to print if $test to help prevent recursive loops, but not all fixed yet.
* Added the new 'host_keys' database table to the schema for a possible new feature of removing passwords in favour if machines adding peers' public keys to their authorized_hosts file.
* Cleaned up the opening calls to $anvil->Tools->new() in most tools.
* Cleaned up some variables in tools/anvil-update-states after reading their values from files (clean trailing newlines).
Signed-off-by: Digimer <digimer@alteeve.ca>
* Updated anvil.sql to add the new tables needed for alert mail delivery.
* Update anvil.sql and Database->initialize to now default the user to 'admin' and swap that out if needed, instead of using the #!variable!user!#' replacement variable.
* Started updating anvil.spec for EL8.
* Added support for 'striker::repo::extra-packages' which users can use to add additional packages to the Striker repositories.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got scancore scanning the agents directory, and properly holding on startup until at least one database is available (instead of exiting), and holding on startup until the local system is configured.
* Created the skeleton of the first scan agent; scan-network.
* Fixed a bug in Storage->check_md5sums() where dynamically loaded modules, loaded after the initial md5sum calcs, would cause the calling daemon to exit (possibly on every invocation).
* Created the scancore.README that will eventually be the main scan agent guide / API document.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug in Words->parse_banged_string where some variable strings were not being cleared, causing infinite loops.
* Added job progress reporting in striker-manage-install-target, and made it only refresh the RPM repo when '--refresh' is specified (with --force now forcing the issue). This was done to allow adding it into anvil-daemon in such a way that it would only update the RPM repo once a day.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got anvil-manage-install-target finished creating config files and enabling daemons needed for PXE. Still untested in function though.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Fixed a bug in Storage->read_file() where the last newline wasn't always being faithfully recorded.
* Created System->restart_daemon (as opposed to ->reload_daemon).
* Got creating/updating dhcpd.conf / dhcpd working in tools/anvil-manage-install-target.
Signed-off-by: Digimer <digimer@alteeve.ca>
* After much time wasted chasing a dnf bug (https://bugzilla.redhat.com/show_bug.cgi?id=1641947), tools/anvil-manage-install-target now populates the <DOCROOT>/<os_type>/<os_arch>/os/Packages/ directory with needed RPMs.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Updated anvil-configure-striker to use Job methods and reboot using anvil-manage-power. Also updated it to set/clear maintenance mode and mark a reboot required at the end of it's run just prior to reboot.
* Lots of log cleanup.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got anvil-manage-striker-peers working properly (so far).
* Updated anvil-prep-database to call anvil-manage-striker-peers, but testing still needed.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Updated Get->users_home() to default to return the hore directory for the user running the program.
* Updated Remote->call() to start working on handling timeouts.
* Updated Storage->change_owner(), ->make_directory() and ->write_file() to default the the user and group running the program.
* Fixed a bug in home reporting the MAC address of NICs when confirming configuration of Striker. Also changed showing the domain to the hostname.
* Got more work done on sync peers.
* Updated the RPM spec file to install on Fedora 28.
Signed-off-by: Digimer <digimer@alteeve.ca>
* 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>
* 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>
* 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>
* 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>
* 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 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>
* 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>
* Changed Storage->write_file to touch the target file and set it's permissions before writing it out when 'secure' is set.
* Did a bunch of general cleanup and minor bug fixes.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Changed all methods that returned 'undef' on error to return '!!error!!' instead.
* Created Convert->round(), ->comma(), ->bytes_to_human_readable() and ->human_readable_to_bytes().
* Created Database->archive_databases(), ->check_lock_age(), ->lock_file() and ->resync_databases() (last one is not started yet).
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added the variables table to the core SQL schema.
* Added Databsae->insert_or_update_variables() and ->read_variable().
Signed-off-by: Digimer <digimer@alteeve.ca>
* This is an in-progress commit working on adding the Database methods. Much of it is copy/pasted from v2 and none of the new code is tested yet. It will certainly fail to compile.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Created Get->uuid to generate random UUIDs via 'uuidgen'.
* Created Storage->read_mode that returns the standard 4-digit mode of a directory or file.
* Created System->stop_daemon to stop daemons.
* Altered Template->get to take fully defined path names.
* Altered Template->skin to use the 'set' parameter (as documented) instead of 'skin'. Also made it so that a skin could be set even if the skin directory doesn't exist via the new 'fatal' parameter.
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>
* 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>
* Created Log->language that sets/returns the active log language.
* Created Log->variables that takes a hash reference and logs their variable: [$value] pairs.
* Created the new /usr/sbin/striker/ directory which is added to the list of search directories. We will store our tools here.
* Created the scancore-daemon and scancore-daemon.unit files which will handle all the things we used to use crontab for, minus ScanCore itself.
* Created the scancore-update-states that will eventually store some machine state information in a file that the web browser can read.
* Created the cgi-bin/home script that will be the main landing page for the Striker UI.
* Added some of the initial html files.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Got Log->entry() working now. Decided to use journald logging exclusively... They've thought a lot more about logging than we will, and the idea that there are special facilities for sensitive log entries and the ability to perform remote logging was too appealing.
* Created Log->level() to set/check the currently active log level.
* Created Log->secure() to set/check whether sensitive log entries will be recorded.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Added Get->date_and_time() method.
* Added the 'initialize' parameter to Storage->search_directories() to have a cleaner way of initializing the search directories.
Signed-off-by: Digimer <digimer@alteeve.ca>
* Created tests for most existing module methods now.
* Updated Storage->search_directories to handle merging @INC and $ENV{'PATH'} when called with an invalid directories parameter, and exploited this behaviour to initially set the directory search list. This also deprecated the Tools->_add_environment_path_to_search_directories() method.
* Added Storage->read_config based on the old v2 'Storage->read_conf()'. Also ported over the old Tools->_add_hash_reference() and Tools->_make_hash_reference() methods to assist with this method's operation.
* Created Words->key() that returns the raw string for a given language and key.
Signed-off-by: Digimer <digimer@alteeve.ca>