This repository was archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
This repository was archived by the owner on Oct 15, 2023. It is now read-only.
Document authentication #61
Copy link
Copy link
Open
Labels
Description
I'm attempting to add basic authentication to the websocket channel. I tried following the docs from https://docs.janusgraph.org/basics/server/#http-basic-authentication and added the authentication config in gremlin-server.yaml. I used my own config files in a folder conf and tried to run docker-compose up. Its failing with the error "Gremlin Server was unable to start and will now begin shutdown: Could not create/configure Authenticator null error"
What am I doing wrong here ?
// docker-compose.yml
# Copyright 2019 JanusGraph Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: "3"
services:
janusgraph:
image: janusgraph/janusgraph:latest
container_name: jce-janusgraph
ports:
- "8182:8182"
networks:
- jce-network
volumes:
# bind mounts for configs; use read only so not overridden by environment variables
- "./conf:/etc/opt/janusgraph/:ro"
healthcheck:
test: ["CMD", "bin/gremlin.sh", "-e", "scripts/remote-connect.groovy"]
interval: 10s
timeout: 30s
retries: 3
cassandra:
image: cassandra:3
container_name: jce-cassandra
ports:
- "9042:9042"
- "9160:9160"
networks:
- jce-network
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0
container_name: jce-elastic
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "http.host=0.0.0.0"
- "network.host=0.0.0.0"
- "transport.host=127.0.0.1"
- "cluster.name=docker-cluster"
- "xpack.security.enabled=false"
- "discovery.zen.minimum_master_nodes=1"
ports:
- "9200:9200"
networks:
- jce-network
networks:
jce-network:
volumes:
janusgraph-default-data:
// conf/gremlin-server.yaml
# Copyright 2019 JanusGraph Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
graph: /etc/opt/janusgraph/janusgraph.properties
}
scriptEngines: {
gremlin-groovy: {
plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
# Older serialization versions for backwards compatibility:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
- { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
consoleReporter: {enabled: true, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: true},
slf4jReporter: {enabled: true, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
threadPoolWorker: 1
gremlinPool: 8
authentication: { <<< this is what i added to the default template
authenticator: org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.JanusGraphSimpleAuthenticator,
authenticationHandler: org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthenticationHandler,
config: {
defaultUsername: user,
defaultPassword: password,
credentialsDb: /etc/opt/janusgraph/janusgraph-credentials-server.properties
}
}
// conf/janusgraph.properties
gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=cql
storage.hostname=jce-cassandra
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
index.search.backend=elasticsearch
index.search.hostname=jce-elastic
index.search.elasticsearch.client-only=true
storage.directory=/var/lib/janusgraph/data
index.search.directory=/var/lib/janusgraph/index
// conf/janusgraph-credentials-server.properties
username:user
password:password
Here is the response tail of docker-compose up.
jce-janusgraph | 1 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - 3.4.6
jce-janusgraph | \,,,/
jce-janusgraph | (o o)
jce-janusgraph | -----oOOo-(3)-oOOo-----
jce-janusgraph |
jce-janusgraph | 76 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Configuring Gremlin Server from /etc/opt/janusgraph/gremlin-server.yaml
jce-janusgraph | 135 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics ConsoleReporter configured with report interval=180000ms
jce-janusgraph | 137 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
jce-janusgraph | 173 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics JmxReporter configured with domain= and agentId=
jce-janusgraph | 174 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
jce-janusgraph | 462 [main] INFO com.datastax.driver.core - DataStax Java driver 3.9.0 for Apache Cassandra
jce-janusgraph | 475 [main] INFO com.datastax.driver.core.GuavaCompatibility - Detected Guava < 19 in the classpath, using legacy compatibility layer
jce-janusgraph | 591 [main] INFO com.datastax.driver.core.ClockFactory - Using native clock to generate timestamps.
jce-janusgraph | 661 [main] INFO com.datastax.driver.core.NettyUtil - Found Netty's native epoll transport in the classpath, using it
jce-janusgraph | 890 [main] INFO com.datastax.driver.core.policies.DCAwareRoundRobinPolicy - Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
jce-janusgraph | 890 [main] INFO com.datastax.driver.core.Cluster - New Cassandra host jce-cassandra/172.18.0.4:9042 added
jce-janusgraph | 1020 [main] INFO org.janusgraph.core.util.ReflectiveConfigOptionLoader - Loaded and initialized config classes: 13 OK out of 13 attempts in PT0.034S
jce-janusgraph | 3081 [main] INFO org.janusgraph.graphdb.idmanagement.UniqueInstanceIdRetriever - Generated unique-instance-id=ac120003460-8e2964850e221
jce-janusgraph | 3085 [main] INFO com.datastax.driver.core.ClockFactory - Using native clock to generate timestamps.
jce-janusgraph | 3131 [main] INFO com.datastax.driver.core.policies.DCAwareRoundRobinPolicy - Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)
jce-janusgraph | 3131 [main] INFO com.datastax.driver.core.Cluster - New Cassandra host jce-cassandra/172.18.0.4:9042 added
jce-janusgraph | 3154 [main] INFO org.janusgraph.diskstorage.Backend - Configuring index [search]
jce-janusgraph | 3436 [main] INFO org.janusgraph.diskstorage.Backend - Initiated backend operations thread pool of size 24
jce-janusgraph | 3480 [main] INFO org.janusgraph.diskstorage.Backend - Configuring total store cache size: 112424774
jce-janusgraph | 3571 [main] INFO org.janusgraph.diskstorage.log.kcvs.KCVSLog - Loaded unidentified ReadMarker start time 2020-07-17T18:37:39.866Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller@3e6534e7
jce-janusgraph | 3572 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Graph [graph] was successfully configured via [/etc/opt/janusgraph/janusgraph.properties].
jce-janusgraph | 3572 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*
jce-janusgraph | 3600 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
jce-janusgraph | 5874 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
jce-janusgraph | 5878 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[standardjanusgraph[cql:[jce-cassandra]], standard]
jce-janusgraph | 5884 [main] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the standard OpProcessor.
jce-janusgraph | 5886 [main] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the session OpProcessor.
jce-janusgraph | 5943 [main] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the traversal OpProcessor.
jce-janusgraph | 5949 [main] INFO org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor - Initialized cache for TraversalOpProcessor with size 1000 and expiration time of 600000 ms
jce-janusgraph | 5950 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executing start up LifeCycleHook
jce-janusgraph | 5962 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executed once at startup of Gremlin Server.
jce-janusgraph | 5967 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - idleConnectionTimeout was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
jce-janusgraph | 5967 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - keepAliveInterval was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
jce-janusgraph | 5969 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 serialization class is deprecated.
jce-janusgraph | 6008 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v3.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0
jce-janusgraph | 6008 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 serialization class is deprecated.
jce-janusgraph | 6008 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v3.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0
jce-janusgraph | 6023 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v3.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
jce-janusgraph | 6023 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
jce-janusgraph | 6024 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 serialization class is deprecated.
jce-janusgraph | 6025 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
jce-janusgraph | 6026 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0 serialization class is deprecated.
jce-janusgraph | 6027 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-lite with org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0
jce-janusgraph | 6027 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 serialization class is deprecated.
jce-janusgraph | 6027 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
jce-janusgraph | 6027 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0 serialization class is deprecated.
jce-janusgraph | 6031 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v2.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0
jce-janusgraph | 6031 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - application/json already has org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 configured - it will not be replaced by org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, change order of serialization configuration if this is not desired.
jce-janusgraph | 6035 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0
jce-janusgraph | 6036 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - application/json already has org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 configured - it will not be replaced by org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, change order of serialization configuration if this is not desired.
jce-janusgraph | 6036 [main] INFO org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.JanusGraphAbstractAuthenticator - Initializing authentication with the org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.JanusGraphSimpleAuthenticator
jce-janusgraph | 6037 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Need to set configuration value: root.storage.backend
jce-janusgraph | 6038 [main] ERROR org.apache.tinkerpop.gremlin.server.GremlinServer - Gremlin Server Error
jce-janusgraph | java.lang.IllegalStateException: Could not create/configure Authenticator null
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.AbstractChannelizer.createAuthenticator(AbstractChannelizer.java:206)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.AbstractChannelizer.init(AbstractChannelizer.java:152)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer.init(WebSocketChannelizer.java:62)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.start(GremlinServer.java:162)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:346)
jce-janusgraph | Caused by: java.lang.IllegalStateException: Need to set configuration value: root.storage.backend
jce-janusgraph | at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.ConfigOption.get(ConfigOption.java:229)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.BasicConfiguration.get(BasicConfiguration.java:69)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.Configuration.get(Configuration.java:35)
jce-janusgraph | at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:411)
jce-janusgraph | at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:50)
jce-janusgraph | at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:161)
jce-janusgraph | at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:132)
jce-janusgraph | at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:79)
jce-janusgraph | at org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.JanusGraphAbstractAuthenticator.openGraph(JanusGraphAbstractAuthenticator.java:77)
jce-janusgraph | at org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.JanusGraphAbstractAuthenticator.setup(JanusGraphAbstractAuthenticator.java:94)
jce-janusgraph | at org.janusgraph.graphdb.tinkerpop.gremlin.server.auth.JanusGraphSimpleAuthenticator.setup(JanusGraphSimpleAuthenticator.java:37)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.AbstractChannelizer.createAuthenticator(AbstractChannelizer.java:202)
jce-janusgraph | ... 4 more
jce-janusgraph | 6039 [main] ERROR org.apache.tinkerpop.gremlin.server.GremlinServer - Gremlin Server was unable to start and will now begin shutdown: Could not create/configure Authenticator null
jce-janusgraph | 6040 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Shutting down OpProcessor[]
jce-janusgraph | 6040 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Shutting down OpProcessor[session]
jce-janusgraph | 6040 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Shutting down OpProcessor[traversal]
jce-janusgraph | 6040 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Shutting down thread pools.
jce-janusgraph | 6042 [gremlin-server-stop] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executing shutdown LifeCycleHook
jce-janusgraph | 6042 [gremlin-server-stop] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executed once at shutdown of Gremlin Server.
jce-janusgraph | 10069 [gremlin-server-stop] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Closed Graph instance [graph]
jce-janusgraph | 10072 [gremlin-server-stop] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Gremlin Server - shutdown complete