mirror of https://github.com/MISP/misp-packer
175 lines
6.4 KiB
JSON
175 lines
6.4 KiB
JSON
{
|
|
"_comment": "MISP VM Autogen packer build system",
|
|
"builders": [
|
|
{
|
|
"boot_command": [
|
|
"{{ user `boot_command_prefix` }}",
|
|
"autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
|
|
"<enter>"
|
|
],
|
|
"disk_size": "{{ user `disk_size` }}",
|
|
"export_opts": [
|
|
"--manifest",
|
|
"--vsys", "0",
|
|
"--eulafile", "/tmp/LICENSE-misp",
|
|
"--description", "{{ user `vm_description` }}",
|
|
"--version", "{{ user `vm_version` }}"
|
|
],
|
|
"format": "ova",
|
|
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
|
|
"guest_os_type": "Ubuntu_64",
|
|
"hard_drive_interface": "sata",
|
|
"headless": "{{ user `headless` }}",
|
|
"http_directory": "http",
|
|
"http_port_max": 9011,
|
|
"http_port_min": 9001,
|
|
"iso_checksum": "{{ user `iso_checksum` }}",
|
|
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
|
|
"iso_urls": [
|
|
"{{ user `iso_path` }}/{{ user `iso_name` }}",
|
|
"{{ user `iso_url` }}"
|
|
],
|
|
"shutdown_command": "echo {{ user `ssh_pass` }} | sudo -S shutdown -P now",
|
|
"ssh_password": "{{ user `ssh_pass` }}",
|
|
"ssh_pty": "true",
|
|
"ssh_timeout": "20m",
|
|
"ssh_username": "{{ user `ssh_user` }}",
|
|
"type": "virtualbox-iso",
|
|
"vboxmanage": [
|
|
[ "modifyvm", "{{.Name}}", "--memory", "{{user `memory`}}" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "ssh,tcp,,2222,0.0.0.0,22" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "http,tcp,,8080,,80" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "https,tcp,,8443,,443" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "dashboard,tcp,,8001,0.0.0.0,8001" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "viper,tcp,,8888,0.0.0.0,8888" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "jupyter-notebook,tcp,,8889,0.0.0.0,8889" ],
|
|
[ "modifyvm", "{{.Name}}", "--natpf1", "misp-modules,tcp,,1666,0.0.0.0,6666" ],
|
|
[ "modifyvm", "{{.Name}}", "--audio", "none" ],
|
|
[ "modifyvm", "{{.Name}}", "--graphicscontroller", "vmsvga" ],
|
|
[ "modifyvm", "{{.Name}}", "--usb", "off" ],
|
|
[ "modifyvm", "{{.Name}}", "--vrde", "off" ],
|
|
[ "modifyvm", "{{.Name}}", "--cpus", "{{user `cpus`}}" ],
|
|
[ "modifyvm", "{{.Name}}", "--vram", "32" ]
|
|
],
|
|
"vm_name": "{{user `vm_name`}}"
|
|
},
|
|
{
|
|
"boot_command": [
|
|
"{{ user `boot_command_prefix` }}",
|
|
"autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/",
|
|
"<enter>"
|
|
],
|
|
"boot_wait": "5s",
|
|
"disk_size": "{{ user `disk_size` }}",
|
|
"guest_os_type": "ubuntu-64",
|
|
"headless": "{{ user `headless` }}",
|
|
"http_directory": "http",
|
|
"http_port_min": 9001,
|
|
"http_port_max": 9011,
|
|
"iso_checksum": "{{ user `iso_checksum` }}",
|
|
"iso_checksum_type": "{{ user `iso_checksum_type` }}",
|
|
"iso_urls": [
|
|
"{{ user `iso_path` }}/{{ user `iso_name` }}",
|
|
"{{ user `iso_url` }}"
|
|
],
|
|
"memory": "{{ user `memory` }}",
|
|
"shutdown_command": "echo {{user `ssh_pass`}} |sudo -S shutdown -P now",
|
|
"skip_compaction": false,
|
|
"ssh_pty": "true",
|
|
"ssh_timeout": "30m",
|
|
"ssh_handshake_attempts": "90",
|
|
"ssh_username": "{{user `ssh_user`}}",
|
|
"ssh_password": "{{user `ssh_pass`}}",
|
|
"type": "vmware-iso",
|
|
"vm_name": "{{ user `vm_name` }}"
|
|
}
|
|
],
|
|
"provisioners": [
|
|
{
|
|
"environment_vars": [
|
|
"DESKTOP={{user `desktop`}}",
|
|
"UPDATE={{user `update`}}",
|
|
"http_proxy={{user `http_proxy`}}",
|
|
"https_proxy={{user `https_proxy`}}",
|
|
"no_proxy={{user `no_proxy`}}"
|
|
],
|
|
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
|
|
"inline": [
|
|
"echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers"
|
|
],
|
|
"type": "shell"
|
|
},
|
|
{
|
|
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
|
|
"script": "scripts/extend.sh",
|
|
"type": "shell"
|
|
},
|
|
{
|
|
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
|
|
"script": "scripts/users.sh",
|
|
"type": "shell"
|
|
},
|
|
{
|
|
"destination": "/tmp/INSTALL.sh",
|
|
"source": "scripts/INSTALL.sh",
|
|
"type": "file"
|
|
},
|
|
{
|
|
"environment_vars": [
|
|
"PACKER=1",
|
|
"DEBIAN_FRONTEND=noninteractive"
|
|
],
|
|
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -u {{user `ssh_user`}} -E -S bash '{{ .Path }}'",
|
|
"inline": [
|
|
"chmod u+x /tmp/INSTALL.sh",
|
|
"/tmp/INSTALL.sh -A -u"
|
|
],
|
|
"pause_before": "10s",
|
|
"type": "shell"
|
|
},
|
|
{
|
|
"destination": "/tmp/crontab",
|
|
"source": "conffiles/crontab",
|
|
"type": "file"
|
|
},
|
|
{
|
|
"destination": "/tmp/issue",
|
|
"source": "conffiles/issue",
|
|
"type": "file"
|
|
},
|
|
{
|
|
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
|
|
"expect_disconnect": "true",
|
|
"pause_after": "30s",
|
|
"pause_before": "10s",
|
|
"script": "scripts/clean.sh",
|
|
"type": "shell"
|
|
}
|
|
],
|
|
"variables": {
|
|
"boot_command_prefix": "<enter><enter><f6><esc><wait> ",
|
|
"cpus": "1",
|
|
"desktop": "false",
|
|
"disk_size": "25000",
|
|
"headless": "true",
|
|
"hostname": "misp",
|
|
"http_proxy": "{{env `http_proxy`}}",
|
|
"https_proxy": "{{env `https_proxy`}}",
|
|
"iso_checksum": "8fb81c7a72c0775c17bbc3490e8ff5997fa1ae4eab7446a9c078b81b0103af4eff758ec41b250c36fddc3f1bcd29175440ea8b68944f29b7bcae02be34e8f40f",
|
|
"iso_checksum_type": "sha512",
|
|
"iso_name": "ubuntu-20.04-live-server-amd64.iso",
|
|
"iso_path": "iso",
|
|
"iso_url": "https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso",
|
|
"memory": "3072",
|
|
"no_proxy": "{{env `no_proxy`}}",
|
|
"ovftool_path": "ovftool",
|
|
"ssh_fullname": "MISP User",
|
|
"ssh_user": "misp",
|
|
"ssh_pass": "Password1234",
|
|
"update": "true",
|
|
"vm_description": "MISP, is an open source software solution for collecting, storing, distributing and sharing cyber security indicators and threat about cyber security incidents analysis and malware analysis. MISP is designed by and for incident analysts, security and ICT professionals or malware reverser to support their day-to-day operations to share structured informations efficiently.",
|
|
"vm_name": "MISP_demo",
|
|
"vm_version": "2.4"
|
|
}
|
|
}
|