Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ jobs:
hypervisor:
description: hypervisor to validate
type: string
version:
description: version of kali to validate
type: string
docker:
- image: 'hashicorp/packer:light'
steps:
Expand All @@ -336,7 +339,7 @@ jobs:
- run: packer version
- packer-lint:
template-file: kali-template.json
vars-file: variables.json
vars-file: "variables<< parameters.version>>.json"
only-builder: '<< parameters.hypervisor >>'


Expand Down Expand Up @@ -449,18 +452,24 @@ jobs:
generate-packer-vars:
docker:
- image: 'bash'
parameters:
kalitype:
description: "version of kali to build ( i.e. default, min, light )"
type: string
environment:
KALITYPE: "<< parameters.kalitype >>"
steps:
- run: apk add --update --no-cache git
- checkout
- run: bash --version
- run: scripts/new-kali.sh
- run: |
mkdir -p /tmp/packer_workspace
cp -v variables.json /tmp/packer_workspace
cp -v variables*.json /tmp/packer_workspace
- persist_to_workspace:
root: /tmp/packer_workspace
paths:
- "variables.json"
- "variables*.json"

terraform-packet_deploy:
docker:
Expand Down Expand Up @@ -497,6 +506,9 @@ jobs:
- image: 'elrey741/ansible-playbook_packet:alpine'
parameters:
build:
description: hypervisor build target for packer to hit
type: string
version:
description: build target for packer to hit
type: string
steps:
Expand All @@ -517,7 +529,8 @@ jobs:
command: |
ansible-playbook -i ci/scripts/packet_net.py -u root \
-e "api_key_from_env=${TEXTBELT_KEY:-} phone_from_env=${PERSONAL_NUM:-}" \
-e CIRCLECI="${CIRCLECI:-}" ci/packer_build.yml --limit="packer-build-box-<< parameters.build >>"
-e CIRCLECI="${CIRCLECI:-}" -e build_version="<< parameters.version >>" \
ci/packer_build.yml --limit="packer-build-box-<< parameters.build >>"
- run: |
mkdir -p /tmp/artifacts
pwd && ls
Expand Down Expand Up @@ -545,11 +558,15 @@ workflows:
- python-linting
- ansible-linting
- generate-packer-file
- generate-packer-vars
- generate-packer-vars:
matrix:
parameters:
kalitype: [ "", "light", "min" ]
- packer-linting:
matrix:
parameters:
hypervisor: [ "virtualbox-iso", "vmware-iso", "qemu" ]
version: [ "", "-light", "-min" ]
requires:
- generate-packer-vars
- generate-packer-file
Expand All @@ -570,6 +587,7 @@ workflows:
matrix:
parameters:
build: [ "v", "qemu" ]
version: [ "", "light", "min" ]
requires:
- ansible-bootstrap
- terraform-packet_destroy:
Expand Down Expand Up @@ -627,6 +645,9 @@ workflows:
- master
- dev-stage
- generate-packer-vars:
matrix:
parameters:
kalitype: [ "", "light", "min" ]
filters:
branches:
ignore:
Expand All @@ -636,6 +657,7 @@ workflows:
matrix:
parameters:
hypervisor: [ "virtualbox-iso", "vmware-iso", "qemu" ]
version: [ "", "-light", "-min" ]
requires:
- generate-packer-vars
- generate-packer-file
Expand Down Expand Up @@ -683,6 +705,9 @@ workflows:
only:
- master
- generate-packer-vars:
matrix:
parameters:
kalitype: [ "", "light", "min" ]
filters:
branches:
only:
Expand All @@ -691,6 +716,7 @@ workflows:
matrix:
parameters:
hypervisor: [ "virtualbox-iso", "vmware-iso", "qemu" ]
version: [ "", "-light", "-min" ]
requires:
- generate-packer-vars
- generate-packer-file
Expand All @@ -711,6 +737,7 @@ workflows:
matrix:
parameters:
build: [ "v", "qemu" ]
version: [ "", "light", "min" ]
requires:
- ansible-bootstrap
- terraform-packet_destroy:
Expand Down Expand Up @@ -763,6 +790,9 @@ workflows:
only:
- dev-stage
- generate-packer-vars:
matrix:
parameters:
kalitype: [ "", "light", "min" ]
filters:
branches:
only:
Expand All @@ -771,6 +801,7 @@ workflows:
matrix:
parameters:
hypervisor: [ "virtualbox-iso", "vmware-iso", "qemu" ]
version: [ "", "-light", "-min" ]
requires:
- generate-packer-vars
- generate-packer-file
Expand All @@ -791,6 +822,7 @@ workflows:
matrix:
parameters:
build: [ "v", "qemu" ]
version: [ "", "light", "min" ]
requires:
- ansible-bootstrap
- terraform-packet_destroy:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tmp/
*.orig*

# secret files
*variables.json
*variables*.json
secrets.txt
prov_vagrant/env_vars
*.tfstate*
Expand Down
2 changes: 1 addition & 1 deletion ci/packer_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

- name: launching the packer build process
script:
cmd: "{{ local_ci_scripts_dir }}/packer_build-wrapper.sh '{{ provider_string }}'"
cmd: "{{ local_ci_scripts_dir }}/packer_build-wrapper.sh '{{ provider_string }}' '{{ build_version | default() }}'"
chdir: '{{ kali_project_folder }}'
args:
creates: '{{ kali_project_folder }}/packer_build.log'
Expand Down
29 changes: 26 additions & 3 deletions ci/scripts/packer_build-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,41 @@ function packer_build() {
;;
*)
# just a stop gap to prevent automated tasks from happening.
read -rp 'You are about to try and build all the providers at once...are you sure[N/y]' -n 1
exit 1
;;
esac

}

main() {
function get_variables() {
build_version="${1}"
case "${build_version}" in
light)
packer_build_cmd+=('variables-light.json')
;;
min)
packer_build_cmd+=('variables-min.json')
;;
'')
packer_build_cmd+=('variables.json')
;;
*)
# just a stop gap to prevent automated tasks from happening.
exit 1
;;
esac
}

function main() {
providers_to_build="${1}"
build_version="${2}"
packer_build_cmd=(
'packer' 'build'
'-var-file' 'variables.json'
'-var-file'
)

get_variables "${build_version}"

mapfile -t provider_array < <(tr '|' '\n' <<< "${providers_to_build}")

setup_env
Expand Down
79 changes: 79 additions & 0 deletions install/http/kali-linux-rolling-light-preseed.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Change default hostname
d-i netcfg/get_hostname string vagrant-kali-linux
d-i netcfg/get_domain string

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 lvm
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-auto/disk string /dev/sda
d-i partman/confirm_write_new_label boolean true
d-i partman/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-md/confirm boolean true
d-i partman/choose_partition select finish

# Disable CDROM entries after install
d-i apt-setup/disable-cdrom-entries boolean true

#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/user-fullname string vagrant
d-i passwd/user-uid string 1000
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i passwd/username string vagrant

d-i apt-setup/use_mirror boolean true
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev string /dev/sda
d-i finish-install/reboot_in_progress note

# Disable popularity-contest
popularity-contest popularity-contest/participate boolean false

# configuring packages
# used to Upgrade installed packages
# d-i pkgsel/upgrade select full-upgrade
# d-i tasksel/first multiselect standard system utilities, meta-top10, desktop-xfce
# found this here... : https://www.offensive-security.com/kali-linux/kali-linux-iso-of-doom/
tasksel tasksel/first multiselect meta-top10, desktop-xfce
d-i pkgsel/upgrade select none

d-i preseed/late_command string in-target systemctl enable ssh
78 changes: 78 additions & 0 deletions install/http/kali-linux-rolling-min-preseed.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Change default hostname
d-i netcfg/get_hostname string vagrant-kali-linux
d-i netcfg/get_domain string

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 lvm
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-auto/disk string /dev/sda
d-i partman/confirm_write_new_label boolean true
d-i partman/confirm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman-md/confirm boolean true
d-i partman/choose_partition select finish

# Disable CDROM entries after install
d-i apt-setup/disable-cdrom-entries boolean true

#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/user-fullname string vagrant
d-i passwd/user-uid string 1000
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i passwd/username string vagrant

d-i apt-setup/use_mirror boolean true
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
d-i grub-installer/bootdev string /dev/sda
d-i finish-install/reboot_in_progress note

# Disable popularity-contest
popularity-contest popularity-contest/participate boolean false

# configuring packages
# used to Upgrade installed packages
# d-i pkgsel/upgrade select full-upgrade
# d-i tasksel/first multiselect standard system utilities, meta-top10, desktop-xfce
tasksel tasksel/first multiselect standard
d-i pkgsel/upgrade select none

d-i preseed/late_command string in-target systemctl enable ssh
5 changes: 4 additions & 1 deletion install/http/kali-linux-rolling-preseed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ d-i finish-install/reboot_in_progress note
popularity-contest popularity-contest/participate boolean false

# configuring packages
d-i tasksel/first multiselect standard system utilities, meta-default, desktop-xfce
# used to Upgrade installed packages
# d-i pkgsel/upgrade select full-upgrade
# found this here... : https://www.offensive-security.com/kali-linux/kali-linux-iso-of-doom/
tasksel tasksel/first multiselect meta-default, desktop-xfce
d-i pkgsel/upgrade select none

d-i preseed/late_command string in-target sh -c 'systemctl enable ssh'
Loading