Compare commits

..
3 Commits
Author SHA1 Message Date
Charles N Wyble 97ff9c321d docs(agents): document repo layout and autonomous git policy
Make AGENTS.md actionable for future agents by recording what was learned
while fixing the provisioning scripts:

- Add a Repository Layout section: the KNELShellFramework is vendored
  under vendor/.../KNELShellFramework (not at repo root), scripts must
  self-locate via BASH_SOURCE, configs are read locally (no CDN), and
  some .sh agents are actually PHP
- Replace the vague "commit immediately" note with an explicit
  Autonomous Git Workflow section authorizing agents to commit AND push
  without being asked, grouped into coherent atomic commits

🤖 Generated with [Crush](https://github.com/charmassociates/crush)

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-07-25 13:49:55 -05:00
Charles N Wyble 5928d96aec fix(tests): repair framework paths, assertions, and arithmetic
The test suite referenced a Framework-Includes/ directory that does not
exist at the repo root (it is vendored under vendor/.../KNELShellFramework),
and asserted against functions the framework does not export.

- Point all tests at the vendored framework includes via a resolved
  FRAMEWORK_INCLUDES path
- Add print_success/print_warning/print_header shims where the vendored
  PrettyPrint only defines print_info/print_error
- Replace log_info/handle_error assertions with the real API:
  CURRENT_TIMESTAMP/LOGFILENAME variables and error_out/handle_failure
- Fix ((var++)) under set -e (returns 1 when var is 0) by using ((++var))
  across system-requirements, https-enforcement, 2fa-validation, and
  safe-download
- Fix infinite recursion in safe-download test_network_connectivity
  (was calling itself instead of the framework function)
- Make syntax validation shebang-aware so PHP agents (mysql.sh) are
  skipped instead of flagged as bash syntax errors

Framework unit test now passes (exit 0).

🤖 Generated with [Crush](https://github.com/charmassociates/crush)

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-07-25 13:49:47 -05:00
Charles N Wyble 688b7190e6 refactor(provisioning): make scripts self-locating and read configs locally
All provisioning scripts and modules now resolve their own location via
BASH_SOURCE and derive PROJECT_ROOT_PATH from it, removing a hard
dependency on the current working directory.

- Derive PROJECT_ROOT_PATH/CONFIGFILES_PATH/MODULES_PATH/SCRIPTS_PATH
  from BASH_SOURCE in SetupNewSystem.sh and every module
- Replace all curl ${DL_ROOT}/... downloads with cat of the matching
  local files under ProjectCode/ConfigFiles (the dl.knownelement.com CDN
  is no longer required for a git clone)
- Invoke modules by absolute path instead of cd ./Modules/X && bash ./x
- Fix secharden-audit-agents.sh: wrong path depth (../../ vs ../../..),
  wrong Project-Includes glob, and ConfigFiles/AudidD -> AuditD typo,
  all of which previously crashed the script
- Remove duplicate FrameworkVars source lines

Run from anywhere with: sudo bash ProjectCode/SetupNewSystem.sh

🤖 Generated with [Crush](https://github.com/charmassociates/crush)

Assisted-by: GLM-5 via Crush <crush@charm.land>
2026-07-25 13:49:39 -05:00
14 changed files with 270 additions and 233 deletions
+34 -3
View File
@@ -1,5 +1,27 @@
# Agent Guidelines
## Repository Layout
Knowing where things live prevents broken edits:
- **Vendored framework**: `KNELShellFramework` lives at
`vendor/git@git.knownelement.com/29418/KNEL/KNELShellFramework/`, **not** at
the repo root. Its includes are under `Framework-Includes/` there. Never
assume `./Framework-Includes` exists relative to the repo root.
- **Self-locating scripts**: All provisioning scripts derive their own
location via `BASH_SOURCE` and compute `PROJECT_ROOT_PATH` from it. They must
**never** depend on the current working directory or on `cd`/`realpath ..`
chains. Run them from anywhere — `sudo bash SetupNewSystem.sh` works.
- **Local config files are the source of truth**: Configs in
`ProjectCode/ConfigFiles/` are read with `cat`/`cp`. Do **not** re-introduce
`curl ${DL_ROOT}/...` downloads from `dl.knownelement.com` — that CDN is
deprecated for this repo.
- **Path variables**: Scripts export `PROJECT_ROOT_PATH`, `CONFIGFILES_PATH`,
`MODULES_PATH`, `SCRIPTS_PATH`, and `AGENTS_PATH` for locating repo content.
- **Non-bash agents**: Some files under `ProjectCode/Agents/` carry a `.sh`
extension but are PHP (e.g. `mysql.sh`, shebang `#!/usr/bin/php`). Syntax
checkers must skip these.
## Git Commit Requirements
When making changes to this repository, ALWAYS:
@@ -39,7 +61,16 @@ deployment.
Assisted-by: GLM-5 via Crush <crush@charm.land>
```
## Important
## Autonomous Git Workflow
**NEVER wait to be asked to commit and push your work.**
**Commit immediately after each logical unit of work.**
**Agents are authorized to commit AND push autonomously. Do not wait to be
asked.** After each logical unit of work:
1. Stage only the files belonging to that logical change.
2. Commit with a conventional, well-formed message (see above).
3. Push to `origin` (`git push`). The branch tracks `origin/main`.
4. Repeat per logical unit.
Group changes so each commit is coherent on its own (a reader should
understand the commit without seeing the others). Never batch unrelated
changes into one commit.
+13 -4
View File
@@ -5,10 +5,19 @@
set -euo pipefail
# Source framework includes
PROJECT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.."
source "$PROJECT_ROOT/Framework-Includes/Logging.sh"
source "$PROJECT_ROOT/Framework-Includes/PrettyPrint.sh"
# Resolve repository root from this script's location (Project-Tests/ -> repo root)
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# The KNELShellFramework is vendored under vendor/
FRAMEWORK_INCLUDES="$PROJECT_ROOT/vendor/git@git.knownelement.com/29418/KNEL/KNELShellFramework/Framework-Includes"
source "$FRAMEWORK_INCLUDES/Logging.sh"
source "$FRAMEWORK_INCLUDES/PrettyPrint.sh"
# The vendored PrettyPrint only defines print_info/print_error; provide the
# additional output helpers the test suite relies on.
function print_header() { echo ""; echo "=== $1 ==="; }
function print_success() { echo "$1"; }
function print_warning() { echo "⚠️ $1"; }
# Test configuration
TEST_LOG_DIR="$PROJECT_ROOT/logs/tests"
+17 -17
View File
@@ -18,7 +18,7 @@ function test_2fa_packages() {
echo "✅ Package installed: $package"
else
echo "❌ Package missing: $package"
((failed++))
((++failed))
fi
done
@@ -27,7 +27,7 @@ function test_2fa_packages() {
echo "✅ Google Authenticator command available"
else
echo "❌ Google Authenticator command not found"
((failed++))
((++failed))
fi
return $failed
@@ -44,21 +44,21 @@ function test_ssh_2fa_config() {
echo "✅ ChallengeResponseAuthentication enabled"
else
echo "❌ ChallengeResponseAuthentication not enabled"
((failed++))
((++failed))
fi
if grep -q "^UsePAM yes" "$ssh_config"; then
echo "✅ UsePAM enabled"
else
echo "❌ UsePAM not enabled"
((failed++))
((++failed))
fi
if grep -q "^AuthenticationMethods publickey,keyboard-interactive" "$ssh_config"; then
echo "✅ AuthenticationMethods configured for 2FA"
else
echo "❌ AuthenticationMethods not configured for 2FA"
((failed++))
((++failed))
fi
return $failed
@@ -75,7 +75,7 @@ function test_pam_2fa_config() {
echo "✅ PAM Google Authenticator module configured"
else
echo "❌ PAM Google Authenticator module not configured"
((failed++))
((++failed))
fi
# Check if nullok is present (allows users without 2FA setup)
@@ -106,7 +106,7 @@ function test_cockpit_2fa_config() {
echo "✅ Cockpit configuration file exists"
else
echo "❌ Cockpit configuration file missing"
((failed++))
((++failed))
fi
# Check Cockpit PAM configuration
@@ -114,7 +114,7 @@ function test_cockpit_2fa_config() {
echo "✅ Cockpit PAM 2FA configured"
else
echo "❌ Cockpit PAM 2FA not configured"
((failed++))
((++failed))
fi
return $failed
@@ -137,14 +137,14 @@ function test_webmin_2fa_config() {
echo "✅ Webmin TOTP provider configured"
else
echo "❌ Webmin TOTP provider not configured"
((failed++))
((++failed))
fi
if grep -q "^twofactor=1" "$webmin_config"; then
echo "✅ Webmin 2FA enabled"
else
echo "❌ Webmin 2FA not enabled"
((failed++))
((++failed))
fi
return $failed
@@ -163,7 +163,7 @@ function test_user_2fa_setup() {
echo "✅ 2FA setup script exists for user: $user"
else
echo "❌ 2FA setup script missing for user: $user"
((failed++))
((++failed))
fi
# Check if instructions exist
@@ -171,7 +171,7 @@ function test_user_2fa_setup() {
echo "✅ 2FA instructions exist for user: $user"
else
echo "❌ 2FA instructions missing for user: $user"
((failed++))
((++failed))
fi
else
echo "⚠️ User $user not found, skipping"
@@ -191,7 +191,7 @@ function test_service_status() {
echo "✅ SSH service is running"
else
echo "❌ SSH service is not running"
((failed++))
((++failed))
fi
# Test SSH configuration
@@ -199,7 +199,7 @@ function test_service_status() {
echo "✅ SSH configuration is valid"
else
echo "❌ SSH configuration is invalid"
((failed++))
((++failed))
fi
# Test Cockpit service if installed
@@ -208,7 +208,7 @@ function test_service_status() {
echo "✅ Cockpit service is running"
else
echo "❌ Cockpit service is not running"
((failed++))
((++failed))
fi
fi
@@ -218,7 +218,7 @@ function test_service_status() {
echo "✅ Webmin service is running"
else
echo "❌ Webmin service is not running"
((failed++))
((++failed))
fi
fi
@@ -242,7 +242,7 @@ function test_backup_existence() {
fi
else
echo "❌ Backup directory does not exist"
((failed++))
((++failed))
fi
return $failed
+13 -12
View File
@@ -5,23 +5,24 @@
set -euo pipefail
PROJECT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../.."
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
FRAMEWORK_INCLUDES="$PROJECT_ROOT/vendor/git@git.knownelement.com/29418/KNEL/KNELShellFramework/Framework-Includes"
function test_no_http_urls() {
echo "🔍 Checking for HTTP URLs in scripts..."
local http_violations=0
local script_dirs=("ProjectCode" "Framework-Includes" "Project-Includes")
local script_dirs=("$PROJECT_ROOT/ProjectCode" "$FRAMEWORK_INCLUDES" "$PROJECT_ROOT/Project-Includes")
for dir in "${script_dirs[@]}"; do
if [[ -d "$PROJECT_ROOT/$dir" ]]; then
if [[ -d "$dir" ]]; then
# Find HTTP URLs in shell scripts (excluding comments)
while IFS= read -r -d '' file; do
if grep -n "http://" "$file" | grep -v "^[[:space:]]*#" | grep -v "schema.org" | grep -v "xmlns"; then
echo "❌ HTTP URL found in: $file"
((http_violations++))
((++http_violations))
fi
done < <(find "$PROJECT_ROOT/$dir" -name "*.sh" -type f -print0)
done < <(find "$dir" -name "*.sh" -type f -print0)
fi
done
@@ -37,12 +38,12 @@ function test_no_http_urls() {
function test_https_urls_valid() {
echo "🔍 Validating HTTPS URLs are accessible..."
local script_dirs=("ProjectCode" "Framework-Includes" "Project-Includes")
local script_dirs=("$PROJECT_ROOT/ProjectCode" "$FRAMEWORK_INCLUDES" "$PROJECT_ROOT/Project-Includes")
local https_failures=0
# Extract HTTPS URLs from scripts
for dir in "${script_dirs[@]}"; do
if [[ -d "$PROJECT_ROOT/$dir" ]]; then
if [[ -d "$dir" ]]; then
while IFS= read -r -d '' file; do
# Extract HTTPS URLs from non-comment lines
grep -o "https://[^[:space:]\"']*" "$file" | grep -v "schema.org" | while read -r url; do
@@ -51,10 +52,10 @@ function test_https_urls_valid() {
echo "✅ HTTPS URL accessible: $url"
else
echo "❌ HTTPS URL not accessible: $url"
((https_failures++))
((++https_failures))
fi
done
done < <(find "$PROJECT_ROOT/$dir" -name "*.sh" -type f -print0)
done < <(find "$dir" -name "*.sh" -type f -print0)
fi
done
@@ -78,7 +79,7 @@ function test_ssl_certificate_validation() {
echo "✅ SSL certificate valid: $url"
else
echo "❌ SSL certificate validation failed: $url"
((ssl_failures++))
((++ssl_failures))
fi
done
+45 -42
View File
@@ -5,37 +5,31 @@
set -euo pipefail
PROJECT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../.."
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# Source framework functions
source "$PROJECT_ROOT/Framework-Includes/Logging.sh" 2>/dev/null || echo "Warning: Logging.sh not found"
source "$PROJECT_ROOT/Framework-Includes/PrettyPrint.sh" 2>/dev/null || echo "Warning: PrettyPrint.sh not found"
source "$PROJECT_ROOT/Framework-Includes/ErrorHandling.sh" 2>/dev/null || echo "Warning: ErrorHandling.sh not found"
# Source framework functions from the vendored KNELShellFramework
FRAMEWORK_INCLUDES="$PROJECT_ROOT/vendor/git@git.knownelement.com/29418/KNEL/KNELShellFramework/Framework-Includes"
source "$FRAMEWORK_INCLUDES/Logging.sh" 2>/dev/null || echo "Warning: Logging.sh not found"
source "$FRAMEWORK_INCLUDES/PrettyPrint.sh" 2>/dev/null || echo "Warning: PrettyPrint.sh not found"
source "$FRAMEWORK_INCLUDES/ErrorHandling.sh" 2>/dev/null || echo "Warning: ErrorHandling.sh not found"
function test_logging_functions() {
echo "🔍 Testing logging functions..."
local test_log="/tmp/test-log-$$"
# Test if logging functions exist and work
if command -v log_info >/dev/null 2>&1; then
log_info "Test info message" 2>/dev/null || true
echo "✅ log_info function exists"
function test_logging_variables() {
echo "🔍 Testing logging variables..."
if [[ -n "${CURRENT_TIMESTAMP:-}" ]]; then
echo "✅ CURRENT_TIMESTAMP is set"
else
echo "❌ log_info function missing"
echo "❌ CURRENT_TIMESTAMP is not set"
return 1
fi
if command -v log_error >/dev/null 2>&1; then
log_error "Test error message" 2>/dev/null || true
echo "✅ log_error function exists"
if [[ -n "${LOGFILENAME:-}" ]]; then
echo "✅ LOGFILENAME is set"
else
echo "❌ log_error function missing"
echo "❌ LOGFILENAME is not set"
return 1
fi
# Cleanup
rm -f "$test_log"
return 0
}
@@ -59,14 +53,6 @@ function test_pretty_print_functions() {
return 1
fi
if command -v print_success >/dev/null 2>&1; then
print_success "Test success message" >/dev/null 2>&1 || true
echo "✅ print_success function exists"
else
echo "❌ print_success function missing"
return 1
fi
return 0
}
@@ -74,10 +60,17 @@ function test_error_handling() {
echo "🔍 Testing error handling..."
# Test if error handling functions exist
if command -v handle_error >/dev/null 2>&1; then
echo "✅ handle_error function exists"
if command -v error_out >/dev/null 2>&1; then
echo "✅ error_out function exists"
else
echo "❌ handle_error function missing"
echo "❌ error_out function missing"
return 1
fi
if command -v handle_failure >/dev/null 2>&1; then
echo "✅ handle_failure function exists"
else
echo "❌ handle_failure function missing"
return 1
fi
@@ -112,11 +105,11 @@ function test_framework_includes_exist() {
local missing_files=0
for include_file in "${required_includes[@]}"; do
if [[ -f "$PROJECT_ROOT/Framework-Includes/$include_file" ]]; then
if [[ -f "$FRAMEWORK_INCLUDES/$include_file" ]]; then
echo "✅ Framework include exists: $include_file"
else
echo "❌ Framework include missing: $include_file"
((missing_files++))
((++missing_files))
fi
done
@@ -127,18 +120,28 @@ function test_syntax_validation() {
echo "🔍 Testing script syntax validation..."
local syntax_errors=0
local script_dirs=("Framework-Includes" "Project-Includes" "ProjectCode")
local script_dirs=(
"$FRAMEWORK_INCLUDES"
"$PROJECT_ROOT/Project-Includes"
"$PROJECT_ROOT/ProjectCode"
)
for dir in "${script_dirs[@]}"; do
if [[ -d "$PROJECT_ROOT/$dir" ]]; then
if [[ -d "$dir" ]]; then
while IFS= read -r -d '' file; do
# Skip files that aren't bash scripts despite a .sh extension (e.g. PHP agents)
local shebang
shebang="$(head -c 32 "$file" 2>/dev/null)"
case "$shebang" in
*php*|*python*|*perl*) continue ;;
esac
if bash -n "$file" 2>/dev/null; then
echo "✅ Syntax valid: $(basename "$file")"
else
echo "❌ Syntax error in: $(basename "$file")"
((syntax_errors++))
((++syntax_errors))
fi
done < <(find "$PROJECT_ROOT/$dir" -name "*.sh" -type f -print0)
done < <(find "$dir" -name "*.sh" -type f -print0)
fi
done
@@ -154,7 +157,7 @@ function main() {
# Run all unit tests
test_framework_includes_exist || ((total_failures++))
test_logging_functions || ((total_failures++))
test_logging_variables || ((total_failures++))
test_pretty_print_functions || ((total_failures++))
test_error_handling || ((total_failures++))
test_syntax_validation || ((total_failures++))
+26 -19
View File
@@ -5,15 +5,22 @@
set -euo pipefail
PROJECT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../.."
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
# Source framework functions
source "$PROJECT_ROOT/Framework-Includes/SafeDownload.sh"
# Source framework functions from the vendored KNELShellFramework
FRAMEWORK_INCLUDES="$PROJECT_ROOT/vendor/git@git.knownelement.com/29418/KNEL/KNELShellFramework/Framework-Includes"
# The vendored PrettyPrint only defines print_info/print_error, but SafeDownload.sh
# calls print_success/print_warning; define lightweight shims before sourcing.
function print_success() { echo "$1"; }
function print_warning() { echo "⚠️ $1"; }
source "$FRAMEWORK_INCLUDES/SafeDownload.sh"
function test_network_connectivity() {
echo "🔍 Testing network connectivity..."
if test_network_connectivity; then
if check_url_accessibility "https://github.com"; then
echo "✅ Network connectivity test passed"
return 0
else
@@ -37,7 +44,7 @@ function test_url_accessibility() {
echo "✅ URL accessible: $url"
else
echo "❌ URL not accessible: $url"
((failed++))
((++failed))
fi
done
@@ -60,20 +67,20 @@ function test_safe_download() {
echo "✅ Downloaded file exists and has content"
else
echo "❌ Downloaded file is missing or empty"
((failed++))
((++failed))
fi
# Cleanup
rm -f "$test_dest"
else
echo "❌ Safe download failed"
((failed++))
((++failed))
fi
# Test download with invalid URL
if safe_download "https://invalid.example.com/nonexistent" "/tmp/test-invalid-$$" 2>/dev/null; then
echo "❌ Invalid URL download should have failed"
((failed++))
((++failed))
else
echo "✅ Invalid URL download failed as expected"
fi
@@ -97,13 +104,13 @@ function test_checksum_verification() {
echo "✅ Correct checksum verification passed"
else
echo "❌ Correct checksum verification failed"
((failed++))
((++failed))
fi
# Test incorrect checksum
if verify_checksum "$test_file" "invalid_checksum" 2>/dev/null; then
echo "❌ Incorrect checksum should have failed"
((failed++))
((++failed))
else
echo "✅ Incorrect checksum verification failed as expected"
fi
@@ -111,7 +118,7 @@ function test_checksum_verification() {
# Test missing file
if verify_checksum "/tmp/nonexistent-file-$$" "$expected_checksum" 2>/dev/null; then
echo "❌ Missing file checksum should have failed"
((failed++))
((++failed))
else
echo "✅ Missing file checksum verification failed as expected"
fi
@@ -143,7 +150,7 @@ function test_batch_download() {
echo "✅ Batch file downloaded: $(basename "$file")"
else
echo "❌ Batch file missing: $(basename "$file")"
((failed++))
((++failed))
fi
done
@@ -153,7 +160,7 @@ function test_batch_download() {
done
else
echo "❌ Batch download failed"
((failed++))
((++failed))
fi
return $failed
@@ -172,7 +179,7 @@ function test_config_backup_and_restore() {
# Test safe config download (this will fail with invalid URL, triggering restore)
if safe_config_download "https://invalid.example.com/config" "$test_config" ".test-backup" 2>/dev/null; then
echo "❌ Invalid config download should have failed"
((failed++))
((++failed))
else
echo "✅ Invalid config download failed as expected"
@@ -181,7 +188,7 @@ function test_config_backup_and_restore() {
echo "✅ Original config was restored after failed download"
else
echo "❌ Original config was not restored properly"
((failed++))
((++failed))
fi
fi
@@ -199,14 +206,14 @@ function test_download_error_handling() {
# Test download with missing parameters
if safe_download "" "/tmp/test" 2>/dev/null; then
echo "❌ Download with empty URL should have failed"
((failed++))
((++failed))
else
echo "✅ Download with empty URL failed as expected"
fi
if safe_download "https://example.com" "" 2>/dev/null; then
echo "❌ Download with empty destination should have failed"
((failed++))
((++failed))
else
echo "✅ Download with empty destination failed as expected"
fi
@@ -214,7 +221,7 @@ function test_download_error_handling() {
# Test download to read-only location (should fail)
if safe_download "https://github.com" "/test-readonly-$$" 2>/dev/null; then
echo "❌ Download to read-only location should have failed"
((failed++))
((++failed))
else
echo "✅ Download to read-only location failed as expected"
fi
@@ -44,7 +44,7 @@ function test_required_commands() {
echo "✅ Required command available: $cmd"
else
echo "❌ Required command missing: $cmd"
((failed++))
((++failed))
fi
done
@@ -87,7 +87,7 @@ function test_network_connectivity() {
echo "✅ Network connectivity: $url"
else
echo "❌ Network connectivity failed: $url"
((failed++))
((++failed))
fi
done
@@ -103,7 +103,7 @@ function test_permissions() {
echo "✅ Write permission: $dir"
else
echo "❌ Write permission denied: $dir"
((failed++))
((++failed))
fi
done
+23 -20
View File
@@ -1,9 +1,9 @@
#!/bin/bash
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../../../)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#Framework variables are read from hee
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -11,19 +11,22 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
export AGENTS_PATH
AGENTS_PATH="$PROJECT_ROOT_PATH/ProjectCode/Agents"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../../../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
print_info "Setting up librenms agent..."
cat ../../Agents/librenms/distro > /usr/local/bin/distro
cat "$AGENTS_PATH/librenms/distro" > /usr/local/bin/distro
chmod +x /usr/local/bin/distro
if [ ! -d /usr/lib/check_mk_agent ]; then
@@ -38,26 +41,26 @@ if [ ! -d /usr/lib/check_mk_agent/local ]; then
mkdir -p /usr/lib/check_mk_agent/local
fi
cat ../../Agents/librenms/check_mk_agent > /usr/bin/check_mk_agent
cat "$AGENTS_PATH/librenms/check_mk_agent" > /usr/bin/check_mk_agent
chmod +x /usr/bin/check_mk_agent
cat ../../Agents/librenms/check_mk@.service > /etc/systemd/system/check_mk@.service
cat ../../Agents/librenms/check_mk.socket > /etc/systemd/system/check_mk.socket
cat "$AGENTS_PATH/librenms/check_mk@.service" > /etc/systemd/system/check_mk@.service
cat "$AGENTS_PATH/librenms/check_mk.socket" > /etc/systemd/system/check_mk.socket
systemctl enable check_mk.socket
systemctl start check_mk.socket
#Modules commented out below, we will roll out on systems that use them, most of the fleet doesn't use those modules
cat ../../Agents/librenms/dmi.sh > /usr/lib/check_mk_agent/local/dmi.sh
cat ../../Agents/librenms/dpkg.sh > /usr/lib/check_mk_agent/local/dpkg.sh
#cat ../../Agents/librenms/mysql.sh > /usr/lib/check_mk_agent/local/mysql.sh
cat ../../Agents/librenms/ntp-client > /usr/lib/check_mk_agent/local/ntp-client
#cat ../../Agents/librenms/ntp-server.sh > /usr/lib/check_mk_agent/local/ntp-server.sh
cat ../../Agents/librenms/os-updates.sh > /usr/lib/check_mk_agent/local/os-updates.sh
cat ../../Agents/librenms/postfixdetailed > /usr/lib/check_mk_agent/local/postfixdetailed
cat ../../Agents/librenms/postfix-queues > /usr/lib/check_mk_agent/local/postfix-queues
#cat ../../Agents/librenms/smart.sh > /usr/lib/check_mk_agent/local/smart
#cat ../../Agents/librenms/smart.sh.config > /usr/lib/check_mk_agent/local/smart.config
cat "$AGENTS_PATH/librenms/dmi.sh" > /usr/lib/check_mk_agent/local/dmi.sh
cat "$AGENTS_PATH/librenms/dpkg.sh" > /usr/lib/check_mk_agent/local/dpkg.sh
#cat "$AGENTS_PATH/librenms/mysql.sh" > /usr/lib/check_mk_agent/local/mysql.sh
cat "$AGENTS_PATH/librenms/ntp-client" > /usr/lib/check_mk_agent/local/ntp-client
#cat "$AGENTS_PATH/librenms/ntp-server.sh" > /usr/lib/check_mk_agent/local/ntp-server.sh
cat "$AGENTS_PATH/librenms/os-updates.sh" > /usr/lib/check_mk_agent/local/os-updates.sh
cat "$AGENTS_PATH/librenms/postfixdetailed" > /usr/lib/check_mk_agent/local/postfixdetailed
cat "$AGENTS_PATH/librenms/postfix-queues" > /usr/lib/check_mk_agent/local/postfix-queues
#cat "$AGENTS_PATH/librenms/smart.sh" > /usr/lib/check_mk_agent/local/smart
#cat "$AGENTS_PATH/librenms/smart.sh.config" > /usr/lib/check_mk_agent/local/smart.config
chmod +x /usr/lib/check_mk_agent/local/*
+6 -10
View File
@@ -9,11 +9,10 @@
#Core framework functions...
#####
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../../../)"
#Framework variables are read from hee
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -21,19 +20,16 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../../../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
#Framework variables are read from hee
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
# 2FA Configuration
BACKUP_DIR="/root/backup/2fa"
PAM_CONFIG_DIR="/etc/pam.d"
@@ -4,10 +4,10 @@
#Core framework functions...
#####
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../../)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#Framework variables are read from hee
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -15,20 +15,19 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
export CONFIGFILES_PATH
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/ProjectCode/ConfigFiles"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
export DL_ROOT
DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
# Material herein Sourced from
# https://cisofy.com/documentation/lynis/
@@ -42,10 +41,10 @@ DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
#Auditd
curl --silent ${DL_ROOT}/ConfigFiles/AudidD/auditd.conf > /etc/audit/auditd.conf
cat "$CONFIGFILES_PATH/AuditD/auditd.conf" > /etc/audit/auditd.conf
# Systemd
curl --silent ${DL_ROOT}/ConfigFiles/Systemd/journald.conf > /etc/systemd/journald.conf
cat "$CONFIGFILES_PATH/Systemd/journald.conf" > /etc/systemd/journald.conf
# logrotate
curl --silent ${DL_ROOT}/ConfigFiles/Logrotate/logrotate.conf > /etc/logrotate.conf
cat "$CONFIGFILES_PATH/Logrotate/logrotate.conf" > /etc/logrotate.conf
@@ -5,11 +5,10 @@
#Core framework functions...
#########################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../../../)"
#Framework variables are read from hee
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -17,19 +16,19 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
export CONFIGFILES_PATH
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/ProjectCode/ConfigFiles"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../../../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
#Framework variables are read from hee
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
#########################################
# Core script code begins here
@@ -82,24 +81,24 @@ systemctl --now disable autofs || true
apt-get -y --purge remove autofs || true
#disable usb storage
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/usb_storage.conf > /etc/modprobe.d/usb_storage.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/dccp.conf > /etc/modprobe.d/dccp.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/rds.conf > /etc/modprobe.d/rds.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/sctp.conf > /etc/modprobe.d/sctp.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/tipc.conf > /etc/modprobe.d/tipc.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/cramfs.conf > /etc/modprobe.d/cramfs.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/freevxfs.conf > /etc/modprobe.d/freevxfs.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/hfs.conf > /etc/modprobe.d/hfs.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/hfsplus.conf > /etc/modprobe.d/hfsplus.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/jffs2.conf > /etc/modprobe.d/jffs2.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/squashfs.conf > /etc/modprobe.d/squashfs.conf
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ModProbe/udf.conf > /etc/modprobe.d/udf.conf
cat "$CONFIGFILES_PATH/ModProbe/usb_storage.conf" > /etc/modprobe.d/usb_storage.conf
cat "$CONFIGFILES_PATH/ModProbe/dccp.conf" > /etc/modprobe.d/dccp.conf
cat "$CONFIGFILES_PATH/ModProbe/rds.conf" > /etc/modprobe.d/rds.conf
cat "$CONFIGFILES_PATH/ModProbe/sctp.conf" > /etc/modprobe.d/sctp.conf
cat "$CONFIGFILES_PATH/ModProbe/tipc.conf" > /etc/modprobe.d/tipc.conf
cat "$CONFIGFILES_PATH/ModProbe/cramfs.conf" > /etc/modprobe.d/cramfs.conf
cat "$CONFIGFILES_PATH/ModProbe/freevxfs.conf" > /etc/modprobe.d/freevxfs.conf
cat "$CONFIGFILES_PATH/ModProbe/hfs.conf" > /etc/modprobe.d/hfs.conf
cat "$CONFIGFILES_PATH/ModProbe/hfsplus.conf" > /etc/modprobe.d/hfsplus.conf
cat "$CONFIGFILES_PATH/ModProbe/jffs2.conf" > /etc/modprobe.d/jffs2.conf
cat "$CONFIGFILES_PATH/ModProbe/squashfs.conf" > /etc/modprobe.d/squashfs.conf
cat "$CONFIGFILES_PATH/ModProbe/udf.conf" > /etc/modprobe.d/udf.conf
#banners
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/BANNERS/issue > /etc/issue
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/BANNERS/issue.net > /etc/issue.net
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/BANNERS/motd > /etc/motd
cat "$CONFIGFILES_PATH/BANNERS/issue" > /etc/issue
cat "$CONFIGFILES_PATH/BANNERS/issue.net" > /etc/issue.net
cat "$CONFIGFILES_PATH/BANNERS/motd" > /etc/motd
#Cron perms
+14 -15
View File
@@ -4,11 +4,10 @@
#Core framework functions...
#########################################
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../../../)"
#Framework variables are read from here
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -16,19 +15,19 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
export CONFIGFILES_PATH
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/ProjectCode/ConfigFiles"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../../../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
#Framework variables are read from hee
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
#########################################
# Core script code begins here
@@ -54,7 +53,7 @@ if [ ! -d $ROOT_SSH_DIR ]; then
mkdir /root/.ssh/
fi
cat ../../ConfigFiles/SSH/AuthorizedKeys/root-ssh-authorized-keys >/root/.ssh/authorized_keys
cat "$CONFIGFILES_PATH/SSH/AuthorizedKeys/root-ssh-authorized-keys" >/root/.ssh/authorized_keys
chmod 400 /root/.ssh/authorized_keys
chown root: /root/.ssh/authorized_keys
@@ -63,7 +62,7 @@ if [ "$LOCALUSER_CHECK" -gt 0 ]; then
mkdir -p /home/localuser/.ssh/
fi
cat ../../ConfigFiles/SSH/AuthorizedKeys/localuser-ssh-authorized-keys >/home/localuser/.ssh/authorized_keys
cat "$CONFIGFILES_PATH/SSH/AuthorizedKeys/localuser-ssh-authorized-keys" >/home/localuser/.ssh/authorized_keys
chown localuser /home/localuser/.ssh/authorized_keys &&
chmod 400 /home/localuser/.ssh/authorized_keys
fi
@@ -74,7 +73,7 @@ if [ "$SUBODEV_CHECK" = 1 ]; then
mkdir /home/subodev/.ssh/
fi
cat ../../ConfigFiles/SSH/AuthorizedKeys/localuser-ssh-authorized-keys >/home/subodev/.ssh/authorized_keys
cat "$CONFIGFILES_PATH/SSH/AuthorizedKeys/localuser-ssh-authorized-keys" >/home/subodev/.ssh/authorized_keys
chmod 400 /home/subodev/.ssh/authorized_keys &&
chown subodev: /home/subodev/.ssh/authorized_keys
fi
@@ -84,7 +83,7 @@ DEV_WORKSTATION_CHECK="$(hostname | egrep -c 'subopi-dev|CharlesDevServer' || tr
if [ "$DEV_WORKSTATION_CHECK" -eq 0 ]; then
cat ../../ConfigFiles/SSH/Configs/tsys-sshd-config >/etc/ssh/sshd_config
cat "$CONFIGFILES_PATH/SSH/Configs/tsys-sshd-config" >/etc/ssh/sshd_config
fi
@@ -94,7 +93,7 @@ export UBUNTU_CHECK
UBUNTU_CHECK="$(distro | grep -c Ubuntu||true)"
if [ "$UBUNTU_CHECK" -ne 1 ]; then
cat ../../ConfigFiles/SSH/Configs/ssh-audit-hardening.conf >/etc/ssh/sshd_config.d/ssh-audit_hardening.conf
cat "$CONFIGFILES_PATH/SSH/Configs/ssh-audit-hardening.conf" >/etc/ssh/sshd_config.d/ssh-audit_hardening.conf
chmod og-rwx /etc/ssh/sshd_config.d/*
fi
@@ -4,10 +4,10 @@
#Core framework functions...
#########################################
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../../../)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
#Framework variables are read from here
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/../../.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -15,19 +15,16 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../../../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
#Framework variables are read from hee
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
#########################################
# Core script code begins here
+34 -41
View File
@@ -5,11 +5,10 @@
#####
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PROJECT_ROOT_PATH
PROJECT_ROOT_PATH="$(realpath ../)"
#Framework variables are read from hee
PROJECT_ROOT_PATH="$(cd "$SCRIPT_DIR/.." && pwd)"
export GIT_VENDOR_PATH_ROOT
GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
@@ -17,13 +16,22 @@ GIT_VENDOR_PATH_ROOT="$PROJECT_ROOT_PATH/vendor/git@git.knownelement.com/29418/"
export KNELShellFrameworkRoot
KNELShellFrameworkRoot="$GIT_VENDOR_PATH_ROOT/KNEL/KNELShellFramework"
source $KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars
export CONFIGFILES_PATH
CONFIGFILES_PATH="$PROJECT_ROOT_PATH/ProjectCode/ConfigFiles"
for framework_include_file in $KNELShellFrameworkRoot/Framework-Includes/*; do
export MODULES_PATH
MODULES_PATH="$PROJECT_ROOT_PATH/ProjectCode/Modules"
export SCRIPTS_PATH
SCRIPTS_PATH="$PROJECT_ROOT_PATH/ProjectCode/scripts"
source "$KNELShellFrameworkRoot/Framework-ConfigFiles/FrameworkVars"
for framework_include_file in "$KNELShellFrameworkRoot"/Framework-Includes/*; do
source "$framework_include_file"
done
for project_include_file in ../Project-Includes/*; do
for project_include_file in "$PROJECT_ROOT_PATH"/Project-Includes/*; do
source "$project_include_file"
done
@@ -47,9 +55,6 @@ SUBODEV_CHECK="$(getent passwd | grep -c subodev || true)"
export LOCALUSER_CHECK
LOCALUSER_CHECK="$(getent passwd | grep -c localuser || true)"
export DL_ROOT
DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
#######################
# Support functions
#######################
@@ -57,11 +62,9 @@ DL_ROOT="https://dl.knownelement.com/KNEL/FetchApply/"
function global-oam() {
print_info "Now running $FUNCNAME...."
cat ./scripts/up2date.sh >/usr/local/bin/up2date.sh && chmod +x /usr/local/bin/up2date.sh
cat "$SCRIPTS_PATH/up2date.sh" >/usr/local/bin/up2date.sh && chmod +x /usr/local/bin/up2date.sh
cd Modules/OAM || exit
bash ./oam-librenms.sh
cd - || exit
bash "$MODULES_PATH/OAM/oam-librenms.sh"
print_info "Completed running $FUNCNAME"
@@ -70,9 +73,9 @@ function global-oam() {
function global-systemServiceConfigurationFiles() {
print_info "Now running $FUNCNAME...."
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/ZSH/tsys-zshrc >/etc/zshrc
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/SMTP/aliases >/etc/aliases
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/Syslog/rsyslog.conf >/etc/rsyslog.conf
cat "$CONFIGFILES_PATH/ZSH/tsys-zshrc" >/etc/zshrc
cat "$CONFIGFILES_PATH/SMTP/aliases" >/etc/aliases
cat "$CONFIGFILES_PATH/Syslog/rsyslog.conf" >/etc/rsyslog.conf
newaliases
@@ -235,7 +238,7 @@ function global-postPackageConfiguration() {
systemctl stop postfix
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/SMTP/postfix_generic >/etc/postfix/generic
cat "$CONFIGFILES_PATH/SMTP/postfix_generic" >/etc/postfix/generic
postmap /etc/postfix/generic
postconf -e "inet_protocols = ipv4"
@@ -262,33 +265,33 @@ function global-postPackageConfiguration() {
###Post package deployment bits
curl --silent ${DL_ROOT}/ProjectCode/ConfigFiles/DHCP/dhclient.conf >/etc/dhcp/dhclient.conf
cat "$CONFIGFILES_PATH/DHCP/dhclient.conf" >/etc/dhcp/dhclient.conf
systemctl stop snmpd && /etc/init.d/snmpd stop
cat ./ConfigFiles/SNMP/snmp-sudo.conf >/etc/sudoers.d/Debian-snmp
cat "$CONFIGFILES_PATH/SNMP/snmp-sudo.conf" >/etc/sudoers.d/Debian-snmp
sed -i "s|-Lsd|-LS6d|" /lib/systemd/system/snmpd.service
pi-detect
if [ "$IS_RASPI" = 1 ]; then
cat ./ConfigFiles/SNMP/snmpd-rpi.conf >/etc/snmp/snmpd.conf || true
cat "$CONFIGFILES_PATH/SNMP/snmpd-rpi.conf" >/etc/snmp/snmpd.conf || true
fi
if [ "$IS_PHYSICAL_HOST" = 1 ]; then
cat ./ConfigFiles/SNMP/snmpd-physicalhost.conf >/etc/snmp/snmpd.conf || true
cat "$CONFIGFILES_PATH/SNMP/snmpd-physicalhost.conf" >/etc/snmp/snmpd.conf || true
fi
if [ "$IS_VIRT_GUEST" = 1 ]; then
cat ./ConfigFiles/SNMP/snmpd.conf >/etc/snmp/snmpd.conf || true
cat "$CONFIGFILES_PATH/SNMP/snmpd.conf" >/etc/snmp/snmpd.conf || true
fi
systemctl daemon-reload && systemctl restart snmpd && /etc/init.d/snmpd restart
cat ./ConfigFiles/NetworkDiscovery/lldpd >/etc/default/lldpd
cat "$CONFIGFILES_PATH/NetworkDiscovery/lldpd" >/etc/default/lldpd
systemctl restart lldpd
cat ./ConfigFiles/Cockpit/disallowed-users >/etc/cockpit/disallowed-users
cat "$CONFIGFILES_PATH/Cockpit/disallowed-users" >/etc/cockpit/disallowed-users
systemctl restart cockpit
export LIBRENMS_CHECK
@@ -305,7 +308,7 @@ function global-postPackageConfiguration() {
if [ "$NTP_SERVER_CHECK" -eq 0 ]; then
cat ./ConfigFiles/NTP/ntp.conf >/etc/ntpsec/ntp.conf
cat "$CONFIGFILES_PATH/NTP/ntp.conf" >/etc/ntpsec/ntp.conf
systemctl restart ntpsec.service
fi
@@ -346,42 +349,32 @@ function global-postPackageConfiguration() {
function secharden-ssh() {
print_info "Now running $FUNCNAME"
cd ./Modules/Security || exit
bash ./secharden-ssh.sh
cd -
bash "$MODULES_PATH/Security/secharden-ssh.sh"
print_info "Completed running $FUNCNAME"
}
function secharden-wazuh() {
print_info "Now running $FUNCNAME"
cd ./Modules/Security || exit
bash ./secharden-wazuh.sh
cd -
bash "$MODULES_PATH/Security/secharden-wazuh.sh"
print_info "Completed running $FUNCNAME"
}
function secharden-2fa() {
print_info "Now running $FUNCNAME"
cd ./Modules/Security || exit
bash ./secharden-2fa.sh
cd -
bash "$MODULES_PATH/Security/secharden-2fa.sh"
print_info "Completed running $FUNCNAME"
}
function secharden-scap-stig() {
print_info "Now running $FUNCNAME"
cd ./Modules/Security || exit
bash ./secharden-scap-stig.sh
cd -
bash "$MODULES_PATH/Security/secharden-scap-stig.sh"
print_info "Completed running $FUNCNAME"
}
function secharden-agents() {
print_info "Now running $FUNCNAME"
cd ./Modules/Security || exit
bash ./secharden-audit-agents.sh
cd -
bash "$MODULES_PATH/Security/secharden-audit-agents.sh"
print_info "Completed running $FUNCNAME"
}