|
|
@ -99,6 +99,7 @@ module.exports = class Firewall { |
|
|
|
|
|
|
|
|
async addIptablesRule(source, destination, protocol, target) { |
|
|
async addIptablesRule(source, destination, protocol, target) { |
|
|
debug('Rule adding...'); |
|
|
debug('Rule adding...'); |
|
|
|
|
|
<<<<<<< HEAD |
|
|
<<<<<<< HEAD |
|
|
<<<<<<< HEAD |
|
|
// Validate target & protocol
|
|
|
// Validate target & protocol
|
|
|
if (!Util.isTarget(target) || !Util.isProtocol(protocol)) { |
|
|
if (!Util.isTarget(target) || !Util.isProtocol(protocol)) { |
|
|
@ -156,6 +157,16 @@ module.exports = class Firewall { |
|
|
// Validate protocol
|
|
|
// Validate protocol
|
|
|
if (!Util.isValidIptablesProtocol(protocol)) { |
|
|
if (!Util.isValidIptablesProtocol(protocol)) { |
|
|
throw new Error('Invalid protocol.'); |
|
|
throw new Error('Invalid protocol.'); |
|
|
|
|
|
======= |
|
|
|
|
|
// Validate target & protocol
|
|
|
|
|
|
if (!Util.isValidIptablesTarget(target) || !Util.isValidIptablesProtocol(protocol)) { |
|
|
|
|
|
throw new Error('Invalid target or protocol.'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If empty source or destination
|
|
|
|
|
|
if (!source || !destination) { |
|
|
|
|
|
throw new Error('Invalid source or destination address.') |
|
|
|
|
|
>>>>>>> a20e416 (fix: source & destination are required) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
|