Skip to content

Commit

Permalink
cleanup, bump to 0.4.2
Browse files Browse the repository at this point in the history
- fix commas in multi-port output
- modify usage for web slightly
- add README.md
  • Loading branch information
Jake Teton-Landis committed Feb 22, 2015
1 parent f731a73 commit 72c4ac8
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 6 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# firewall-my-system - instant firewall generator

## Installation

npm install --global firewall-my-systems

## Usage

### Command-line

`firewall-my-systems` can be run on the command line, or accessed over HTTP
using the server. Here's the usage for the command:

firewall-my-system FIREWALL PORTSPEC`
FIREWALL = iptables | pf | ipfw
PORTSPEC = (t|u)PORTNUMBER [PORTSPEC]
t for TCP
u for UDP

The firewalls generated are actually shell scripts that set up those firewalls,
so feel free to pipe the output of this command into bash or something.

Example: generate an iptables firewall script opening TCP 22, 80, and UDP 5000

firewall-my-system iptables t22 t80 u5000

### Server

To start the server, run `firewall-my-systems-server`. You can specify the port
by setting the `PORT` env variable: `PORT=80 firewall-my-systems-server`.

Accessing the server is almost identical to using the command line, except
instead of spaces deliminating positional arguments, slashes are used instead.
To run the example above, you would access
http://firewallmy.systems/iptables/t22/t80/u5000, although you could use commas
or any other non-number character to seperate portspecs.
4 changes: 2 additions & 2 deletions firewall/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ module.exports = class BaseFirewall {
// finally
build() {
return this.header() +
this.tcp.map(this.buildTcp.bind(this)) +
this.udp.map(this.buildUdp.bind(this)) +
this.tcp.map(this.buildTcp.bind(this)).join('') +
this.udp.map(this.buildUdp.bind(this)).join('') +
this.footer()
}
}
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "firewall-my-systems",
"version": "0.4.1",
"description": "quick firewall rules builder",
"version": "0.4.2",
"description": "quick firewall rules builder for iptables, ipfw, and pf",
"main": "index.js",
"bin": {
"firewall-my-systems-server": "./launch-server.js",
Expand All @@ -11,6 +11,10 @@
"start": "./node_modules/.bin/supervisor -e js,jsx,json,styl launch-server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/berke1337/firewallmy.systems"
},
"keywords": [
"firewall",
"rules",
Expand All @@ -20,11 +24,17 @@
"builder",
"easy"
],
"author": "Jake Teton-Landis",
"author": {
"name": "Jake Teton-Landis",
"url": "http://jake.teton-landis.org",
"email": "[email protected]"
},
"license": "GPL",
"dependencies": {
"babel": "^4.4.3",
"express": "^4.11.2",
"express": "^4.11.2"
},
"devDependencies": {
"supervisor": "^0.6.0"
}
}
3 changes: 3 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const { make } = require('./')
const USAGE = require('./usage')

const SH_USAGE = `echo '${USAGE}'`
.replace(/firewall-my-system/g, 'firewallmy.systems')
.replace(' FIREWALL PORTSPEC', '/FIREWALL/PORTSPEC')
.replace(' iptables t22 t80 u5000', '/iptables/t22/t80/u5000/')

app.get('/', (req, res) => {
// pls don't re-indent this -- it looks nice ;)
Expand Down

0 comments on commit 72c4ac8

Please sign in to comment.