|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.eurotech.framework.linux.net.iptables.LocalRule
public class 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,
String protocol,
NetworkPair<IP4Address> permittedNetwork,
String permittedMAC,
String sourcePortRange)
Constructor of LocalRule object. |
|
LocalRule(String portRange,
String protocol,
NetworkPair<IP4Address> permittedNetwork,
String permittedMAC,
String sourcePortRange)
Constructor of LocalRule object. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
String |
getPermittedMAC()
Getter for permittedMAC |
NetworkPair<IP4Address> |
getPermittedNetwork()
Getter for permittedNetwork |
int |
getPort()
Getter for port |
String |
getPortRange()
Getter for portRange |
String |
getProtocol()
Getter for protocol |
String |
getSourcePortRange()
Getter for the sourcePortRange. |
int |
hashCode()
|
boolean |
isComplete()
Returns true if the required LocalRule parameters have all been set. |
void |
setPermittedMAC(String permittedMAC)
Setter for the permittedMAC. |
void |
setPermittedNetwork(NetworkPair<IP4Address> permittedNetwork)
Setter for the permittedNetwork. |
void |
setPort(int port)
Setter for the port. |
void |
setPortRange(String portRange)
Setter for the portRange |
void |
setProtocol(String protocol)
Setter for the protocol. |
void |
setSourcePortRange(String sourcePortRange)
Setter for the sourcePortRange. |
String |
toString()
Converts the LocalRule to a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LocalRule(int port,
String protocol,
NetworkPair<IP4Address> permittedNetwork,
String permittedMAC,
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/24)permittedMAC - MAC address from which connection is allowed (such as AA:BB:CC:DD:EE:FF)
public LocalRule(String portRange,
String protocol,
NetworkPair<IP4Address> permittedNetwork,
String permittedMAC,
String sourcePortRange)
LocalRule object.
portRange - destination local IP port range to allow of the form X:Y where Xprotocol - 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/24)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(String protocol)
protocol - A String representing the protocol.public void setPermittedNetwork(NetworkPair<IP4Address> permittedNetwork)
permittedNetwork - A String representing the permittedNetwork.public void setPermittedMAC(String permittedMAC)
permittedMAC - A String representing the permittedMAC.public void setSourcePortRange(String sourcePortRange)
sourcePortRange - A String representing the sourcePortRange.public void setPort(int port)
port - An int representing the port.public void setPortRange(String portRange)
portRange - A string representing the port range of the form X:Y where X < Y and both are valid portspublic String getSourcePortRange()
public int getPort()
public String getPortRange()
public String getProtocol()
public NetworkPair<IP4Address> getPermittedNetwork()
throws EsfException
EsfExceptionpublic String getPermittedMAC()
public 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
toString in class Objectpublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||