diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml index 733e069..de1f416 100644 --- a/Docker/docker-compose.yml +++ b/Docker/docker-compose.yml @@ -1,7 +1,7 @@ version: '2.4' services: timesketch: - image: aorlikoski/skadi_timesketch:1.4 + image: aorlikoski/skadi_timesketch:20190326 container_name: timesketch ports: - 127.0.0.1:5000:5000 @@ -115,7 +115,7 @@ services: restart: always cyberchef: - image: aorlikoski/skadi_cyberchef:latest + image: aorlikoski/skadi_cyberchef:20190326 container_name: cyberchef ports: - 127.0.0.1:8000:8000 diff --git a/Packer/GCP/skadi_server.json b/Packer/GCP/skadi_server.json deleted file mode 100644 index 8804b70..0000000 --- a/Packer/GCP/skadi_server.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "_comment": "Build with `packer build skadi_server.json`", - "builders": [ - { - "type": "googlecompute", - "account_file": "../auth_files/template_creds.json", - "project_id": "insert GCP project_id here", - "source_image": "ubuntu-1604-xenial-v20180831", - "ssh_username": "vagrant", - "image_name": "skadi-server", - "image_family": "skadi-server", - "disk_size": "10", - "machine_type": "n1-standard-2", - "disk_type": "pd-ssd", - "zone": "us-central1-a" - } - ], - "provisioners": [ - { - "environment_vars": [ - "CLEANUP_PAUSE={{user `cleanup_pause`}}", - "DEBIAN_FRONTEND=noninteractive", - "DESKTOP={{user `desktop`}}", - "UPDATE={{user `update`}}", - "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", - "SSH_USERNAME={{user `ssh_username`}}", - "SSH_PASSWORD={{user `ssh_password`}}", - "http_proxy={{user `http_proxy`}}", - "https_proxy={{user `https_proxy`}}", - "ftp_proxy={{user `ftp_proxy`}}", - "rsync_proxy={{user `rsync_proxy`}}", - "no_proxy={{user `no_proxy`}}" - ], - "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "scripts": [ - "../script/vagrant.sh", - "../script/sshd.sh", - "../script/virtualbox.sh", - "../script/motd.sh", - "../{{user `custom_script`}}", - "../script/cleanup.sh" - ], - "type": "shell", - "expect_disconnect": "true" - } - ], - "variables": { - "boot_command_prefix": "", - "cleanup_pause": "", - "cpus": "4", - "memory": "8192", - "custom_script": "../../Docker/BuildDockerSkadi.sh", - "desktop": "true", - "disk_size": "10240", - "ftp_proxy": "{{env `ftp_proxy`}}", - "headless": "false", - "http_proxy": "{{env `http_proxy`}}", - "https_proxy": "{{env `https_proxy`}}", - "install_vagrant_key": "true", - "iso_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8", - "iso_checksum_type": "sha256", - "iso_name": "ubuntu-16.04.5-server-amd64.iso", - "iso_path": "/Volumes/Storage/software/ubuntu", - "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso", - "locale": "en_US", - "no_proxy": "{{env `no_proxy`}}", - "parallels_guest_os_type": "ubuntu", - "preseed" : "preseed.cfg", - "rsync_proxy": "{{env `rsync_proxy`}}", - "hostname": "skadi", - "ssh_fullname": "vagrant", - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "update": "false", - "vagrantfile_template": "../../Vagrant/skadi_server/virtualbox/Vagrantfile", - "version": "2018.3.1", - "virtualbox_guest_os_type": "Ubuntu_64", - "vm_name": "skadi_desktop", - "vmware_guest_os_type": "ubuntu-64" - } -} diff --git a/Packer/VirtualBox/http/preseed.cfg b/Packer/VirtualBox/http/preseed.cfg deleted file mode 100644 index d38c245..0000000 --- a/Packer/VirtualBox/http/preseed.cfg +++ /dev/null @@ -1,43 +0,0 @@ -choose-mirror-bin mirror/http/proxy string -d-i base-installer/kernel/override-image string linux-server -d-i clock-setup/utc boolean true -d-i clock-setup/utc-auto boolean true -d-i finish-install/reboot_in_progress note -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true -d-i partman-auto/disk string /dev/sda -d-i partman-auto-lvm/guided_size string max -d-i partman-auto/choose_recipe select atomic -d-i partman-auto/method string lvm -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-lvm/device_remove_lvm boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true -d-i partman/confirm_write_new_label boolean true -d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common -d-i pkgsel/install-language-support boolean false -d-i pkgsel/update-policy select none -d-i pkgsel/upgrade select full-upgrade -d-i time/zone string UTC -tasksel tasksel/first multiselect standard, ubuntu-server - -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/layoutcode string us -d-i keyboard-configuration/modelcode string pc105 -d-i debian-installer/locale string en_US - -# Create vagrant user account. -d-i passwd/user-fullname string vagrant -d-i passwd/username string vagrant -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -d-i user-setup/allow-password-weak boolean true -d-i user-setup/encrypt-home boolean false -d-i passwd/user-default-groups vagrant sudo -d-i passwd/user-uid string 900 - -# Set root passwords -d-i rootpw vagrant diff --git a/Packer/VirtualBox/skadi_server.json b/Packer/VirtualBox/skadi_server.json deleted file mode 100644 index 7a36fa1..0000000 --- a/Packer/VirtualBox/skadi_server.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "_comment": "Build with `packer build skadi_server.json`", - "builders": [ - { - "boot_command": [ - "{{ user `boot_command_prefix` }}", - "/install/vmlinuz noapic ", - "initrd=/install/initrd.gz ", - "file=/floppy/{{ user `preseed` }} ", - "debian-installer={{ user `locale` }} auto locale={{ user `locale` }} kbd-chooser/method=us ", - "hostname={{ user `hostname` }} ", - "grub-installer/bootdev=/dev/sda ", - "fb=false debconf/frontend=noninteractive ", - "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", - "keyboard-configuration/variant=USA console-setup/ask_detect=false ", - "passwd/user-fullname={{ user `ssh_fullname` }} ", - "passwd/user-password={{ user `ssh_password` }} ", - "passwd/user-password-again={{ user `ssh_password` }} ", - "passwd/username={{ user `ssh_username` }} ", - "-- " - ], - "disk_size": "{{ user `disk_size` }}", - "floppy_files": [ - "http/{{ user `preseed` }}" - ], - "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", - "guest_os_type": "{{ user `virtualbox_guest_os_type` }}", - "hard_drive_interface": "sata", - "headless": "{{ user `headless` }}", - "iso_checksum": "{{ user `iso_checksum` }}", - "iso_checksum_type": "{{ user `iso_checksum_type` }}", - "iso_urls": [ - "{{ user `iso_path` }}/{{ user `iso_name` }}", - "{{ user `iso_url` }}" - ], - "output_directory": "output-{{ user `vm_name` }}-virtualbox-iso", - "post_shutdown_delay": "1m", - "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now", - "ssh_password": "{{ user `ssh_password` }}", - "ssh_username": "{{ user `ssh_username` }}", - "ssh_wait_timeout": "10000s", - "type": "virtualbox-iso", - "vboxmanage": [ - [ - "modifyvm", "{{.Name}}", "--nictype1", "virtio" - ], - [ - "modifyvm", "{{.Name}}", "--memory", "{{ user `memory` }}" - ], - [ - "modifyvm", "{{.Name}}", "--cpus", "{{ user `cpus` }}" - ] - ], - "virtualbox_version_file": ".vbox_version", - "vm_name": "{{user `vm_name`}}" - } - ], - "post-processors": [ - { - "keep_input_artifact": false, - "output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box", - "type": "vagrant", - "vagrantfile_template": "{{ user `vagrantfile_template` }}" - } - ], - "provisioners": [ - { - "environment_vars": [ - "CLEANUP_PAUSE={{user `cleanup_pause`}}", - "DEBIAN_FRONTEND=noninteractive", - "DESKTOP={{user `desktop`}}", - "UPDATE={{user `update`}}", - "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", - "SSH_USERNAME={{user `ssh_username`}}", - "SSH_PASSWORD={{user `ssh_password`}}", - "http_proxy={{user `http_proxy`}}", - "https_proxy={{user `https_proxy`}}", - "ftp_proxy={{user `ftp_proxy`}}", - "rsync_proxy={{user `rsync_proxy`}}", - "no_proxy={{user `no_proxy`}}" - ], - "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "scripts": [ - "../script/vagrant.sh", - "../script/sshd.sh", - "../script/virtualbox.sh", - "../script/motd.sh", - "../{{user `custom_script`}}", - "../script/cleanup.sh" - ], - "type": "shell", - "expect_disconnect": "true" - } - ], - "variables": { - "boot_command_prefix": "", - "cleanup_pause": "", - "cpus": "4", - "memory": "8196", - "custom_script": "script/skadibuild.sh", - "desktop": "false", - "disk_size": "10240", - "ftp_proxy": "{{env `ftp_proxy`}}", - "headless": "false", - "http_proxy": "{{env `http_proxy`}}", - "https_proxy": "{{env `https_proxy`}}", - "install_vagrant_key": "true", - "iso_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8", - "iso_checksum_type": "sha256", - "iso_name": "ubuntu-16.04.5-server-amd64.iso", - "iso_path": "/Volumes/Storage/software/ubuntu", - "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso", - "locale": "en_US", - "no_proxy": "{{env `no_proxy`}}", - "parallels_guest_os_type": "ubuntu", - "preseed" : "preseed.cfg", - "rsync_proxy": "{{env `rsync_proxy`}}", - "hostname": "skadi", - "ssh_fullname": "vagrant", - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "update": "false", - "vagrantfile_template": "../../Vagrant/skadi_server/virtualbox/Vagrantfile", - "version": "2018.3.2", - "virtualbox_guest_os_type": "Ubuntu_64", - "vm_name": "skadi_server", - "vmware_guest_os_type": "ubuntu-64" - } -} diff --git a/Packer/auth_files/template_creds.json b/Packer/auth_files/template_creds.json deleted file mode 100644 index dc5d1ae..0000000 --- a/Packer/auth_files/template_creds.json +++ /dev/null @@ -1 +0,0 @@ -Placeholder to put creds diff --git a/Packer/script/cleanup.sh b/Packer/script/cleanup.sh index 0fcb989..beb8220 100644 --- a/Packer/script/cleanup.sh +++ b/Packer/script/cleanup.sh @@ -30,11 +30,10 @@ apt-get -y autoremove --purge apt-get -y clean apt-get -y autoclean - # Remove Bash history unset HISTFILE rm -f /root/.bash_history -rm -f /home/${SSH_USER}/.bash_history +rm -f /home/$SKADI_USER/.bash_history rm -f /home/$SKADI_USER/.bash_history # Clean up log files diff --git a/Packer/script/skadi.sh b/Packer/script/skadi.sh new file mode 100644 index 0000000..f45c75e --- /dev/null +++ b/Packer/script/skadi.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +date > /etc/box_build_time + +SSH_USER=$skadi +SSH_PASS=$skadi +SSH_USER_HOME=$/home/$SSH_USER + +# Set up sudo +echo "==> Giving $SSH_USER sudo powers" +echo "$SSH_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$SSH_USER +chmod 440 /etc/sudoers.d/$SSH_USER + +# Fix stdin not being a tty +if grep -q -E "^mesg n$" /root/.profile && sed -i "s/^mesg n$/tty -s \\&\\& mesg n/g" /root/.profile; then + echo "==> Fixed stdin not being a tty." +fi diff --git a/Packer/script/update.sh b/Packer/script/update.sh index 3d59538..c4b8fac 100644 --- a/Packer/script/update.sh +++ b/Packer/script/update.sh @@ -4,13 +4,17 @@ echo "==> Disabling the release upgrader" sed -i.bak 's/^Prompt=.*$/Prompt=never/' /etc/update-manager/release-upgrades +# Sync Date +sudo timedatectl set-ntp off +sudo timedatectl set-ntp on + echo "==> Checking version of Ubuntu" . /etc/lsb-release -if [[ $DISTRIB_RELEASE == 16.04 || $DISTRIB_RELEASE == 16.10 ]]; then - echo "==> Disabling periodic apt upgrades" - echo 'APT::Periodic::Enable "0";' >> /etc/apt/apt.conf.d/10periodic -fi + +echo "==> Disabling periodic apt upgrades" +echo 'APT::Periodic::Enable "0";' >> /etc/apt/apt.conf.d/10periodic + echo "==> Updating list of repositories" diff --git a/Packer/script/vagrant.sh b/Packer/script/vagrant.sh index 37a7f1c..368fdec 100644 --- a/Packer/script/vagrant.sh +++ b/Packer/script/vagrant.sh @@ -2,9 +2,9 @@ date > /etc/box_build_time -SSH_USER=${SSH_USERNAME:-vagrant} -SSH_PASS=${SSH_PASSWORD:-vagrant} -SSH_USER_HOME=${SSH_USER_HOME:-/home/${SSH_USER}} +SSH_USER=vagrant +SSH_PASS=vagrant +SSH_USER_HOME=/home/$SSH_USER VAGRANT_INSECURE_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" @@ -12,14 +12,17 @@ if ! id -u $SSH_USER >/dev/null 2>&1; then echo "==> Creating $SSH_USER user" /usr/sbin/groupadd $SSH_USER /usr/sbin/useradd $SSH_USER -g $SSH_USER -G sudo -d $SSH_USER_HOME --create-home - echo "${SSH_USER}:${SSH_PASS}" | chpasswd + echo "$SSH_USER:$SSH_PASS" | chpasswd fi # Set up sudo -echo "==> Giving ${SSH_USER} sudo powers" -echo "${SSH_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$SSH_USER +echo "==> Giving $SSH_USER sudo powers" +echo "$SSH_USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$SSH_USER chmod 440 /etc/sudoers.d/$SSH_USER +# Add vagrant user to the docker usergroup +sudo usermod -aG docker $SSH_USER + # Fix stdin not being a tty if grep -q -E "^mesg n$" /root/.profile && sed -i "s/^mesg n$/tty -s \\&\\& mesg n/g" /root/.profile; then echo "==> Fixed stdin not being a tty." @@ -31,6 +34,6 @@ chmod 700 $SSH_USER_HOME/.ssh cd $SSH_USER_HOME/.ssh # https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -echo "${VAGRANT_INSECURE_KEY}" > $SSH_USER_HOME/.ssh/authorized_keys +echo "$VAGRANT_INSECURE_KEY" > $SSH_USER_HOME/.ssh/authorized_keys chmod 600 $SSH_USER_HOME/.ssh/authorized_keys chown -R $SSH_USER:$SSH_USER $SSH_USER_HOME/.ssh diff --git a/Packer/script/virtualbox.sh b/Packer/script/virtualbox.sh index ac7e314..d55e059 100644 --- a/Packer/script/virtualbox.sh +++ b/Packer/script/virtualbox.sh @@ -1,6 +1,6 @@ #!/bin/bash -eux -SSH_USER=${SSH_USERNAME:-vagrant} +SSH_USER=skadi #SSH_USER="root" @@ -9,9 +9,9 @@ echo "==> Installing VirtualBox guest additions" #apt-get install -y linux-headers-$(uname -r) build-essential perl #apt-get install -y dkms -VBOX_VERSION=$(cat /home/${SSH_USER}/.vbox_version) -mount -o loop /home/${SSH_USER}/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt +VBOX_VERSION=$(cat /home/$SSH_USER/.vbox_version) +mount -o loop /home/$SSH_USER/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt sh /mnt/VBoxLinuxAdditions.run umount /mnt -rm /home/${SSH_USER}/VBoxGuestAdditions_$VBOX_VERSION.iso -rm /home/${SSH_USER}/.vbox_version +rm /home/$SSH_USER/VBoxGuestAdditions_$VBOX_VERSION.iso +rm /home/$SSH_USER/.vbox_version diff --git a/Packer/skadi_build/build_skadi.ps1 b/Packer/skadi_build/build_skadi.ps1 new file mode 100644 index 0000000..89a4a06 --- /dev/null +++ b/Packer/skadi_build/build_skadi.ps1 @@ -0,0 +1,4 @@ +packer build -force create_basebox.json +packer build -force create_boxes.json +vagrant.exe box add box/virtualbox/skadi_server-2019.2.box --name skadivm/skadi_server +vagrant.exe box add box/vmware/skadi_server-2019.2.box --name skadivm/skadi_server diff --git a/Packer/skadi_build/skadi_server_newbuild.json b/Packer/skadi_build/create_basebox.json similarity index 69% rename from Packer/skadi_build/skadi_server_newbuild.json rename to Packer/skadi_build/create_basebox.json index 24e471d..7c46d39 100644 --- a/Packer/skadi_build/skadi_server_newbuild.json +++ b/Packer/skadi_build/create_basebox.json @@ -3,7 +3,7 @@ "builders": [ { "boot_command": [ - "{{ user `boot_command_prefix` }}", + "{{ user `bionic_boot_command_prefix` }}", "/install/vmlinuz noapic ", "initrd=/install/initrd.gz ", "file=/floppy/{{ user `preseed` }} ", @@ -26,11 +26,11 @@ ], "guest_os_type": "{{ user `vmware_guest_os_type` }}", "headless": "{{ user `headless` }}", - "iso_checksum": "{{ user `iso_checksum` }}", + "iso_checksum": "{{ user `iso_bionic_checksum` }}", "iso_checksum_type": "{{ user `iso_checksum_type` }}", "iso_urls": [ - "{{ user `iso_path` }}/{{ user `iso_name` }}", - "{{ user `iso_url` }}" + "{{ user `iso_path` }}/{{ user `iso_bionic_name` }}", + "{{ user `iso_bionic_url` }}" ], "output_directory": "output-{{ user `vm_name` }}-vmware-iso", "shutdown_timeout": "1m", @@ -47,7 +47,7 @@ }, { "boot_command": [ - "{{ user `boot_command_prefix` }}", + "{{ user `bionic_boot_command_prefix` }}", "/install/vmlinuz noapic ", "initrd=/install/initrd.gz ", "file=/floppy/{{ user `preseed` }} ", @@ -71,11 +71,11 @@ "guest_os_type": "{{ user `virtualbox_guest_os_type` }}", "hard_drive_interface": "sata", "headless": "{{ user `headless` }}", - "iso_checksum": "{{ user `iso_checksum` }}", + "iso_checksum": "{{ user `iso_bionic_checksum` }}", "iso_checksum_type": "{{ user `iso_checksum_type` }}", "iso_urls": [ - "{{ user `iso_path` }}/{{ user `iso_name` }}", - "{{ user `iso_url` }}" + "{{ user `iso_path` }}/{{ user `iso_bionic_name` }}", + "{{ user `iso_bionic_url` }}" ], "output_directory": "output-{{ user `vm_name` }}-virtualbox-iso", "post_shutdown_delay": "1m", @@ -101,30 +101,11 @@ ], "provisioners": [ { - "environment_vars": [ - "CLEANUP_PAUSE={{user `cleanup_pause`}}", - "DEBIAN_FRONTEND=noninteractive", - "DESKTOP={{user `desktop`}}", - "UPDATE={{user `update`}}", - "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", - "SSH_USERNAME={{user `ssh_username`}}", - "SSH_PASSWORD={{user `ssh_password`}}", - "http_proxy={{user `http_proxy`}}", - "https_proxy={{user `https_proxy`}}", - "ftp_proxy={{user `ftp_proxy`}}", - "rsync_proxy={{user `rsync_proxy`}}", - "no_proxy={{user `no_proxy`}}", - "DEFAULT_PASSWORDS={{user `skadi_default_passwords`}}" - ], "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", "scripts": [ - "../script/vagrant.sh", - "../script/sshd.sh", - "../script/vmware.sh", - "../script/motd.sh", "../script/update.sh", - "{{user `custom_script`}}", - "../script/cleanup.sh" + "../script/skadi.sh", + "../script/motd.sh" ], "type": "shell", "expect_disconnect": "true" @@ -132,35 +113,38 @@ ], "variables": { "skadi_default_passwords": "true", - "boot_command_prefix": "", + "xenial_boot_command_prefix": "", + "bionic_boot_command_prefix": "", "cleanup_pause": "", "cpus": "4", "memory": "8196", - "custom_script": "../../Docker/BuildDockerSkadi.sh", "desktop": "false", "disk_size": "102400", "ftp_proxy": "{{env `ftp_proxy`}}", - "headless": "false", + "headless": "true", "http_proxy": "{{env `http_proxy`}}", "https_proxy": "{{env `https_proxy`}}", - "install_vagrant_key": "true", - "iso_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8", - "iso_checksum_type": "sha256", - "iso_name": "ubuntu-16.04.5-server-amd64.iso", + "install_vagrant_key": "false", "iso_path": "/Volumes/Storage/software/ubuntu", - "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso", + "iso_checksum_type": "sha256", + "iso_xenial_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8", + "iso_xenial_name": "ubuntu-16.04.5-server-amd64.iso", + "iso_xenial_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso", + "iso_bionic_checksum": "a2cb36dc010d98ad9253ea5ad5a07fd6b409e3412c48f1860536970b073c98f5", + "iso_bionic_name": "ubuntu-18.04.2-server-amd64.iso", + "iso_bionic_url": "http://cdimage.ubuntu.com/releases/18.04.2/release/ubuntu-18.04.2-server-amd64.iso", "locale": "en_US", "no_proxy": "{{env `no_proxy`}}", "parallels_guest_os_type": "ubuntu", "preseed" : "preseed.cfg", "rsync_proxy": "{{env `rsync_proxy`}}", "hostname": "skadi", - "ssh_fullname": "vagrant", - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "update": "false", + "ssh_fullname": "skadi", + "ssh_password": "skadi", + "ssh_username": "skadi", + "update": "true", "vagrantfile_template": "../../Vagrant/skadi_server/vmware/Vagrantfile", - "version": "2019.1", + "version": "2019.2", "virtualbox_guest_os_type": "Ubuntu_64", "vm_name": "skadi_basebox", "vmware_guest_os_type": "ubuntu-64" diff --git a/Packer/skadi_build/create_boxes.json b/Packer/skadi_build/create_boxes.json new file mode 100644 index 0000000..8cf28b3 --- /dev/null +++ b/Packer/skadi_build/create_boxes.json @@ -0,0 +1,115 @@ +{ + "_comment": "Build with `packer build create_boxes.json`", + "builders": [ + { + "type": "vmware-vmx", + "source_path": "output-skadi_basebox-vmware-iso/skadi_basebox.vmx", + "ssh_username": "skadi", + "ssh_password": "skadi", + "shutdown_command": "sudo shutdown -P now", + "headless": "{{ user `headless` }}" + }, + { + "type": "virtualbox-ovf", + "source_path": "output-skadi_basebox-virtualbox-iso/skadi_basebox.ovf", + "ssh_username": "skadi", + "ssh_password": "skadi", + "shutdown_command": "sudo shutdown -P now", + "headless": "{{ user `headless` }}" + }, + { + "name": "ova", + "vm_name": "{{user `vm_name`}}-{{user `version`}}.", + "output_directory": "ova", + "type": "virtualbox-ovf", + "source_path": "output-skadi_basebox-virtualbox-iso/skadi_basebox.ovf", + "ssh_username": "skadi", + "ssh_password": "skadi", + "shutdown_command": "sudo shutdown -P now", + "headless": "{{ user `headless` }}", + "format": "ova" + } + ], + "provisioners": [ + { + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "scripts": [ + "../script/vmware.sh" + ], + "type": "shell", + "expect_disconnect": "true", + "only": ["vmware-vmx"] + }, + { + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "scripts": [ + "../script/virtualbox.sh" + ], + "type": "shell", + "expect_disconnect": "true", + "only": ["virtualbox-ovf"] + }, + { + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive", + "SSH_USERNAME=skadi", + "CDQR_VERSION=4.4.0", + "DEFAULT_PASSWORDS=true", + "INSTALL_BRANCH=master", + "SKADI_HOSTNAME=true", + "MAKE_SKADI_USER=true", + "UTC_TIME=true" + ], + "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "scripts": [ + "../script/update.sh", + "../script/sshd.sh", + "../script/motd.sh", + "{{user `custom_script` }}", + "../script/cleanup.sh" + ], + "type": "shell", + "expect_disconnect": "true" + }, + { + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "scripts": [ + "../script/vagrant.sh" + ], + "type": "shell", + "expect_disconnect": "true", + "only": ["virtualbox-ovf", "vmware-vmx"] + } + ], + "post-processors": [ + { + "keep_input_artifact": false, + "output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box", + "type": "vagrant", + "vagrantfile_template": "../../Vagrant/skadi_server/vmware/Vagrantfile", + "only": ["vmware-vmx"] + }, + { + "keep_input_artifact": false, + "output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box", + "type": "vagrant", + "vagrantfile_template": "../../Vagrant/skadi_server/virtualbox/Vagrantfile", + "only": ["virtualbox-ovf"] + } + ], + "variables": { + "custom_script": "../../scripts/signedbuildskadi.sh", + "version": "2019.2", + "vm_name": "skadi_server", + "headless": "true" + } +} diff --git a/Packer/skadi_build/http/preseed.cfg b/Packer/skadi_build/http/preseed.cfg index d38c245..e22d446 100644 --- a/Packer/skadi_build/http/preseed.cfg +++ b/Packer/skadi_build/http/preseed.cfg @@ -29,15 +29,15 @@ d-i keyboard-configuration/layoutcode string us d-i keyboard-configuration/modelcode string pc105 d-i debian-installer/locale string en_US -# Create vagrant user account. -d-i passwd/user-fullname string vagrant -d-i passwd/username string vagrant -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant +# Create skadi user account. +d-i passwd/user-fullname string skadi +d-i passwd/username string skadi +d-i passwd/user-password password skadi +d-i passwd/user-password-again password skadi d-i user-setup/allow-password-weak boolean true d-i user-setup/encrypt-home boolean false -d-i passwd/user-default-groups vagrant sudo -d-i passwd/user-uid string 900 +d-i passwd/user-default-groups skadi sudo +d-i passwd/user-uid string 1001 # Set root passwords d-i rootpw vagrant diff --git a/Packer/skadi_build/skadi_server_vagrant_vb.json b/Packer/skadi_build/skadi_server_vagrant_vb.json deleted file mode 100644 index 50c70dc..0000000 --- a/Packer/skadi_build/skadi_server_vagrant_vb.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "_comment": "Build with `packer build skadi_server.json`", - "builders": [ - { - "type": "virtualbox-ovf", - "source_path": "F:/VirtualBox/OVA/skadi_server_2019.1.ova", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "shutdown_command": "sudo shutdown -P now" - } - ], - "provisioners": [ - { - "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "scripts": [ - "../script/vagrant.sh", - "../script/sshd.sh", - "../script/motd.sh", - "../script/cleanup.sh" - ], - "type": "shell", - "expect_disconnect": "true" - } - ], - "post-processors": [ - { - "keep_input_artifact": false, - "output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box", - "type": "vagrant", - "vagrantfile_template": "{{ user `vagrantfile_template` }}" - } - ], - "variables": { - "vagrantfile_template": "../../Vagrant/skadi_server/virtualbox/Vagrantfile", - "version": "2019.1", - "vm_name": "skadi_server" - } -} diff --git a/Packer/skadi_build/skadi_server_vagrant_vmware.json b/Packer/skadi_build/skadi_server_vagrant_vmware.json deleted file mode 100644 index f41d5c9..0000000 --- a/Packer/skadi_build/skadi_server_vagrant_vmware.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "_comment": "Build with `packer build skadi_server.json`", - "builders": [ - { - "type": "vmware-vmx", - "source_path": "F:/VMWARE/Skadi Server 2019.1/Skadi Server 2019.1.vmx", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "shutdown_command": "sudo shutdown -P now" - } - ], - "provisioners": [ - { - "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "scripts": [ - "../script/vagrant.sh", - "../script/sshd.sh", - "../script/motd.sh", - "../script/cleanup.sh" - ], - "type": "shell", - "expect_disconnect": "true" - } - ], - "post-processors": [ - { - "keep_input_artifact": false, - "output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box", - "type": "vagrant", - "vagrantfile_template": "{{ user `vagrantfile_template` }}" - } - ], - "variables": { - "vagrantfile_template": "../../Vagrant/skadi_server/vmware/Vagrantfile", - "version": "2019.1", - "vm_name": "skadi_server" - } -} diff --git a/Packer/vmware/http/preseed.cfg b/Packer/vmware/http/preseed.cfg deleted file mode 100644 index d38c245..0000000 --- a/Packer/vmware/http/preseed.cfg +++ /dev/null @@ -1,43 +0,0 @@ -choose-mirror-bin mirror/http/proxy string -d-i base-installer/kernel/override-image string linux-server -d-i clock-setup/utc boolean true -d-i clock-setup/utc-auto boolean true -d-i finish-install/reboot_in_progress note -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true -d-i partman-auto/disk string /dev/sda -d-i partman-auto-lvm/guided_size string max -d-i partman-auto/choose_recipe select atomic -d-i partman-auto/method string lvm -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-lvm/device_remove_lvm boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true -d-i partman/confirm_write_new_label boolean true -d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms nfs-common -d-i pkgsel/install-language-support boolean false -d-i pkgsel/update-policy select none -d-i pkgsel/upgrade select full-upgrade -d-i time/zone string UTC -tasksel tasksel/first multiselect standard, ubuntu-server - -d-i console-setup/ask_detect boolean false -d-i keyboard-configuration/layoutcode string us -d-i keyboard-configuration/modelcode string pc105 -d-i debian-installer/locale string en_US - -# Create vagrant user account. -d-i passwd/user-fullname string vagrant -d-i passwd/username string vagrant -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -d-i user-setup/allow-password-weak boolean true -d-i user-setup/encrypt-home boolean false -d-i passwd/user-default-groups vagrant sudo -d-i passwd/user-uid string 900 - -# Set root passwords -d-i rootpw vagrant diff --git a/Packer/vmware/skadi_server.json b/Packer/vmware/skadi_server.json deleted file mode 100644 index 0897196..0000000 --- a/Packer/vmware/skadi_server.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "_comment": "Build with `packer build skadi_server_newbuild.json`", - "builders": [ - { - "boot_command": [ - "{{ user `boot_command_prefix` }}", - "/install/vmlinuz noapic ", - "initrd=/install/initrd.gz ", - "file=/floppy/{{ user `preseed` }} ", - "debian-installer={{ user `locale` }} auto locale={{ user `locale` }} kbd-chooser/method=us ", - "hostname={{ user `hostname` }} ", - "grub-installer/bootdev=/dev/sda ", - "fb=false debconf/frontend=noninteractive ", - "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", - "keyboard-configuration/variant=USA console-setup/ask_detect=false ", - "passwd/user-fullname={{ user `ssh_fullname` }} ", - "passwd/user-password={{ user `ssh_password` }} ", - "passwd/user-password-again={{ user `ssh_password` }} ", - "passwd/username={{ user `ssh_username` }} ", - "-- " - ], - "disk_adapter_type": "sata", - "disk_size": "{{ user `disk_size` }}", - "floppy_files": [ - "http/{{ user `preseed` }}" - ], - "guest_os_type": "{{ user `vmware_guest_os_type` }}", - "headless": "{{ user `headless` }}", - "iso_checksum": "{{ user `iso_checksum` }}", - "iso_checksum_type": "{{ user `iso_checksum_type` }}", - "iso_urls": [ - "{{ user `iso_path` }}/{{ user `iso_name` }}", - "{{ user `iso_url` }}" - ], - "output_directory": "output-{{ user `vm_name` }}-virtualbox-iso", - "shutdown_timeout": "1m", - "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now", - "ssh_password": "{{ user `ssh_password` }}", - "ssh_username": "{{ user `ssh_username` }}", - "ssh_wait_timeout": "10000s", - "type": "vmware-iso", - "vmx_data": { - "memsize": "{{ user `memory` }}", - "numvcpus": "{{ user `cpus` }}", - }, - "vm_name": "{{user `vm_name`}}" - } - ], - "post-processors": [ - { - "keep_input_artifact": false, - "output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box", - "type": "vagrant", - "vagrantfile_template": "{{ user `vagrantfile_template` }}" - } - ], - "provisioners": [ - { - "environment_vars": [ - "CLEANUP_PAUSE={{user `cleanup_pause`}}", - "DEBIAN_FRONTEND=noninteractive", - "DESKTOP={{user `desktop`}}", - "UPDATE={{user `update`}}", - "INSTALL_VAGRANT_KEY={{user `install_vagrant_key`}}", - "SSH_USERNAME={{user `ssh_username`}}", - "SSH_PASSWORD={{user `ssh_password`}}", - "http_proxy={{user `http_proxy`}}", - "https_proxy={{user `https_proxy`}}", - "ftp_proxy={{user `ftp_proxy`}}", - "rsync_proxy={{user `rsync_proxy`}}", - "no_proxy={{user `no_proxy`}}", - "DEFAULT_PASSWORDS={{user `skadi_default_passwords`}}" - ], - "execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "scripts": [ - "../script/vagrant.sh", - "../script/sshd.sh", - "../script/vmware.sh", - "../script/motd.sh", - "../script/update.sh", - "{{user `custom_script`}}", - "../script/cleanup.sh" - ], - "type": "shell", - "expect_disconnect": "true" - } - ], - "variables": { - "skadi_default_passwords": "true", - "boot_command_prefix": "", - "cleanup_pause": "", - "cpus": "4", - "memory": "8196", - "custom_script": "../../scripts/signedbuildskadi.sh", - "desktop": "false", - "disk_size": "102400", - "ftp_proxy": "{{env `ftp_proxy`}}", - "headless": "false", - "http_proxy": "{{env `http_proxy`}}", - "https_proxy": "{{env `https_proxy`}}", - "install_vagrant_key": "true", - "iso_checksum": "c94de1cc2e10160f325eb54638a5b5aa38f181d60ee33dae9578d96d932ee5f8", - "iso_checksum_type": "sha256", - "iso_name": "ubuntu-16.04.5-server-amd64.iso", - "iso_path": "/Volumes/Storage/software/ubuntu", - "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.5-server-amd64.iso", - "locale": "en_US", - "no_proxy": "{{env `no_proxy`}}", - "parallels_guest_os_type": "ubuntu", - "preseed" : "preseed.cfg", - "rsync_proxy": "{{env `rsync_proxy`}}", - "hostname": "skadi", - "ssh_fullname": "vagrant", - "ssh_password": "vagrant", - "ssh_username": "vagrant", - "update": "false", - "vagrantfile_template": "../../Vagrant/skadi_server/vmware/Vagrantfile", - "version": "2018.4", - "virtualbox_guest_os_type": "Ubuntu_64", - "vm_name": "skadi_basebox", - "vmware_guest_os_type": "ubuntu-64" - } -} diff --git a/Vagrant/skadi_desktop/virtualbox/Vagrantfile b/Vagrant/skadi_desktop/virtualbox/Vagrantfile deleted file mode 100644 index d607769..0000000 --- a/Vagrant/skadi_desktop/virtualbox/Vagrantfile +++ /dev/null @@ -1,29 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - - config.vm.box = "skadivm/skadi_desktop" - config.vm.define "skadi_desktop" - # Uncomment this line to choose specific version - # config.vm.box_version = "2018.3" - - # Change the following to align with resources available - config.vm.provider :virtualbox do |v| - v.name = "skadi_desktop" - v.gui = true - v.customize ["modifyvm", :id, "--memory", 12288] - v.customize ["modifyvm", :id, "--cpus", 6] - v.customize ["modifyvm", :id, "--vram", "256"] - v.customize ["setextradata", "global", "GUI/MaxGuestResolution", "any"] - v.customize ["setextradata", :id, "CustomVideoMode1", "1024x768x32"] - v.customize ["modifyvm", :id, "--ioapic", "on"] - v.customize ["modifyvm", :id, "--rtcuseutc", "on"] - v.customize ["modifyvm", :id, "--accelerate3d", "on"] - v.customize ["modifyvm", :id, "--clipboard", "bidirectional"] - end - # Uncomment the following lines to run the update script each time the VM is created - # config.vm.provision "shell", inline: <<-SHELL - # /opt/skadi/update.sh - # SHELL -end diff --git a/Vagrant/skadi_desktop/vmware/Vagrantfile b/Vagrant/skadi_desktop/vmware/Vagrantfile deleted file mode 100644 index 5010f36..0000000 --- a/Vagrant/skadi_desktop/vmware/Vagrantfile +++ /dev/null @@ -1,25 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - - config.vm.box = "skadivm/skadi_desktop" - config.vm.define "skadi_desktop" - # Uncomment this line to choose specific version - # config.vm.box_version = "2018.3" - - # Change the following to align with resources available - ["vmware_desktop"].each do |provider| - config.vm.provider provider do |v, override| - v.name = "skadi_desktop" - v.gui = true - v.vmx["memsize"] = "12288" - v.vmx["numvcpus"] = "6" - #v.vmx["cpuid.coresPerSocket"] = "6" - end - end - # Uncomment the following lines to run the update script each time the VM is created - # config.vm.provision "shell", inline: <<-SHELL - # /opt/skadi/update.sh - # SHELL -end diff --git a/scripts/buildskadi.sig b/scripts/buildskadi.sig index 8e1ee0a..1d7da95 100644 Binary files a/scripts/buildskadi.sig and b/scripts/buildskadi.sig differ diff --git a/scripts/buildskadi.tgz b/scripts/buildskadi.tgz index 21acb0c..dde36bb 100644 Binary files a/scripts/buildskadi.tgz and b/scripts/buildskadi.tgz differ diff --git a/scripts/signedbuildskadi.sh b/scripts/signedbuildskadi.sh index 3c26772..efcc40e 100644 --- a/scripts/signedbuildskadi.sh +++ b/scripts/signedbuildskadi.sh @@ -41,6 +41,7 @@ sudo apt-get install -y \ htop \ screen \ gnupg \ + net-tools \ software-properties-common \ apache2-utils @@ -206,6 +207,10 @@ echo "Setting the ElasticSearch default number of replicas to 0" curl -XPUT 'localhost:9200/_template/number_of_replicas' \ -d '{"template": "*","settings": {"number_of_replicas": 0}}' \ -H'Content-Type: application/json' +echo "Waiting 30 seconds for Kibana to start" +sleep 30 +echo "Importing Saved Objects to Kibana" +curl -X POST "http://localhost:5601/api/saved_objects/_bulk_create" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' --data-binary @/opt/Skadi/objects/kibana_6.x_cli_import.json # The TimeSketch container needs to be running before continuing and this # requires the other containers to be up and running too. This can take time