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

Plugin-sandbox-based OUTCONTAINERSAFE Mode #349

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1a5823b
plugincont wip
sahilsuneja1 Nov 14, 2017
3fbb250
lugincont wip
sahilsuneja1 Nov 16, 2017
12fa3c7
plugincont wip
sahilsuneja1 Nov 16, 2017
b8081d5
plugincont wip
sahilsuneja1 Nov 16, 2017
630d9d3
plugincont wip
sahilsuneja1 Nov 17, 2017
5e9aee4
plugincont wip
sahilsuneja1 Nov 20, 2017
a198f04
plugincont wip
sahilsuneja1 Nov 20, 2017
c19ff96
plugincont wip
sahilsuneja1 Nov 20, 2017
1acc702
plugincont wip
sahilsuneja1 Nov 21, 2017
9b1e46f
plugincont wip
sahilsuneja1 Nov 22, 2017
2523ca8
plugincont wip
sahilsuneja1 Nov 28, 2017
e31e55f
plugincont wip
sahilsuneja1 Nov 28, 2017
45360fb
plugincont wip
sahilsuneja1 Nov 30, 2017
2934140
plugincont wip
sahilsuneja1 Nov 30, 2017
0afc1b2
plugincont wip
sahilsuneja1 Nov 30, 2017
fd7a7e7
plugincont wip
sahilsuneja1 Nov 30, 2017
7548b03
plugincont wip
sahilsuneja1 Dec 1, 2017
c099c66
plugincont wip
sahilsuneja1 Dec 1, 2017
1b8ca7e
plugincont wip
sahilsuneja1 Dec 1, 2017
7dd606b
plugincont wip
sahilsuneja1 Dec 2, 2017
c4823aa
safe plugin mode with tests
sahilsuneja1 Dec 5, 2017
3593694
safe plugin mode with tests
sahilsuneja1 Dec 5, 2017
2ea4e3e
safe plugin mode with tests
sahilsuneja1 Dec 5, 2017
76af887
safe plugin mode with tests
sahilsuneja1 Dec 5, 2017
59b1d88
plugincont wip
sahilsuneja1 Dec 5, 2017
86c319b
plugincont wip
sahilsuneja1 Dec 5, 2017
5b9a9b5
safe plugin mode with tests
sahilsuneja1 Dec 5, 2017
1cf1d34
plugincont wip
sahilsuneja1 Dec 5, 2017
5ead8f5
plugincont wip
sahilsuneja1 Dec 5, 2017
6919e9e
plugincont wip
sahilsuneja1 Dec 5, 2017
49e9485
plugincont wip
sahilsuneja1 Dec 5, 2017
05971e9
plugincont wip
sahilsuneja1 Dec 6, 2017
f645e37
plugincont wip
sahilsuneja1 Dec 6, 2017
0007e6b
plugincont wip
sahilsuneja1 Dec 6, 2017
4a441ed
plugincont wip
sahilsuneja1 Dec 6, 2017
1bfedd3
plugincont wip
sahilsuneja1 Dec 6, 2017
6016429
plugincont wip
sahilsuneja1 Dec 6, 2017
3072498
plugincont wip
sahilsuneja1 Dec 6, 2017
5f67f7a
plugincont wipush
sahilsuneja1 Dec 6, 2017
0e1d95a
adding pids limit to plugin cont
sahilsuneja1 Jan 11, 2018
260d659
remoing unused imports
sahilsuneja1 Feb 22, 2018
92e5354
more cgroup limits on plugin cont
sahilsuneja1 Feb 22, 2018
c16ecb0
Merge branch 'master' of https://github.com/cloudviz/agentless-system…
sahilsuneja1 Feb 22, 2018
9f67138
merge fix for new docker version
sahilsuneja1 Feb 22, 2018
164d25c
flake8
sahilsuneja1 Feb 22, 2018
bf1ff67
cgroupfs shared
sahilsuneja1 Feb 23, 2018
4193706
docker py version in requirements
sahilsuneja1 Feb 23, 2018
7853404
docker py version reduction for travis
sahilsuneja1 Feb 23, 2018
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
1 change: 0 additions & 1 deletion .cache/v/cache/lastfailed

This file was deleted.

1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ exclude_lines =
ignore_errors = True
omit =
tests/*
crawler/utils/plugincont/*
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ sudo: required
dist: trusty
group: deprecated-2017Q4
language: python

services:
- docker

Expand Down Expand Up @@ -35,6 +34,8 @@ before_install:
- cp -r psvmi/maps maps
- cp -r psvmi/offsets offsets
- cp psvmi/header.h .
# for safe plugin mode
- sudo apt-get install libcap-dev iptables iptables-dev

# command to install dependencies
# XXX: Now mock complains if we don't `sudo pip install`.
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ COPY \
RUN dpkg -i /tmp/python-socket-datacollector_*_all.deb && \
apt-get -y update && \
apt-get -y install libpcap0.8 && \
apt-get -y install libcap-dev && \
apt-get -y install iptables && \
apt-get -y install iptables-dev && \
dpkg -i /tmp/softflowd_0.9.*_amd64.deb && \
pip install pyroute2 py-radix requests-unixsocket json-rpc && \
dpkg -i /tmp/python-conntrackprobe_*_all.deb && \
Expand Down
1 change: 0 additions & 1 deletion crawler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ binaries/
kafka-producer.py
timeout.py
alchemy.py
*.json
*.sh
18 changes: 12 additions & 6 deletions crawler/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@


def list_all_containers(user_list='ALL', host_namespace='',
ignore_raw_containers=True):
ignore_raw_containers=True,
group_by_pid_namespace=True):
"""
Returns a list of all running containers in the host.

Expand All @@ -24,10 +25,13 @@ def list_all_containers(user_list='ALL', host_namespace='',

for _container in get_docker_containers(host_namespace=host_namespace,
user_list=user_list):
curr_ns = _container.process_namespace
if curr_ns not in visited_ns:
visited_ns.add(curr_ns)
if group_by_pid_namespace is False:
yield _container
else:
curr_ns = _container.process_namespace
if curr_ns not in visited_ns:
visited_ns.add(curr_ns)
yield _container

# XXX get list of rkt containers

Expand Down Expand Up @@ -62,7 +66,8 @@ def get_containers(
environment='cloudsight',
host_namespace=misc.get_host_ipaddr(),
user_list='ALL',
ignore_raw_containers=True
ignore_raw_containers=True,
group_by_pid_namespace=True
):
"""
Returns a list of all containers running in the host.
Expand All @@ -79,7 +84,8 @@ def get_containers(
"""
filtered_list = []
containers_list = list_all_containers(user_list, host_namespace,
ignore_raw_containers)
ignore_raw_containers,
group_by_pid_namespace)
for _container in containers_list:
default_environment = 'cloudsight'
if (environment != default_environment and
Expand Down
4 changes: 2 additions & 2 deletions crawler/crawler.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

[[ process_host ]]

[[ ruby_pkg ]]
[[ rubypackage ]]

[[ python_pkg ]]
[[ pythonpackage ]]
avoid_setns = False

[[ fprobe_container ]]
Expand Down
13 changes: 12 additions & 1 deletion crawler/crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from worker import Worker
from containers_crawler import ContainersCrawler
from safe_containers_crawler import SafeContainersCrawler
from utils import misc
from crawlmodes import Modes
from emitters_manager import EmittersManager
Expand Down Expand Up @@ -93,11 +94,12 @@ def main():
Modes.OUTVM,
Modes.MOUNTPOINT,
Modes.OUTCONTAINER,
Modes.OUTCONTAINERSAFE,
Modes.MESOS,
],
default=Modes.INVM,
help='The crawler mode: '
'{INVM,OUTVM,MOUNTPOINT,OUTCONTAINER}. '
'{INVM,OUTVM,MOUNTPOINT,OUTCONTAINER,OUTCONTAINERSAFE}. '
'Defaults to INVM',
)
parser.add_argument(
Expand Down Expand Up @@ -222,6 +224,15 @@ def main():
host_namespace=args.namespace,
plugin_places=args.plugin_places,
options=options)
elif args.crawlmode == 'OUTCONTAINERSAFE':
crawler = SafeContainersCrawler(
features=args.features,
environment=args.environment,
user_list=args.crawlContainers,
host_namespace=args.namespace,
plugin_places=args.plugin_places,
frequency=args.frequency,
options=options)
else:
raise NotImplementedError('Invalid crawlmode')

Expand Down
1 change: 1 addition & 0 deletions crawler/crawlmodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
OUTVM='OUTVM',
MOUNTPOINT='MOUNTPOINT',
OUTCONTAINER='OUTCONTAINER',
OUTCONTAINERSAFE='OUTCONTAINERSAFE',
MESOS='MESOS')
2 changes: 1 addition & 1 deletion crawler/dockercontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def __init__(
self.volumes = inspect.get('Volumes')
self.image_name = inspect['Config']['Image']
self.inspect = inspect

self.plugincont = None
self.process_namespace = (process_namespace or
namespace.get_pid_namespace(self.pid))

Expand Down
Loading