Skip to content
Snippets Groups Projects
Commit 3d7d4da8 authored by Daniel Tovarňák's avatar Daniel Tovarňák
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
packer_cache/*
target-vmware/
target-qemu/
# Cyber Czech '18 Kali Linux Base image
## Introduction
This repo is based on fork of TODO - doplnit.
It contains Packer files for building Kali Linux base image for both QEMU and
VMware. It will be used for Cyber Czech '18.
## Requirements
* [packer](http://www.packer.io/downloads.html) >=1.1.3
* VMware Workstation Pro >=14.1.1
* QEMU >=2.10.1
## Info about the build
VMware tools are installed on the VM. The only user is "root". Root password
is "changeme".
## Usage
### VMware
```bash
# start the installation
packer build -only=kali-vmware kali.json
```
### QEMU
```bash
# start the installation
packer build -only=kali-qemu kali.json
```
## CI
CI is used for building and storing the images. Each push to our lab git
repository will trigger a CI job that will build both QEMU and VMware and store
them on the GitLab server where user can download them via GitLab Web UI.
Files will be deleted after 24 hours.
## TODO
None
## Known Issues
None
d-i debian-installer/locale string en_US.UTF-8
d-i console-keymaps-at/keymap select us
d-i mirror/country string enter information manually
d-i mirror/http/hostname string http.kali.org
d-i mirror/http/directory string /kali
d-i keyboard-configuration/xkb-keymap select us
d-i mirror/http/proxy string
d-i mirror/suite string kali-rolling
d-i mirror/codename string kali-rolling
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
# Disable security, volatile and backports
d-i apt-setup/services-select multiselect
# Enable contrib and non-free
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
# Disable source repositories too
d-i apt-setup/enable-source-repositories boolean false
# Partitioning
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman/confirm_write_new_label 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-partitioning/confirm_write_new_label boolean true
# Disable CDROM entries after install
d-i apt-setup/disable-cdrom-entries boolean true
# Upgrade installed packages
d-i pkgsel/include string openssh-server openvas metasploit-framework metasploit nano openvpn ntpupdate
d-i pkgsel/upgrade select full-upgrade
# Change default hostname
d-i netcfg/get_hostname string kali
d-i netcfg/get_domain string unassigned-domain
#d-i netcfg/choose_interface select auto
d-i netcfg/choose_interface select eth0
d-i netcfg/dhcp_timeout string 60
d-i hw-detect/load_firmware boolean false
# Do not create a normal user account
d-i passwd/make-user boolean false
d-i passwd/root-password password changeme
d-i passwd/root-password-again password changeme
d-i apt-setup/use_mirror boolean true
d-i finish-install/reboot_in_progress note
# Disable popularity-contest
popularity-contest popularity-contest/participate boolean false
kismet kismet/install-setuid boolean false
kismet kismet/install-users string
sslh sslh/inetd_or_standalone select standalone
mysql-server-5.5 mysql-server/root_password_again password
mysql-server-5.5 mysql-server/root_password password
mysql-server-5.5 mysql-server/error_setting_password error
mysql-server-5.5 mysql-server-5.5/postrm_remove_databases boolean false
mysql-server-5.5 mysql-server-5.5/start_on_boot boolean true
mysql-server-5.5 mysql-server-5.5/nis_warning note
mysql-server-5.5 mysql-server-5.5/really_downgrade boolean false
mysql-server-5.5 mysql-server/password_mismatch error
mysql-server-5.5 mysql-server/no_upgrade_when_using_ndb error
d-i preseed/late_command string \
in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config ; \
in-target systemctl start ssh ; \
in-target systemctl enable ssh ;
{
"builders": [
{
"accelerator": "kvm",
"boot_command": [
"<esc><wait>",
"install <wait>",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg <wait>",
"debian-installer=en_US.UTF-8 <wait>",
"auto <wait>",
"locale=en_US.UTF-8 <wait>",
"kbd-chooser/method=us <wait>",
"keyboard-configuration/xkb-keymap=us <wait>",
"netcfg/get_hostname=kali <wait>",
"netcfg/get_domain=kali <wait>",
"fb=false <wait>",
"debconf/frontend=noninteractive <wait>",
"console-setup/ask_detect=false <wait>",
"console-keymaps-at/keymap=us <wait>",
"grub-installer/bootdev=/dev/sda<wait>",
"<enter><wait>"
],
"boot_wait": "{{user `boot_wait`}}",
"disk_interface": "virtio-scsi",
"disk_size": "{{ user `disk_size` }}",
"format": "raw",
"headless": "{{user `headless`}}",
"http_directory": "{{user `http_directory`}}",
"http_port_max": "{{user `http_port_max`}}",
"http_port_min": "{{user `http_port_min`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_url": "{{user `iso_url`}}",
"name": "kali-qemu",
"net_device": "virtio-net",
"output_directory": "target-qemu",
"qemuargs": [
[
"-m",
"{{ user `memory_size` }}m"
],
[
"-smp",
"cpus={{ user `cpus` }},maxcpus=16,cores=4"
]
],
"shutdown_command": "{{user `shutdown_command`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_port": "{{user `ssh_port`}}",
"ssh_username": "{{user `ssh_username`}}",
"ssh_wait_timeout": "{{user `ssh_wait_timeout`}}",
"type": "qemu",
"vm_name": "{{user `vm_name`}}",
"vnc_bind_address": "{{user `vnc_bind_address`}}"
}
],
"provisioners": [
{
"scripts": [
"scripts/packages.sh",
"scripts/zerodisk.sh"
],
"type": "shell"
}
],
"variables": {
"boot_wait": "30s",
"cpus": "4",
"disk_size": "16384",
"headless": "false",
"http_directory": "http",
"http_port_max": "10089",
"http_port_min": "10082",
"iso_checksum": "7c65d6a319448efe4ee1be5b5a93d48ef30687d4e3f507896b46b9c2226a0ed0",
"iso_checksum_type": "sha256",
"iso_url": "http://cdimage.kali.org/kali-2018.4/kali-linux-2018.4-amd64.iso",
"memory_size": "4096",
"shutdown_command": "shutdown -P now",
"ssh_password": "changeme",
"ssh_port": "22",
"ssh_username": "root",
"ssh_wait_timeout": "90m",
"vm_name": "kali",
"vnc_bind_address": "0.0.0.0"
}
}
#!/bin/sh -x
# Zero out the rest of the free space using dd, then delete the written file.
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y cloud-init qemu-guest-agent cloud-guest-utils cloud-initramfs-growroot spice-vdagent
\ No newline at end of file
#!/bin/sh -x
# Zero out the rest of the free space using dd, then delete the written file.
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
# Add `sync` so Packer doesn't quit too early, before the large file is deleted.
sync
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment