Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working prototype (with ufw service)
- Loading branch information
Mark
committed
Apr 8, 2013
1 parent
832dc36
commit 9ba0700
Showing
6 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var ServiceLogic = require('../ServiceLogic'); | ||
|
||
var ServiceLogic_Fake = module.exports = ServiceLogic.extend({ | ||
|
||
doSwitchUp : function (next) { | ||
setTimeout(function () { | ||
next(null); | ||
}, 1000); | ||
}, | ||
|
||
doSwitchDown : function (next) { | ||
setTimeout(function () { | ||
next(null); | ||
}, 1000); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var path = require('path'); | ||
var child_process = require('child_process'); | ||
var ServiceLogic = require('../ServiceLogic'); | ||
|
||
var SCRIPT_UP = path.resolve(__dirname + '/ufw/ufw-up.sh'); | ||
var SCRIPT_DOWN = path.resolve(__dirname + '/ufw/ufw-down.sh'); | ||
|
||
|
||
var ServiceLogic_Ufw = module.exports = ServiceLogic.extend({ | ||
|
||
doSwitchUp : function (next) { | ||
child_process.exec(SCRIPT_UP, function (error, stdout, stderr) { | ||
if(error) { | ||
next(error); | ||
return; | ||
} | ||
next(); | ||
}); | ||
}, | ||
|
||
doSwitchDown : function (next) { | ||
child_process.exec(SCRIPT_DOWN, function (error, stdout, stderr) { | ||
if(error) { | ||
next(error); | ||
return; | ||
} | ||
next(); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
UFW=`which ufw` | ||
${UFW} reject out http | ||
${UFW} reject out https |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
UFW=`which ufw` | ||
${UFW} --force delete reject out http | ||
${UFW} --force delete reject out https |