|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esf.net.firewall.service.LocalRule
Creates an iptables command for a Local Rule, allowing an incoming port connection. CONFIGURATION Configuration will be accepted in the form of key/value pairs. The key/value pairs are strictly defined here: CONFIG_ENTRY -> KEY + "=" + VALUE KEY -> TYPE + INDEX + "_" + PARAM TYPE -> "LocalRule" INDEX -> "0" | "1" | "2" | ... | "N" PARAM (required) -> "port" | "protocol" PARAM (optional) -> "permittedNetwork" | "permittedMAC" | "sourcePortRange" VALUE -> (value of the specified parameter) EXAMPLE: LocalRule0_port=1234 LocalRule0_protocol=tcp LocalRule0_permittedNetwork=192.168.1.1 LocalRule0_permittedMAC=AA:BB:CC:DD:EE:FF LocalRule0_sourcePortRange=3333:4444
Constructor Summary | |
LocalRule()
Constructor of LocalRule object. |
|
LocalRule(int port,
java.lang.String protocol,
java.lang.String permittedNetwork,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Constructor of LocalRule object. |
Method Summary | |
java.lang.String |
getPermittedMAC()
Getter for permittedMAC |
java.lang.String |
getPermittedNetwork()
Getter for permittedNetwork |
int |
getPort()
Getter for port |
java.lang.String |
getProtocol()
Getter for protocol |
java.lang.String |
getSourcePortRange()
Getter for the sourcePortRange. |
boolean |
isComplete()
Returns true if the required LocalRule parameters have all been set. |
void |
setPermittedMAC(java.lang.String permittedMAC)
Setter for the permittedMAC. |
void |
setPermittedNetwork(java.lang.String permittedNetwork)
Setter for the permittedNetwork. |
void |
setPort(int port)
Setter for the port. |
void |
setProtocol(java.lang.String protocol)
Setter for the protocol. |
void |
setSourcePortRange(java.lang.String sourcePortRange)
Setter for the sourcePortRange. |
java.lang.String |
toString()
Converts the LocalRule to a String .
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LocalRule(int port, java.lang.String protocol, java.lang.String permittedNetwork, java.lang.String permittedMAC, java.lang.String sourcePortRange)
LocalRule
object.
port
- destination local IP port number to allowprotocol
- protocol of port (tcp, udp)sourcePortRange
- range of source ports allowed on IP connection (sourcePort1:sourcePort2)permittedNetwork
- source network or ip address from which connection is allowed (such as 192.168.1.0)permittedMAC
- MAC address from which connection is allowed (such as AA:BB:CC:DD:EE:FF)public LocalRule()
LocalRule
object.
Method Detail |
public boolean isComplete()
LocalRule
parameters have all been set. Returns false otherwise.
public void setProtocol(java.lang.String protocol)
protocol
- A String representing the protocol.public void setPermittedNetwork(java.lang.String permittedNetwork)
permittedNetwork
- A String representing the permittedNetwork.public void setPermittedMAC(java.lang.String permittedMAC)
permittedMAC
- A String representing the permittedMAC.public void setSourcePortRange(java.lang.String sourcePortRange)
sourcePortRange
- A String representing the sourcePortRange.public void setPort(int port)
port
- An int representing the port.public java.lang.String getSourcePortRange()
public int getPort()
public java.lang.String getProtocol()
public java.lang.String getPermittedNetwork()
public java.lang.String getPermittedMAC()
public java.lang.String toString()
LocalRule
to a String
.
Returns one of the following iptables strings depending on the LocalRule
format:
iptables -I INPUT -p {protocol} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -m mac --mac-source {permittedMAC} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -m mac --mac-source {permittedMAC} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} -m mac --mac-source {permittedMAC} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} -m mac --mac-source {permittedMAC} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |