mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-24 01:43:11 +01:00
remove unneeded files
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
#listen_tls = "0"
|
||||
#listen_tcp = "0"
|
||||
#tls_port = "16514"
|
||||
#tcp_port = "16509"
|
||||
#listen_addr = "0.0.0.0"
|
||||
#unix_sock_group = "root"
|
||||
#unix_sock_ro_perms = "0777"
|
||||
#unix_sock_rw_perms = "0770"
|
||||
#unix_sock_admin_perms = "0700"
|
||||
#unix_sock_dir = "/run/libvirt"
|
||||
#auth_unix_ro = "none"
|
||||
#auth_unix_rw = "none"
|
||||
#auth_tcp = "none"
|
||||
#auth_tls = "none"
|
||||
#access_drivers = "[ \"nop\" ]"
|
||||
#key_file = "/etc/pki/libvirt/private/serverkey.pem"
|
||||
#cert_file = "/etc/pki/libvirt/servercert.pem"
|
||||
#ca_file = "/etc/pki/CA/cacert.pem"
|
||||
#crl_file = "/etc/pki/CA/crl.pem"
|
||||
#tls_no_sanity_certificate = "0"
|
||||
#tls_no_verify_certificate = "0"
|
||||
#tls_allowed_dn_list = "[\"DN1\", \"DN2\"]"
|
||||
#tls_priority = "NORMAL"
|
||||
#sasl_allowed_username_list = "[\"joe@example.com\", \"fred@example.com\"]"
|
||||
#max_clients = "5000"
|
||||
#max_queued_clients = "20"
|
||||
#max_anonymous_clients = "20"
|
||||
#min_workers = "5"
|
||||
#max_workers = "20"
|
||||
#prio_workers = "5"
|
||||
#max_client_requests = "5"
|
||||
#admin_min_workers = "1"
|
||||
#admin_max_workers = "5"
|
||||
#admin_max_clients = "5"
|
||||
#admin_max_queued_clients = "5"
|
||||
#admin_max_client_requests = "5"
|
||||
#log_level = "3"
|
||||
#log_filters = "\"1:qemu 1:libvirt 4:object 4:json 4:event 1:util\""
|
||||
#log_outputs = "\"3:syslog:libvirtd\""
|
||||
#audit_level = "1"
|
||||
#audit_logging = "0"
|
||||
#host_uuid = "00000000-0000-0000-0000-000000000000"
|
||||
#host_uuid_source = "smbios"
|
||||
#keepalive_interval = "5"
|
||||
#keepalive_count = "5"
|
||||
#keepalive_required = "0"
|
||||
#admin_keepalive_required = "0"
|
||||
#admin_keepalive_interval = "5"
|
||||
#admin_keepalive_count = "5"
|
||||
#ovs_timeout = "5"
|
||||
@@ -1,51 +0,0 @@
|
||||
#listen_tls = 0
|
||||
#listen_tcp = 1
|
||||
#tls_port = "16514"
|
||||
#tcp_port = "16509"
|
||||
#listen_addr = "192.168.0.1"
|
||||
#unix_sock_group = "libvirt"
|
||||
#unix_sock_ro_perms = "0777"
|
||||
#unix_sock_rw_perms = "0770"
|
||||
#unix_sock_admin_perms = "0700"
|
||||
#unix_sock_dir = "/run/libvirt"
|
||||
#auth_unix_ro = "polkit"
|
||||
#auth_unix_rw = "polkit"
|
||||
#auth_tcp = "sasl"
|
||||
#auth_tls = "none"
|
||||
#tcp_min_ssf = 112
|
||||
#access_drivers = [ "polkit" ]
|
||||
#key_file = "/etc/pki/libvirt/private/serverkey.pem"
|
||||
#cert_file = "/etc/pki/libvirt/servercert.pem"
|
||||
#ca_file = "/etc/pki/CA/cacert.pem"
|
||||
#crl_file = "/etc/pki/CA/crl.pem"
|
||||
#tls_no_sanity_certificate = 1
|
||||
#tls_no_verify_certificate = 1
|
||||
#tls_allowed_dn_list = ["DN1", "DN2"]
|
||||
#tls_priority="NORMAL"
|
||||
#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ]
|
||||
#max_clients = 5000
|
||||
#max_queued_clients = 1000
|
||||
#max_anonymous_clients = 20
|
||||
#min_workers = 5
|
||||
#max_workers = 20
|
||||
#prio_workers = 5
|
||||
#max_client_requests = 5
|
||||
#admin_min_workers = 1
|
||||
#admin_max_workers = 5
|
||||
#admin_max_clients = 5
|
||||
#admin_max_queued_clients = 5
|
||||
#admin_max_client_requests = 5
|
||||
#log_level = 3
|
||||
#log_filters="1:qemu 1:libvirt 4:object 4:json 4:event 1:util"
|
||||
#log_outputs="3:syslog:libvirtd"
|
||||
#audit_level = 2
|
||||
#audit_logging = 1
|
||||
#host_uuid = "00000000-0000-0000-0000-000000000000"
|
||||
#host_uuid_source = "smbios"
|
||||
#keepalive_interval = 5
|
||||
#keepalive_count = 5
|
||||
#keepalive_required = 1
|
||||
#admin_keepalive_required = 1
|
||||
#admin_keepalive_interval = 5
|
||||
#admin_keepalive_count = 5
|
||||
#ovs_timeout = 5
|
||||
@@ -1 +1 @@
|
||||
# The files in this directory (/opt/so/saltstack/local/salt/libvirt/images/sool9) are generated by createvm.sh. They are then distributed to the hypervisors where a storage pool will be created then the image can be installed.
|
||||
# The files in this directory (/opt/so/saltstack/local/salt/libvirt/images/sool9) are generated by the setup_hypervisor runner. They are then distributed to the hypervisors where a storage pool will be created then the image can be installed.
|
||||
|
||||
@@ -34,7 +34,7 @@ libvirt_conf_dir:
|
||||
libvirt_config:
|
||||
file.managed:
|
||||
- name: /opt/so/conf/libvirt/libvirtd.conf
|
||||
- source: salt://libvirt/configstockstock
|
||||
- source: salt://libvirt/etc/libvirtd.conf
|
||||
# - source: salt://libvirt/etc/libvirtd.conf.jinja
|
||||
# - template: jinja
|
||||
# - defaults:
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Ensure /root/create_vm/var/lib/libvirt/images exists
|
||||
# Place this script in /root/create_vm
|
||||
# Download OL9U5_x86_64-kvm-b253.qcow2 from https://yum.oracle.com/oracle-linux-templates.html, place in /root/create_vm/
|
||||
|
||||
# These steps will be removed from the process to create the final image and is being used for development
|
||||
# This is used for the user-data auth portion of cloud-init
|
||||
# Create passwd hash:
|
||||
# python3 -c 'import crypt; print(crypt.crypt("YOUR_PASSWD_HERE", crypt.mksalt(crypt.METHOD_SHA512)))'
|
||||
# Create ssh keypair:
|
||||
# ssh-keygen -t ed25519 -C "soqemussh" -f ~/.ssh/soqemussh
|
||||
|
||||
# Run the script: createvm.sh coreol9Small 205G
|
||||
# IP options may be removed for final version
|
||||
|
||||
# After running the script, the following will be output:
|
||||
#[root@jppvirtman create_vm]# ll var/lib/libvirt/images/coreol9Small/
|
||||
#total 610376
|
||||
#-rw-r--r--. 1 root root 380928 Dec 20 14:33 coreol9Small-cidata.iso
|
||||
#-rw-r--r--. 1 root root 624623616 Dec 20 14:33 coreol9Small.qcow2
|
||||
#-rw-r--r--. 1 root root 55 Dec 20 14:32 meta-data
|
||||
#-rw-r--r--. 1 root root 333 Dec 20 14:32 network-config
|
||||
#-rw-r--r--. 1 root root 1047 Dec 20 14:32 user-data
|
||||
|
||||
# These files are now scp to a hypervisor node
|
||||
# Place the files in /var/lib/libvirt/images/coreol9Small (or whatever is the same as the vm name)
|
||||
# Create your storage pool as instructed by the script. this is only needed if one doesn't already exist
|
||||
# Run the virt-install command as instructed by the script
|
||||
|
||||
# Could add the following to the final runcmd in the user-data to fill the disk to avoid the cons of thin provisioning the disk
|
||||
# - dd if=/dev/zero of=/tmp/fill bs=1M || true
|
||||
# - rm -f /tmp/fill
|
||||
|
||||
# Exit on any error
|
||||
set -e
|
||||
|
||||
# Set variables and defaults
|
||||
VM=${1:-"small-vm"} # VM name
|
||||
DISK_SIZE=${2:-"205G"} # Disk size with unit (default 205G)
|
||||
IP=${3:-"192.168.1.10"} # IP address
|
||||
GATEWAY=${4:-"192.168.1.1"} # Gateway
|
||||
DNS=${5:-"192.168.1.1"} # Comma-separated list of DNS servers
|
||||
MAC_ADDRESS="52:54:00:f2:c3:df" # Default MAC - will be overridden if found
|
||||
|
||||
# Show usage if help is requested
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
echo "Usage: $0 <vm_name> <disk_size> <ip> <gateway> <dns_servers>"
|
||||
echo "Example: $0 myvm 100G 192.168.1.50 192.168.1.1 8.8.8.8,8.8.4.4"
|
||||
echo "Parameters:"
|
||||
echo " vm_name : Name of the VM (default: small-vm)"
|
||||
echo " disk_size : Size of the disk with unit G/M (default: 205G)"
|
||||
echo " ip : IP address (default: 192.168.1.10)"
|
||||
echo " gateway : Gateway address (default: 192.168.1.1)"
|
||||
echo " dns_servers: Comma-separated DNS servers (default: 192.168.1.1)"
|
||||
echo "All parameters are optional and will use defaults if not specified"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Validate disk size format
|
||||
if ! [[ $DISK_SIZE =~ ^[0-9]+[GM]$ ]]; then
|
||||
echo "Error: Disk size must be a number followed by G (gigabytes) or M (megabytes)"
|
||||
echo "Example: 100G or 51200M"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert comma-separated DNS servers to yaml format
|
||||
format_dns() {
|
||||
local IFS=','
|
||||
local dns_list=($1)
|
||||
local yaml=""
|
||||
for dns in "${dns_list[@]}"; do
|
||||
yaml="$yaml - $dns"$'\n'
|
||||
done
|
||||
echo "$yaml"
|
||||
}
|
||||
|
||||
DNS_YAML=$(format_dns "$DNS")
|
||||
|
||||
# Set up directory structure
|
||||
D=/root/create_vm/var/lib/libvirt/images
|
||||
mkdir -vp $D/$VM
|
||||
cd $D/$VM
|
||||
|
||||
# Create cloud-init metadata
|
||||
cat > meta-data << EOF
|
||||
instance-id: ${VM}
|
||||
local-hostname: ${VM}
|
||||
EOF
|
||||
|
||||
# Create network configuration
|
||||
cat > network-config << EOF
|
||||
version: 2
|
||||
ethernets:
|
||||
eth0:
|
||||
match:
|
||||
macaddress: ${MAC_ADDRESS}
|
||||
dhcp4: false
|
||||
dhcp6: false
|
||||
addresses:
|
||||
- ${IP}/24
|
||||
routes:
|
||||
- to: 0.0.0.0/0
|
||||
via: ${GATEWAY}
|
||||
nameservers:
|
||||
addresses:
|
||||
$(format_dns "$DNS")
|
||||
EOF
|
||||
|
||||
# Create user-data with network configuration
|
||||
cat > user-data << EOF
|
||||
#cloud-config
|
||||
preserve_hostname: False
|
||||
hostname: ${VM}
|
||||
fqdn: ${VM}.local
|
||||
|
||||
users:
|
||||
- default
|
||||
- name: soqemussh
|
||||
groups: ['wheel']
|
||||
shell: /bin/bash
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
lock_passwd: false
|
||||
passwd: $(echo '___YOUR_HASH_HERE___')
|
||||
ssh-authorized-keys:
|
||||
- ssh-ed25519 ___YOUR_PUB_KEY_HERE___ soqemussh
|
||||
|
||||
# Configure where output will go
|
||||
output:
|
||||
all: ">> /var/log/cloud-init.log"
|
||||
|
||||
# configure interaction with ssh server
|
||||
ssh_genkeytypes: ['ed25519', 'rsa']
|
||||
|
||||
# set timezone for VM
|
||||
timezone: UTC
|
||||
|
||||
# Install QEMU guest agent. Enable and start the service
|
||||
packages:
|
||||
- qemu-guest-agent
|
||||
|
||||
runcmd:
|
||||
- systemctl enable --now qemu-guest-agent
|
||||
- systemctl enable --now serial-getty@ttyS0.service
|
||||
- systemctl enable --now NetworkManager
|
||||
- growpart /dev/vda 2
|
||||
- pvresize /dev/vda2
|
||||
- lvextend -l +100%FREE /dev/vg_main/lv_root
|
||||
- xfs_growfs /dev/vg_main/lv_root
|
||||
EOF
|
||||
|
||||
# First, copy the base image with progress
|
||||
echo "Creating base VM image..."
|
||||
rsync --progress /root/create_vm/OL9U5_x86_64-kvm-b253.qcow2 $VM.qcow2
|
||||
|
||||
# Resize the image to specified size
|
||||
echo "Resizing image to $DISK_SIZE..."
|
||||
echo "Current image size: $(qemu-img info $VM.qcow2 | grep 'virtual size' | cut -d':' -f2 | cut -d'(' -f1 | tr -d ' ')"
|
||||
qemu-img resize -f qcow2 $VM.qcow2 $DISK_SIZE
|
||||
echo "New image size: $(qemu-img info $VM.qcow2 | grep 'virtual size' | cut -d':' -f2 | cut -d'(' -f1 | tr -d ' ')"
|
||||
|
||||
# Now compress it with progress
|
||||
echo "Compressing image..."
|
||||
qemu-img convert -p -O qcow2 -c $VM.qcow2 $VM-compressed.qcow2
|
||||
mv -v $VM-compressed.qcow2 $VM.qcow2
|
||||
|
||||
# Create a cloud-init ISO with network config and progress indication
|
||||
echo "Creating cloud-init ISO..."
|
||||
mkisofs -output $VM-cidata.iso -volid CIDATA -rock -verbose user-data meta-data network-config
|
||||
|
||||
# Echo the configuration for verification
|
||||
echo "Creating VM with the following configuration:"
|
||||
echo "VM Name: $VM"
|
||||
echo "Disk Size: $DISK_SIZE"
|
||||
echo "IP Address: $IP"
|
||||
echo "Gateway: $GATEWAY"
|
||||
echo "DNS Servers: $DNS"
|
||||
echo "MAC Address: $MAC_ADDRESS"
|
||||
|
||||
echo "Files have been created in $D/$VM"
|
||||
echo
|
||||
echo "To complete VM creation on the hypervisor, run:"
|
||||
echo "virsh pool-create-as --name $VM --type dir --target $D/$VM"
|
||||
echo "virt-install --import --name ${VM} \\"
|
||||
echo " --memory 4096 --vcpus 4 --cpu host \\"
|
||||
echo " --disk ${VM}.qcow2,format=qcow2,bus=virtio \\"
|
||||
echo " --disk ${VM}-cidata.iso,device=cdrom \\"
|
||||
echo " --network bridge=br0,model=virtio,mac=${MAC_ADDRESS} \\"
|
||||
echo " --os-variant=ol9.5 \\"
|
||||
echo " --noautoconsole"
|
||||
@@ -1,144 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Ensure /root/create_vm/var/lib/libvirt/images exists
|
||||
# Place this script in /root/create_vm
|
||||
# Download OL9U5_x86_64-kvm-b253.qcow2 from https://yum.oracle.com/oracle-linux-templates.html, place in /root/create_vm/
|
||||
|
||||
# These steps will be removed from the process to create the final image and is being used for development
|
||||
# This is used for the user-data auth portion of cloud-init
|
||||
# Create passwd hash:
|
||||
# python3 -c 'import crypt; print(crypt.crypt("YOUR_PASSWD_HERE", crypt.mksalt(crypt.METHOD_SHA512)))'
|
||||
# Create ssh keypair:
|
||||
# ssh-keygen -t ed25519 -C "soqemussh" -f ~/.ssh/soqemussh
|
||||
|
||||
# Run the script: createbase.sh coreol9Small 20G
|
||||
# After running the script, the following will be output:
|
||||
#[root@jppvirtman create_vm]# ll var/lib/libvirt/images/coreol9Small/
|
||||
#total 610376
|
||||
#-rw-r--r--. 1 root root 380928 Dec 20 14:33 coreol9Small-cidata.iso
|
||||
#-rw-r--r--. 1 root root 624623616 Dec 20 14:33 coreol9Small.qcow2
|
||||
#-rw-r--r--. 1 root root 55 Dec 20 14:32 meta-data
|
||||
#-rw-r--r--. 1 root root 1047 Dec 20 14:32 user-data
|
||||
|
||||
# These files are now scp to a hypervisor node
|
||||
# Place the files in /var/lib/libvirt/images/coreol9Small (or whatever is the same as the vm name)
|
||||
# Create your storage pool as instructed by the script if one doesn't already exist
|
||||
# Run the virt-install command as instructed by the script
|
||||
|
||||
# Exit on any error
|
||||
set -e
|
||||
|
||||
# Set variables and defaults
|
||||
VM=${1:-"base-vm"} # VM name
|
||||
DISK_SIZE=${2:-"220G"} # Disk size with unit (default 20G)
|
||||
|
||||
# Show usage if help is requested
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
echo "Usage: $0 <vm_name> <disk_size>"
|
||||
echo "Example: $0 myvm 20G"
|
||||
echo "Parameters:"
|
||||
echo " vm_name : Name of the VM (default: base-vm)"
|
||||
echo " disk_size : Size of the disk with unit G/M (default: 20G)"
|
||||
echo "All parameters are optional and will use defaults if not specified"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Validate disk size format
|
||||
if ! [[ $DISK_SIZE =~ ^[0-9]+[GM]$ ]]; then
|
||||
echo "Error: Disk size must be a number followed by G (gigabytes) or M (megabytes)"
|
||||
echo "Example: 20G or 20480M"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set up directory structure
|
||||
#D=/root/create_vm/var/lib/libvirt/images
|
||||
D=/opt/so/saltstack/local/salt/libvirt/images
|
||||
mkdir -vp $D/$VM
|
||||
cd $D/$VM
|
||||
|
||||
# Create cloud-init metadata
|
||||
cat > meta-data << EOF
|
||||
instance-id: ${VM}
|
||||
local-hostname: ${VM}
|
||||
EOF
|
||||
|
||||
# Create user-data configuration
|
||||
cat > user-data << EOF
|
||||
#cloud-config
|
||||
preserve_hostname: False
|
||||
hostname: ${VM}
|
||||
fqdn: ${VM}.local
|
||||
|
||||
users:
|
||||
- default
|
||||
- name: soqemussh
|
||||
groups: ['wheel']
|
||||
shell: /bin/bash
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
lock_passwd: false
|
||||
passwd: $(echo '___YOUR_HASH_HERE___')
|
||||
ssh-authorized-keys:
|
||||
- ssh-ed25519 ___YOUR_PUB_KEY_HERE___ soqemussh
|
||||
|
||||
# Configure where output will go
|
||||
output:
|
||||
all: ">> /var/log/cloud-init.log"
|
||||
|
||||
# configure interaction with ssh server
|
||||
ssh_genkeytypes: ['ed25519', 'rsa']
|
||||
|
||||
# set timezone for VM
|
||||
timezone: UTC
|
||||
|
||||
# Install QEMU guest agent. Enable and start the service
|
||||
packages:
|
||||
- qemu-guest-agent
|
||||
|
||||
runcmd:
|
||||
- systemctl enable --now qemu-guest-agent
|
||||
- systemctl enable --now serial-getty@ttyS0.service
|
||||
- systemctl enable --now NetworkManager
|
||||
- growpart /dev/vda 2
|
||||
- pvresize /dev/vda2
|
||||
- lvextend -l +100%FREE /dev/vg_main/lv_root
|
||||
- xfs_growfs /dev/vg_main/lv_root
|
||||
- touch /etc/cloud/cloud-init.disabled
|
||||
- shutdown -P now
|
||||
EOF
|
||||
|
||||
# First, copy the base image with progress
|
||||
echo "Creating base VM image..."
|
||||
rsync --progress /root/create_vm/OL9U5_x86_64-kvm-b253.qcow2 $VM.qcow2
|
||||
|
||||
# Resize the image to specified size
|
||||
echo "Resizing image to $DISK_SIZE..."
|
||||
echo "Current image size: $(qemu-img info $VM.qcow2 | grep 'virtual size' | cut -d':' -f2 | cut -d'(' -f1 | tr -d ' ')"
|
||||
qemu-img resize -f qcow2 $VM.qcow2 $DISK_SIZE
|
||||
echo "New image size: $(qemu-img info $VM.qcow2 | grep 'virtual size' | cut -d':' -f2 | cut -d'(' -f1 | tr -d ' ')"
|
||||
|
||||
# Now compress it with progress
|
||||
echo "Compressing image..."
|
||||
qemu-img convert -p -O qcow2 -c $VM.qcow2 $VM-compressed.qcow2
|
||||
mv -v $VM-compressed.qcow2 $VM.qcow2
|
||||
|
||||
# Create a cloud-init ISO with progress indication
|
||||
echo "Creating cloud-init ISO..."
|
||||
mkisofs -output $VM-cidata.iso -volid CIDATA -rock -verbose user-data meta-data
|
||||
|
||||
# Echo the configuration for verification
|
||||
echo "Creating VM with the following configuration:"
|
||||
echo "VM Name: $VM"
|
||||
echo "Disk Size: $DISK_SIZE"
|
||||
|
||||
echo "Files have been created in $D/$VM"
|
||||
echo
|
||||
echo "To complete VM creation on the hypervisor, run:"
|
||||
echo "virsh pool-create-as --name $VM --type dir --target $D/$VM"
|
||||
echo "virt-install --name ${VM} \\"
|
||||
echo " --memory 4096 --vcpus 4 --cpu host \\"
|
||||
echo " --disk ${VM}.qcow2,format=qcow2,bus=virtio \\"
|
||||
echo " --disk ${VM}-cidata.iso,device=cdrom \\"
|
||||
echo " --network bridge=br0,model=virtio \\"
|
||||
echo " --os-variant=ol9.5 \\"
|
||||
echo " --import \\"
|
||||
echo " --noautoconsole"
|
||||
Reference in New Issue
Block a user