mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
7472aca387
|
@ -45,7 +45,7 @@ name in AQL queries now requires quoting.
|
||||||
The AQL optimizer rule "merge-traversal-filter" was renamed to "optimize-traversals".
|
The AQL optimizer rule "merge-traversal-filter" was renamed to "optimize-traversals".
|
||||||
|
|
||||||
|
|
||||||
!SECTION Command Line Options
|
!SECTION Command-line options
|
||||||
|
|
||||||
Quite a few startup options in ArangoDB 2 were double negations (like
|
Quite a few startup options in ArangoDB 2 were double negations (like
|
||||||
`--server.disable-authentication false`). In ArangoDB 3 these are now expressed as
|
`--server.disable-authentication false`). In ArangoDB 3 these are now expressed as
|
||||||
|
@ -82,6 +82,7 @@ in 3.0:
|
||||||
upgrade at startup use `--database.auto-upgrade true`. To not perform it, use
|
upgrade at startup use `--database.auto-upgrade true`. To not perform it, use
|
||||||
`--database.auto-upgrade false`.
|
`--database.auto-upgrade false`.
|
||||||
- `--check-version` has been renamed to `--database.check-version`.
|
- `--check-version` has been renamed to `--database.check-version`.
|
||||||
|
- `--temp-path` has been renamed to `--temp.path`.
|
||||||
|
|
||||||
!SUBSECTION Log verbosity, topics and output files
|
!SUBSECTION Log verbosity, topics and output files
|
||||||
|
|
||||||
|
@ -157,9 +158,36 @@ been removed. These endpoints have been used by some ArangoDB-internal applicati
|
||||||
and were not part of ArangoDB's public API.
|
and were not part of ArangoDB's public API.
|
||||||
|
|
||||||
|
|
||||||
|
!SECTION ArangoShell and client tools
|
||||||
|
|
||||||
|
The ArangoShell (arangosh) and the other client tools bundled with ArangoDB can only
|
||||||
|
connect to an ArangoDB server of version 3.0 or higher. They will not connect to an
|
||||||
|
ArangoDB 2.8. This is because the server HTTP APIs have changed between 2.8 and 3.0,
|
||||||
|
and all client tools uses these APIs.
|
||||||
|
|
||||||
|
In order to connect to earlier versions of ArangoDB with the client tools, an older
|
||||||
|
version of the client tools needs to be kept installed.
|
||||||
|
|
||||||
|
|
||||||
|
!SUBSECTION Command-line options changed
|
||||||
|
|
||||||
|
For all client tools, the option `--server.disable-authentication` was renamed to
|
||||||
|
`--server.authentication`. Note that the meaning of the option `--server.authentication`
|
||||||
|
is the opposite of the previous `--server.disable-authentication`.
|
||||||
|
|
||||||
|
The command-line option `--quiet` was removed from all client tools except arangosh
|
||||||
|
because it had no effect in those tools.
|
||||||
|
|
||||||
|
|
||||||
|
!SUBSECTION Arangobench
|
||||||
|
|
||||||
|
In order to make its purpose more apparent, the former `arangob` client tool has
|
||||||
|
been renamed to `arangobench` in 3.0.
|
||||||
|
|
||||||
|
|
||||||
!SECTION Miscellaneous changes
|
!SECTION Miscellaneous changes
|
||||||
|
|
||||||
The checksum calculation algorithm for the `collection.checksum()` method and its
|
The checksum calculation algorithm for the `collection.checksum()` method and its
|
||||||
corresponding REST API has changed in 3.0. Checksums calculated in 2.8 will differ
|
corresponding REST API has changed in 3.0. Checksums calculated in 3.0 will differ
|
||||||
from checksums calculated with 3.0.
|
from checksums calculated with 2.8 or before.
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "ApplicationFeatures/DaemonFeature.h"
|
#include "ApplicationFeatures/DaemonFeature.h"
|
||||||
#include "ApplicationFeatures/LanguageFeature.h"
|
#include "ApplicationFeatures/LanguageFeature.h"
|
||||||
#include "ApplicationFeatures/NonceFeature.h"
|
#include "ApplicationFeatures/NonceFeature.h"
|
||||||
|
#include "ApplicationFeatures/PrivilegeFeature.h"
|
||||||
#include "ApplicationFeatures/ShutdownFeature.h"
|
#include "ApplicationFeatures/ShutdownFeature.h"
|
||||||
#include "ApplicationFeatures/SslFeature.h"
|
#include "ApplicationFeatures/SslFeature.h"
|
||||||
#include "ApplicationFeatures/SupervisorFeature.h"
|
#include "ApplicationFeatures/SupervisorFeature.h"
|
||||||
|
@ -121,6 +122,7 @@ int main(int argc, char* argv[]) {
|
||||||
server.addFeature(new LoggerBufferFeature(&server));
|
server.addFeature(new LoggerBufferFeature(&server));
|
||||||
server.addFeature(new LoggerFeature(&server, true));
|
server.addFeature(new LoggerFeature(&server, true));
|
||||||
server.addFeature(new NonceFeature(&server));
|
server.addFeature(new NonceFeature(&server));
|
||||||
|
server.addFeature(new PrivilegeFeature(&server));
|
||||||
server.addFeature(new QueryRegistryFeature(&server));
|
server.addFeature(new QueryRegistryFeature(&server));
|
||||||
server.addFeature(new RandomFeature(&server));
|
server.addFeature(new RandomFeature(&server));
|
||||||
server.addFeature(new RestServerFeature(&server, "arangodb"));
|
server.addFeature(new RestServerFeature(&server, "arangodb"));
|
||||||
|
|
|
@ -407,8 +407,10 @@ int V8ShellFeature::runShell(std::vector<std::string> const& positionals) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_console->printLine("");
|
if (!_console->quiet()) {
|
||||||
_console->printByeBye();
|
_console->printLine("");
|
||||||
|
_console->printByeBye();
|
||||||
|
}
|
||||||
|
|
||||||
return promptError ? TRI_ERROR_INTERNAL : TRI_ERROR_NO_ERROR;
|
return promptError ? TRI_ERROR_INTERNAL : TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "ApplicationServer.h"
|
#include "ApplicationServer.h"
|
||||||
|
|
||||||
#include "ApplicationFeatures/ApplicationFeature.h"
|
#include "ApplicationFeatures/ApplicationFeature.h"
|
||||||
|
#include "ApplicationFeatures/PrivilegeFeature.h"
|
||||||
#include "Basics/StringUtils.h"
|
#include "Basics/StringUtils.h"
|
||||||
#include "ProgramOptions/ArgumentParser.h"
|
#include "ProgramOptions/ArgumentParser.h"
|
||||||
#include "Logger/Logger.h"
|
#include "Logger/Logger.h"
|
||||||
|
@ -58,7 +59,8 @@ void ApplicationServer::throwFeatureNotFoundException(std::string const& name) {
|
||||||
"unknown feature '" + name + "'");
|
"unknown feature '" + name + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationServer::throwFeatureNotEnabledException(std::string const& name) {
|
void ApplicationServer::throwFeatureNotEnabledException(
|
||||||
|
std::string const& name) {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL,
|
||||||
"feature '" + name + "' is not enabled");
|
"feature '" + name + "' is not enabled");
|
||||||
}
|
}
|
||||||
|
@ -80,11 +82,13 @@ void ApplicationServer::disableFeatures(std::vector<std::string> const& names) {
|
||||||
disableFeatures(names, false);
|
disableFeatures(names, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationServer::forceDisableFeatures(std::vector<std::string> const& names) {
|
void ApplicationServer::forceDisableFeatures(
|
||||||
|
std::vector<std::string> const& names) {
|
||||||
disableFeatures(names, true);
|
disableFeatures(names, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationServer::disableFeatures(std::vector<std::string> const& names, bool force) {
|
void ApplicationServer::disableFeatures(std::vector<std::string> const& names,
|
||||||
|
bool force) {
|
||||||
for (auto const& name : names) {
|
for (auto const& name : names) {
|
||||||
auto feature = ApplicationServer::lookupFeature(name);
|
auto feature = ApplicationServer::lookupFeature(name);
|
||||||
|
|
||||||
|
@ -329,7 +333,7 @@ void ApplicationServer::enableAutomaticFeatures() {
|
||||||
void ApplicationServer::setupDependencies(bool failOnMissing) {
|
void ApplicationServer::setupDependencies(bool failOnMissing) {
|
||||||
LOG_TOPIC(TRACE, Logger::STARTUP)
|
LOG_TOPIC(TRACE, Logger::STARTUP)
|
||||||
<< "ApplicationServer::validateDependencies";
|
<< "ApplicationServer::validateDependencies";
|
||||||
|
|
||||||
// calculate ancestors for all features
|
// calculate ancestors for all features
|
||||||
for (auto& it : _features) {
|
for (auto& it : _features) {
|
||||||
it.second->determineAncestors();
|
it.second->determineAncestors();
|
||||||
|
@ -350,7 +354,6 @@ void ApplicationServer::setupDependencies(bool failOnMissing) {
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// first insert all features, even the inactive ones
|
// first insert all features, even the inactive ones
|
||||||
std::vector<ApplicationFeature*> features;
|
std::vector<ApplicationFeature*> features;
|
||||||
|
@ -498,7 +501,7 @@ void ApplicationServer::raisePrivilegesTemporarily() {
|
||||||
THROW_ARANGO_EXCEPTION_MESSAGE(
|
THROW_ARANGO_EXCEPTION_MESSAGE(
|
||||||
TRI_ERROR_INTERNAL, "must not raise privileges after dropping them");
|
TRI_ERROR_INTERNAL, "must not raise privileges after dropping them");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "raising privileges";
|
LOG_TOPIC(TRACE, Logger::STARTUP) << "raising privileges";
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -511,7 +514,7 @@ void ApplicationServer::dropPrivilegesTemporarily() {
|
||||||
TRI_ERROR_INTERNAL,
|
TRI_ERROR_INTERNAL,
|
||||||
"must not try to drop privileges after dropping them");
|
"must not try to drop privileges after dropping them");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_TOPIC(TRACE, Logger::STARTUP) << "dropping privileges";
|
LOG_TOPIC(TRACE, Logger::STARTUP) << "dropping privileges";
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -524,7 +527,12 @@ void ApplicationServer::dropPrivilegesPermanently() {
|
||||||
TRI_ERROR_INTERNAL,
|
TRI_ERROR_INTERNAL,
|
||||||
"must not try to drop privileges after dropping them");
|
"must not try to drop privileges after dropping them");
|
||||||
}
|
}
|
||||||
_privilegesDropped = true;
|
|
||||||
|
|
||||||
// TODO
|
auto privilege = dynamic_cast<PrivilegeFeature*>(lookupFeature("Privilege"));
|
||||||
|
|
||||||
|
if (privilege != nullptr) {
|
||||||
|
privilege->dropPrivilegesPermanently();
|
||||||
|
}
|
||||||
|
|
||||||
|
_privilegesDropped = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,15 +93,25 @@ class ApplicationServer {
|
||||||
public:
|
public:
|
||||||
static ApplicationServer* server;
|
static ApplicationServer* server;
|
||||||
static ApplicationFeature* lookupFeature(std::string const&);
|
static ApplicationFeature* lookupFeature(std::string const&);
|
||||||
static bool isStopping() { return server != nullptr && server->_stopping.load(); }
|
static bool isStopping() {
|
||||||
|
return server != nullptr && server->_stopping.load();
|
||||||
|
}
|
||||||
|
|
||||||
enum class FeatureState { UNINITIALIZED, INITIALIZED, VALIDATED, PREPARED, STARTED, STOPPED };
|
enum class FeatureState {
|
||||||
|
UNINITIALIZED,
|
||||||
|
INITIALIZED,
|
||||||
|
VALIDATED,
|
||||||
|
PREPARED,
|
||||||
|
STARTED,
|
||||||
|
STOPPED
|
||||||
|
};
|
||||||
|
|
||||||
// returns the feature with the given name if known
|
// returns the feature with the given name if known
|
||||||
// throws otherwise
|
// throws otherwise
|
||||||
template<typename T>
|
template <typename T>
|
||||||
static T* getFeature(std::string const& name) {
|
static T* getFeature(std::string const& name) {
|
||||||
T* feature = dynamic_cast<T*>(application_features::ApplicationServer::lookupFeature(name));
|
T* feature = dynamic_cast<T*>(
|
||||||
|
application_features::ApplicationServer::lookupFeature(name));
|
||||||
if (feature == nullptr) {
|
if (feature == nullptr) {
|
||||||
throwFeatureNotFoundException(name);
|
throwFeatureNotFoundException(name);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +120,7 @@ class ApplicationServer {
|
||||||
|
|
||||||
// returns the feature with the given name if known and enabled
|
// returns the feature with the given name if known and enabled
|
||||||
// throws otherwise
|
// throws otherwise
|
||||||
template<typename T>
|
template <typename T>
|
||||||
static T* getEnabledFeature(std::string const& name) {
|
static T* getEnabledFeature(std::string const& name) {
|
||||||
T* feature = getFeature<T>(name);
|
T* feature = getFeature<T>(name);
|
||||||
if (!feature->isEnabled()) {
|
if (!feature->isEnabled()) {
|
||||||
|
@ -166,11 +176,12 @@ class ApplicationServer {
|
||||||
private:
|
private:
|
||||||
// throws an exception if a requested feature was not found
|
// throws an exception if a requested feature was not found
|
||||||
static void throwFeatureNotFoundException(std::string const& name);
|
static void throwFeatureNotFoundException(std::string const& name);
|
||||||
|
|
||||||
// throws an exception if a requested feature is not enabled
|
// throws an exception if a requested feature is not enabled
|
||||||
static void throwFeatureNotEnabledException(std::string const& name);
|
static void throwFeatureNotEnabledException(std::string const& name);
|
||||||
|
|
||||||
static void disableFeatures(std::vector<std::string> const& names, bool force);
|
static void disableFeatures(std::vector<std::string> const& names,
|
||||||
|
bool force);
|
||||||
|
|
||||||
// fail and abort with the specified message
|
// fail and abort with the specified message
|
||||||
void fail(std::string const& message);
|
void fail(std::string const& message);
|
||||||
|
|
|
@ -22,31 +22,49 @@
|
||||||
|
|
||||||
#include "PrivilegeFeature.h"
|
#include "PrivilegeFeature.h"
|
||||||
|
|
||||||
//YYY #warning FRANK TODO
|
#ifdef ARANGODB_HAVE_GETGRGID
|
||||||
#if 0
|
#include <grp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
SslFeature::SslFeature(application_features::ApplicationServer* server)
|
#ifdef ARANGODB_HAVE_GETPWUID
|
||||||
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Basics/conversions.h"
|
||||||
|
#include "ProgramOptions/ProgramOptions.h"
|
||||||
|
#include "ProgramOptions/Section.h"
|
||||||
|
|
||||||
|
using namespace arangodb;
|
||||||
|
using namespace arangodb::basics;
|
||||||
|
using namespace arangodb::options;
|
||||||
|
|
||||||
|
PrivilegeFeature::PrivilegeFeature(
|
||||||
|
application_features::ApplicationServer* server)
|
||||||
: ApplicationFeature(server, "Privilege") {
|
: ApplicationFeature(server, "Privilege") {
|
||||||
setOptional(true);
|
setOptional(true);
|
||||||
requiresElevatedPrivileges(false);
|
requiresElevatedPrivileges(false);
|
||||||
startsAfter("Logger");
|
startsAfter("Logger");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SslFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
void PrivilegeFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
|
||||||
#ifdef ARANGODB_HAVE_SETUID
|
#ifdef ARANGODB_HAVE_SETUID
|
||||||
options->addHiddenOption("--uid",
|
options->addHiddenOption("--uid",
|
||||||
"switch to user-id after reading config files",
|
"switch to user-id after reading config files",
|
||||||
new UInt64Parameter(&_uid));
|
new StringParameter(&_uid));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARANGODB_HAVE_SETGID
|
#ifdef ARANGODB_HAVE_SETGID
|
||||||
options->addHiddenOption("--gid",
|
options->addHiddenOption("--gid",
|
||||||
"switch to group-id after reading config files",
|
"switch to group-id after reading config files",
|
||||||
new UInt64Parameter(&_gid));
|
new StringParameter(&_gid));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationServer::extractPrivileges() {
|
void PrivilegeFeature::prepare() {
|
||||||
|
extractPrivileges();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrivilegeFeature::extractPrivileges() {
|
||||||
#ifdef ARANGODB_HAVE_SETGID
|
#ifdef ARANGODB_HAVE_SETGID
|
||||||
if (_gid.empty()) {
|
if (_gid.empty()) {
|
||||||
_numericGid = getgid();
|
_numericGid = getgid();
|
||||||
|
@ -121,7 +139,7 @@ void ApplicationServer::extractPrivileges() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationServer::dropPrivilegesPermanently() {
|
void PrivilegeFeature::dropPrivilegesPermanently() {
|
||||||
#if defined(ARANGODB_HAVE_INITGROUPS) && defined(ARANGODB_HAVE_SETGID) && \
|
#if defined(ARANGODB_HAVE_INITGROUPS) && defined(ARANGODB_HAVE_SETGID) && \
|
||||||
defined(ARANGODB_HAVE_SETUID)
|
defined(ARANGODB_HAVE_SETUID)
|
||||||
// clear all supplementary groups
|
// clear all supplementary groups
|
||||||
|
@ -162,5 +180,3 @@ void ApplicationServer::dropPrivilegesPermanently() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -33,11 +33,20 @@ class PrivilegeFeature final : public application_features::ApplicationFeature {
|
||||||
public:
|
public:
|
||||||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||||
void prepare() override final;
|
void prepare() override final;
|
||||||
void start() override final;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string _path;
|
std::string _uid;
|
||||||
std::string _appname;
|
std::string _gid;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void dropPrivilegesPermanently();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void extractPrivileges();
|
||||||
|
|
||||||
|
private:
|
||||||
|
TRI_uid_t _numericUid;
|
||||||
|
TRI_gid_t _numericGid;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ else ()
|
||||||
set(LIB_ARANGO_POSIX
|
set(LIB_ARANGO_POSIX
|
||||||
ApplicationFeatures/DaemonFeature.cpp
|
ApplicationFeatures/DaemonFeature.cpp
|
||||||
ApplicationFeatures/PrivilegeFeature.cpp
|
ApplicationFeatures/PrivilegeFeature.cpp
|
||||||
|
ApplicationFeatures/PrivilegeFeature.cpp
|
||||||
ApplicationFeatures/SupervisorFeature.cpp
|
ApplicationFeatures/SupervisorFeature.cpp
|
||||||
Basics/locks-posix.cpp
|
Basics/locks-posix.cpp
|
||||||
Basics/memory-map-posix.cpp
|
Basics/memory-map-posix.cpp
|
||||||
|
|
Loading…
Reference in New Issue