public interface ILinuxFirewallService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SERVICE_NAME
service name of this interface for the bundle activator
(com.esf.networking.firewall.service)
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomRule(java.lang.String rule)
Adds a custom rule to the firewall.
|
void |
addLocalRule(int port,
java.lang.String protocol,
java.lang.String permittedNetwork,
java.lang.String permittedNetworkMask,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Adds a new Local Port rule to the firewall, to allow incoming port
connections.
|
void |
addLocalRule(java.lang.String portRange,
java.lang.String protocol,
java.lang.String permittedNetwork,
java.lang.String permittedNetworkMask,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Adds a new Local Port rule to the firewall, to allow incoming port
connections.
|
void |
addNatRule(java.lang.String sourceNetwork,
java.lang.String sourceInterface,
java.lang.String destinationInterface,
boolean masquerade)
Adds a new Network Address Translation rule to the firewall.
|
void |
addPortForwardRule(java.lang.String iface,
java.lang.String address,
java.lang.String protocol,
int inPort,
int outPort,
java.lang.String permittedNetwork,
java.lang.String permittedNetworkMask,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Adds a new Port Forwarding rule to firewall.
|
void |
allowIcmp()
sets the rule to allow ICMP packets through on all interfaces.
|
void |
blockAllPorts()
blocks all ports in the firewall configuration.
|
void |
deleteAllLocalRules()
Removes all Local Port rules from this firewall configuration.
|
void |
deleteAllNatRules()
Removes all Network Address Translation rules from this firewall
configuration.
|
void |
deleteAllPortForwardRules()
Removes all Port Forwarding rules from this firewall configuration.
|
void |
deleteLocalRule(int index)
Deletes a Local Rule from this firewall configuration.
|
void |
deleteNatRule(int index)
Deletes a Network Address Translation rule from this firewall
configuration.
|
void |
deletePortForwardRule(int index)
Deletes a Port Forwarding rule from this firewall configuration.
|
void |
disableForwarding()
disables forwarding by setting forwarding to enabled in /proc (echo 0 > /proc/sys/net/ipv4/ip_forward).
|
void |
disableIcmp()
sets the rule to not allow ICMP packets through on all interfaces
|
void |
enableForwarding()
enables forwarding by setting forwarding to enabled in /proc (echo 1 > /proc/sys/net/ipv4/ip_forward).
|
java.util.ArrayList |
getLocalRules()
Gets a list of all Local Port rules from this firewall configuration.
|
java.util.ArrayList |
getNatRules()
Gets a list of all Network Address Translation rules from this firewall
configuration.
|
java.util.ArrayList |
getPortForwardRules()
Gets a list of all Port Forwarding rules from this firewall
configuration.
|
void |
runScript()
Runs the currently stored firewall configuration script.
|
void |
unblockAllPorts()
unblocks all ports in the firewall configuration.
|
void |
writeFile()
Writes a new firewall configuration script.
|
static final java.lang.String SERVICE_NAME
void writeFile() throws java.lang.Exception
java.lang.Exception
- If any access errors occur.void runScript() throws java.lang.Exception
java.lang.Exception
void addLocalRule(int port, java.lang.String protocol, java.lang.String permittedNetwork, java.lang.String permittedNetworkMask, java.lang.String permittedMAC, java.lang.String sourcePortRange) throws java.lang.Exception
port
- local port number for the incoming connectionprotocol
- network protocol, as String
permittedNetwork
- permitted source IP address or network, as
String
permittedNetworkMask
- permitted source network mask, as
String
permittedMAC
- permitted source MAC address, as String
sourcePortRange
- permitted source port range for incoming
connection, as String
java.lang.Exception
- If rule cannot be addedvoid addLocalRule(java.lang.String portRange, java.lang.String protocol, java.lang.String permittedNetwork, java.lang.String permittedNetworkMask, java.lang.String permittedMAC, java.lang.String sourcePortRange) throws java.lang.Exception
portRange
- local port range for the incoming connectionprotocol
- network protocol, as String
permittedNetwork
- permitted source IP address or network, as
String
permittedNetworkMask
- permitted source network mask, as
String
permittedMAC
- permitted source MAC address, as String
sourcePortRange
- permitted source port range for incoming
connection, as String
java.lang.Exception
- If rule cannot be addedvoid addPortForwardRule(java.lang.String iface, java.lang.String address, java.lang.String protocol, int inPort, int outPort, java.lang.String permittedNetwork, java.lang.String permittedNetworkMask, java.lang.String permittedMAC, java.lang.String sourcePortRange) throws java.lang.Exception
iface
- source interface name, as String
address
- destination IP address to forward to, as
String
protocol
- network protocol, as String
inPort
- incoming IP portoutPort
- forwarded destination IP portpermittedNetwork
- permitted source IP address or network, as
String
permittedNetworkMask
- permitted source network mask, as
String
permittedMAC
- permitted source MAC address, as String
sourcePortRange
- permitted source port range for incoming
connection, as String
java.lang.Exception
- If rule cannot be addedvoid addNatRule(java.lang.String sourceNetwork, java.lang.String sourceInterface, java.lang.String destinationInterface, boolean masquerade) throws java.lang.Exception
sourceNetwork
- source IP address or network, as String
sourceInterface
- source interface name, as String
destinationInterface
- destination interface name, as
String
masquerade
- add masquerade entry, as boolean
java.lang.Exception
- If rule cannot be addedvoid addCustomRule(java.lang.String rule) throws java.lang.Exception
rule
- custom rule, as String
java.lang.Exception
- If rule cannot be addedjava.util.ArrayList getLocalRules() throws java.lang.Exception
ArrayList
of Local Port rulesjava.lang.Exception
- If unable to get Local Port rulesjava.util.ArrayList getPortForwardRules() throws java.lang.Exception
ArrayList
of Port Forwarding rulesjava.lang.Exception
- If unable to get Port Forwarding rulesjava.util.ArrayList getNatRules() throws java.lang.Exception
ArrayList
of NAT rulesjava.lang.Exception
- If unable to get NAT rulesvoid deleteLocalRule(int index) throws java.lang.Exception
index
- index in the ArrayList
of the Local Rule to be
deletedjava.lang.Exception
- If unable to delete Local Rulevoid deletePortForwardRule(int index) throws java.lang.Exception
index
- index in the ArrayList
of the Port Forwarding
rule to be deletedjava.lang.Exception
- If unable to delete Port Forwarding rulevoid deleteNatRule(int index) throws java.lang.Exception
index
- index in the ArrayList
of the NAT rule to be
deletedjava.lang.Exception
- If unable to delete NAT rulevoid deleteAllLocalRules() throws java.lang.Exception
java.lang.Exception
- If unable to delete all Local Port rulesvoid deleteAllPortForwardRules() throws java.lang.Exception
java.lang.Exception
- If unable to delete all Port Forwarding rulesvoid deleteAllNatRules() throws java.lang.Exception
java.lang.Exception
- If unable to delete all NAT rulesvoid blockAllPorts() throws java.lang.Exception
java.lang.Exception
- If unable to block all portsvoid unblockAllPorts() throws java.lang.Exception
java.lang.Exception
- If unable to unblock all portsvoid allowIcmp()
void disableIcmp()
void enableForwarding()
void disableForwarding()
Copyright © 2009 Eurotech Inc. All rights reserved.