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

Add FreeBSD support #38

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#exclude_paths:
# - ./my/excluded/directory/
# - ./my/other/excluded/directory/
# - ./last/excluded/directory/
parseable: true
quiet: true
#rulesdir:
# - ./rule/directory/
skip_list:
- trailing-spaces
#tags:
# - run_this_tag
use_default_rules: true
verbosity: 1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ fabric.properties
# kdevelop
*.kdev4
.kdev4

# emacs and zile tmp files
.#*
*#
*~
32 changes: 32 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---

extends: default

rules:
braces:
level: warning
max-spaces-inside: 1
brackets:
level: warning
max-spaces-inside: 1
colons:
level: warning
commas:
level: warning
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
level: warning
hyphens:
level: warning
indentation:
level: warning
indent-sequences: consistent
line-length:
level: warning
allow-non-breakable-inline-mappings: true
new-line-at-end-of-file:
level: warning
truthy: disable
trailing-spaces: disable
21 changes: 0 additions & 21 deletions Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions FEATURES.md

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

21 changes: 0 additions & 21 deletions circle.yml

This file was deleted.

30 changes: 23 additions & 7 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
# file: defaults/main.yml
# New default options based on: https://github.com/grke/burp/wiki/Performance-Tips

# default paths for non FreeBSD systems
etc_dir: "/etc"
usr_dir: "/usr"
# use the pkg tool to use binaries and be faster
burp_freebsd_use_portinstall: false

### Modules ---
# Configure Burp UI Agent
burp_module_agent: false
# Configure burp restore service
burp_module_restore: false
# Configure Burp manual delete
burp_manual_delete_enabled: true
# Configure Burp Autoupgrade
burp_server_autoupgrade_enabled: true
# Activate clients from git repository
burp_repos: false
#burpsrv_repos:
# - { repo: "url", version: "branch", dir: "dest dir"}
# - { repo: "url", versiong: "branch", dir: "dest dir"}
# Example:
# burp_repos:
# - { repo: "http://host/group/repo.git", version: "master", dir: "linux_clients"}
Expand All @@ -26,14 +36,15 @@ burp_repos: false
burp_home: "/var/spool/burp"

## Build vars:

# freeBSD need gmake
make: "make"
# Add these vars to your hosts/groups to change version/tag (archive to download and compile)
burpsrcext: "zip" # must be tar.gz or zip
autoupgrade_version: "2.2.18" # master version is not compiled so added separately
burp_version: "2.2.18" # branch or tag, example: "master" , example: "2.0.46"
burp_configure_line: "CFLAGS='-O2 -march=native -mtune=native -mfpmath=sse -floop-parallelize-all -ftree-parallelize-loops=4' ./configure "
# For CFLAGS see: https://github.com/grke/burp/wiki/Performance-Tips#optional-compile-time-improvements
burp_usr_path: '/usr/local'
burp_usr_path: "{{ usr_dir }}"
burp_bin_path: "{{ burp_usr_path }}/sbin/burp"

burp_force_reinstall: false
Expand All @@ -45,7 +56,7 @@ burpurl: "https://github.com/grke/burp/archive/{{ burp_version }}.{{ burpsrcext
# Directory that will be used as the location for the downloads§
download_dir: "{{ ansible_env.HOME }}/burp"

burp_server_etc: '/etc/burp'
burp_server_etc: "{{ etc_dir }}/burp"
## Additional autoupgrade vars:
#autoupgrade_url_win64: "https://sourceforge.net/projects/burp/files/burp-{{ autoupgrade_version }}/burp-win64-installer-{{ autoupgrade_version }}.exe/download"
#autoupgrade_url_win32: "https://sourceforge.net/projects/burp/files/burp-{{ autoupgrade_version }}/burp-win32-installer-{{ autoupgrade_version }}.exe/download"
Expand Down Expand Up @@ -125,7 +136,7 @@ burp_server_custom_lines: []
# See also files/incexc, those in this repo are copied to /etc/burp/clientconfdir/incexc
# This template create each template in: /etc/burp/clientconfdir/incexc/name
profiles_templates:

- name: profile_lnxsrv
content:
- "#hard_quota No permitir backups a clientes con mas de xxGb en el backup total"
Expand Down Expand Up @@ -284,8 +295,9 @@ burp_sv_server_command: "{{ burp_bin_path }} -c {{ burp_server_etc }}/burp-serve
burp_sv_server_user: "root"
burp_sv_server_autostart: "true"
burp_sv_server_autorestart: "true"
burp_sv_server_stdout_logfile: "/var/log/supervisor/%(program_name)s.log"
burp_sv_server_stderr_logfile: "/var/log/supervisor/%(program_name)s.log"
burp_sv_server_startretries: "5"
burp_sv_server_stdout_logfile: "{{ burp_sv_server_log_dir }}/%(program_name)s.log"
burp_sv_server_stderr_logfile: "{{ burp_sv_server_log_dir }}/%(program_name)s.log"
### ---

# if burp_manual_delete_enabled: true
Expand Down Expand Up @@ -342,3 +354,7 @@ backup_tool_script_url: 'https://github.com/grke/burp/blob/master/configs/server
backup_tool_script_dir: '{{ burp_usr_path }}/share/burp/scripts'
backup_tool_script_path: "{{ backup_tool_script_dir }}/backup_tool_script"
install_backup_tool_script: false

# use the 'portinstall' module on FreeBSD to compile packages instead of 'package'
burp_freebsd_use_portinstall: True

1 change: 1 addition & 0 deletions meta/.galaxy_install_info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{install_date: 'Thu Jan 25 14:39:13 2018', version: master}
5 changes: 3 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ galaxy_info:
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
- name: FreeBSD
versions:
# - all
- 11.4
# - 10.0
# - 10.1
# - 10.2
Expand Down
24 changes: 24 additions & 0 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Molecule managed

FROM {{ item.image }}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi

RUN if [ $(command -v dnf) ]; then dnf -y update && dnf clean all; fi

RUN if [ $(command -v dnf) ]; then dnf -y install systemd hostname && dnf clean all && \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*; fi

# VOLUME [ "/sys/fs/cgroup" ]
# CMD ["/usr/sbin/init"]
59 changes: 59 additions & 0 deletions molecule/default/create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
tasks:
- name: Create Dockerfiles from image names
template:
src: "{{ molecule_scenario_directory }}/Dockerfile.j2"
dest: "{{ molecule_ephemeral_directory }}/Dockerfile_{{ item.image | regex_replace('[^a-zA-Z0-9_]', '_') }}"
with_items: "{{ molecule_yml.platforms }}"
register: platforms

- name: Discover local Docker images
docker_image_facts:
name: "molecule_local/{{ item.item.name }}"
with_items: "{{ platforms.results }}"
register: docker_images

- name: Build an Ansible compatible image
docker_image:
path: "{{ molecule_ephemeral_directory }}"
name: "molecule_local/{{ item.item.image }}"
dockerfile: "{{ item.item.dockerfile | default(item.invocation.module_args.dest) }}"
force: "{{ item.item.force | default(true) }}"
with_items: "{{ platforms.results }}"
when: platforms.changed or docker_images.results | map(attribute='images') | select('equalto', []) | list | count >= 0

- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
hostname: "{{ item.name }}"
image: "molecule_local/{{ item.image }}"
state: started
recreate: false
log_driver: syslog
command: "{{ item.command | default('bash -c \"while true; do sleep 10000; done\"') }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
ports: "{{ item.exposed_ports | default(omit) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0

- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
27 changes: 27 additions & 0 deletions molecule/default/destroy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
- name: Destroy
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
vars:
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
tasks:
- name: Destroy molecule instance(s)
docker_container:
name: "{{ item.name }}"
state: absent
force_kill: "{{ item.force_kill | default(true) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0

- name: Wait for instance(s) deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"
1 change: 1 addition & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
dependency:
name: galaxy
options:
Expand Down
8 changes: 8 additions & 0 deletions molecule/default/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
vars:
burp_module_test_client: true
burp_module_agent: true
roles:
- role: ansible_burp2_server
5 changes: 5 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Prepare
hosts: all
gather_facts: false
tasks: []
17 changes: 17 additions & 0 deletions molecule/freebsd/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*******
Install
*******

Requirements
============

* Vagrant
* Virtualbox, Parallels, VMware Fusion, VMware Workstation or VMware Desktop
* python-vagrant

Install
=======

.. code-block:: bash

$ sudo pip install python-vagrant
Loading