Skip to content

Commit

Permalink
Merge pull request #6 from GSA/el-support
Browse files Browse the repository at this point in the history
add Enterprise Linux and Ubuntu 14 support/testing
  • Loading branch information
wwaltersp authored Jan 10, 2018
2 parents 82e5f02 + 1bc70a3 commit d41a7b5
Show file tree
Hide file tree
Showing 16 changed files with 190 additions and 13 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vagrant/
*.log
*.retry
*.deb
*.rpm
secrets.yml
.kitchen/
.kitchen.local.yml
Dockerfile*
32 changes: 32 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
driver:
name: docker
# https://github.com/test-kitchen/kitchen-docker/issues/207#issuecomment-218544624
use_sudo: false

provisioner:
name: ansible_playbook
hosts: instances
additional_copy_path:
# for some reason this isn't copied by default
- test/integration/default/files

platforms:
# https://github.com/test-kitchen/kitchen-docker/issues/268#issuecomment-304141235
- name: centos-6
driver:
disable_upstart: false
run_command: /sbin/init
- name: centos-7
driver_config:
image: centos/systemd
run_command: /usr/sbin/init
privileged: true
provision_command:
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
- systemctl enable sshd.service
- name: ubuntu-14.04
- name: ubuntu-16.04

suites:
- name: default
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ install:
# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
- cd test/integration/default && ansible-playbook default.yml -i inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
webhooks: https://galaxy.ansible.com/api/v1/notifications/
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'test-kitchen'
gem 'kitchen-ansible'
gem 'kitchen-docker'
76 changes: 76 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
GEM
remote: https://rubygems.org/
specs:
builder (3.2.3)
erubis (2.7.0)
ffi (1.9.18)
gssapi (1.2.0)
ffi (>= 1.0.1)
gyoku (1.3.1)
builder (>= 2.1.2)
httpclient (2.8.3)
kitchen-ansible (0.48.1)
net-ssh (>= 3)
test-kitchen (~> 1.4)
kitchen-docker (2.6.0)
test-kitchen (>= 1.0.0)
little-plugger (1.1.4)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
mixlib-install (3.8.0)
mixlib-shellout
mixlib-versioning
thor
mixlib-shellout (2.3.2)
mixlib-versioning (1.2.2)
multi_json (1.12.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (4.2.0)
net-ssh-gateway (1.3.0)
net-ssh (>= 2.6.5)
nori (2.6.0)
rubyntlm (0.6.2)
rubyzip (1.2.1)
safe_yaml (1.0.4)
test-kitchen (1.19.2)
mixlib-install (~> 3.6)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
net-ssh (>= 2.9, < 5.0)
net-ssh-gateway (~> 1.2)
safe_yaml (~> 1.0)
thor (~> 0.19, < 0.19.2)
winrm (~> 2.0)
winrm-elevated (~> 1.0)
winrm-fs (~> 1.1.0)
thor (0.19.1)
winrm (2.2.3)
builder (>= 2.1.2)
erubis (~> 2.7)
gssapi (~> 1.2)
gyoku (~> 1.0)
httpclient (~> 2.2, >= 2.2.0.2)
logging (>= 1.6.1, < 3.0)
nori (~> 2.0)
rubyntlm (~> 0.6.0, >= 0.6.1)
winrm-elevated (1.1.0)
winrm (~> 2.0)
winrm-fs (~> 1.0)
winrm-fs (1.1.1)
erubis (~> 2.7)
logging (>= 1.6.1, < 3.0)
rubyzip (~> 1.1)
winrm (~> 2.0)

PLATFORMS
ruby

DEPENDENCIES
kitchen-ansible
kitchen-docker
test-kitchen

BUNDLED WITH
1.16.0
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Role Variables
- `nessus_agent_key`: key used for linking with nessus host (this is a required variable)

- `nessus_agent_group`: host group this agent should be added to when linking with nessus host (this is a required variable)

- `nessus_agent_host`: nessus host to link with (default: `cloud.tenable.com`)

- `nessus_agent_port`: nessus host port (default: `443`)

- `nessus_agent_package`: can be either a repository package, path to a file, or a URL (default: `NessusAgent`)

nessus_agent_package: nessus-agent
nessus_agent_package: nessus-agent
nessus_agent_package: /tmp/nessus-agent_6.8.1_amd64.deb

Example Playbook
Expand All @@ -33,6 +33,38 @@ Example Playbook
nessus_agent_key: xxxxxxxxx
tags: nessus-agent

Testing Locally
---------------

1. Ensure you have a running [Nessus Manager](https://www.tenable.com/products/nessus-vulnerability-scanner/nessus-manager) or [tenable.io](https://www.tenable.com/products/tenable-io) account and agent key.
1. Install dependencies.
* [Ansible](https://docs.ansible.com/ansible/latest/intro_installation.html)
* [Docker](https://www.docker.com/)
* [Ruby](https://www.ruby-lang.org/)
1. Install Test Kitchen and dependencies.

```sh
bundle
```

1. [Download Nessus Agent packages](https://www.tenable.com/products/nessus/agent-download) for CentOS 6, CentOS 7, and Ubuntu 14.04/16.04. Put them under `test/integration/default/files/`.
1. Create credentials file.

```sh
cp test/integration/default/group_vars/all/secrets.yml.example test/integration/default/group_vars/all/secrets.yml
```

1. Fill out `tests/group_vars/all/secrets.yml`.
1. Run integration test.

```sh
kitchen create
kitchen converge
# when done, run
kitchen destroy
```

Author Information
------------------

Expand Down
1 change: 1 addition & 0 deletions chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.kitchen
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ galaxy_info:
- name: Debian
versions:
- all
- name: EL
versions:
- all

galaxy_tags:
- security
Expand Down
2 changes: 2 additions & 0 deletions test/integration/default/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[defaults]
roles_path=../../../../
9 changes: 9 additions & 0 deletions test/integration/default/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- hosts: all
become: true
pre_tasks:
# not included by default on ubuntu:16.04 image
- name: Install time zone package
package: name=tzdata
roles:
- ansible-role-nessus-agent
Empty file.
11 changes: 11 additions & 0 deletions test/integration/default/group_vars/all/pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
nessus_agent_version: "7.0.0"
# https://docs.tenable.com/cloud/Content/AdditionalResources/InstallNessusAgent.htm
nessus_agent_packages:
CentOS:
6: NessusAgent-{{ nessus_agent_version }}-es6.x86_64.rpm
7: NessusAgent-{{ nessus_agent_version }}-es7.x86_64.rpm
Ubuntu:
14: NessusAgent-{{ nessus_agent_version }}-ubuntu1110_amd64.deb
16: NessusAgent-{{ nessus_agent_version }}-ubuntu1110_amd64.deb
nessus_agent_package: "{{ role_path }}/test/integration/default/files/{{ nessus_agent_packages[ansible_distribution][ansible_distribution_major_version | int] }}"
5 changes: 5 additions & 0 deletions test/integration/default/group_vars/all/secrets.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
nessus_agent_key: ...
"{{ role_path }}/test/integration/default/files/NessusAgent-7.0.0-ubuntu1110_amd64.deb"

# you can also configure the optional variables here
1 change: 1 addition & 0 deletions test/integration/default/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost ansible_connection=local ansible_user=root
1 change: 0 additions & 1 deletion tests/inventory

This file was deleted.

5 changes: 0 additions & 5 deletions tests/test.yml

This file was deleted.

0 comments on commit d41a7b5

Please sign in to comment.