cartography-cncf / cartography

Cartography is a Python tool that consolidates infrastructure assets and the relationships between them in an intuitive graph view powered by a Neo4j database.
https://cartography-cncf.github.io/cartography/
Apache License 2.0
2.99k stars 337 forks source link

Can't connect on neo4j later than 4.0 with driver 1.7 #390

Closed sachafaust closed 4 years ago

sachafaust commented 4 years ago

OS - Windows 10 Neo4j - Desktop 4.0.1 Driver - 1.7

Latest version of neo4j doesn't appear to have self signed certificate and won't allow the driver to connect unless encryption is disabled and/or the driver constructor indicate to not encrypt. This blocked new dev box using latest.

See neo4j driver issue - https://github.com/neo4j/neo4j-python-driver/issues/368

Output C:\Users\sacha>cartography --neo4j-uri bolt://localhost:7687 Traceback (most recent call last): File "C:\Users\sacha\AppData\Local\Programs\Python\Python38-32\Scripts\cartography-script.py", line 11, in load_entry_point('cartography==0.25.0', 'console_scripts', 'cartography')() File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\cartography\cli.py", line 348, in main return CLI(default_sync, prog='cartography').main(argv) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\cartography\cli.py", line 328, in main return cartography.sync.run_with_config(self.sync, config) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\cartography\sync.py", line 106, in run_with_config neo4j_driver = GraphDatabase.driver( File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neo4j__init.py", line 120, in driver return Driver(uri, config) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neo4j__init.py", line 161, in new__ return subclass(uri, config) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neo4j__init.py", line 235, in new__ pool.release(pool.acquire()) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neobolt\direct.py", line 715, in acquire return self.acquire_direct(self.address) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neobolt\direct.py", line 608, in acquire_direct connection = self.connector(address, error_handler=self.connection_error_handler) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neo4j\init__.py", line 232, in connector return connect(address, dict(config, kwargs)) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neobolt\direct.py", line 972, in connect raise last_error File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neobolt\direct.py", line 963, in connect s, der_encoded_server_certificate = _secure(s, host, security_plan.ssl_context, **config) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\site-packages\neobolt\direct.py", line 854, in _secure s = ssl_context.wrap_socket(s, server_hostname=host if HAS_SNI and host else None) File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\ssl.py", line 1040, in _create self.do_handshake() File "c:\users\sacha\appdata\local\programs\python\python38-32\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() FileNotFoundError: [Errno 2] No such file or directory

achantavy commented 4 years ago

Double-checking: your Neo4j DB itself is on 4.0.x?

Cartography only supports 3.5.x.

sachafaust commented 4 years ago

by design, didn't see the 3.5.x requirement but it's in the doc.

mingfang commented 4 years ago

@achantavy Are there any plans to upgrade Neo4j to v4+?

achantavy commented 4 years ago

@mingfang Not at the moment. Are there compelling features in v4+ for you? Please create an issue to track if so.

mingfang commented 4 years ago

The biggest reason is scalability. Neo4j v4 has sharding and multiple database support. Also it's been out for some time now so makes sense to build on it to be more future proof.

achantavy commented 4 years ago

Horizontal scaling and sharding are neat, do you know if they are supported in community edition as well? I want to make sure Cartography users without enterprise Neo4j are still supported and I haven't had time to look into v4.

Can you please submit an issue for migrating to v4? We can then talk about it at our 9/24 meeting (you're welcome to join too!).

mingfang commented 4 years ago

@achantavy I created a PR https://github.com/lyft/cartography/pull/405 I tested on AWS