mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-05-01 22:57:33 +02:00
fix: Deprecated QString::endl
This commit is contained in:
parent
bc40683f2a
commit
085bc8a5aa
@ -80,14 +80,14 @@ CompilerDriver* CompilerDriver_iosacl::clone()
|
|||||||
|
|
||||||
void CompilerDriver_iosacl::printProlog(QTextStream &file, const string &prolog_code)
|
void CompilerDriver_iosacl::printProlog(QTextStream &file, const string &prolog_code)
|
||||||
{
|
{
|
||||||
file << endl;
|
file << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# Prolog script" << endl;
|
file << "# Prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << prolog_code << endl;
|
file << prolog_code << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# End of prolog script" << endl;
|
file << "# End of prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
||||||
@ -97,8 +97,7 @@ string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
|||||||
{
|
{
|
||||||
/* Generate short temporary ACL and assign it to all
|
/* Generate short temporary ACL and assign it to all
|
||||||
* interfaces. This ACL permits IPSEC (IP proto 50 and UDP port 500)
|
* interfaces. This ACL permits IPSEC (IP proto 50 and UDP port 500)
|
||||||
as well as ssh from given subnet to any.
|
as well as ssh from given subnet to any. */
|
||||||
*/
|
|
||||||
|
|
||||||
string temp_acl_addr = fw->getOptionsObject()->getStr(
|
string temp_acl_addr = fw->getOptionsObject()->getStr(
|
||||||
safety_net_install_acl_addr_option_name);
|
safety_net_install_acl_addr_option_name);
|
||||||
@ -201,7 +200,6 @@ string CompilerDriver_iosacl::safetyNetInstall(Firewall *fw)
|
|||||||
configlet.setVariable("management_addr", addr.c_str());
|
configlet.setVariable("management_addr", addr.c_str());
|
||||||
configlet.setVariable("management_netm", nnm.toString().c_str());
|
configlet.setVariable("management_netm", nnm.toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// find management interface
|
// find management interface
|
||||||
list<FWObject*> ll = fw->getByType(Interface::TYPENAME);
|
list<FWObject*> ll = fw->getByType(Interface::TYPENAME);
|
||||||
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
|
||||||
|
|||||||
@ -79,7 +79,7 @@ QString CompilerDriver_iosacl::assembleManifest(Cluster *, Firewall* , bool )
|
|||||||
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
||||||
|
|
||||||
script << "!" << manifestMarker()
|
script << "!" << manifestMarker()
|
||||||
<< "* " << this->escapeFileName(file_names[FW_FILE]) << endl;
|
<< "* " << this->escapeFileName(file_names[FW_FILE]) << '\n';
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,14 +80,14 @@ CompilerDriver* CompilerDriver_nxosacl::clone()
|
|||||||
|
|
||||||
void CompilerDriver_nxosacl::printProlog(QTextStream &file, const string &prolog_code)
|
void CompilerDriver_nxosacl::printProlog(QTextStream &file, const string &prolog_code)
|
||||||
{
|
{
|
||||||
file << endl;
|
file << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# Prolog script" << endl;
|
file << "# Prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << prolog_code << endl;
|
file << prolog_code << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# End of prolog script" << endl;
|
file << "# End of prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
string CompilerDriver_nxosacl::safetyNetInstall(Firewall *fw)
|
string CompilerDriver_nxosacl::safetyNetInstall(Firewall *fw)
|
||||||
|
|||||||
@ -79,7 +79,7 @@ QString CompilerDriver_nxosacl::assembleManifest(Cluster *, Firewall* , bool )
|
|||||||
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
||||||
|
|
||||||
script << "!" << manifestMarker()
|
script << "!" << manifestMarker()
|
||||||
<< "* " << this->escapeFileName(file_names[FW_FILE]) << endl;
|
<< "* " << this->escapeFileName(file_names[FW_FILE]) << '\n';
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -75,13 +75,13 @@ string CompilerDriver_pix::protocolInspectorCommands()
|
|||||||
|
|
||||||
void CompilerDriver_pix::printProlog(QTextStream &file, const string &prolog_code)
|
void CompilerDriver_pix::printProlog(QTextStream &file, const string &prolog_code)
|
||||||
{
|
{
|
||||||
file << endl;
|
file << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# Prolog script" << endl;
|
file << "# Prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << prolog_code << endl;
|
file << prolog_code << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# End of prolog script" << endl;
|
file << "# End of prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,7 +105,7 @@ QString CompilerDriver_pix::assembleManifest(Cluster*, Firewall*, bool)
|
|||||||
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
||||||
|
|
||||||
script << "!" << manifestMarker()
|
script << "!" << manifestMarker()
|
||||||
<< "* " << this->escapeFileName(file_names[FW_FILE]) << endl;
|
<< "* " << this->escapeFileName(file_names[FW_FILE]) << '\n';
|
||||||
|
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,13 +56,13 @@ CompilerDriver* CompilerDriver_procurve_acl::clone()
|
|||||||
void CompilerDriver_procurve_acl::printProlog(QTextStream &file,
|
void CompilerDriver_procurve_acl::printProlog(QTextStream &file,
|
||||||
const string &prolog_code)
|
const string &prolog_code)
|
||||||
{
|
{
|
||||||
file << endl;
|
file << '\n';
|
||||||
file << ";" << endl;
|
file << ";" << '\n';
|
||||||
file << "; Prolog script" << endl;
|
file << "; Prolog script" << '\n';
|
||||||
file << ";" << endl;
|
file << ";" << '\n';
|
||||||
file << prolog_code << endl;
|
file << prolog_code << '\n';
|
||||||
file << ";" << endl;
|
file << ";" << '\n';
|
||||||
file << "; End of prolog script" << endl;
|
file << "; End of prolog script" << '\n';
|
||||||
file << ";" << endl;
|
file << ";" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ QString CompilerDriver_procurve_acl::assembleManifest(Cluster*, Firewall*, bool)
|
|||||||
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
||||||
|
|
||||||
script << ";" << manifestMarker()
|
script << ";" << manifestMarker()
|
||||||
<< "* " << this->escapeFileName(file_names[FW_FILE]) << endl;
|
<< "* " << this->escapeFileName(file_names[FW_FILE]) << '\n';
|
||||||
|
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -657,7 +657,7 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
|||||||
script << QString::fromUtf8(generated_script.c_str());
|
script << QString::fromUtf8(generated_script.c_str());
|
||||||
script << QString::fromUtf8(routing_compiler->getCompiledScript().c_str());
|
script << QString::fromUtf8(routing_compiler->getCompiledScript().c_str());
|
||||||
|
|
||||||
script << endl;
|
script << '\n';
|
||||||
|
|
||||||
script_skeleton.setVariable("script_body", indent(4, script_buffer));
|
script_skeleton.setVariable("script_body", indent(4, script_buffer));
|
||||||
|
|
||||||
@ -676,8 +676,8 @@ QString CompilerDriver_ipt::run(const std::string &cluster_id,
|
|||||||
! fw->getOptionsObject()->getBool("use_iptables_restore"));
|
! fw->getOptionsObject()->getBool("use_iptables_restore"));
|
||||||
|
|
||||||
script_buffer = "";
|
script_buffer = "";
|
||||||
if (have_ipv4) script << " reset_iptables_v4" << endl;
|
if (have_ipv4) script << " reset_iptables_v4" << '\n';
|
||||||
if (have_ipv6) script << " reset_iptables_v6" << endl;
|
if (have_ipv6) script << " reset_iptables_v6" << '\n';
|
||||||
script_skeleton.setVariable("reset_all", script_buffer);
|
script_skeleton.setVariable("reset_all", script_buffer);
|
||||||
|
|
||||||
script_buffer = "";
|
script_buffer = "";
|
||||||
|
|||||||
@ -199,7 +199,7 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
|
|
||||||
stream << "MGM_DEV=\"";
|
stream << "MGM_DEV=\"";
|
||||||
stream << stringify(mgm_iface, " ").c_str();
|
stream << stringify(mgm_iface, " ").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* lookup Management IP address */
|
/* lookup Management IP address */
|
||||||
mgm_ip = options->getStr("secuwall_mgmt_mgmtaddr").c_str();
|
mgm_ip = options->getStr("secuwall_mgmt_mgmtaddr").c_str();
|
||||||
@ -221,7 +221,7 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
tmp_v.clear();
|
tmp_v.clear();
|
||||||
tokenize(mgm_ip.toStdString(), tmp_v, ",");
|
tokenize(mgm_ip.toStdString(), tmp_v, ",");
|
||||||
stream << stringify(tmp_v, " ").c_str();
|
stream << stringify(tmp_v, " ").c_str();
|
||||||
stream << s << "\"" << endl;
|
stream << s << "\"" << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
tmp_v.clear();
|
tmp_v.clear();
|
||||||
tokenize(options->getStr("secuwall_mgmt_loggingaddr"), tmp_v, ",");
|
tokenize(options->getStr("secuwall_mgmt_loggingaddr"), tmp_v, ",");
|
||||||
stream << stringify(tmp_v, " ").c_str();
|
stream << stringify(tmp_v, " ").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* SNMP-Server IP address */
|
/* SNMP-Server IP address */
|
||||||
snmp_ip = options->getStr("secuwall_mgmt_snmpaddr").c_str();
|
snmp_ip = options->getStr("secuwall_mgmt_snmpaddr").c_str();
|
||||||
@ -246,12 +246,12 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
tmp_v.clear();
|
tmp_v.clear();
|
||||||
tokenize(options->getStr("secuwall_mgmt_snmpaddr"), tmp_v, ",");
|
tokenize(options->getStr("secuwall_mgmt_snmpaddr"), tmp_v, ",");
|
||||||
stream << stringify(tmp_v, " ").c_str();
|
stream << stringify(tmp_v, " ").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* SNMP Community string */
|
/* SNMP Community string */
|
||||||
stream << "SNMP_COM=\"";
|
stream << "SNMP_COM=\"";
|
||||||
stream << options->getStr("secuwall_mgmt_rosnmp").c_str();
|
stream << options->getStr("secuwall_mgmt_rosnmp").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,17 +260,17 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
tmp_v.clear();
|
tmp_v.clear();
|
||||||
tokenize(options->getStr("secuwall_mgmt_ntpaddr"), tmp_v, ",");
|
tokenize(options->getStr("secuwall_mgmt_ntpaddr"), tmp_v, ",");
|
||||||
stream << stringify(tmp_v, " ").c_str();
|
stream << stringify(tmp_v, " ").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* /var partition */
|
/* /var partition */
|
||||||
stream << "VARPART=\"";
|
stream << "VARPART=\"";
|
||||||
stream << options->getStr("secuwall_mgmt_varpart").c_str();
|
stream << options->getStr("secuwall_mgmt_varpart").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Configuration partition */
|
/* Configuration partition */
|
||||||
stream << "CFGPART=\"";
|
stream << "CFGPART=\"";
|
||||||
stream << options->getStr("secuwall_mgmt_confpart").c_str();
|
stream << options->getStr("secuwall_mgmt_confpart").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Activate Nagios */
|
/* Activate Nagios */
|
||||||
stream << "NRPE=";
|
stream << "NRPE=";
|
||||||
@ -278,18 +278,18 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
s = options->getStr("secuwall_mgmt_nagiosaddr").c_str();
|
s = options->getStr("secuwall_mgmt_nagiosaddr").c_str();
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
{
|
{
|
||||||
stream << "yes" << endl;
|
stream << "yes" << '\n';
|
||||||
|
|
||||||
/* Nagios-Server IP-Address */
|
/* Nagios-Server IP-Address */
|
||||||
stream << "NRPE_IP=\"";
|
stream << "NRPE_IP=\"";
|
||||||
tmp_v.clear();
|
tmp_v.clear();
|
||||||
tokenize(s.toStdString(), tmp_v, ",");
|
tokenize(s.toStdString(), tmp_v, ",");
|
||||||
stream << stringify(tmp_v, " ").c_str();
|
stream << stringify(tmp_v, " ").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream << "no" << endl;
|
stream << "no" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VRRP interfaces */
|
/* VRRP interfaces */
|
||||||
@ -317,20 +317,20 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
stream << "VRRPD=";
|
stream << "VRRPD=";
|
||||||
if (options->getBool("cluster_member"))
|
if (options->getBool("cluster_member"))
|
||||||
{
|
{
|
||||||
stream << "yes" << endl;
|
stream << "yes" << '\n';
|
||||||
/* VRRP secret */
|
/* VRRP secret */
|
||||||
stream << "VRRPSECRET=\"";
|
stream << "VRRPSECRET=\"";
|
||||||
stream << vrrp_secret;
|
stream << vrrp_secret;
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* VRRP Master/Slave */
|
/* VRRP Master/Slave */
|
||||||
stream << "MASTER=";
|
stream << "MASTER=";
|
||||||
stream << (vrrp_master ? "yes" : "no");
|
stream << (vrrp_master ? "yes" : "no");
|
||||||
stream << endl;
|
stream << '\n';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream << "no" << endl;
|
stream << "no" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* conntrackd */
|
/* conntrackd */
|
||||||
@ -339,15 +339,15 @@ int OSConfigurator_secuwall::generateManagementFile()
|
|||||||
stream << "CONNTRACKD=";
|
stream << "CONNTRACKD=";
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
{
|
{
|
||||||
stream << "yes" << endl;
|
stream << "yes" << '\n';
|
||||||
/* conntrack device */
|
/* conntrack device */
|
||||||
stream << "CONN_DEV=\"";
|
stream << "CONN_DEV=\"";
|
||||||
stream << s;
|
stream << s;
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stream << "no" << endl;
|
stream << "no" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write actual management file */
|
/* Write actual management file */
|
||||||
@ -377,7 +377,7 @@ int OSConfigurator_secuwall::generateNetworkFile()
|
|||||||
RoutingRule* defaultRoute = nullptr;
|
RoutingRule* defaultRoute = nullptr;
|
||||||
|
|
||||||
/* Prepend static content */
|
/* Prepend static content */
|
||||||
stream << "NETWORKING=yes" << endl;
|
stream << "NETWORKING=yes" << '\n';
|
||||||
|
|
||||||
/* Find default route */
|
/* Find default route */
|
||||||
FWObjectTypedChildIterator routing_rules = routes->findByType(RoutingRule::TYPENAME);
|
FWObjectTypedChildIterator routing_rules = routes->findByType(RoutingRule::TYPENAME);
|
||||||
@ -430,7 +430,7 @@ int OSConfigurator_secuwall::generateNetworkFile()
|
|||||||
{
|
{
|
||||||
// stream << s;
|
// stream << s;
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Gateway interface */
|
/* Gateway interface */
|
||||||
stream << "GATEWAYDEV=\"";
|
stream << "GATEWAYDEV=\"";
|
||||||
@ -438,12 +438,12 @@ int OSConfigurator_secuwall::generateNetworkFile()
|
|||||||
{
|
{
|
||||||
// stream << s;
|
// stream << s;
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Hostname */
|
/* Hostname */
|
||||||
stream << "HOSTNAME=\"";
|
stream << "HOSTNAME=\"";
|
||||||
stream << fw->getName().c_str();
|
stream << fw->getName().c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Routing */
|
/* Routing */
|
||||||
stream << "FORWARD_IPV4=\"";
|
stream << "FORWARD_IPV4=\"";
|
||||||
@ -455,7 +455,7 @@ int OSConfigurator_secuwall::generateNetworkFile()
|
|||||||
{
|
{
|
||||||
stream << "no";
|
stream << "no";
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Write actual network file */
|
/* Write actual network file */
|
||||||
string filename = fw->getName() + "/" + network_filename;
|
string filename = fw->getName() + "/" + network_filename;
|
||||||
@ -477,12 +477,12 @@ int OSConfigurator_secuwall::generateHostsFile()
|
|||||||
QTextStream stream (&stream_string);
|
QTextStream stream (&stream_string);
|
||||||
|
|
||||||
/* Prepend static content */
|
/* Prepend static content */
|
||||||
stream << "127.0.0.1\tlocalhost\n\n# Secuwall hosts" << endl;
|
stream << "127.0.0.1\tlocalhost\n\n# Secuwall hosts" << '\n';
|
||||||
|
|
||||||
/* TODO: Should entries of every fw interface address be appended? */
|
/* TODO: Should entries of every fw interface address be appended? */
|
||||||
|
|
||||||
stream << options->getStr("secuwall_dns_hosts").c_str();
|
stream << options->getStr("secuwall_dns_hosts").c_str();
|
||||||
stream << endl;
|
stream << '\n';
|
||||||
|
|
||||||
/* Write actual hosts file */
|
/* Write actual hosts file */
|
||||||
string filename = fw->getName() + "/" + hosts_filename;
|
string filename = fw->getName() + "/" + hosts_filename;
|
||||||
@ -509,21 +509,21 @@ int OSConfigurator_secuwall::generateDNSFile()
|
|||||||
{
|
{
|
||||||
/* Replace \n with " " */
|
/* Replace \n with " " */
|
||||||
s.replace(QString("\n"), QString(" "));
|
s.replace(QString("\n"), QString(" "));
|
||||||
stream << "search\t\t" << s << endl;
|
stream << "search\t\t" << s << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DNS-Server entries */
|
/* DNS-Server entries */
|
||||||
s = options->getStr("secuwall_dns_srv1").c_str();
|
s = options->getStr("secuwall_dns_srv1").c_str();
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
stream << "nameserver\t" << s << endl;
|
stream << "nameserver\t" << s << '\n';
|
||||||
|
|
||||||
s = options->getStr("secuwall_dns_srv2").c_str();
|
s = options->getStr("secuwall_dns_srv2").c_str();
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
stream << "nameserver\t" << s << endl;
|
stream << "nameserver\t" << s << '\n';
|
||||||
|
|
||||||
s = options->getStr("secuwall_dns_srv3").c_str();
|
s = options->getStr("secuwall_dns_srv3").c_str();
|
||||||
if (!s.isEmpty())
|
if (!s.isEmpty())
|
||||||
stream << "nameserver\t" << s << endl;
|
stream << "nameserver\t" << s << '\n';
|
||||||
|
|
||||||
/* Write actual DNS file */
|
/* Write actual DNS file */
|
||||||
string filename = fw->getName() + "/" + dns_filename;
|
string filename = fw->getName() + "/" + dns_filename;
|
||||||
@ -545,7 +545,7 @@ int OSConfigurator_secuwall::generateNsswitchFile()
|
|||||||
QTextStream stream(&stream_string);
|
QTextStream stream(&stream_string);
|
||||||
|
|
||||||
/* Prepend static content */
|
/* Prepend static content */
|
||||||
stream << "passwd:\t\tfiles\nshadow:\t\tfiles\ngroup:\t\tfiles\n" << endl;
|
stream << "passwd:\t\tfiles\nshadow:\t\tfiles\ngroup:\t\tfiles\n" << '\n';
|
||||||
|
|
||||||
/* hosts entries */
|
/* hosts entries */
|
||||||
stream << "hosts:\t\t";
|
stream << "hosts:\t\t";
|
||||||
@ -576,10 +576,10 @@ int OSConfigurator_secuwall::generateNsswitchFile()
|
|||||||
s = options->getStr("secuwall_dns_reso5").c_str();
|
s = options->getStr("secuwall_dns_reso5").c_str();
|
||||||
if (!s.isEmpty() && s != "none")
|
if (!s.isEmpty() && s != "none")
|
||||||
{
|
{
|
||||||
stream << " " << s << endl;
|
stream << " " << s << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
stream << endl;
|
stream << '\n';
|
||||||
|
|
||||||
/* Append static content */
|
/* Append static content */
|
||||||
stream << "ethers:\t\tfiles\nnetmasks:\tfiles\nnetworks:\tfiles\nprotocols:\tfiles\nrpc:\t\tfiles\nservices:\tfiles\n";
|
stream << "ethers:\t\tfiles\nnetmasks:\tfiles\nnetworks:\tfiles\nprotocols:\tfiles\nrpc:\t\tfiles\nservices:\tfiles\n";
|
||||||
@ -638,7 +638,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
stream << name.c_str();
|
stream << name.c_str();
|
||||||
if (iface_number > 0)
|
if (iface_number > 0)
|
||||||
stream << ":" << iface_number;
|
stream << ":" << iface_number;
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Boot-Protocol */
|
/* Boot-Protocol */
|
||||||
stream << "BOOTPROTO=\"";
|
stream << "BOOTPROTO=\"";
|
||||||
@ -650,7 +650,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
{
|
{
|
||||||
stream << "none";
|
stream << "none";
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Address object contains host, network and broadcast address plus netmask */
|
/* Address object contains host, network and broadcast address plus netmask */
|
||||||
const Address* ipAddr = nullptr;
|
const Address* ipAddr = nullptr;
|
||||||
@ -662,22 +662,22 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
/* Interface IP Address */
|
/* Interface IP Address */
|
||||||
stream << "IPADDR=\"";
|
stream << "IPADDR=\"";
|
||||||
stream << ipAddr->getAddressPtr()->toString().c_str();
|
stream << ipAddr->getAddressPtr()->toString().c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Netmask */
|
/* Netmask */
|
||||||
stream << "NETMASK=\"";
|
stream << "NETMASK=\"";
|
||||||
stream << ipAddr->getNetmaskPtr()->toString().c_str();
|
stream << ipAddr->getNetmaskPtr()->toString().c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Network IP Address */
|
/* Network IP Address */
|
||||||
stream << "NETWORK=\"";
|
stream << "NETWORK=\"";
|
||||||
stream << ipAddr->getNetworkAddressPtr()->toString().c_str();
|
stream << ipAddr->getNetworkAddressPtr()->toString().c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Broadcast IP Address */
|
/* Broadcast IP Address */
|
||||||
stream << "BROADCAST=\"";
|
stream << "BROADCAST=\"";
|
||||||
stream << ipAddr->getBroadcastAddressPtr()->toString().c_str();
|
stream << ipAddr->getBroadcastAddressPtr()->toString().c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Activate on bootup */
|
/* Activate on bootup */
|
||||||
@ -690,7 +690,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
{
|
{
|
||||||
stream << "yes";
|
stream << "yes";
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Link */
|
/* Link */
|
||||||
stream << "LINK=\"";
|
stream << "LINK=\"";
|
||||||
@ -698,7 +698,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
{
|
{
|
||||||
stream << options->getStr("iface_options").c_str();
|
stream << options->getStr("iface_options").c_str();
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* MAC-Address */
|
/* MAC-Address */
|
||||||
stream << "MACADDR=\"";
|
stream << "MACADDR=\"";
|
||||||
@ -707,7 +707,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
{
|
{
|
||||||
stream << macAddr->getPhysAddress().c_str();
|
stream << macAddr->getPhysAddress().c_str();
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* MTU */
|
/* MTU */
|
||||||
s.clear();
|
s.clear();
|
||||||
@ -719,7 +719,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
s = "1500";
|
s = "1500";
|
||||||
}
|
}
|
||||||
stream << s;
|
stream << s;
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Activate ARP */
|
/* Activate ARP */
|
||||||
stream << "ARP=\"";
|
stream << "ARP=\"";
|
||||||
@ -731,12 +731,12 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
{
|
{
|
||||||
stream << "yes";
|
stream << "yes";
|
||||||
}
|
}
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* Interface type */
|
/* Interface type */
|
||||||
stream << "TYPE=\"";
|
stream << "TYPE=\"";
|
||||||
stream << s_mapIfaceStrings[itype].c_str();
|
stream << s_mapIfaceStrings[itype].c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
/* get all direct children of type interface */
|
/* get all direct children of type interface */
|
||||||
list<FWObject *> basedevs = iface->getByType(Interface::TYPENAME);
|
list<FWObject *> basedevs = iface->getByType(Interface::TYPENAME);
|
||||||
@ -769,7 +769,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
/* Base Device */
|
/* Base Device */
|
||||||
stream << "BASEDEV=\"";
|
stream << "BASEDEV=\"";
|
||||||
stream << stringify(devs," ").c_str();
|
stream << stringify(devs," ").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
|
|
||||||
stream << "VLANID=\"";
|
stream << "VLANID=\"";
|
||||||
stream << options->getStr("vlan_id").c_str();
|
stream << options->getStr("vlan_id").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
if (iface->getParent() == nullptr || iface->getParent()->getName().empty())
|
if (iface->getParent() == nullptr || iface->getParent()->getName().empty())
|
||||||
{
|
{
|
||||||
@ -791,7 +791,7 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
|
|
||||||
stream << "BASEDEV=\"";
|
stream << "BASEDEV=\"";
|
||||||
stream << iface->getParent()->getName().c_str();
|
stream << iface->getParent()->getName().c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
|
|
||||||
generateInterfaceFile(Interface::cast(iface->getParent()));
|
generateInterfaceFile(Interface::cast(iface->getParent()));
|
||||||
break;
|
break;
|
||||||
@ -805,14 +805,14 @@ int OSConfigurator_secuwall::generateInterfaceFile (Interface * iface, string na
|
|||||||
|
|
||||||
stream << "BASEDEV=\"";
|
stream << "BASEDEV=\"";
|
||||||
stream << options->getStr("base_device").c_str();
|
stream << options->getStr("base_device").c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ALIAS:
|
case ALIAS:
|
||||||
/* Base Device for secondary interfaces*/
|
/* Base Device for secondary interfaces*/
|
||||||
stream << "BASEDEV=\"";
|
stream << "BASEDEV=\"";
|
||||||
stream << name.c_str();
|
stream << name.c_str();
|
||||||
stream << "\"" << endl;
|
stream << "\"" << '\n';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -31,12 +31,12 @@ CompilerDriver* CompilerDriver_junosacl::clone()
|
|||||||
|
|
||||||
void CompilerDriver_junosacl::printProlog(QTextStream &file, const string &prolog_code)
|
void CompilerDriver_junosacl::printProlog(QTextStream &file, const string &prolog_code)
|
||||||
{
|
{
|
||||||
file << endl;
|
file << '\n';
|
||||||
file << "/*" << endl;
|
file << "/*" << '\n';
|
||||||
file << " * Prolog script" << endl;
|
file << " * Prolog script" << '\n';
|
||||||
file << " */" << endl;
|
file << " */" << '\n';
|
||||||
file << prolog_code << endl;
|
file << prolog_code << '\n';
|
||||||
file << "/*" << endl;
|
file << "/*" << '\n';
|
||||||
file << " * End of prolog script" << endl;
|
file << " * End of prolog script" << '\n';
|
||||||
file << " */" << endl;
|
file << " */" << '\n';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ QString CompilerDriver_junosacl::assembleManifest(Cluster*, Firewall*, bool)
|
|||||||
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
QTextStream script(&script_buffer, QIODevice::WriteOnly);
|
||||||
|
|
||||||
script << "/* " << manifestMarker()
|
script << "/* " << manifestMarker()
|
||||||
<< " * " << this->escapeFileName(file_names[FW_FILE]) << " */" << endl;
|
<< " * " << this->escapeFileName(file_names[FW_FILE]) << " */" << '\n';
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@ QString CompilerDriver_ipf::assembleManifest(Cluster*, Firewall* fw, bool )
|
|||||||
|
|
||||||
if (remote_name != file_names[FW_FILE])
|
if (remote_name != file_names[FW_FILE])
|
||||||
script << " " << this->escapeFileName(remote_name);
|
script << " " << this->escapeFileName(remote_name);
|
||||||
script << endl;
|
script << '\n';
|
||||||
|
|
||||||
if (have_filter)
|
if (have_filter)
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ QString CompilerDriver_ipf::assembleManifest(Cluster*, Firewall* fw, bool )
|
|||||||
|
|
||||||
if (remote_ipf_name != file_names[CONF1_FILE])
|
if (remote_ipf_name != file_names[CONF1_FILE])
|
||||||
script << " " << this->escapeFileName(remote_ipf_name);
|
script << " " << this->escapeFileName(remote_ipf_name);
|
||||||
script << endl;
|
script << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_nat)
|
if (have_nat)
|
||||||
@ -130,7 +130,7 @@ QString CompilerDriver_ipf::assembleManifest(Cluster*, Firewall* fw, bool )
|
|||||||
|
|
||||||
if (remote_nat_name != file_names[CONF2_FILE])
|
if (remote_nat_name != file_names[CONF2_FILE])
|
||||||
script << " " << this->escapeFileName(remote_nat_name);
|
script << " " << this->escapeFileName(remote_nat_name);
|
||||||
script << endl;
|
script << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
@ -332,7 +332,7 @@ QString CompilerDriver_ipf::run(const std::string &cluster_id,
|
|||||||
{
|
{
|
||||||
all_errors.push_back(c.getErrors("").c_str());
|
all_errors.push_back(c.getErrors("").c_str());
|
||||||
ipf_str << "# Policy compiler errors and warnings:"
|
ipf_str << "# Policy compiler errors and warnings:"
|
||||||
<< endl;
|
<< '\n';
|
||||||
ipf_str << QString::fromUtf8(c.getErrors("# ").c_str());
|
ipf_str << QString::fromUtf8(c.getErrors("# ").c_str());
|
||||||
}
|
}
|
||||||
ipf_str << QString::fromUtf8(c.getCompiledScript().c_str());
|
ipf_str << QString::fromUtf8(c.getCompiledScript().c_str());
|
||||||
@ -371,7 +371,7 @@ QString CompilerDriver_ipf::run(const std::string &cluster_id,
|
|||||||
{
|
{
|
||||||
all_errors.push_back(n.getErrors("").c_str());
|
all_errors.push_back(n.getErrors("").c_str());
|
||||||
nat_str << "# NAT compiler errors and warnings:"
|
nat_str << "# NAT compiler errors and warnings:"
|
||||||
<< endl;
|
<< '\n';
|
||||||
nat_str << QString::fromUtf8(n.getErrors("# ").c_str());
|
nat_str << QString::fromUtf8(n.getErrors("# ").c_str());
|
||||||
}
|
}
|
||||||
nat_str << QString::fromUtf8(n.getCompiledScript().c_str());
|
nat_str << QString::fromUtf8(n.getCompiledScript().c_str());
|
||||||
|
|||||||
@ -80,8 +80,8 @@ QString CompilerDriver_ipfw::assembleManifest(Cluster*, Firewall* , bool )
|
|||||||
if (!remote_file_names[FW_FILE].isEmpty())
|
if (!remote_file_names[FW_FILE].isEmpty())
|
||||||
script << " " << this->escapeFileName(remote_file_names[FW_FILE]);
|
script << " " << this->escapeFileName(remote_file_names[FW_FILE]);
|
||||||
script << "\n";
|
script << "\n";
|
||||||
script << "#" << endl;
|
script << "#" << '\n';
|
||||||
script << "#" << endl;
|
script << "#" << '\n';
|
||||||
return script_buffer;
|
return script_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,14 +142,14 @@ string CompilerDriver_pf::printTimeout(FWOptions* options,
|
|||||||
|
|
||||||
void CompilerDriver_pf::printProlog(QTextStream &file, const string &prolog_code)
|
void CompilerDriver_pf::printProlog(QTextStream &file, const string &prolog_code)
|
||||||
{
|
{
|
||||||
file << endl;
|
file << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# Prolog script" << endl;
|
file << "# Prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << prolog_code << endl;
|
file << prolog_code << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# End of prolog script" << endl;
|
file << "# End of prolog script" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
||||||
@ -163,24 +163,24 @@ void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
|||||||
if (prolog_place == "pf_file_top")
|
if (prolog_place == "pf_file_top")
|
||||||
printProlog(file, pre_hook);
|
printProlog(file, pre_hook);
|
||||||
|
|
||||||
file << endl;
|
file << '\n';
|
||||||
|
|
||||||
string set_debug = options->getStr("pf_set_debug");
|
string set_debug = options->getStr("pf_set_debug");
|
||||||
if (!set_debug.empty())
|
if (!set_debug.empty())
|
||||||
{
|
{
|
||||||
file << "set debug " << set_debug << endl;
|
file << "set debug " << set_debug << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
string state_policy = options->getStr("pf_state_policy");
|
string state_policy = options->getStr("pf_state_policy");
|
||||||
if (!state_policy.empty())
|
if (!state_policy.empty())
|
||||||
{
|
{
|
||||||
file << "set state-policy " << state_policy << endl;
|
file << "set state-policy " << state_policy << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
string block_policy = options->getStr("pf_block_policy");
|
string block_policy = options->getStr("pf_block_policy");
|
||||||
if (!block_policy.empty())
|
if (!block_policy.empty())
|
||||||
{
|
{
|
||||||
file << "set block-policy " << block_policy << endl;
|
file << "set block-policy " << block_policy << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList limits;
|
QStringList limits;
|
||||||
@ -215,12 +215,12 @@ void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
|||||||
if (limits.size() > 1 ) file << "{ ";
|
if (limits.size() > 1 ) file << "{ ";
|
||||||
file << limits.join(", ");
|
file << limits.join(", ");
|
||||||
if (limits.size() > 1 ) file << " }";
|
if (limits.size() > 1 ) file << " }";
|
||||||
file << endl;
|
file << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! options->getStr("pf_optimization").empty() )
|
if ( ! options->getStr("pf_optimization").empty() )
|
||||||
file << "set optimization "
|
file << "set optimization "
|
||||||
<< options->getStr("pf_optimization") << endl;
|
<< options->getStr("pf_optimization") << '\n';
|
||||||
|
|
||||||
file << printTimeout(options,
|
file << printTimeout(options,
|
||||||
"pf_do_timeout_interval","pf_timeout_interval",
|
"pf_do_timeout_interval","pf_timeout_interval",
|
||||||
@ -293,11 +293,11 @@ void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
|||||||
assert(iface);
|
assert(iface);
|
||||||
|
|
||||||
if ( iface->isUnprotected())
|
if ( iface->isUnprotected())
|
||||||
file << "set skip on " << iface->getName() << endl;
|
file << "set skip on " << iface->getName() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file << endl;
|
file << '\n';
|
||||||
|
|
||||||
if (prolog_place == "pf_file_after_set")
|
if (prolog_place == "pf_file_after_set")
|
||||||
printProlog(file, pre_hook);
|
printProlog(file, pre_hook);
|
||||||
@ -329,9 +329,9 @@ void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
|||||||
|
|
||||||
if (!scrub_options.empty())
|
if (!scrub_options.empty())
|
||||||
{
|
{
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
file << "# Scrub rules" << endl;
|
file << "# Scrub rules" << '\n';
|
||||||
file << "#" << endl;
|
file << "#" << '\n';
|
||||||
|
|
||||||
if (XMLTools::version_compare(fw->getStr("version"), "4.6")>=0)
|
if (XMLTools::version_compare(fw->getStr("version"), "4.6")>=0)
|
||||||
{
|
{
|
||||||
@ -339,14 +339,14 @@ void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
|||||||
<< scrub_rule_direction
|
<< scrub_rule_direction
|
||||||
<< "all scrub ("
|
<< "all scrub ("
|
||||||
<< scrub_options.join(" ").toStdString() << ")"
|
<< scrub_options.join(" ").toStdString() << ")"
|
||||||
<< endl;
|
<< '\n';
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
file << "scrub "
|
file << "scrub "
|
||||||
<< scrub_rule_direction
|
<< scrub_rule_direction
|
||||||
<< "all "
|
<< "all "
|
||||||
<< scrub_options.join(" ").toStdString()
|
<< scrub_options.join(" ").toStdString()
|
||||||
<< endl;
|
<< '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,21 +366,21 @@ void CompilerDriver_pf::printStaticOptions(QTextStream &file, Firewall* fw)
|
|||||||
if (XMLTools::version_compare(fw->getStr("version"), "4.6")>=0)
|
if (XMLTools::version_compare(fw->getStr("version"), "4.6")>=0)
|
||||||
{
|
{
|
||||||
file << "match out all scrub ("
|
file << "match out all scrub ("
|
||||||
<< scrub_options.join(" ").toStdString() << ")" << endl;
|
<< scrub_options.join(" ").toStdString() << ")" << '\n';
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
file << "scrub out all "
|
file << "scrub out all "
|
||||||
<< scrub_options.join(" ").toStdString() << endl;
|
<< scrub_options.join(" ").toStdString() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file << endl;
|
file << '\n';
|
||||||
|
|
||||||
if (prolog_place == "pf_file_after_scrub")
|
if (prolog_place == "pf_file_after_scrub")
|
||||||
printProlog(file, pre_hook);
|
printProlog(file, pre_hook);
|
||||||
|
|
||||||
//file << table_factory->PrintTables();
|
//file << table_factory->PrintTables();
|
||||||
//file << endl;
|
//file << '\n';
|
||||||
|
|
||||||
//if (prolog_place == "pf_file_after_tables")
|
//if (prolog_place == "pf_file_after_tables")
|
||||||
// printProlog(file, pre_hook);
|
// printProlog(file, pre_hook);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user