Commit Graph

399 Commits

Author SHA1 Message Date
Digimer
a63bfb0799 * Added support to reconfigure a Striker system.
* Started adding support for updating the striker (and later, all) systems. This will be handled by the in-progress tools/anvil-update-system program.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-13 18:25:48 -04:00
Digimer
252fbf21ef * Fixed a bug where '$anvil->' wasn't referencing '$anvil->data->' when it should have been.
* 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>
2018-08-13 02:22:46 -04:00
Digimer
1106d36e03 * Fixed bugs in tools/anvil-manage-striker-peers, basic testing done.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-11 23:20:03 -04:00
Digimer
f9ce6e1154 * Finished, but not yet tested, tools/anvil-manage-striker-peers.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-10 00:57:09 -04:00
Digimer
89c06b9f24 * Started work on tools/anvil-manage-striker-peers to do the actual work on managing local and peer databases in anvil.conf.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-08 15:10:29 -04:00
Digimer
0fa3c42f2f * Fixed a bug where setting the debug level to 3 caused a deep recursion and a system hang.
* Update Anvil::Tools->new() to access the parameters 'log_level', 'log_secure' and 'debug', streamlining the frequent calls to $anvil->Log->level and ->secure in program startup, and allowing the values to take effect during the ->new constructor.
* Passed 'debug' to child method calls in more places (still more to do though).
* Fixed a bug where 'test_table' wasn't set in the right place, causing the database to try to initialize repeatedly.
* Made Database->archive_database only run if called with root access.
* Now the number of database connections are stored in 'sys::db_connections' instead of checking the returned number, and that is cleared on disconnect.
* Started working more on 'anvil-daemon', including adding support for System->call being taking 'background', 'stderr_file' and 'stdout_file' paramters which, when set, used Proc::Simple to background the process.
* Did some more work on database archiving, though still far from done.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-08-01 02:06:16 -04:00
Digimer
839bfc8a2d * Updated Striker to better handle when host.uuid hasn't been generated yet on brand new installs.
* Updated anvil-update-state to add commas to network link speeds.
* Added dmidecode to the spec file

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-25 21:02:48 -04:00
Digimer
9ab242a117 * Decided to move development to Fedora 28 to prepare for the leap to RHEL 8. So this commit is the first where the Anvil! Striker can be installed.
* 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>
2018-07-25 02:34:47 -04:00
Digimer
1ac1bc5ffb * Made more progress on the peer database configuration page.
* Added a switch to tools/anvil-configure-striker to prevent reboots.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-18 18:32:39 -04:00
Digimer
458ef94851 * Fixed a bug where the config page would be shown while a job was pending.
* Fixed a bug in Database->insert_or_update_users() wasn't handling the user's session salt.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-18 01:47:52 -04:00
Digimer
9e8ce6dec4 * Fixed up security handling.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-14 03:05:19 -04:00
Digimer
56045214f2 * Fixed a problem with tools/anvil-prep-database being called from the anvil-striker RPM where the local DB password wasn't making it into the hash in time to set the DB password.
* Disabled searching for 'path::config...' files.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-14 02:51:22 -04:00
Digimer
7e63cfbcc4 * Fixed the schema path.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-13 18:29:28 -04:00
Digimer
2c52f649ba * Fixed the path of anvil.sql
* Set Log->entry to chmod the log file to 666 when the file is opened to ensure apache can write to it.
* Fixed a string replacement variable name.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-13 03:26:53 -04:00
Digimer
ee543ab64b * Re-fixed postgresql daemon path.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-12 21:30:13 -04:00
Digimer
8cee9cdcc2 * Updatedb the anvil.spec to be smarter about pre and post (and postun).
* Updated tools/anvil-prep-database to use a daemon name from Tools.pm to more easily support later postgres version upgrades.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-12 21:16:27 -04:00
Digimer
1539ef72a8 * Fixed how passwords are supressed in logs.
* Fixed config step 2 display.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-07-11 14:07:07 -04:00
Digimer
96bda1d329 Merge branch 'master' of github.com:digimer/anvil
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-27 18:51:55 -04:00
Digimer
3fce021498 * Making good progress on the internal login/account methods. The user can now log in, though the first reload logs them right back out. Lots still broken.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-27 01:28:13 -04:00
Digimer
a6a5df2496 * Fixed a bug in 'home' not displaying the 'offline' message when it was waiting for a reconfig.
* Cleaned up 'button' CSS class links and submit CSS to match.
* Re-enabled reboot at the end of a tools/anvil-configure-striker run.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-22 17:27:30 -04:00
Digimer
66928edb06 * Added logic to check if Striker is configured and, if so, enter main functions.
* Finished up the configuration logic for Striker.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-22 01:43:43 -04:00
Digimer
2febb09d72 * Updated anvil-configure-striker to handle network configurations in non-bonded configurations and to remove virsh bridges.
* Added error messages to Striker configuration forms.
* Fixed a bug in home->get_network_details() function to handle single IPs in network.xml.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-20 19:50:56 -04:00
Digimer
a3d97e4c92 * Updated anvil-update-states to mark interfaces, bonds, bridges and IP addresses as DELETEd when they disappear.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-18 16:29:27 -04:00
Digimer
2ea506b4d9 * Got the jquery to fill the form IP data is set.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-17 18:25:56 -04:00
Digimer
0272ba8b80 * Moved the network default values into the main defaults hash.
* Fixed a bug in Database->insert_or_update_network_interfaces where independent interfaces (not under a bridge or a bond) were not being saved.
* Continued working on improving Striker's network config jquery/form functions.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-15 02:17:20 -04:00
Digimer
86259a4783 * Got the network.xml and network.json files fixed and parsable.
* Moved config JS to config.js.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-10 00:27:08 -04:00
Digimer
66b5c815d0 * Finished recording IP address information in network.json/xml.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-09 13:29:51 -04:00
Digimer
12afcb9731 * Started working on adding IP data to network.json (and .xml).
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-08 10:52:31 -04:00
Digimer
1245cfc547 * Re-enabled writing of the network.json and network.xml files.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-07 23:40:38 -04:00
Digimer
76725e9160 * Fixed a bug in Database->insert_or_update_bonds() that caused unneeded UPDATE.
* Fixed anvil-update-states to record the bond UUID for interfaces already in bonds.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-07 23:15:43 -04:00
Digimer
d600a635d4 * Made 'network_interface_bridge_uuid' allow NULL entries allow NULL entries.
* Fixed a sanity check in Database->insert_or_update_network_interfaces.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-06 18:43:56 -04:00
Digimer
67c4f50bdc * Updated Database->insert_or_update_network_interfaces() to work like other similar methods. Also re-enabled NULL for 'network_interface_bond_uuid' as an empty string can't be used on a 'uuid' column type and it's not always set.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-06 18:31:19 -04:00
Digimer
870a2eb803 * Updated the SQL schema to convert all 'boolean' to 'integer' (using 0 for false). Also made all columns NOT NULL, given they should all always have an empty string. The logic behind this was to standardize the code and avoid bugs.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-04 13:12:32 -05:00
Digimer
39c06f364f * Got tools/anvil-configure-striker updating the system passwords now.
* Updated System->get_ips to only record 'sys::mac::<mac>::iface' for actual interfaces, not bonds.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-06-02 00:22:40 -05:00
Digimer
b0232c6180 * Made the sysfs directory references static.
* Fixed a typo in Database->insert_or_update_bridges().
* Added 'bond_mac_address' and 'bond_operational' to the bonds table.
* Gathered data needed for bonds in tools/anvil-update-states and got bonds recording successfully (but more testing needed).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-29 17:57:55 -04:00
Digimer
d6c94e9d28 * Started working on Database->insert_or_update_bonds.
* Changed the database table ip_address_subnet to ip_address_subnet_mask for clarity.
* Added a check to tools/anvil-update-states to update bond entries instead of just interface entries (also not done).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-24 03:02:27 -04:00
Digimer
a6e50f15a9 * Updated System->get_ips() to determine which interface is the default gateway and set the gateway IP and active DNS servers.
* Created (but not yet tested) Database->insert_or_update_ip_addresses() and the associated ip_addresses database table to store IP address details and reference the interface they're on.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-23 03:50:30 -04:00
Digimer
4e6f492c4f * Updated Log->variables to add dots when printing a variable/value pair per line so that variables line up vertically.
* 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>
2018-05-21 22:02:45 -04:00
Digimer
2163739b93 * Created Storage->update_config that will update a variable in anvil.conf (locally or remotely).
* Finished (for now) tools/anvil-change-password.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-21 03:11:47 -04:00
Digimer
6f3537807a * Added Account->read_details to collect data on the given user name.
* Updated Account->encrypt_password to return a hash reference with keys matching to database column names for consistency sake,
* Renamed 'users -> user_password' to 'user_password_hash' for clarity.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-19 00:01:24 -04:00
Digimer
59245a4f0b * Created Account->validate_password to test that a user name and password is valid.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-18 12:23:55 -04:00
Digimer
04cbec30a0 * Created Database->insert_or_update_users() to add/edit users.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-17 00:45:20 -04:00
Digimer
d110bff224 * Created Account->encrypt_password() for creating encrypted hashes of passwords. Set the default algorithm to sha256, a ~16 byte random salt and 500,000 re-encryptions (which takes a total of about 0.7 seconds on an Intel i7-6820HQ CPU).
* Added user_algorithm and user_hash_count to the new users database table so that we can remember how a hash was generated, should it be changed down the road.
* Made the salt length configurable by the user (as well as the algorithm and loop count).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-15 17:45:52 -04:00
Digimer
9a37f66468 * Decided to abandon using apache security and to integrate it into Striker itself. This will allow for layers of access, easier account sync'ing, etc. Further, there is no proper way to handle logging out on apache, and they use md5 * 1000 iterations (with a salt, to be fair) for security... Not exactly the strongest.
* 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>
2018-05-15 01:55:56 -04:00
Digimer
de333704b5 * Created System->change_apache_password() to update (and enable) Striker's apache user. For now, it simply enables it in httpd.conf, it doesn't actually set/update the password.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-10 01:41:45 -04:00
Digimer
b8bb781c5e * Added the new tools/anvil-cycle-vm-nics, which is the updated version for m2's cycle-vm-nics.pl.
* The RPM spec changes SELinux to 'permissive' (only for developmer, it will be removed before RC stage).

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-06 14:25:43 -04:00
Digimer
5f06752167 * Finished updating tools/anvil-prep-database to inject the new, local database entry into anvil.conf. This tool works again.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-05-01 12:26:41 -04:00
Digimer
a89fb24adf * Changed the Storage->copy() 'target' parameter to 'target_file' to avoid confusion with the often-used 'target' parameter for connecting to remote machines.
* 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>
2018-04-30 11:43:30 -04:00
Digimer
eafd4fd3f7 * Fixed a couple bugs to get System->change_shell_user_password() working.
* 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>
2018-04-26 12:41:03 -04:00
Digimer
b42d4a6fea * Tested that the new remote Storage->read_file() works and removed some test code.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-24 18:46:12 -04:00
Digimer
188cab5ec0 * Fixed a few bugs with how rsync is handled, specifically in the rsync wrapper script.
* 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>
2018-04-24 13:32:19 -04:00
Digimer
ea43896fca * Created the new Remote module, and in it, moved System->remote_call to Remote->call() and created the new add_target_to_known_hosts() method (and two private helper methods). These are adapted from the m2 code.
* 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>
2018-04-22 22:16:10 -04:00
Digimer
a294c6c4fa * Updated the database components to use the name 'anvil' and the user 'admin'. The 'database::user' and 'database::name' variables are still supported, but now hidden.
* 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>
2018-04-13 19:55:34 -04:00
Digimer
e4f7bcf661 * Created Storage->backup() that makes a backup of the given file under the Anvil! backup directory with a time-stamped suffix and preserving the original directory path.
* 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>
2018-04-05 02:25:56 -04:00
Digimer
c88cbf4531 * Got tools/anvil-configure-network writing the first network config file body.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-03 01:00:46 -04:00
Digimer
d6846841a2 * Added the 'job_status' column to the 'jobs' table where progress to be shown to users is stored.
* Updated anvil-configure-network to use Database->insert_or_update_jobs().

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-04-02 01:03:28 -04:00
Digimer
d86750ba01 * Created System->hostname() to get and optionally set the hostname (static and pretty).
* 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>
2018-04-01 02:26:38 -04:00
Digimer
217dfaedc7 * Created System->pids() to read in all process data and, optionally, return an array reference of PIDs matching a string (program name).
* 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>
2018-03-31 02:01:38 -04:00
Digimer
b53f688048 * Got tools/anvil-configure-network to the point where it loads the job details.
* Made the Striker logo clickable.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-03-29 01:04:04 -04:00
Digimer
7694847160 * Fixed a bug in Database->insert_or_update_jobs().
* 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>
2018-03-26 23:55:39 -04:00
Digimer
e38bc826dd * Fixed a bug in resync_databases where undefined column values weren't being handled properly.
* Made the link speed of down interfaces '0'.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-03-24 15:20:37 -04:00
Digimer
0370d6acef * Fixed a bug in the network_interfaces SQL procedure that broke how data was recorded in the history schema.
* 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>
2018-03-24 09:57:10 -04:00
Digimer
c21b326f1a * Changed all methods to take a 'debug' argument for setting log level on calls.
* 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>
2018-03-07 03:11:55 -05:00
Digimer
f52d8196f6 * Migration is now sort of working. There is still an issue to sort out with enabling drbd dual-primary, but server can move is some cases now.
* Changed fence_pacemaker to exit with '1' on generic error as per LINBIT's comments.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-21 02:06:00 -05:00
Digimer
81534cddbc * Moved ocf:alteeve:server along... It now can properly check and report the server's status on a monitor call.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-13 23:59:07 -05:00
Digimer
636cef0564 * Barring some testing, the fence_pacemaker fence handler is done.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-11 19:32:18 -05:00
Digimer
6405483fea * Added a check to fence_pacemaker that exits with 7 if the target node is already out of the pacemaker cluster.
* Verified that the logic works in a 3-node (Anvil! + DR) cluster.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-11 02:45:56 -05:00
Digimer
26f956e429 * Much more work done on the fence handler. How able to sanity check most of the pacemaker side of things and have the framing done for sanity checking DRBD.
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-08 02:03:36 -05:00
Digimer
806b452d10 Merge branch 'master' of github.com:digimer/m3
Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-07 12:11:21 -05:00
Digimer
ced92139b1 * Added the new (and still very much in progress) 'fence_pacemaker' fence handler for power-fencing via DRBD.
* Updated dev notes.

Signed-off-by: Digimer <digimer@alteeve.ca>
2018-02-07 03:36:49 -05:00
Digimer
fe4a1d5a1c * Working on timing for DB connections.
* 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>
2018-01-17 15:10:07 -06:00
Digimer
2170c00add * Added the 'debug' parameter to System->check_alert_sent. Also updated it to use 'alert_sent_uuid'.
* 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>
2017-12-27 13:01:58 -04:00
Digimer
4e30f2024c * Changed tabs to white-spaces in the SQL source to make copy/pasting easier.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-27 02:43:32 -04:00
Digimer
f1bd4b99ca * Fixed more issues with anvil-prep-database.
* 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>
2017-12-27 00:45:59 -04:00
Digimer
d864bd6dac * Moved words.xml to /usr/share/anvil/
* 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>
2017-12-26 14:12:59 -04:00
Digimer
d03213b860 * Fixed some string and path issues from the 'anvil' merger.
* Added a 'debug' parameter to System->ping() to allow per-call log levels.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-24 01:49:57 -04:00
Digimer
5976e7ea32 * Adding a new Database->insert_or_update_jobs() method and associated database tables.
* 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>
2017-12-13 11:40:50 -05:00
Digimer
9648e8ba43 * Create tools/anvil-jobs and units/anvil-jobs.service, which is a new daemon that will handle jobs that can take some time to finish.
* 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>
2017-12-08 17:04:36 -05:00
Digimer
bb48c090a7 * Created Get->md5sum() to return the md5sum of the specified file.
* Updated anvil-daemon to exit if the md5sum on disk changes.
* Quieted a lot of logging.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-12-07 18:42:48 -05:00
Digimer
8e5e5b07d3 * Moved the buffer disable up the script.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-11-01 00:33:41 -04:00
Digimer
9e4414613b * Added a check to exit if no DBs were available in tools/anvil-update-states.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 13:53:01 -04:00
Digimer
1c3b3c2c9e * Fixed a bug in calling ethtool in tools/anvil-update-states and added conditionals to reading the data files.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 13:45:55 -04:00
Digimer
2b9c6c26dc * Fixed a couple remaining issues from the recent merger. Specifically, '$$anvil' was fixed from a bad regex and the path/names of our tools were fixed.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-20 11:13:00 -04:00
Digimer
1cb42080c3 ** Major Changes **
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>
2017-10-20 00:19:32 -04:00
Digimer
eed06bdb22 * Created a dedicated loop for processes that need to run each time tools/scancore-daemon loops.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-18 11:27:57 -04:00
Digimer
886331c756 * Created the new System->get_ips method which records IP addresses, subnet masks and MAC addresses of interfaces as reported by 'ip addr'.
* Finished the form for showing the user what changes will be made.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-12 18:34:41 -04:00
Digimer
3d385a5731 * Updated the configuration step 2 to properly show interface link changes again (had to add the network status XML generator back), and added displaying the 'up order', which tells the order that interfaces last cycles. This allows a user to unplug and plug the network cables in without watching the screen and be able to determine which interfaces cycled in a given order. This makes it easier to map MAC addresses to desired roles.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-10-05 00:20:36 -04:00
Digimer
fa11459543 * Updated Log->entry to use the new Log::Journald method, which improved writing to log speed at high log levels dramatically (ie: 33 seconds -> 1 seconds).
* 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>
2017-10-04 02:11:03 -04:00
Digimer
1e7fe44c23 * Updated Get->host_uuid to record the UUID to a cache file when run with root privs, but read from the cache when an unpriv user.
* 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>
2017-09-27 03:24:27 -04:00
Digimer
96670756ab * Created Database->insert_or_update_network_interfaces to handle pushing data into update_network_interfaces.
* 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>
2017-09-22 00:56:35 -04:00
Digimer
13352bad6d * Moved most of 'scancore-database' into the new Database->configure_pgsql() method. I had renamed that script, but now it will be removed soon.
* Created System->reload_daemon().

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-07-27 01:56:52 -04:00
Digimer
edf85511f4 * Did more work on Tools.t tests.
* 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>
2017-06-21 20:09:22 -04:00
Digimer
648af130cd * Finished scancore-database. It now setups/repairs postgresql database config, user and scancore database.
* 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>
2017-06-19 22:32:35 -04:00
Digimer
632f677f04 * Added two new modules; Convert.pm for converting data types and Database.pm for managing all things related to databases.
* 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>
2017-06-13 17:08:38 -04:00
Digimer
e983f27de7 * Changed scancore-update-states to report link speeds > 100 Gbps as 0.
* Added polling to update the network state as needed.

Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-12 17:39:09 -04:00
Digimer
a8a98b431d * Updated the jquery to read in translated strings and to display the link speed.
Signed-off-by: Digimer <digimer@alteeve.ca>
2017-06-12 15:44:23 -04:00
Digimer
8c42b78e63 * Made some progress on displaying the network state on an HTML page using jquery. It's ugly as sin, but it works.
* 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>
2017-06-12 14:39:20 -04:00
Digimer
bea6bc5e69 * Updated Tools->new() to check if it is being invoked in a browser and set the environment appropriately. It also sets the PWD environmental variable to the DOCUMENT_ROOT variable.
* 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>
2017-06-11 03:00:35 -04:00
Digimer
753d7a3ba6 * Created the new System.pm module with the initial read_file() method that reads files.
* 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>
2017-06-10 02:38:04 -04:00