Пример #1
0
  private String getForwardingNamedFile() {
    StringBuilder sb =
        new StringBuilder()
            .append("// Forwarding and Caching Name Server Configuration\n")
            .append("options {\n")
            .append("\tdirectory \"/var/named\";\n")
            .append("\tversion \"not currently available\";\n")
            .append("\tforwarders {");
    Set<IP4Address> forwarders = m_dnsServerConfigIP4.getForwarders();
    for (IP4Address forwarder : forwarders) {
      sb.append(forwarder.getHostAddress()).append(";");
    }
    sb.append("};\n");

    sb.append("\tforward only;\n")
        .append("\tallow-transfer{\"none\";};\n")
        .append("\tallow-query {");
    Set<NetworkPair<IP4Address>> allowedNetworks = m_dnsServerConfigIP4.getAllowedNetworks();
    for (NetworkPair<IP4Address> pair : allowedNetworks) {
      sb.append(pair.getIpAddress().getHostAddress())
          .append("/")
          .append(pair.getPrefix())
          .append(";");
    }
    sb.append("};\n");
    sb.append("\tmax-cache-ttl 30;\n");
    sb.append("\tmax-ncache-ttl 30;\n");
    sb.append("};\n")
        .append("logging{\n")
        .append("\tchannel named_log {\n")
        .append("\t\tfile \"")
        .append(s_logFileName)
        .append("\" versions 3;\n")
        .append("\t\tseverity info;\n")
        .append("\t\tprint-severity yes;\n")
        .append("\t\tprint-time yes;\n")
        .append("\t\tprint-category yes;\n")
        .append("\t};\n")
        .append("\tcategory default{\n")
        .append("\t\tnamed_log;\n")
        .append("\t};\n")
        .append("};\n")
        .append("zone \".\" IN {\n")
        .append("\ttype hint;\n")
        .append("\tfile \"named.ca\";\n")
        .append("};\n")
        .append("include \"")
        .append(s_rfc1912ZonesFilename)
        .append("\";\n");

    return sb.toString();
  }
Пример #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   FirewallOpenPortConfigIP other = (FirewallOpenPortConfigIP) obj;
   if (permittedInterfaceName == null) {
     if (other.permittedInterfaceName != null) return false;
   } else if (!permittedInterfaceName.equals(other.permittedInterfaceName)) return false;
   if (permittedMac == null) {
     if (other.permittedMac != null) return false;
   } else if (!permittedMac.equals(other.permittedMac)) return false;
   if (permittedNetwork == null) {
     if (other.permittedNetwork != null) return false;
   } else if (!permittedNetwork.equals(other.permittedNetwork)) return false;
   if (port != other.port) return false;
   if (protocol != other.protocol) return false;
   if (sourcePortRange == null) {
     if (other.sourcePortRange != null) return false;
   } else if (!sourcePortRange.equals(other.sourcePortRange)) return false;
   if (unpermittedInterfaceName == null) {
     if (other.unpermittedInterfaceName != null) return false;
   } else if (!unpermittedInterfaceName.equals(other.unpermittedInterfaceName)) return false;
   return true;
 }
Пример #3
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result =
       prime * result + ((permittedInterfaceName == null) ? 0 : permittedInterfaceName.hashCode());
   result = prime * result + ((permittedMac == null) ? 0 : permittedMac.hashCode());
   result = prime * result + ((permittedNetwork == null) ? 0 : permittedNetwork.hashCode());
   result = prime * result + port;
   result = prime * result + ((protocol == null) ? 0 : protocol.hashCode());
   result = prime * result + ((sourcePortRange == null) ? 0 : sourcePortRange.hashCode());
   result =
       prime * result
           + ((unpermittedInterfaceName == null) ? 0 : unpermittedInterfaceName.hashCode());
   return result;
 }