add playbook to setup scanners
This commit is contained in:
parent
f8fef3a0af
commit
05d45daef1
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,3 +5,6 @@ generated_passwords.txt
|
|||||||
|
|
||||||
# Ignore Vagrant directory
|
# Ignore Vagrant directory
|
||||||
.vagrant/
|
.vagrant/
|
||||||
|
|
||||||
|
# Ignore galaxy roles
|
||||||
|
roles/geerlingguy.go
|
||||||
|
@ -3,6 +3,13 @@
|
|||||||
This repository contains a collection of Ansible playbooks and roles for setting up
|
This repository contains a collection of Ansible playbooks and roles for setting up
|
||||||
my base Debian systems.
|
my base Debian systems.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
Some playbooks require roles from Ansible Galaxy:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-galaxy install -r requirements.yml
|
||||||
|
```
|
||||||
|
|
||||||
## Roles
|
## Roles
|
||||||
- **base_setup** - Role to set up a base system
|
- **base_setup** - Role to set up a base system
|
||||||
- Installs basic packages
|
- Installs basic packages
|
||||||
@ -11,6 +18,7 @@ my base Debian systems.
|
|||||||
- Creates user with or without password
|
- Creates user with or without password
|
||||||
- **system_update** - Role to update the system
|
- **system_update** - Role to update the system
|
||||||
- **tor** - Role to install Tor
|
- **tor** - Role to install Tor
|
||||||
|
- **offsec_scanning** - Role to install scanning tools
|
||||||
|
|
||||||
## Playbooks
|
## Playbooks
|
||||||
- **playbooks/setup_base_system.yml** - Sets up the base system
|
- **playbooks/setup_base_system.yml** - Sets up the base system
|
||||||
@ -18,6 +26,7 @@ my base Debian systems.
|
|||||||
- Passwords will be placed in a file called `generated_passwords.txt`
|
- Passwords will be placed in a file called `generated_passwords.txt`
|
||||||
- **playbooks/update_systems.yml** - Updates the systems
|
- **playbooks/update_systems.yml** - Updates the systems
|
||||||
- **playbooks/install_tor.yml** - Installs Tor for all hosts in the `tor_systems` group
|
- **playbooks/install_tor.yml** - Installs Tor for all hosts in the `tor_systems` group
|
||||||
|
- **playbooks/setup_scanner.yml** - Installs scanning tools on all hosts in the `scanners` group.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
If you would like to test out the plays before using them on your live systems, this
|
If you would like to test out the plays before using them on your live systems, this
|
||||||
|
@ -7,3 +7,6 @@ testserver2 ansible_host=192.168.56.12 ansible_ssh_private_key_file=.vagrant/mac
|
|||||||
|
|
||||||
[tor_systems]
|
[tor_systems]
|
||||||
testserver1
|
testserver1
|
||||||
|
|
||||||
|
[scanners]
|
||||||
|
testserver2
|
15
playbooks/setup_scanner.yml
Normal file
15
playbooks/setup_scanner.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
- name: Set up scanner
|
||||||
|
hosts:
|
||||||
|
scanners
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- geerlingguy.go
|
||||||
|
- offsec_scanning
|
||||||
|
vars:
|
||||||
|
go_version: "1.24.2"
|
||||||
|
go_platform: linux
|
||||||
|
go_arch: amd64
|
||||||
|
go_tarball: go{{ go_version }}.{{ go_platform }}-{{ go_arch }}.tar.gz
|
||||||
|
go_download_url: https://dl.google.com/go/{{ go_tarball }}
|
||||||
|
go_checksum: '68097bd680839cbc9d464a0edce4f7c333975e27a90246890e9f1078c7e702ad'
|
2
requirements.yml
Normal file
2
requirements.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- src: geerlingguy.go
|
38
roles/offsec_scanning/README.md
Normal file
38
roles/offsec_scanning/README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
2
roles/offsec_scanning/defaults/main.yml
Normal file
2
roles/offsec_scanning/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for roles/offsec_scanning
|
2
roles/offsec_scanning/handlers/main.yml
Normal file
2
roles/offsec_scanning/handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for roles/offsec_scanning
|
52
roles/offsec_scanning/meta/main.yml
Normal file
52
roles/offsec_scanning/meta/main.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
galaxy_info:
|
||||||
|
author: your name
|
||||||
|
description: your role description
|
||||||
|
company: your company (optional)
|
||||||
|
|
||||||
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
|
# next line and provide a value
|
||||||
|
# issue_tracker_url: http://example.com/issue/tracker
|
||||||
|
|
||||||
|
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||||
|
# - BSD-3-Clause (default)
|
||||||
|
# - MIT
|
||||||
|
# - GPL-2.0-or-later
|
||||||
|
# - GPL-3.0-only
|
||||||
|
# - Apache-2.0
|
||||||
|
# - CC-BY-4.0
|
||||||
|
license: license (GPL-2.0-or-later, MIT, etc)
|
||||||
|
|
||||||
|
min_ansible_version: 2.1
|
||||||
|
|
||||||
|
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||||
|
# min_ansible_container_version:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||||
|
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||||
|
# To view available platforms and versions (or releases), visit:
|
||||||
|
# https://galaxy.ansible.com/api/v1/platforms/
|
||||||
|
#
|
||||||
|
# platforms:
|
||||||
|
# - name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 25
|
||||||
|
# - name: SomePlatform
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 1.0
|
||||||
|
# - 7
|
||||||
|
# - 99.99
|
||||||
|
|
||||||
|
galaxy_tags: []
|
||||||
|
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||||
|
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||||
|
# remove the '[]' above, if you add tags to this list.
|
||||||
|
#
|
||||||
|
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||||
|
# Maximum 20 tags per role.
|
||||||
|
|
||||||
|
dependencies: []
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
33
roles/offsec_scanning/tasks/main.yml
Normal file
33
roles/offsec_scanning/tasks/main.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# tasks file for roles/offsec_scanning
|
||||||
|
- name: Update package cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Install apt packages
|
||||||
|
package:
|
||||||
|
name:
|
||||||
|
- masscan
|
||||||
|
- nmap
|
||||||
|
- zmap
|
||||||
|
- jq
|
||||||
|
- wget
|
||||||
|
- git
|
||||||
|
- make
|
||||||
|
- build-essential
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Clone zgrab2 repository
|
||||||
|
git:
|
||||||
|
repo: https://github.com/zmap/zgrab2.git
|
||||||
|
dest: /opt/zgrab2
|
||||||
|
version: master
|
||||||
|
|
||||||
|
- name: Build zgrab2 and install
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: |
|
||||||
|
. /etc/profile.d/go-path.sh
|
||||||
|
make
|
||||||
|
ln -s /opt/zgrab2/zgrab2 /usr/local/bin
|
||||||
|
chdir: "/opt/zgrab2"
|
2
roles/offsec_scanning/tests/inventory
Normal file
2
roles/offsec_scanning/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
localhost
|
||||||
|
|
5
roles/offsec_scanning/tests/test.yml
Normal file
5
roles/offsec_scanning/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- roles/offsec_scanning
|
2
roles/offsec_scanning/vars/main.yml
Normal file
2
roles/offsec_scanning/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for roles/offsec_scanning
|
Loading…
x
Reference in New Issue
Block a user