Skip to content

Commit f969423

Browse files
Agent2 updates (#32)
* start updating module for puppet 5.x and agent 2.0 * remove notifications * no bundler up in there? * maybe skip ruby 2.1 for now * update rakefile and ditch puppet 4.8 * fix linting issues with chaining arrows * use new style facts * errant brace * need to define os related facts in spec test * hello, typo * update facts for rhel like stuff * something's not defined here in spec tests * try top level scope here * removed centos/rhel 6 spec test bits updated metadata for agent 2.0 supported os versions * fix spec to use stdlib functions this requires a different test to see if the pkg is in the catalogue. * 'run' is only available within 'describe' or 'context' groups * if lsb bits aren't there, we don't get some os facts feels like this is an old issue, but here's a reccent ticket: https://tickets.puppetlabs.com/projects/FACT/issues/FACT-1899?filter=allopenissues * sudo train to success * move this up to see if it works * use the apt module instead will have to clean up a bunch of these so they work and modify tests. * maybe cleaned this up a little * add those params for debian * added back that gpg key param not sure this is even needed now * bump version and include apt dependency in fixtures * add the osfamily fact to spec for apt used in apt module * add translate module dependency for tests * fix apt spec facts * add os release full fact to spec test * nice typo, yo * move defined type test to defines add rspec-puppet-facts to save time. need to edit the apt spec test and other stuff. * no top scope there? special var in play * update repo for v2 add different setup/config commands. will sort out the correct execs here and update tests to reflect these. * updated travis conf and comments * change config dir and add params * errant spaces * try skipping rvm installs with travis not sure this will work or is even the way to go, but it might be quicker. * use confdir in config line * missing comma * update facts in init spec * updated facts in config spec * was that failing due to changed path? * change repo url in yum spec * add facts to pkg spec * update specs * errant brace * match apt repo comment * multiline content this should be a defined type test instead. * fix indent gross * fixed apt stuff * fix facts in apt spec * fixed typo * fix config spec needs more facts * add more facts * more facts for init spec * add facts for redhat * facts for config spec * load it up with facts * missing brace * got your operatingsystem right here, buddy * fix family * add another debian fact * move apt spec to defined type test * move defined type tests to apt class test * might need to pass params like this * make it work * config options have changed. see if this works. * loop over config args and such * fix tabs * fix config spec had the old command in there * have params match what apt class expects * updated config class and other bits * this might work for the apt spec test * just name the release * might've used the wrong resource type there * changes those names, too * fixed apt params it's been awhile... * skip the apt key test for now * fix these spec tests * more spec tinkering * an extra space in there * fix format of rulesets * dupe it up * have package inherit params, too * test complained about an undefined thing * change how options are passed * make sure yaml is valid * only use extra args if they're defined * give this a try please work, yo * use the undef symbol instead * make it work i am retiring after this. * this works? * remove that param for great success * this should skip config is no args are defined i think that's what we want here. * tests pass; yay * added changelog, changed dates * change reference to cloudsight * remove ubuntu 14.04 from metadata * updated readme * removed feature plan param
1 parent c7e3a9f commit f969423

29 files changed

Lines changed: 413 additions & 180 deletions

.fixtures.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ fixtures:
33
threatstack: "#{source_dir}"
44
forge_modules:
55
stdlib: "puppetlabs/stdlib"
6+
apt: "puppetlabs/apt"
7+
translate: "puppetlabs/translate"

.travis.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
language: ruby
2+
before_install:
3+
- curl https://apt.puppetlabs.com/DEB-GPG-KEY-puppet | sudo apt-key add -
4+
- curl -O https://apt.puppetlabs.com/puppet5-release-trusty.deb
5+
- sudo dpkg -i puppet5-release-trusty.deb
6+
- sudo apt-get update -q
7+
- sudo apt-get install -y lsb-release puppet-agent
8+
- /opt/puppetlabs/puppet/bin/gem install bundler
29
bundler_args: "--without system_tests"
10+
before_script:
11+
- export PATH=$PATH:/opt/puppetlabs/puppet/bin
312
script: bundle install && bundle exec rake validate && bundle exec rake test SPEC_OPTS='--format documentation'
413
cache: bundler
514
sudo: required
6-
rvm:
7-
- 2.1.0
815
env:
9-
- PUPPET_VERSION="~> 3.8.0"
10-
- PUPPET_VERSION="~> 4.6.0"
11-
- PUPPET_VERSION="~> 4.7.0"
12-
- PUPPET_VERSION="~> 4.8.0"
13-
notifications:
14-
slack:
15-
secure: fIRcyLQ5G7XmPV5n06Q4NPAiQ1E5VwsoL4GuwIZQ79/c85yxUXk7Y2rDVFnzjtJnWBZ4cTxbz1GATn0PmSDV6fEh5pS31nLwZ7LJUWfLz8Kr86XFTkJpo5fnUxik9BYIwx/WyxAhCtHinFxWS9S2MweABhsDX8vIEFcraASpdHs=
16+
- PUPPET_VERSION="~> 5.5.8"

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Change log
2+
3+
We'll track changes here starting with details about the 2.0 release and reference to earlier releases.
4+
5+
## 2.0
6+
### This release tracks the release of the Threat Stack Agent 2.0
7+
8+
### NOTE: To install/configure/run Threat Stack Agent < 2.0, please keep using the 1.8.1 release of this module. Module version 2.0 supports Threat Stack Agent 2.0 and above, only.
9+
10+
### Changed
11+
- module depends on [puppetlabs/apt](https://github.com/puppetlabs/puppetlabs-apt) and [puppetlabs/stdlib](https://github.com/puppetlabs/puppetlabs-stdlib)
12+
- paths and `tsagent` related commands are changed to reflect new layout in packages
13+
- dropped support for TS Agent < 2.0 in this module
14+
- agent package repos are completely separate
15+
- supported OSes:
16+
- Debian 8, 9
17+
- Ubuntu 16.04, 18.04
18+
- RedHat 7
19+
- CentOS 7
20+
- Amazon Linux
21+
- targets support for Puppet 5.x
22+
23+
24+
### Fixed
25+
- cleaned up code
26+
- used `apt_source` resource instead of `exec`s
27+
- updated spec tests
28+
29+
## 1.8.1
30+
31+
### Fixed
32+
- use `operatingsystem` fact to ensure Amazon Linux can install yum repos
33+

Gemfile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@ source 'https://rubygems.org'
33
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
44

55
group :development, :unit_tests do
6-
gem 'rake', :require => false
7-
gem 'rspec-puppet', "2.2.0", :require => false
8-
gem 'puppetlabs_spec_helper', :require => false
9-
gem 'puppet-lint', "1.0.1", :require => false
10-
gem 'librarian-puppet', :require => false
11-
gem 'simplecov', :require => false
12-
gem 'json', :require => false
13-
gem 'puppet-syntax', :require => false
14-
gem 'metadata-json-lint', '0.0.4', :require => false
15-
gem 'vagrant-wrapper', :require => false
16-
gem 'puppet-blacksmith', :require => false
17-
gem 'rest-client', ">=1.7.3", :require => false
6+
gem 'rake', :require => false
7+
gem 'rspec-puppet', "2.7.2", :require => false
8+
gem 'puppetlabs_spec_helper', :require => false
9+
gem 'puppet-lint', "2.3.6", :require => false
10+
gem 'librarian-puppet', :require => false
11+
gem 'simplecov', :require => false
12+
gem 'json', :require => false
13+
gem 'puppet-syntax', :require => false
14+
gem 'metadata-json-lint', '2.2.0', :require => false
15+
gem 'vagrant-wrapper', :require => false
16+
gem 'puppet-blacksmith', :require => false
17+
gem 'rest-client', ">=1.7.3", :require => false
18+
gem 'semantic_puppet', :require => false
19+
gem 'rspec-puppet-facts', '~> 1.7', :require => false
1820
end
1921
group :system_tests do
2022
gem 'serverspec', :require => false
@@ -32,7 +34,7 @@ end
3234
if puppetversion = ENV['PUPPET_VERSION']
3335
gem 'puppet', puppetversion, :require => false
3436
else
35-
gem 'puppet', '3.8.2', :require => false
37+
gem 'puppet', '5.5.8', :require => false
3638
end
3739

3840
# vim:ft=ruby

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Platforms
1818

1919
* Amazon Linux
2020
* CentOS
21+
* Debian
2122
* RedHat
2223
* Ubuntu
2324

@@ -36,25 +37,27 @@ Parameters
3637
=====
3738

3839
* `threatstack::deploy_key` [required] - Set the deploy key for registering the agent.
39-
* `threatstack::feature_plan` [required] - Threat Stack feature plan package. (https://www.threatstack.com/plans)
40-
* `investigate` - Investigate plan.
41-
* `monitor` - Monitor tier plan.
42-
* `legacy` - Legacy Basic, Advanced, and Pro plans.
43-
* `threatstack::ruleset` [optional array] - Set the ruleset or rulesets the node will be added to (Defaults to 'Base Rule Set').
40+
* `threatstack::rulesets` [optional array] - Set the ruleset or rulesets the node will be added to (Default: 'Base Rule Set').
4441
* `threatstack::configure_agent` [optiona bool] - Set to false to just install agent without configuring. Useful for image building.
45-
* `threatstack::agent_config_args` [optional string] - Extra arguments to pass during agent activation. Useful for enabling new platform features.
42+
* `threatstack::agent_config_args` [optional array of hashes] - Extra arguments to pass during agent activation. Useful for enabling new platform features.
43+
* `threatstack::extra_args` [optional array of hashes] - optional array of hashes to define setup options for the threatstack agent (Default: `undef`)
44+
* `threatstack::confdir` [optional string] - path to config directory for the threatstack service (Default: '/opt/threatstack/etc')
45+
* `threatstack::ts_hostname` [optional string] - hostname of your node (Default: `$::fqdn`)
46+
* `threatstack::gpg_key` [optional string] - gpg key url for use with yum/apt repos (Default: set in `threatstack::params` based on operating system)
47+
* `threatstack::package_version` [optional string] - version of the `threatstack-agent` package to install (Default: `installed`)
48+
* `threatstack::repo_class` [optional string] - name of puppet class that configures the threatstack package repo (Default: either `threatstack::apt` or `threatstack::yum`, set in `threatstack::params` based on operating system)
49+
* `threatstack::repo_url` [optional string] - url used by threatstack package repo (Default: defined in `threatstack::params` for Debian and RedHat operating system families.)
4650

4751
Example usage
4852
=====
49-
Below are some examples for how to use module.
53+
Below are some examples for how to use this module.
5054

5155
Standard usage
5256
===
53-
Supply a your Threat Stack deploy key, and if you choose, an array of rulesets.
57+
Supply your Threat Stack deploy key, and if you choose, an array of rulesets.
5458
```
5559
class { '::threatstack':
5660
deploy_key => 'MyDeployKey',
57-
feature_plan => 'investigate',
5861
ruleset => ['MyRuleset']
5962
}
6063
```
@@ -64,7 +67,6 @@ If you manage your own package repository from which you deploy the agent packag
6467
```
6568
class { '::threatstack':
6669
deploy_key => 'MyDeployKey',
67-
feature_plan => 'monitor',
6870
ruleset => ['MyRuleset'],
6971
repo_url => 'https://my-mirror.example.com/centos-6'
7072
gpg_key => 'https://my-mirror.example.com/RPM-GPG-KEY-THREATSTACK'
@@ -93,4 +95,3 @@ Integration testing requires setting `TS_DEPLOY_KEY` in the environment to a val
9395
export TS_DEPLOY_KEY='<deploy_key>'
9496
bundle exec kitchen test
9597
```
96-

Rakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ exclude_paths = [
66
'pkg/**/*',
77
'vendor/**/*',
88
'spec/**/*',
9+
'pkg/**/*',
910
]
1011

11-
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
12+
# PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
1213
PuppetLint.configuration.ignore_paths = exclude_paths
1314
PuppetLint.configuration.send('disable_80chars')
1415
PuppetLint.configuration.send('disable_autoloader_layout')

data/common.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
threatstack::params:
3+
ts_package: 'threatstack-agent'
4+
ts_service: 'threatstack'
5+
package_version: 'installed'
6+
rulesets: ['Base Rule Set']
7+
extra_args: undef
8+
cloudsight_bin: '/usr/bin/tsagent'
9+
confdir: '/opt/threatstack/etc'

data/os/Amazon.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
threatstack::params:
3+
repo_class: '::threatstack::yum'
4+
gpg_key: 'https://app.threatstack.com/RPM-GPG-KEY-THREATSTACK'

data/os/CentOS.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
threatstack::params:
3+
repo_class: '::threatstack::yum'
4+
gpg_key: 'https://app.threatstack.com/RPM-GPG-KEY-THREATSTACK'

data/os/Debian.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
threatstack::params:
3+
repo_class: '::threatstack::apt'
4+
gpg_key: 'https://app.threatstack.com/APT-GPG-KEY-THREATSTACK'
5+

0 commit comments

Comments
 (0)