Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.0 dev packer initial merge #136

Merged
merged 23 commits into from
Sep 2, 2020
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e15ab62
combining gitignore
elreydetoda Jun 7, 2020
c76c1f3
Merge branch '5.0-dev' of github.com:SamuraiWTF/samuraiwtf into 5.0-d…
elreydetoda Jun 7, 2020
d74fc80
adding pipfile for deps
elreydetoda Jun 7, 2020
6481542
adding all necessary items for packer build
elreydetoda Jun 7, 2020
b8f5394
Merge branch '5.0-dev' of github.com:SamuraiWTF/samuraiwtf into 5.0-d…
elreydetoda Jun 8, 2020
0534f13
preping for v5.0 dev
elreydetoda Jun 8, 2020
957abed
removing becuasing not doing vmware yet
elreydetoda Jun 8, 2020
174bd8a
removing because packer requires at buildtime
elreydetoda Jun 8, 2020
f05270b
adding these for now, and we will centralize later
elreydetoda Jun 8, 2020
e89377c
converting to 2 spaces
elreydetoda Jun 8, 2020
0d5d758
moving Pipfile to project dirs
elreydetoda Jun 8, 2020
c261ff7
trying to add katana to base box build
elreydetoda Aug 31, 2020
f498f17
combining gitignore
elreydetoda Jun 7, 2020
6b80525
adding pipfile for deps
elreydetoda Jun 7, 2020
af6f02e
adding all necessary items for packer build
elreydetoda Jun 7, 2020
64beeb2
preping for v5.0 dev
elreydetoda Jun 8, 2020
de9ad67
removing becuasing not doing vmware yet
elreydetoda Jun 8, 2020
11d777d
removing because packer requires at buildtime
elreydetoda Jun 8, 2020
1fdafe2
adding these for now, and we will centralize later
elreydetoda Jun 8, 2020
197327d
converting to 2 spaces
elreydetoda Jun 8, 2020
40fbdc6
moving Pipfile to project dirs
elreydetoda Jun 8, 2020
130c8d3
trying to add katana to base box build
elreydetoda Aug 31, 2020
e92e40c
Merge branch '5.0-dev_packer' of github.com:elreydetoda/samuraiwtf-ba…
elreydetoda Aug 31, 2020
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
Prev Previous commit
Next Next commit
trying to add katana to base box build
  • Loading branch information
elreydetoda committed Aug 31, 2020
commit c261ff789625748b43ffa73e56efb488ceeeb80a
15 changes: 13 additions & 2 deletions base/packer/not-working_build.sh
Original file line number Diff line number Diff line change
@@ -31,8 +31,19 @@ fi
# generating samurai.json packer template
scripts/util/template_alterations.py

# compressing config folder
pushd ./scripts/build/ || exit 1 && tar -czvf config.tgz config && popd
# folders to compress
folder_array=(
'./scripts/build/:config'
'../../:katana'
)

for array_item in "${folder_array[@]}" ; do
path_to_folder="${array_item%:*}"
folder_to_compress="${array_item##*:}"
# compressing folder
pushd "${path_to_folder}" || exit 1 && tar -czvf "${folder_to_compress}.tgz" "${folder_to_compress}" && popd

done

# building vagrant box
packer validate -only=virtualbox-iso -var-file variables.json samurai.json |& tee build.log
28 changes: 18 additions & 10 deletions base/packer/scripts/build/install/samuraiwtf.yml
Original file line number Diff line number Diff line change
@@ -37,6 +37,12 @@
dest: /opt/
mode: 0744

- name: Copy katana files to opt/samurai
unarchive:
src: /tmp/katana.tgz
dest: /opt/
mode: 0744

- name: Install dconf
apt:
name:
@@ -95,16 +101,18 @@
- docker-ce
update_cache: yes
ignore_errors: yes
# - name: Create necessary folders
# file:
# path: '{{ item }}'
# state: directory
# loop:
# - '{{ main_folder }}/katana'
# - '{{ main_folder }}/samurai'
# - '{{ main_folder }}/targets'
# vars:
# - main_folder: '/opt'
- name: Create necessary folders
file:
path: '{{ item }}'
state: directory
loop:
# will get created by packer uploading folder
# - '{{ main_folder }}/katana'
- '{{ main_folder }}/samurai'
# currently gets created already
# - '{{ main_folder }}/targets'
vars:
- main_folder: '/opt'


- import_tasks: menu-tasks.yml
14 changes: 13 additions & 1 deletion base/packer/scripts/util/template_alterations.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@
install_dir = '{}'.format(build_script)
# config_dir = '../../'
# install_dir = '../../'
project_root = '../../'
katana_dir = '{}'.format(project_root)
base_box_name = 'samuraiwtf-base_box'

# start each section with a pre-defined message and it's name
@@ -190,11 +192,21 @@ def prov_alterations(json_obj):
prov_list.append(
{
'type': 'file',
'source': config_dir + '/config.tgz',
'source': '{}/config.tgz'.format(config_dir),
'destination': '/tmp/config.tgz'
}
)

### need to add the following provisions
## FILE: upload compressed config files to /tmp
prov_list.append(
{
'type': 'file',
'source': '{}/katana.tgz'.format(katana_dir),
'destination': '/tmp/katana.tgz'
}
)

## ANSIBLE: run all the samurai scripts
prov_list.append(
{