Skip to content

Commit

Permalink
Change build to be contained to the VM.
Browse files Browse the repository at this point in the history
Change authentication to support permissions.
Remove kafka and postgres as dependencies.
Updated README for simplified build.
  • Loading branch information
rammie committed Aug 15, 2014
1 parent dc48e0b commit f67daa6
Show file tree
Hide file tree
Showing 27 changed files with 137 additions and 641 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -5,7 +5,12 @@ logs
# Runtime data
pids
*.pid
*.seed

# Pcap files
*.pcap

# Config overrides
config.json

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
Expand Down
7 changes: 1 addition & 6 deletions .jshintrc
Expand Up @@ -10,11 +10,10 @@


"predef" : [ // extra globals
"Backbone",
"angular",
"JST",
"MTD",
"google",
"_",

// Tests
"assert",
Expand Down Expand Up @@ -52,9 +51,6 @@
// Development
"debug" : false, // warn about debugger statements

// ECMAScript 5
"es5" : true, // allow ES5 syntax

// Enforcing
"bitwise" : true, // prohibit the use of bitwise operations (slow and '&' is usually supposed to be '&&')
"curly" : true, // require {} for all blocks/scopes
Expand All @@ -67,5 +63,4 @@
"sub" : true, // allow all subscript notation, including '[]'
"laxcomma" : true, // allow commas after line breaks in lists
"strict" : false // don't force strict mode

}
2 changes: 2 additions & 0 deletions .nodemonignore
@@ -0,0 +1,2 @@
.vagrant
node_modules
43 changes: 14 additions & 29 deletions README.md
Expand Up @@ -7,57 +7,41 @@ User interface for OpenSOC

## Hacking

### Step 1: Ensure you have a proper Node ~> 0.10.x installed

If you're on a Mac, [Homebrew](http://brew.sh) is the recommended way to install NodeJS with ```brew install node```.

[Here](.jshintrc) is a sample jshintrc file. Make sure to save it as ```.jshintrc``` in your home directory.

#### Optional: Ensure you have the tshark commandline utility

If you'd like to experiment with the PCAP panel type, you'll need tshark to parse the sample pcaps. This is part of Wireshark and can be installed with Homebrew as well with ```brew install wireshark```.

### Step 2: Install Virtualbox and Vagrant
### Step 1: Install Virtualbox and Vagrant

Download the latest package for your platform here:

1. [Virtualbox](https://www.virtualbox.org/wiki/Downloads)
2. [Vagrant](https://www.vagrantup.com/downloads.html)

### Step 3: Install library dependencies
### Step 2: Clone repo

```bash
git clone git@github.com:OpenSOC/opensoc-ui.git
cd opensoc-ui
npm install
```

If you get an error complaining about missing pg headers, you need to install the Postgres development headers. On Mac this is simply ```brew install postgresql```

### Step 4: Download and provision the development environment
### Step 3: Download and provision the development environment

```bash
vagrant up
```

You might see a couple warnings, but usually these can be ignored. Check for any obvious errors as this can cause problems running the portal later.

### Step 5: Migrate the DB

You'll need to migrate the database for both the development (default) and test environments:
### Step 4: SSH into the vm
All dependencies will be installed in the VM. The repository root is shared between the host and VM. The shared volume is mounted at /vagrant. Use the following command to ssh into the newly built VM:

```bash
script/migrate up
script/migrate up -e test
vagrant ssh
cd vagrant
```

You should see no errors.

### Step 6: Seed the development VM
### Step 5: Seed the development VM

This will populate dummy data from data/*.json into the Elasticsearch development instance.

First, take a look at the [fetch](script/fetch.js) script to ensure it's pulling from the proper indices. Then run it like so:
Take a look at the [fetch](script/fetch.js) script to ensure it's pulling from the proper indices. Then run it like so:

```bash
ES_HOST=changeme.com script/es_fetch
Expand All @@ -71,27 +55,28 @@ script/es_seed

Of course, you can always populate your ES indices as you see fit.

For Postgres, there's ```script/pg_seed``` which loads the seed data from ```seed/pg/*.json``` into Postgres.

For authentication, make sure you set up the LDAP directory structure with:

```bash
script/ldap_seed
```

### Step 7: Ensure tests pass
### Step 6: Ensure tests pass

You can now run the tests:

```bash
make test
```

### Step 8: Launch the server
### Step 7: Launch the server

The ```nodemon``` utility automatically watches for changed files and reloads the node server automatically.
The ```nodemon``` utility automatically watches for changed files and reloads the node server automatically. Run the following commands from with the vagrant vm.

```bash
vagrant ssh
cd /vagrant
npm install -g nodemon
nodemon
```
Expand Down
2 changes: 2 additions & 0 deletions Vagrantfile
Expand Up @@ -14,6 +14,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.provision "shell", path: 'script/provision'


config.vm.network :forwarded_port, guest: 5000, host: 5000
# Port Forwarding not needed if VM is on NAT'd net
# Elasticsearch
# config.vm.network :forwarded_port, guest: 9200, host: 9200
Expand Down
22 changes: 0 additions & 22 deletions database.json

This file was deleted.

29 changes: 29 additions & 0 deletions lib/config.json
Expand Up @@ -16,8 +16,37 @@
"url": "ldap://192.168.33.10:389",
"searchBase": "dc=opensoc,dc=dev",
"searchFilter": "(mail={{username}})",
"searchAttributes": ["mail", "givenName", "memberOf"],
"adminDn": "cn=admin,dc=opensoc,dc=dev",
"adminPassword": "opensoc"
},
"permissions": {
"pcap": "cn=investigators,ou=groups,dc=opensoc,dc=dev"
}
},
"vagrant": {
"elasticsearch": {
"host": "127.0.0.1",
"port": 9200
},
"zookeeper": {
"host": "127.0.0.1",
"port": 2181
},
"redis": {
"host": "127.0.0.1",
"port": 6379
},
"ldap": {
"url": "ldap://127.0.0.1:389",
"searchBase": "dc=opensoc,dc=dev",
"searchFilter": "(mail={{username}})",
"searchAttributes": ["cn", "uid", "mail", "givenName", "sn", "memberOf"],
"adminDn": "cn=admin,dc=opensoc,dc=dev",
"adminPassword": "opensoc"
},
"permissions": {
"pcap": "cn=investigators,ou=groups,dc=opensoc,dc=dev"
}
},
"ci": {
Expand Down
10 changes: 0 additions & 10 deletions lib/helpers/db.js

This file was deleted.

43 changes: 0 additions & 43 deletions lib/models/credential.js

This file was deleted.

30 changes: 0 additions & 30 deletions lib/models/user.js

This file was deleted.

0 comments on commit f67daa6

Please sign in to comment.