mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 13:03:45 +02:00
Merge branch 'refs/heads/master' into dev
This commit is contained in:
commit
a993ddc54d
14 changed files with 3841 additions and 61 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -120,3 +120,4 @@ __pycache__
|
||||||
*~
|
*~
|
||||||
attic/world/*.c25519
|
attic/world/*.c25519
|
||||||
attic/world/mkworld
|
attic/world/mkworld
|
||||||
|
workspace/
|
||||||
|
|
34
Jenkinsfile
vendored
34
Jenkinsfile
vendored
|
@ -40,26 +40,26 @@ parallel 'centos7': {
|
||||||
// throw err
|
// throw err
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }, 'macOS': {
|
}, 'macOS': {
|
||||||
// node('macOS') {
|
node('macOS') {
|
||||||
// try {
|
try {
|
||||||
// checkout scm
|
checkout scm
|
||||||
|
|
||||||
// stage('Build macOS') {
|
stage('Build macOS') {
|
||||||
// sh 'make -f make-mac.mk'
|
sh 'make -f make-mac.mk'
|
||||||
// }
|
}
|
||||||
|
|
||||||
// stage('Build macOS UI') {
|
stage('Build macOS UI') {
|
||||||
// sh 'cd macui && xcodebuild -target "ZeroTier One" -configuration Debug'
|
sh 'cd macui && xcodebuild -target "ZeroTier One" -configuration Debug'
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// catch (err) {
|
catch (err) {
|
||||||
// currentBuild.result = "FAILURE"
|
currentBuild.result = "FAILURE"
|
||||||
// mattermostSend color: '#ff0000', message: "${env.JOB_NAME} broken on macOS (<${env.BUILD_URL}|Open>)"
|
mattermostSend color: '#ff0000', message: "${env.JOB_NAME} broken on macOS (<${env.BUILD_URL}|Open>)"
|
||||||
|
|
||||||
// throw err
|
throw err
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }, 'windows': {
|
// }, 'windows': {
|
||||||
// node('windows') {
|
// node('windows') {
|
||||||
// try {
|
// try {
|
||||||
|
|
|
@ -760,7 +760,7 @@ void PostgreSQL::networksDbWatcher()
|
||||||
fprintf(stderr, "ERROR: %s networksDbWatcher should still be running! Exiting Controller.\n", _myAddressStr.c_str());
|
fprintf(stderr, "ERROR: %s networksDbWatcher should still be running! Exiting Controller.\n", _myAddressStr.c_str());
|
||||||
exit(8);
|
exit(8);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "Exited membersDbWatcher\n");
|
fprintf(stderr, "Exited networksDbWatcher\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostgreSQL::_networksWatcher_Postgres(PGconn *conn) {
|
void PostgreSQL::_networksWatcher_Postgres(PGconn *conn) {
|
||||||
|
|
|
@ -51,13 +51,13 @@ void RabbitMQ::init()
|
||||||
throw std::runtime_error("Can't create socket for RabbitMQ");
|
throw std::runtime_error("Can't create socket for RabbitMQ");
|
||||||
}
|
}
|
||||||
|
|
||||||
_status = amqp_socket_open_noblock(_socket, _mqc->host, _mqc->port, &tval);
|
_status = amqp_socket_open_noblock(_socket, _mqc->host.c_str(), _mqc->port, &tval);
|
||||||
if (_status) {
|
if (_status) {
|
||||||
throw std::runtime_error("Can't connect to RabbitMQ");
|
throw std::runtime_error("Can't connect to RabbitMQ");
|
||||||
}
|
}
|
||||||
|
|
||||||
amqp_rpc_reply_t r = amqp_login(_conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN,
|
amqp_rpc_reply_t r = amqp_login(_conn, "/", 0, 131072, 0, AMQP_SASL_METHOD_PLAIN,
|
||||||
_mqc->username, _mqc->password);
|
_mqc->username.c_str(), _mqc->password.c_str());
|
||||||
if (r.reply_type != AMQP_RESPONSE_NORMAL) {
|
if (r.reply_type != AMQP_RESPONSE_NORMAL) {
|
||||||
throw std::runtime_error("RabbitMQ Login Error");
|
throw std::runtime_error("RabbitMQ Login Error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,15 @@
|
||||||
#define ZT_CONTROLLER_RABBITMQ_HPP
|
#define ZT_CONTROLLER_RABBITMQ_HPP
|
||||||
|
|
||||||
#include "DB.hpp"
|
#include "DB.hpp"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace ZeroTier
|
namespace ZeroTier
|
||||||
{
|
{
|
||||||
struct MQConfig {
|
struct MQConfig {
|
||||||
const char *host;
|
std::string host;
|
||||||
int port;
|
int port;
|
||||||
const char *username;
|
std::string username;
|
||||||
const char *password;
|
std::string password;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ struct MQConfig {
|
||||||
|
|
||||||
#include <amqp.h>
|
#include <amqp.h>
|
||||||
#include <amqp_tcp_socket.h>
|
#include <amqp_tcp_socket.h>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace ZeroTier
|
namespace ZeroTier
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
# Dockerfile for ZeroTier Central Controllers
|
# Dockerfile for ZeroTier Central Controllers
|
||||||
FROM centos:7
|
FROM centos:7 as builder
|
||||||
MAINTAINER Adam Ierymekno <adam.ierymenko@zerotier.com>, Grant Limberg <grant.limberg@zerotier.com>
|
MAINTAINER Adam Ierymekno <adam.ierymenko@zerotier.com>, Grant Limberg <grant.limberg@zerotier.com>
|
||||||
|
|
||||||
|
ARG git_branch=master
|
||||||
|
|
||||||
RUN yum update -y
|
RUN yum update -y
|
||||||
RUN yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
|
RUN yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
|
||||||
RUN yum install -y bash postgresql10 libpqxx-devel
|
|
||||||
|
|
||||||
RUN yum -y install epel-release && yum -y update && yum clean all
|
RUN yum -y install epel-release && yum -y update && yum clean all
|
||||||
RUN yum -y install clang jemalloc jemalloc-devel
|
RUN yum groupinstall -y "Development Tools"
|
||||||
|
RUN yum install -y bash postgresql10 postgresql10-devel libpqxx-devel glibc-static libstdc++-static clang jemalloc jemalloc-devel
|
||||||
|
|
||||||
|
RUN git clone http://git.int.zerotier.com/zerotier/ZeroTierOne.git
|
||||||
|
RUN if [ "$git_branch" != "master" ]; then cd ZeroTierOne && git checkout -b $git_branch origin/$git_branch; fi
|
||||||
|
RUN ldconfig
|
||||||
|
RUN cd ZeroTierOne && make central-controller
|
||||||
|
|
||||||
ADD zerotier-one /usr/local/bin/zerotier-one
|
FROM centos:7
|
||||||
|
|
||||||
|
COPY --from=builder /ZeroTierOne/zerotier-one /usr/local/bin/zerotier-one
|
||||||
RUN chmod a+x /usr/local/bin/zerotier-one
|
RUN chmod a+x /usr/local/bin/zerotier-one
|
||||||
|
|
||||||
ADD docker/main.sh /
|
ADD ext/central-controller-docker/main.sh /
|
||||||
RUN chmod a+x /main.sh
|
RUN chmod a+x /main.sh
|
||||||
|
|
||||||
ENTRYPOINT /main.sh
|
ENTRYPOINT /main.sh
|
||||||
|
|
2538
ext/librabbitmq/macos/include/amqp.h
Normal file
2538
ext/librabbitmq/macos/include/amqp.h
Normal file
File diff suppressed because it is too large
Load diff
1144
ext/librabbitmq/macos/include/amqp_framing.h
Normal file
1144
ext/librabbitmq/macos/include/amqp_framing.h
Normal file
File diff suppressed because it is too large
Load diff
68
ext/librabbitmq/macos/include/amqp_tcp_socket.h
Normal file
68
ext/librabbitmq/macos/include/amqp_tcp_socket.h
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/** \file */
|
||||||
|
/*
|
||||||
|
* Portions created by Alan Antonuk are Copyright (c) 2013-2014 Alan Antonuk.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Portions created by Michael Steinert are Copyright (c) 2012-2013 Michael
|
||||||
|
* Steinert. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A TCP socket connection.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AMQP_TCP_SOCKET_H
|
||||||
|
#define AMQP_TCP_SOCKET_H
|
||||||
|
|
||||||
|
#include <amqp.h>
|
||||||
|
|
||||||
|
AMQP_BEGIN_DECLS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new TCP socket.
|
||||||
|
*
|
||||||
|
* Call amqp_connection_close() to release socket resources.
|
||||||
|
*
|
||||||
|
* \return A new socket object or NULL if an error occurred.
|
||||||
|
*
|
||||||
|
* \since v0.4.0
|
||||||
|
*/
|
||||||
|
AMQP_PUBLIC_FUNCTION
|
||||||
|
amqp_socket_t *AMQP_CALL amqp_tcp_socket_new(amqp_connection_state_t state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign an open file descriptor to a socket object.
|
||||||
|
*
|
||||||
|
* This function must not be used in conjunction with amqp_socket_open(), i.e.
|
||||||
|
* the socket connection should already be open(2) when this function is
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* \param [in,out] self A TCP socket object.
|
||||||
|
* \param [in] sockfd An open socket descriptor.
|
||||||
|
*
|
||||||
|
* \since v0.4.0
|
||||||
|
*/
|
||||||
|
AMQP_PUBLIC_FUNCTION
|
||||||
|
void AMQP_CALL amqp_tcp_socket_set_sockfd(amqp_socket_t *self, int sockfd);
|
||||||
|
|
||||||
|
AMQP_END_DECLS
|
||||||
|
|
||||||
|
#endif /* AMQP_TCP_SOCKET_H */
|
BIN
ext/librabbitmq/macos/lib/librabbitmq.a
Normal file
BIN
ext/librabbitmq/macos/lib/librabbitmq.a
Normal file
Binary file not shown.
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -334,8 +334,8 @@ docker: FORCE
|
||||||
central-controller: FORCE
|
central-controller: FORCE
|
||||||
make -j4 LDLIBS="-L/usr/pgsql-10/lib/ -lpq -Lext/librabbitmq/centos_x64/lib/ -lrabbitmq" CXXFLAGS="-I/usr/pgsql-10/include -I./ext/librabbitmq/centos_x64/include -fPIC" DEFS="-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER" ZT_OFFICIAL=1 ZT_USE_X64_ASM_ED25519=1 one
|
make -j4 LDLIBS="-L/usr/pgsql-10/lib/ -lpq -Lext/librabbitmq/centos_x64/lib/ -lrabbitmq" CXXFLAGS="-I/usr/pgsql-10/include -I./ext/librabbitmq/centos_x64/include -fPIC" DEFS="-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER" ZT_OFFICIAL=1 ZT_USE_X64_ASM_ED25519=1 one
|
||||||
|
|
||||||
central-controller-docker: central-controller
|
central-controller-docker: FORCE
|
||||||
docker build -t docker.zerotier.com/zerotier-central/ztcentral-controller:${TIMESTAMP} -f ext/central-controller-docker/Dockerfile .
|
docker build -t docker.zerotier.com/zerotier-central/ztcentral-controller:${TIMESTAMP} -f ext/central-controller-docker/Dockerfile --build-arg git_branch=`git name-rev --name-only HEAD` .
|
||||||
|
|
||||||
debug: FORCE
|
debug: FORCE
|
||||||
make ZT_DEBUG=1 one
|
make ZT_DEBUG=1 one
|
||||||
|
|
|
@ -18,14 +18,18 @@ ZT_VERSION_MINOR=$(shell cat version.h | grep -F VERSION_MINOR | cut -d ' ' -f 3
|
||||||
ZT_VERSION_REV=$(shell cat version.h | grep -F VERSION_REVISION | cut -d ' ' -f 3)
|
ZT_VERSION_REV=$(shell cat version.h | grep -F VERSION_REVISION | cut -d ' ' -f 3)
|
||||||
ZT_VERSION_BUILD=$(shell cat version.h | grep -F VERSION_BUILD | cut -d ' ' -f 3)
|
ZT_VERSION_BUILD=$(shell cat version.h | grep -F VERSION_BUILD | cut -d ' ' -f 3)
|
||||||
|
|
||||||
|
# for central controller builds
|
||||||
|
TIMESTAMP=$(shell date +"%Y%m%d%H%M")
|
||||||
|
|
||||||
DEFS+=-DZT_BUILD_PLATFORM=$(ZT_BUILD_PLATFORM) -DZT_BUILD_ARCHITECTURE=$(ZT_BUILD_ARCHITECTURE)
|
DEFS+=-DZT_BUILD_PLATFORM=$(ZT_BUILD_PLATFORM) -DZT_BUILD_ARCHITECTURE=$(ZT_BUILD_ARCHITECTURE)
|
||||||
|
|
||||||
include objects.mk
|
include objects.mk
|
||||||
ONE_OBJS+=osdep/MacEthernetTap.o osdep/MacKextEthernetTap.o ext/http-parser/http_parser.o
|
ONE_OBJS+=osdep/MacEthernetTap.o osdep/MacKextEthernetTap.o ext/http-parser/http_parser.o
|
||||||
|
|
||||||
ifeq ($(ZT_CONTROLLER),1)
|
ifeq ($(ZT_CONTROLLER),1)
|
||||||
LIBS+=-lpq -lrabbitmq
|
LIBS+=-L/usr/local/opt/libpq/lib -lpq -Lext/librabbitmq/macos/lib -lrabbitmq
|
||||||
DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER
|
DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER
|
||||||
|
INCLUDES+=-Iext/librabbitmq/macos/include -I/usr/local/opt/libpq/include
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Official releases are signed with our Apple cert and apply software updates by default
|
# Official releases are signed with our Apple cert and apply software updates by default
|
||||||
|
@ -145,6 +149,9 @@ official: FORCE
|
||||||
make ZT_OFFICIAL_RELEASE=1 macui
|
make ZT_OFFICIAL_RELEASE=1 macui
|
||||||
make ZT_OFFICIAL_RELEASE=1 mac-dist-pkg
|
make ZT_OFFICIAL_RELEASE=1 mac-dist-pkg
|
||||||
|
|
||||||
|
central-controller-docker: FORCE
|
||||||
|
docker build -t docker.zerotier.com/zerotier-central/ztcentral-controller:${TIMESTAMP} -f ext/central-controller-docker/Dockerfile --build-arg git_branch=$(shell git name-rev --name-only HEAD) .
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf MacEthernetTapAgent *.dSYM build-* *.a *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o $(CORE_OBJS) $(ONE_OBJS) zerotier-one zerotier-idtool zerotier-selftest zerotier-cli zerotier doc/node_modules macui/build zt1_update_$(ZT_BUILD_PLATFORM)_$(ZT_BUILD_ARCHITECTURE)_*
|
rm -rf MacEthernetTapAgent *.dSYM build-* *.a *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o $(CORE_OBJS) $(ONE_OBJS) zerotier-one zerotier-idtool zerotier-selftest zerotier-cli zerotier doc/node_modules macui/build zt1_update_$(ZT_BUILD_PLATFORM)_$(ZT_BUILD_ARCHITECTURE)_*
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,10 @@ public:
|
||||||
// than one device behind the same NAT tries to use the same internal
|
// than one device behind the same NAT tries to use the same internal
|
||||||
// private address port number. Buggy NATs are a running theme.
|
// private address port number. Buggy NATs are a running theme.
|
||||||
if (_allowSecondaryPort) {
|
if (_allowSecondaryPort) {
|
||||||
_ports[1] = (_secondaryPort == 0) ? 20000 + ((unsigned int)_node->address() % 45500) : _secondaryPort;
|
if (_secondaryPort) {
|
||||||
|
_ports[1] = _secondaryPort;
|
||||||
|
} else {
|
||||||
|
_ports[1] = 20000 + ((unsigned int)_node->address() % 45500);
|
||||||
for(int i=0;;++i) {
|
for(int i=0;;++i) {
|
||||||
if (i > 1000) {
|
if (i > 1000) {
|
||||||
_ports[1] = 0;
|
_ports[1] = 0;
|
||||||
|
@ -690,14 +693,17 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#ifdef ZT_USE_MINIUPNPC
|
#ifdef ZT_USE_MINIUPNPC
|
||||||
if (_portMappingEnabled) {
|
if (_portMappingEnabled) {
|
||||||
// If we're running uPnP/NAT-PMP, bind a *third* port for that. We can't
|
// If we're running uPnP/NAT-PMP, bind a *third* port for that. We can't
|
||||||
// use the other two ports for that because some NATs do really funky
|
// use the other two ports for that because some NATs do really funky
|
||||||
// stuff with ports that are explicitly mapped that breaks things.
|
// stuff with ports that are explicitly mapped that breaks things.
|
||||||
if (_ports[1]) {
|
if (_ports[1]) {
|
||||||
_ports[2] = (_tertiaryPort == 0) ? _ports[1] : _tertiaryPort;
|
if (_tertiaryPort) {
|
||||||
|
_ports[2] = _tertiaryPort;
|
||||||
|
} else {
|
||||||
|
_ports[2] = _ports[1];
|
||||||
for(int i=0;;++i) {
|
for(int i=0;;++i) {
|
||||||
if (i > 1000) {
|
if (i > 1000) {
|
||||||
_ports[2] = 0;
|
_ports[2] = 0;
|
||||||
|
@ -715,8 +721,8 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Delete legacy iddb.d if present (cleanup)
|
// Delete legacy iddb.d if present (cleanup)
|
||||||
OSUtils::rmDashRf((_homePath + ZT_PATH_SEPARATOR_S "iddb.d").c_str());
|
OSUtils::rmDashRf((_homePath + ZT_PATH_SEPARATOR_S "iddb.d").c_str());
|
||||||
|
|
||||||
|
@ -990,9 +996,9 @@ public:
|
||||||
fprintf(stderr, "Reading RabbitMQ Config\n");
|
fprintf(stderr, "Reading RabbitMQ Config\n");
|
||||||
_mqc = new MQConfig;
|
_mqc = new MQConfig;
|
||||||
_mqc->port = rmq["port"];
|
_mqc->port = rmq["port"];
|
||||||
_mqc->host = OSUtils::jsonString(rmq["host"], "").c_str();
|
_mqc->host = OSUtils::jsonString(rmq["host"], "");
|
||||||
_mqc->username = OSUtils::jsonString(rmq["username"], "").c_str();
|
_mqc->username = OSUtils::jsonString(rmq["username"], "");
|
||||||
_mqc->password = OSUtils::jsonString(rmq["password"], "").c_str();
|
_mqc->password = OSUtils::jsonString(rmq["password"], "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind to wildcard instead of to specific interfaces (disables full tunnel capability)
|
// Bind to wildcard instead of to specific interfaces (disables full tunnel capability)
|
||||||
|
|
Loading…
Add table
Reference in a new issue