mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 02:48:18 +00:00
cloud_discovery: use production CDS for migration path
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -42,6 +42,21 @@ ulog(LOG_INFO, 'Start\n');
|
|||||||
|
|
||||||
uloop.init();
|
uloop.init();
|
||||||
|
|
||||||
|
let cds_server = 'discovery.open-lan.org';
|
||||||
|
|
||||||
|
function set_cds_server() {
|
||||||
|
let pipe = fs.popen(`openssl x509 -in /etc/ucentral/cert.pem -noout -issuer`);
|
||||||
|
let issuer = pipe.read("all");
|
||||||
|
pipe.close();
|
||||||
|
|
||||||
|
if (!match(issuer, /Telecom Infra Project Issuing CA/)) {
|
||||||
|
ulog(LOG_INFO, 'Certificate type is "Demo" \n');
|
||||||
|
est_server = 'openlan.keys.tip.build';
|
||||||
|
} else {
|
||||||
|
ulog(LOG_INFO, 'Certificate type is "TIP"\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function readjsonfile(path) {
|
function readjsonfile(path) {
|
||||||
let file = fs.readfile(path);
|
let file = fs.readfile(path);
|
||||||
if (file)
|
if (file)
|
||||||
@@ -178,7 +193,7 @@ function redirector_lookup() {
|
|||||||
let serial = uci.get('system', '@system[-1]', 'mac');
|
let serial = uci.get('system', '@system[-1]', 'mac');
|
||||||
|
|
||||||
fs.unlink(path);
|
fs.unlink(path);
|
||||||
system(`curl -k --cert /etc/ucentral/operational.pem --key /etc/ucentral/key.pem --cacert /etc/ucentral/operational.ca https://openlan.keys.tip.build/v1/devices/${serial} --output /tmp/ucentral.redirector`);
|
system(`curl -k --cert /etc/ucentral/operational.pem --key /etc/ucentral/key.pem --cacert /etc/ucentral/operational.ca https://${cds_server}/v1/devices/${serial} --output /tmp/ucentral.redirector`);
|
||||||
if (!fs.stat(path))
|
if (!fs.stat(path))
|
||||||
return;
|
return;
|
||||||
let redir = readjsonfile(path);
|
let redir = readjsonfile(path);
|
||||||
@@ -369,6 +384,8 @@ function expiry_handler() {
|
|||||||
system('/etc/init.d/ucentral restart');
|
system('/etc/init.d/ucentral restart');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_cds_server();
|
||||||
|
|
||||||
if (gateway_available()) {
|
if (gateway_available()) {
|
||||||
let status = ubus.call('ucentral', 'status');
|
let status = ubus.call('ucentral', 'status');
|
||||||
ulog(LOG_INFO, 'cloud is known\n');
|
ulog(LOG_INFO, 'cloud is known\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user