mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-01-23 08:31:30 +01:00
use vrt
This commit is contained in:
@@ -121,8 +121,8 @@ def _check_license():
|
||||
log.error("LICENSE: No license_id found in license file")
|
||||
return False
|
||||
|
||||
if 'hvn' not in features:
|
||||
log.error("LICENSE: 'hvn' feature not found in license")
|
||||
if 'vrt' not in features:
|
||||
log.error("LICENSE: 'vrt' feature not found in license")
|
||||
return False
|
||||
|
||||
log.info("LICENSE: License validation successful")
|
||||
@@ -506,7 +506,7 @@ def setup_environment(vm_name: str = 'sool9', disk_size: str = '220G', minion_id
|
||||
if not _check_license():
|
||||
return {
|
||||
'success': False,
|
||||
'error': 'Invalid license or missing hvn feature',
|
||||
'error': 'Invalid license or missing vrt feature',
|
||||
'vm_result': None
|
||||
}
|
||||
|
||||
@@ -670,7 +670,7 @@ def create_vm(vm_name: str, disk_size: str = '220G'):
|
||||
if not _check_license():
|
||||
return {
|
||||
'success': False,
|
||||
'error': 'Invalid license or missing hvn feature',
|
||||
'error': 'Invalid license or missing vrt feature',
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -958,11 +958,6 @@ def regenerate_ssh_keys():
|
||||
else:
|
||||
print("Failed to regenerate SSH keys")
|
||||
"""
|
||||
# Check license before proceeding
|
||||
if not _check_license():
|
||||
log.error("MAIN: Invalid license or missing hvn feature")
|
||||
return False
|
||||
|
||||
log.info("MAIN: Starting SSH key regeneration")
|
||||
try:
|
||||
# Verify current state
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) -%}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) -%}
|
||||
|
||||
"""
|
||||
Script for emitting VM deployment status events to the Salt event bus.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
hypervisor_log_dir:
|
||||
file.directory:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
in the software, and you may not remove or obscure any functionality in the
|
||||
software that is protected by the license key." #}
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
{# Import defaults.yaml for model hardware capabilities #}
|
||||
{% import_yaml 'hypervisor/defaults.yaml' as DEFAULTS %}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
"""
|
||||
Script for managing hardware configurations of KVM virtual machines. This script provides
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) -%}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) -%}
|
||||
|
||||
"""
|
||||
Script for modifying network configurations within QCOW2 virtual machine images. This script provides
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls.split('.')[0] in allowed_states or sls in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
include:
|
||||
- libvirt.packages
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
{% from 'libvirt/map.jinja' import LIBVIRTMERGED %}
|
||||
|
||||
include:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls.split('.')[0] in allowed_states or sls in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
# allows for creating vm images
|
||||
# any node manipulating images needs this
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls.split('.')[0] in allowed_states or sls in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
{% from 'vars/globals.map.jinja' import GLOBALS %}
|
||||
|
||||
{% if GLOBALS.is_manager %}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls.split('.')[0] in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
{% set manager_hostname = grains.id.split('_')[0] %}
|
||||
|
||||
# Check if hypervisor environment has been set up
|
||||
|
||||
@@ -235,7 +235,7 @@ function acceptminion() {
|
||||
|
||||
if [[ "$MINION_ID" == *"_hypervisor" ]]; then
|
||||
FEATURES=$(/usr/sbin/so-yaml.py get /opt/so/saltstack/local/pillar/soc/license.sls features)
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "hvn" ]]; then
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "vrt" ]]; then
|
||||
error_msg="Hypervisor nodes are a feature supported only for customers with a valid license.\n Contact Security Onion Solutions, LLC via our website at https://securityonionsolutions.com\n for more information about purchasing a license to enable this feature."
|
||||
log "ERROR" "$error_msg"
|
||||
echo -e "Error: $error_msg"
|
||||
@@ -869,7 +869,7 @@ function createRECEIVER() {
|
||||
function createHYPERVISOR() {
|
||||
log "INFO" "Creating HYPERVISOR configuration for minion $MINION_ID"
|
||||
FEATURES=$(/usr/sbin/so-yaml.py get /opt/so/saltstack/local/pillar/soc/license.sls features)
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "hvn" ]]; then
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "vrt" ]]; then
|
||||
error_msg="Hypervisor nodes are a feature supported only for customers with a valid license.\n Contact Security Onion Solutions, LLC via our website at https://securityonionsolutions.com\n for more information about purchasing a license to enable this feature."
|
||||
log "ERROR" "$error_msg"
|
||||
echo -e "Error: $error_msg"
|
||||
@@ -964,7 +964,7 @@ function updateMineAndApplyStates() {
|
||||
# We don't want a hypervisor node to highstate until the image is downloaded and built. This will be triggered from the setup_hypervisor runner
|
||||
if [[ "$NODETYPE" == "HYPERVISOR" ]]; then
|
||||
FEATURES=$(/usr/sbin/so-yaml.py get /opt/so/saltstack/local/pillar/soc/license.sls features)
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "hvn" ]]; then
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "vrt" ]]; then
|
||||
error_msg="Hypervisor nodes are a feature supported only for customers with a valid license.\n Contact Security Onion Solutions, LLC via our website at https://securityonionsolutions.com\n for more information about purchasing a license to enable this feature."
|
||||
log "ERROR" "$error_msg"
|
||||
echo -e "Error: $error_msg"
|
||||
@@ -1058,7 +1058,7 @@ case "$OPERATION" in
|
||||
"addVM")
|
||||
log "INFO" "Adding VM minion $MINION_ID"
|
||||
FEATURES=$(/usr/sbin/so-yaml.py get /opt/so/saltstack/local/pillar/soc/license.sls features)
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "hvn" ]]; then
|
||||
if [[ $? -ne 0 || ! "$FEATURES" =~ "vrt" ]]; then
|
||||
error_msg="Hypervisor nodes are a feature supported only for customers with a valid license.\n Contact Security Onion Solutions, LLC via our website at https://securityonionsolutions.com\n for more information about purchasing a license to enable this feature."
|
||||
log "ERROR" "$error_msg"
|
||||
echo -e "Error: $error_msg"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) -%}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) -%}
|
||||
|
||||
"""
|
||||
Script for automated virtual machine provisioning and configuration in Security Onion's virtualization infrastructure.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
{% do salt.log.info('dyanno_hypervisor_orch: Running') %}
|
||||
{% set vm_name = None %}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
{% do salt.log.debug('vm_pillar_clean_orch: Running') %}
|
||||
{% set vm_name = pillar.get('vm_name') %}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
{% from 'salt/map.jinja' import SALTVERSION %}
|
||||
{% set HYPERVISORS = salt['pillar.get']('hypervisor:nodes', {} ) %}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls.split('.')[:2]|join('.') in allowed_states %}
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
reactor_config_hypervisor:
|
||||
file.managed:
|
||||
- name: /etc/salt/master.d/reactor_hypervisor.conf
|
||||
|
||||
@@ -63,7 +63,7 @@ State Files:
|
||||
- <vm_name>.error: Error state with detailed message
|
||||
|
||||
Notes:
|
||||
- Requires 'hvn' feature license
|
||||
- Requires 'vrt' feature license
|
||||
- Uses hypervisor's sosmodel grain for hardware capabilities
|
||||
- Hardware allocation based on model-specific configurations
|
||||
- All created files maintain socore ownership
|
||||
@@ -80,7 +80,7 @@ Description:
|
||||
- Lock remains until clean shutdown or error
|
||||
|
||||
2. License Validation
|
||||
- Verifies 'hvn' feature is licensed
|
||||
- Verifies 'vrt' feature is licensed
|
||||
- Prevents operation if license is invalid
|
||||
|
||||
3. Configuration Processing
|
||||
@@ -567,7 +567,7 @@ def mark_invalid_hardware(hypervisor_path: str, vm_name: str, config: dict, erro
|
||||
log.error("Failed to create invalid hardware file: %s", str(e))
|
||||
raise
|
||||
|
||||
def validate_hvn_license() -> bool:
|
||||
def validate_vrt_license() -> bool:
|
||||
"""Check if the license file exists and contains required values."""
|
||||
if not os.path.exists(LICENSE_PATH):
|
||||
log.error("License file not found at %s", LICENSE_PATH)
|
||||
@@ -588,7 +588,7 @@ def validate_hvn_license() -> bool:
|
||||
log.error("No license_id found in license file")
|
||||
return False
|
||||
|
||||
if 'hvn' not in features:
|
||||
if 'vrt' not in features:
|
||||
log.error("Hypervisor nodes are a feature supported only for customers with a valid license.\n"
|
||||
"Contact Security Onion Solutions, LLC via our website at https://securityonionsolutions.com\n"
|
||||
"for more information about purchasing a license to enable this feature.")
|
||||
@@ -889,7 +889,7 @@ def start(interval: int = DEFAULT_INTERVAL,
|
||||
"""
|
||||
log.info("Starting virtual node manager engine")
|
||||
|
||||
if not validate_hvn_license():
|
||||
if not validate_vrt_license():
|
||||
return
|
||||
|
||||
# Attempt to acquire lock
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
include:
|
||||
- salt.minion
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
- salt.cloud
|
||||
- salt.cloud.reactor_config_hypervisor
|
||||
|
||||
@@ -48,11 +48,11 @@ pillarWatch_engine:
|
||||
- name: /etc/salt/engines/pillarWatch.py
|
||||
- source: salt://salt/engines/master/pillarWatch.py
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
hvn_engine_config:
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
vrt_engine_config:
|
||||
file.managed:
|
||||
- name: /etc/salt/master.d/hvn_engine.conf
|
||||
- source: salt://salt/files/hvn_engine.conf
|
||||
- name: /etc/salt/master.d/vrt_engine.conf
|
||||
- source: salt://salt/files/vrt_engine.conf
|
||||
- watch_in:
|
||||
- service: salt_master_service
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features') and salt['grains.get']('salt-cloud', {}) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features') and salt['grains.get']('salt-cloud', {}) %}
|
||||
|
||||
include:
|
||||
- sensor.vm.network
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
{% set mainint = salt['pillar.get']('host:mainint', 'enp1s0') %}
|
||||
{% set interfaces = salt['network.interfaces']() %}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
{% from 'hypervisor/map.jinja' import HYPERVISORS %}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
in the software, and you may not remove or obscure any functionality in the
|
||||
software that is protected by the license key." #}
|
||||
|
||||
{%- if 'hvn' in salt['pillar.get']('features', []) -%}
|
||||
{%- if 'vrt' in salt['pillar.get']('features', []) -%}
|
||||
|
||||
{%- import_yaml 'soc/dyanno/hypervisor/hypervisor.yaml' as ANNOTATION -%}
|
||||
{%- from 'hypervisor/map.jinja' import HYPERVISORS -%}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
{# Import the process steps from map.jinja #}
|
||||
{% from 'soc/dyanno/hypervisor/map.jinja' import PROCESS_STEPS %}
|
||||
|
||||
@@ -155,7 +155,7 @@ base:
|
||||
- stig
|
||||
- kafka
|
||||
|
||||
'*_managerhype and I@features:hvn and G@saltversion:{{saltversion}}':
|
||||
'*_managerhype and I@features:vrt and G@saltversion:{{saltversion}}':
|
||||
- match: compound
|
||||
- manager.hypervisor
|
||||
|
||||
@@ -299,7 +299,7 @@ base:
|
||||
- elasticfleet.install_agent_grid
|
||||
- schedule
|
||||
|
||||
'*_hypervisor and I@features:hvn and G@saltversion:{{saltversion}}':
|
||||
'*_hypervisor and I@features:vrt and G@saltversion:{{saltversion}}':
|
||||
- match: compound
|
||||
- ssl
|
||||
- sensoroni
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# in the software, and you may not remove or obscure any functionality in the
|
||||
# software that is protected by the license key."
|
||||
|
||||
{% if 'hvn' in salt['pillar.get']('features', []) %}
|
||||
{% if 'vrt' in salt['pillar.get']('features', []) %}
|
||||
|
||||
# Send highstate trigger event for VM deployment status tracking
|
||||
# so-salt-emit-vm-deployment-status sets event_tag = f'soc/dyanno/hypervisor/{status.lower()}'
|
||||
|
||||
Reference in New Issue
Block a user