Skip to content

Commit 0a6bee3

Browse files
authored
Merge pull request #28 from olhado/remove-1x
Remove 1x
2 parents 753cece + 754fe73 commit 0a6bee3

File tree

8 files changed

+232
-93
lines changed

8 files changed

+232
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12
.kitchen/
23
.bundle
34
.kitchen.local.yml

.kitchen.yml

Lines changed: 173 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,199 @@
11
---
22
driver:
3-
name: vagrant
3+
name: docker
44

55
provisioner:
66
name: salt_solo
7+
bootstrap_url: 'https://raw.githubusercontent.com/olhado/kitchen-salt/master/assets/install.sh'
78
is_file_root: true
89
# Use this section (and comment out the `threatstack.sls` definition in the `pillars` section)
910
# to grab pillar data from the `pillar.example` file
10-
pillars_from_files:
11-
threatstack.sls: pillar.example
11+
# pillars_from_files:
12+
# threatstack.sls: pillar.example
1213
pillars:
1314
top.sls:
1415
base:
1516
'*':
1617
- threatstack
1718
# Use this section (and comment out the `pillars_from_files` section)
1819
# to grab pillar data from environment variables
19-
# threatstack.sls:
20-
# deploy_key: <%= ENV['TS_DEPLOY_KEY'] != nil ? ENV['TS_DEPLOY_KEY'] : 'ts_deploy_key' %>
21-
# ts_agent_version: <%= ENV['TS_PACKAGE_VERSION'] %>
22-
# <% if ENV['TS_CONFIG_ARGS'] %>
23-
# ts_agent_config_args: <%= ENV['TS_CONFIG_ARGS'] %>
24-
# <% end %>
25-
# ts_agent_version: <%= ENV['TS_PACKAGE_VERSION'] %>
26-
# ts_configure_agent: <%= ENV['TS_CONFIGURE_AGENT'] %>
27-
# ts_agent_latest: <%= ENV['TS_AGENT_LATEST'] %>
28-
# <% if ENV['TS_SETUP_ARGS'] %>
29-
# ts_agent_extra_args: <%= ENV['TS_SETUP_ARGS'] %>
30-
# <% end %>
20+
threatstack.sls:
21+
deploy_key: <%= ENV['TS_DEPLOY_KEY'] != nil ? ENV['TS_DEPLOY_KEY'] : 'ts_deploy_key' %>
22+
<% if ENV['TS_PACKAGE_VERSION'] %>
23+
ts_agent_version: <%= ENV['TS_PACKAGE_VERSION'] %>
24+
<% end %>
25+
<% if ENV['TS_CONFIGURE_AGENT'] %>
26+
ts_configure_agent: <%= ENV['TS_CONFIGURE_AGENT'] %>
27+
<% end %>
28+
<% if ENV['TS_SETUP_ARGS'] %>
29+
ts_agent_extra_args: <%= ENV['TS_SETUP_ARGS'] %>
30+
<% end %>
31+
<% if ENV['TS_CONFIG_ARGS'] %>
32+
ts_agent_config_args: <%= ENV['TS_CONFIG_ARGS'] %>
33+
<% end %>
3134
state_top:
3235
base:
3336
'*':
3437
- threatstack
3538

3639
platforms:
37-
- name: centos-6
38-
- name: centos-7.6
39-
- name: debian-8.11
40-
- name: debian-9.6
41-
- name: ubuntu-14.04
40+
- name: amazonlinux-1
41+
image: amazonlinux:1
42+
driver_config:
43+
run_command: /sbin/init
44+
privileged: true
45+
run_options:
46+
env: container=docker
47+
volume:
48+
- /sys/fs/cgroup:/sys/fs/cgroup
49+
provision_command:
50+
- yum install -y ruby24
51+
- alternatives --set ruby /usr/bin/ruby2.4
52+
- yum install -y audit initscripts
53+
- sed -i 's/local_events = yes/local_events = no/g' /etc/audit/auditd.conf
54+
- chkconfig auditd on
55+
- name: amazonlinux-2
56+
image: amazonlinux:2
57+
driver_config:
58+
run_command: /sbin/init
59+
privileged: true
60+
run_options:
61+
env: container=docker
62+
volume:
63+
- /sys/fs/cgroup:/sys/fs/cgroup
64+
provision_command:
65+
- amazon-linux-extras install ruby2.6
66+
- yum install -y ruby-devel gcc make
67+
- gem install io-console --install-dir=/tmp/verifier/gems
68+
- chown -R kitchen:kitchen /tmp/verifier
69+
- yum install -y audit initscripts
70+
- sed -i 's/local_events = yes/local_events = no/g' /etc/audit/auditd.conf
71+
- systemctl enable auditd.service
72+
image: centos:7
73+
- name: centos-7
74+
image: centos:7
75+
driver_config:
76+
run_command: /sbin/init
77+
privileged: true
78+
run_options:
79+
env: container=docker
80+
volume:
81+
- /sys/fs/cgroup:/sys/fs/cgroup
82+
provision_command:
83+
- yum install -y ruby ruby-devel git
84+
- yum install -y centos-release-scl-rh
85+
- yum install -y rh-ruby26
86+
- mkdir -p /opt/chef/embedded/bin
87+
- ln -s "/opt/rh/rh-ruby26/root/usr/bin/gem" /opt/chef/embedded/bin/
88+
- ln -s "/opt/rh/rh-ruby26/root/usr/bin/ruby" /opt/chef/embedded/bin/
89+
- |
90+
printf "LD_LIBRARY_PATH=/opt/rh/rh-ruby26/root/usr/local/lib64:/opt/rh/rh-ruby26/root/usr/lib64\n"\
91+
>> /etc/environment
92+
- yum install -y audit initscripts
93+
- sed -i 's/local_events = yes/local_events = no/g' /etc/audit/auditd.conf
94+
- systemctl enable auditd.service
95+
- name: centos-8
96+
image: centos:8
97+
driver_config:
98+
run_command: /sbin/init
99+
privileged: true
100+
run_options:
101+
env: container=docker
102+
volume:
103+
- /sys/fs/cgroup:/sys/fs/cgroup
104+
provision_command:
105+
- yum install -y audit initscripts
106+
- sed -i 's/local_events = yes/local_events = no/g' /etc/audit/auditd.conf
107+
- systemctl enable auditd.service
108+
- name: debian-8
109+
image: debian:8
110+
driver_config:
111+
run_command: /sbin/init
112+
cap_add:
113+
- SYS_ADMIN
114+
run_options:
115+
env: container=docker
116+
volume:
117+
- /sys/fs/cgroup:/sys/fs/cgroup
118+
provision_command:
119+
- |
120+
apt-get install -y checkinstall build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev wget && \
121+
wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.gz && \
122+
tar xfz ruby-2.6.6.tar.gz && \
123+
echo "364b143def360bac1b74eb56ed60b1a0dca6439b00157ae11ff77d5cd2e92291 ruby-2.6.6.tar.gz" | sha256sum -c && \
124+
cd ruby-2.6.6 && ./configure && make && make install && rm ../ruby-2.6.6.tar.gz
125+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
126+
- systemctl enable ssh.service
127+
- name: debian-9
128+
image: debian:9
129+
driver_config:
130+
run_command: /bin/systemd
131+
cap_add:
132+
- SYS_ADMIN
133+
run_options:
134+
env: container=docker
135+
volume:
136+
- /sys/fs/cgroup:/sys/fs/cgroup
137+
provision_command:
138+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
139+
- systemctl enable ssh.service
140+
- name: debian-10
141+
image: debian:10
142+
driver_config:
143+
run_command: /sbin/init
144+
cap_add:
145+
- SYS_ADMIN
146+
run_options:
147+
env: container=docker
148+
volume:
149+
- /sys/fs/cgroup:/sys/fs/cgroup
150+
provision_command:
151+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
152+
- systemctl enable ssh.service
42153
- name: ubuntu-16.04
154+
image: ubuntu:16.04
155+
driver_config:
156+
run_command: /sbin/init
157+
cap_add:
158+
- SYS_ADMIN
159+
run_options:
160+
env: container=docker
161+
volume:
162+
- /sys/fs/cgroup:/sys/fs/cgroup
163+
provision_command:
164+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
165+
- systemctl enable ssh.service
43166
- name: ubuntu-18.04
167+
image: ubuntu:18.04
168+
driver_config:
169+
run_command: /sbin/init
170+
cap_add:
171+
- SYS_ADMIN
172+
run_options:
173+
env: container=docker
174+
volume:
175+
- /sys/fs/cgroup:/sys/fs/cgroup
176+
provision_command:
177+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
178+
- systemctl enable ssh.service
179+
- name: ubuntu-20.04
180+
image: ubuntu:20.04
181+
driver_config:
182+
run_command: /sbin/init
183+
cap_add:
184+
- SYS_ADMIN
185+
run_options:
186+
env: container=docker
187+
volume:
188+
- /sys/fs/cgroup:/sys/fs/cgroup
189+
provision_command:
190+
- sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
191+
- systemctl enable ssh.service
44192

45193
suites:
46194
- name: default
195+
- name: custom
196+
provisioner:
197+
pillars:
198+
threatstack.sls:
199+
ts_agent_config_args: "--set log.maxSize 22"

Gemfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
source 'https://rubygems.org'
2-
31
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
42

53
group :development, :unit_tests do
6-
gem 'rake', :require => false
4+
gem 'rake', :require => false
75
end
86
group :system_tests do
9-
gem 'serverspec', :require => false
10-
gem 'test-kitchen', :require => false
11-
gem 'kitchen-salt', :require => false
12-
gem 'kitchen-vagrant', :require => false
7+
gem 'serverspec', :require => false
8+
gem 'test-kitchen', :require => false
9+
gem 'kitchen-salt', :require => false
10+
gem 'kitchen-docker', :require => false
1311
end
1412

1513
# vim:ft=ruby

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
A formula for installing Threat Stack agent
44

5-
This formula supports installing agent 1.x and agent 2.x
5+
This formula supports installing agent 2.x
6+
7+
>>>
8+
**No longer supports Threat Stack agent 1.x**
9+
10+
For 1.x support, look at the 2.x versions of this formula.
11+
>>>
612
713
## Available states
814
The following states are available:
@@ -16,13 +22,10 @@ The following states are available:
1622
* `ts_configure_agent:` [optional] If the agent should be configured during run. Set to False if installing agent into an AMI.
1723
* ex. True
1824
* `ts_agent_version:` [optional] Version of agent to install. By default if this setting is omitted, the latest version will be installed. Set a version to maintain consistency in an environment.
19-
* ex. "1.4.5.0ubuntu14.0"
20-
* `ts_agent_config_args:` [optional] Optional arguments to be passed to `cloudsight config` or `tsagent config` (depends on version of agent). Use this to enable optional features.
21-
* agent 1.x ex. "--enable_foo=1"
25+
* ex. "2.0.0.0ubuntu20.0"
2226
* agent 2.x ex. "--set enable_foo 1"
23-
* `ts_agent_extra_args:` [optional] Optional arguments to be passed to `cloudsight setup` or `tsagent setup` (depends on version of agent).
24-
* Please refer to the agent documentation or check the appropriate help output for `cloudsight setup`/`tsagent setup`.
25-
* `ts_agent_1x_platforms:` [required] This list defines the linux distributions (and versions) that should use the 1.x agent. This should only be changed if you have reviewed this salt formula, and understand the ramifications.
27+
* `ts_agent_extra_args:` [optional] Optional arguments to be passed to `tsagent setup`.
28+
* Please refer to the agent documentation or check the appropriate help output for `tsagent setup`.
2629

2730
## Testing
2831
There is currently no spec testing as a saltstack rspec module does not exist.
@@ -34,7 +37,7 @@ Integration testing can be configured two different ways.
3437
This method requires the following:
3538
* Uncommenting the section for `threatstack.sls` in `.kitchen.yml`
3639
* Commenting out the `pillars_from_files` section in `.kitchen.yml`
37-
* Setting `TS_DEPLOY_KEY` in the environment to a valid key value for tests to succeed.
40+
* Setting `TS_DEPLOY_KEY`, `TS_CONFIGURE_AGENT`, `TS_PACKAGE_VERSION` in the environment to a valid key value for tests to succeed.
3841
```
3942
export TS_DEPLOY_KEY='<deploy_key>'
4043
bundle exec kitchen test

pillar.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
deploy_key: "xxxx-xxxx-your-secret-key-xxxx"
2+
ts_agent_version: 2.3.0*
23
ts_configure_agent: True
3-
ts_agent_version: 1.4.5.0ubuntu14.0
4-
ts_agent_config_args: '--enable_foo=1'
54
ts_agent_extra_args: ''
6-
ts_agent_1x_platforms: ['CentOS-6', 'RHEL-6', 'Ubuntu-trusty', 'Debian-wheezy']
5+
ts_agent_config_args: ''
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'serverspec'
2+
3+
set :backend, :exec
4+
5+
describe package('threatstack-agent') do
6+
it { should be_installed }
7+
end
8+
9+
describe service('threatstack') do
10+
it { should be_running }
11+
it { should be_enabled }
12+
end
13+
14+
describe command('tsagent config --list') do
15+
its(:stdout) { should match /log.maxSize=22/ } # rubocop: disable Lint/AmbiguousRegexpLiteral
16+
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'serverspec'
2+
3+
set :backend, :exec
4+
5+
describe package('threatstack-agent') do
6+
it { should be_installed }
7+
end
8+
9+
describe service('threatstack') do
10+
it { should be_running }
11+
it { should be_enabled }
12+
end
13+
14+
describe command('tsagent status') do
15+
# Sometimes due to other services, like auditd, the install would be successful, but then this service would get killed
16+
its(:stdout) { should match /UP Threat Stack Audit Collection/ } # rubocop: disable Lint/AmbiguousRegexpLiteral
17+
end

0 commit comments

Comments
 (0)