Skip to content
Permalink
Browse files

Add kali-linux distro

Signed-off-by: Re4son <re4son@kali.org>
  • Loading branch information...
Re4son authored and Re4son committed May 23, 2019
1 parent 22e913c commit 8dac9aaa0e7368fe8be1e9d2743e345ef619a8dc
Showing with 300 additions and 0 deletions.
  1. +124 −0 doc/examples/kali
  2. +151 −0 doc/examples/kali-with-core-packages
  3. +1 −0 shared/definition.go
  4. +3 −0 shared/definition_test.go
  5. +8 −0 shared/osarch.go
  6. +13 −0 shared/osarch_test.go
@@ -0,0 +1,124 @@
image:
distribution: "kali"
release: kali-rolling

source:
downloader: debootstrap
url: http://http.kali.org/kali
keyserver: keys.gnupg.net
keys:
- 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
variant: minbase
apt_sources: |-
deb http://http.kali.org/kali {{ image.release }} main non-free contrib

targets:
lxc:
create-message: |-
You just created a {{ image.description }} container.

To enable SSH, run: apt install openssh-server
No default root or user password are set by LXC.

config:
- type: all
before: 5
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/kali.common.conf

- type: user
before: 5
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/kali.userns.conf

- type: all
after: 4
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/common.conf

- type: user
after: 4
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/userns.conf

- type: all
content: |-
lxc.arch = {{ image.architecture_personality }}

files:
- path: /etc/hostname
generator: hostname

- path: /etc/hosts
generator: hosts

- path: /etc/resolvconf/resolv.conf.d/original
generator: remove

- path: /etc/resolvconf/resolv.conf.d/tail
generator: remove

- path: /etc/machine-id
generator: remove

- path: /etc/network/interfaces
generator: dump
content: |-
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

packages:
manager: apt
update: true
cleanup: true

sets:
- packages:
- dialog
- ifupdown
- isc-dhcp-client
- locales
- netbase
- net-tools
- openssh-client
- vim
- systemd
- kali-archive-keyring
action: install

actions:
- trigger: post-packages
action: |-
#!/bin/sh
set -eux

# Make sure the locale is built and functional
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
locale-gen en_US.UTF-8 UTF-8
update-locale LANG=en_US.UTF-8

# Cleanup underlying /run
mount -o bind / /mnt
rm -rf /mnt/run/*
umount /mnt

# Cleanup temporary shadow paths
rm /etc/*-

- trigger: post-packages
action: |-
#!/bin/sh
set -eux
apt-get install iproute2 init -y
releases:
- kali-rolling

mappings:
architecture_map: kali
@@ -0,0 +1,151 @@
image:
distribution: "kali"
release: kali-rolling

source:
downloader: debootstrap
url: http://http.kali.org/kali
keyserver: keys.gnupg.net
keys:
- 44C6513A8E4FB3D30875F758ED444FF07D8D0BF6
variant: minbase
apt_sources: |-
deb http://http.kali.org/kali {{ image.release }} main non-free contrib

targets:
lxc:
create-message: |-
You just created a {{ image.description }} container.

To enable SSH, run: apt install openssh-server
No default root or user password are set by LXC.

config:
- type: all
before: 5
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/kali.common.conf

- type: user
before: 5
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/kali.userns.conf

- type: all
after: 4
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/common.conf

- type: user
after: 4
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/userns.conf

- type: all
content: |-
lxc.arch = {{ image.architecture_personality }}

files:
- path: /etc/hostname
generator: hostname

- path: /etc/hosts
generator: hosts

- path: /etc/resolvconf/resolv.conf.d/original
generator: remove

- path: /etc/resolvconf/resolv.conf.d/tail
generator: remove

- path: /etc/machine-id
generator: remove

- path: /etc/network/interfaces
generator: dump
content: |-
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

packages:
manager: apt
update: true
cleanup: true

sets:
- packages:
- dialog
- ifupdown
- isc-dhcp-client
- locales
- netbase
- net-tools
- openssh-client
- vim
- systemd
- iw
- kali-defaults
- mlocate
- netcat-traditional
- net-tools
- psmisc
- screen
- tmux
- wget
- zerofree
- exploitdb
- hydra
- john
- medusa
- metasploit-framework
- mfoc
- ncrack
- nmap
- passing-the-hash
- proxychains
- recon-ng
- sqlmap
- tcpdump
- theharvester
- tor
- tshark
- whois
- kali-archive-keyring
action: install

actions:
- trigger: post-packages
action: |-
#!/bin/sh
set -eux

# Make sure the locale is built and functional
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
locale-gen en_US.UTF-8 UTF-8
update-locale LANG=en_US.UTF-8

# Cleanup underlying /run
mount -o bind / /mnt
rm -rf /mnt/run/*
umount /mnt

# Cleanup temporary shadow paths
rm /etc/*-

- trigger: post-packages
action: |-
#!/bin/sh
set -eux
apt-get install iproute2 init -y
releases:
- kali-rolling

mappings:
architecture_map: kali
@@ -333,6 +333,7 @@ func (d *Definition) Validate() error {
"centos",
"debian",
"gentoo",
"kali",
"plamolinux",
}

@@ -49,6 +49,9 @@ func TestValidateDefinition(t *testing.T) {
Mappings: DefinitionMappings{
ArchitectureMap: "debian",
},
Mappings: DefinitionMappings{
ArchitectureMap: "kali",
},
},
"",
false,
@@ -41,6 +41,13 @@ var gentooArchitectureNames = map[int]string{
osarch.ARCH_64BIT_S390_BIG_ENDIAN: "s390x",
}

var kaliArchitectureNames = map[int]string{
osarch.ARCH_32BIT_INTEL_X86: "i386",
osarch.ARCH_64BIT_INTEL_X86: "amd64",
osarch.ARCH_32BIT_ARMV7_LITTLE_ENDIAN: "armhf",
osarch.ARCH_64BIT_ARMV8_LITTLE_ENDIAN: "arm64",
}

var plamoLinuxArchitectureNames = map[int]string{
osarch.ARCH_32BIT_INTEL_X86: "x86",
}
@@ -58,6 +65,7 @@ var distroArchitecture = map[string]map[int]string{
"centos": centosArchitectureNames,
"debian": debianArchitectureNames,
"gentoo": gentooArchitectureNames,
"kali": kaliArchitectureNames,
"plamolinux": plamoLinuxArchitectureNames,
}

@@ -38,6 +38,16 @@ func TestGetArch(t *testing.T) {
"s390x",
"s390x",
},
{
"kali",
"amd64",
"amd64",
},
{
"kali",
"x86_64",
"amd64",
},
}

for i, tt := range tests {
@@ -52,4 +62,7 @@ func TestGetArch(t *testing.T) {

_, err = GetArch("debian", "arch")
require.EqualError(t, err, "Architecture isn't supported: arch")

_, err = GetArch("kali", "arch")
require.EqualError(t, err, "Architecture isn't supported: arch")
}

0 comments on commit 8dac9aa

Please sign in to comment.
You can’t perform that action at this time.