From 21a7e774bba4832848687dbd8d2e0a1df33650ce Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 15 Apr 2015 19:14:12 -0700 Subject: Wire API auth token stuff. --- service/OneService.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'service/OneService.cpp') diff --git a/service/OneService.cpp b/service/OneService.cpp index f84af0ae..1ba7a8c5 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -173,6 +173,25 @@ public: virtual ReasonForTermination run() { try { + std::string authToken; + { + std::string authTokenPath(_homePath + ZT_PATH_SEPARATOR_S + "authtoken.secret"); + if (!OSUtils::readFile(authTokenPath.c_str(),authToken)) { + unsigned char foo[24]; + Utils::getSecureRandom(foo,sizeof(foo)); + authToken = ""; + for(unsigned int i=0;isetNetconfMaster((void *)_master); _controlPlane = new ControlPlane(this,_node); + _controlPlane->addAuthToken(authToken.c_str()); { // Remember networks from previous session std::vector networksDotD(OSUtils::listDirectory((_homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str())); -- cgit v1.2.3