有人让Neo4j使用LetsEncrypt证书吗?
我有一个与LetsEncrypt合作的常规网站,所以我知道我的证书很好。 Neo4j正在运行,我可以通过https访问Neo4j浏览器,并且收到自签名证书警告。
我一直在遵循有关设置SSL的文档,但是当我尝试启动服务时,它立即失败。问题出在哪里,我什至没有输出任何日志。
myself@localhost:/var/lib/neo4j/certificates/bolt/trusted# service neo4j status
● neo4j.service - Neo4j Graph Database
Loaded: loaded (/lib/systemd/system/neo4j.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/neo4j.service.d
└─override.conf
Active: inactive (dead) (Result: exit-code) since Sat 2018-07-21 21:08:37 MDT; 658ms ago
Process: 19066 ExecStart=/usr/share/neo4j/bin/neo4j console (code=exited, status=1/FAILURE)
Main PID: 19066 (code=exited, status=1/FAILURE)
Jul 21 21:08:37 Swingset systemd[1]: neo4j.service: Unit entered failed state.
Jul 21 21:08:37 Swingset systemd[1]: neo4j.service: Failed with result 'exit-code'.
Jul 21 21:08:37 Swingset systemd[1]: neo4j.service: Service hold-off time over, scheduling restart.
Jul 21 21:08:37 Swingset systemd[1]: Stopped Neo4j Graph Database.
Jul 21 21:08:37 Swingset systemd[1]: neo4j.service: Start request repeated too quickly.
Jul 21 21:08:37 Swingset systemd[1]: Failed to start Neo4j Graph Database.
因此,我正在寻找能够完成这项工作的人员,并可以给我提供一些要仔细检查的事情的清单。我相信我具有正确的文件夹结构,我认为我具有正确的权限,我认为neo4j.conf修改正确,并且我认为我具有复制到正确的文件夹中并具有正确文件名的正确的LetsEncrypt文件。但是我必须丢失一些东西,因为它不起作用。
答案 0 :(得分:1)
今天我在做完全相同的事情时很有趣,在试图弄清楚这个问题时偶然发现了这个问题...那么根据{{3}的指示,这就是对我有用的方法以及我遵循的程序}。
创建适当的目录结构
cd /var/lib/neo4j/certificates
mkdir -p default/revoked default/trusted
将letsencrypt证书复制到neo4j文件夹中
# Copy your server cert to the base dir and the trusted dir of neo4j
cp $your_cert_dir/cert.pem /var/lib/neo4j/certificates/default/cert.pem
cp $your_cert_dir/cert.pem /var/lib/neo4j/certificates/default/trusted/cert.pem
# Copy your key to the base dir of neo4j
cp $your_cert_dir/privkey.pem /var/lib/neo4j/certificates/default/privkey.pem
确保文件具有正确的权限
# To my system, Ubuntu 16.04, it was neo4j:adm
chown -R neo4j:adm /var/lib/neo4j/certificates/default/
确保neo4j(/etc/neo4j/neo4j.conf
)的配置文件中包含以下条目
# Set the base dir for certificates
dbms.directories.certificates=/var/lib/neo4j/certificates
# To enable connections from remote servers
dbms.connectors.default_listen_address=0.0.0.0
# This can remain "OPTIONAL"
dbms.connector.bolt.tls_level=REQUIRED
# Enable https connector
dbms.connector.https.enabled=true
dbms.connector.https.listen_address=:7473
# Set up the policy for the connectors to the default
bolt.ssl_policy=default
https.ssl_policy=default
# Create default policy
dbms.ssl.policy.default.base_directory=certificates/default
# Set the paths for the private key and of the server cert.
# These must be absolute paths.
dbms.ssl.policy.default.private_key=/var/lib/neo4j/certificates/default/privkey.pem
dbms.ssl.policy.default.public_certificate=/var/lib/neo4j/certificates/default/cert.pem
# Set up client authentication to "optional" or "none".
# If this is left to "default" then the client (a.k.a person who tries to
# access the web-portal) would need to authenticate with a certificate
dbms.ssl.policy.default.client_auth=none
确保已打开以下端口,以打开服务器的防火墙
重新启动neo4j
service neo4j restart
您现在应该可以使用https://<your server domain name>:7473
连接到Web界面。如果您尝试使用https://IP:7473
,则您的浏览器将抱怨证书和地址不同的事实。
仅供参考,我仍然在Neo4j日志中收到以下错误,并且我正在尝试解决该错误。到目前为止,其他所有功能似乎都还不错。
Jul 24 14:13:34 sstest neo4j[18181]: 2018-07-24 12:13:34.556+0000 ERROR Unexpected error detected in bolt session 'fa163efffeefd082-00004705-00000003-81330a20f088cbac-29e11d2a'. The client is unauthorized due to authentication failure.
Jul 24 14:13:34 sstest neo4j[18181]: org.neo4j.bolt.v1.runtime.BoltConnectionFatality: The client is unauthorized due to authentication failure.
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.v1.runtime.BoltStateMachine.handleFailure(BoltStateMachine.java:742)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.v1.runtime.BoltStateMachine.handleFailure(BoltStateMachine.java:728)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.v1.runtime.BoltStateMachine.access$500(BoltStateMachine.java:62)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.v1.runtime.BoltStateMachine$State$1.init(BoltStateMachine.java:435)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.v1.runtime.BoltStateMachine.init(BoltStateMachine.java:145)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.v1.messaging.BoltMessageRouter.lambda$onInit$0(BoltMessageRouter.java:70)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:195)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:143)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.runtime.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:170)
Jul 24 14:13:34 sstest neo4j[18181]: at org.neo4j.bolt.runtime.ExecutorBoltScheduler.lambda$scheduleBatchOrHandleError$2(ExecutorBoltScheduler.java:153)
Jul 24 14:13:34 sstest neo4j[18181]: at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
Jul 24 14:13:34 sstest neo4j[18181]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
Jul 24 14:13:34 sstest neo4j[18181]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Jul 24 14:13:34 sstest neo4j[18181]: at java.lang.Thread.run(Thread.java:748)