mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 09:42:38 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -829,7 +829,7 @@ namespace OpenWifi::ProvObjects {
|
||||
std::string accountId;
|
||||
std::string csr;
|
||||
std::string certificate;
|
||||
std::string certificateChain;
|
||||
std::vector<std::string> certificateChain;
|
||||
std::string certificateId;
|
||||
std::uint64_t expiresAt = 0;
|
||||
std::uint64_t created = 0;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Poco/JWT/Token.h>
|
||||
#include <Poco/JWT/Signer.h>
|
||||
#include <Poco/Net/HTTPSClientSession.h>
|
||||
#include <Poco/Net/DNS.h>
|
||||
#include <Poco/URI.h>
|
||||
#include <Poco/TemporaryFile.h>
|
||||
#include <Poco/JSON/Object.h>
|
||||
@@ -237,6 +238,12 @@ namespace OpenWifi {
|
||||
auto Srvs = Utils::getSRVRecords(rec.replacement);
|
||||
for(const auto &srv:Srvs) {
|
||||
Utils::HostNameServerResult R{srv.srvname,srv.port};
|
||||
if(!Utils::ValidIP(srv.srvname)) {
|
||||
auto Server = Poco::Net::DNS::hostByName(srv.srvname).addresses();
|
||||
if(!Server.empty()) {
|
||||
R.Hostname = Server[0].toString();
|
||||
}
|
||||
}
|
||||
Results.emplace_back(R);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,20 +58,51 @@ namespace OpenWifi {
|
||||
}
|
||||
ServerDetails.set("servers",ServerArray);
|
||||
RadiusPools.add(ServerDetails);
|
||||
} else if(Endpoint.Type=="radsec") {
|
||||
PoolEntry.set("radsecPoolType","radsec");
|
||||
for(const auto &Server:Endpoint.RadsecServers) {
|
||||
|
||||
} else if(Endpoint.Type=="globalreach") {
|
||||
PoolEntry.set("radsecPoolType","globalreach");
|
||||
auto Servers = OpenRoaming_GlobalReach()->GetServers();
|
||||
Poco::JSON::Object ServerDetails;
|
||||
ServerDetails.set("methodParameters", Poco::JSON::Array() );
|
||||
ServerDetails.set("monitor", false );
|
||||
ServerDetails.set("monitorMethod", "none" );
|
||||
ServerDetails.set("strategy","random");
|
||||
Poco::JSON::Array ServerArray;
|
||||
ProvObjects::GLBLRCertificateInfo GRCertificate;
|
||||
ProvObjects::GLBLRAccountInfo GRAccountInfo;
|
||||
StorageService()->GLBLRCertsDB().GetRecord("id",Endpoint.RadsecServers[0].UseOpenRoamingAccount,GRCertificate);
|
||||
StorageService()->GLBLRAccountInfoDB().GetRecord("id",GRCertificate.accountId,GRAccountInfo);
|
||||
int i=1;
|
||||
for(const auto &Server:Servers) {
|
||||
Poco::JSON::Object AuthConfig;
|
||||
AuthConfig.set("allowSelfSigned", false);
|
||||
AuthConfig.set("ignore", false);
|
||||
AuthConfig.set("name", fmt::format("Server {}",i));
|
||||
AuthConfig.set("ip", Server.Hostname);
|
||||
AuthConfig.set("radsecPort", Server.Port);
|
||||
AuthConfig.set("radsecCert", Utils::base64encode((const u_char *)GRCertificate.certificate.c_str(),GRCertificate.certificate.size()));
|
||||
AuthConfig.set("radsecKey", Utils::base64encode((const u_char *)GRAccountInfo.CSRPrivateKey.c_str(),GRAccountInfo.CSRPrivateKey.size()));
|
||||
Poco::JSON::Array CaCerts;
|
||||
for(const auto &cert:GRCertificate.certificateChain) {
|
||||
CaCerts.add(Utils::base64encode((const u_char *)cert.c_str(),cert.size()));
|
||||
}
|
||||
AuthConfig.set("radsecCacerts", CaCerts);
|
||||
AuthConfig.set("radsecSecret","radsec");
|
||||
i++;
|
||||
ServerArray.add(AuthConfig);
|
||||
}
|
||||
ServerDetails.set("servers",ServerArray);
|
||||
RadiusPools.add(ServerDetails);
|
||||
} else if(Endpoint.Type=="radius") {
|
||||
PoolEntry.set("radsecPoolType","generic");
|
||||
auto Servers = OpenRoaming_GlobalReach()->GetServers();
|
||||
for(const auto &Server:Servers) {
|
||||
|
||||
}
|
||||
} else if(Endpoint.Type=="globalreach") {
|
||||
PoolEntry.set("radsecPoolType","globalreach");
|
||||
auto Servers = OpenRoaming_GlobalReach()->GetServers();
|
||||
} else if(Endpoint.Type=="radsec") {
|
||||
PoolEntry.set("radsecPoolType", "radsec");
|
||||
for (const auto &Server: Endpoint.RadsecServers) {
|
||||
|
||||
}
|
||||
}
|
||||
RadiusPools.add(PoolEntry);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void ORM::DB<OpenWifi::GLBLRCertsDBRecordType, OpenWifi::ProvObjects::GLBLRCerti
|
||||
Out.accountId = In.get<2>();
|
||||
Out.csr = In.get<3>();
|
||||
Out.certificate = In.get<4>();
|
||||
Out.certificateChain = In.get<5>();
|
||||
Out.certificateChain = OpenWifi::RESTAPI_utils::to_object_array(In.get<5>());
|
||||
Out.certificateId = In.get<6>();
|
||||
Out.expiresAt = In.get<7>();
|
||||
Out.created = In.get<8>();
|
||||
@@ -69,7 +69,7 @@ void ORM::DB<OpenWifi::GLBLRCertsDBRecordType, OpenWifi::ProvObjects::GLBLRCerti
|
||||
Out.set<2>(In.accountId);
|
||||
Out.set<3>(In.csr);
|
||||
Out.set<4>(In.certificate);
|
||||
Out.set<5>(In.certificateChain);
|
||||
Out.set<5>(OpenWifi::RESTAPI_utils::to_string(In.certificateChain));
|
||||
Out.set<6>(In.certificateId);
|
||||
Out.set<7>(In.expiresAt);
|
||||
Out.set<8>(In.created);
|
||||
|
||||
Reference in New Issue
Block a user