简体   繁体   English

在SchemaSpy中使用SSL连接反向工程PostgreSQL数据库

[英]Reverse enginerring PostgreSQL database with SSL connection in SchemaSpy

When running SchemaSpy get error: 运行SchemaSpy时出现错误:

Connection failed because of the following error: "no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user "xxxx", database "xxx", SSL off" 由于以下错误,连接失败:“主机“ xxx.xxx.xxx.xxx”没有pg_hba.conf条目,用户“ xxxx”,数据库“ xxx”,SSL关闭”

The error occurs because the database does require an SSL connection. 发生错误是因为数据库确实需要SSL连接。

Is there a way to turn on the SSL flag for a connection in SchemaSpy, I opened up the jar file but couldn't find anything. 有没有办法在SchemaSpy中打开连接的SSL标志,我打开了jar文件,但找不到任何东西。 I know the PostgreSQL JDBC Driver supports SSL so this should be theoretically possible. 我知道PostgreSQL JDBC驱动程序支持SSL,因此理论上应该可行。

Otherwise if any one knows any opensource/freeware tools for reverse engineering a postgresql database with an SSL connections, that would help a lot. 否则,如果有人知道任何用于通过SSL连接对Postgresql数据库进行逆向工程的开源/免费工具,那将大有帮助。

Thanks. 谢谢。

Do it like this: 像这样做:

java -jar schemaSpy_5.0.0 -t pgsql -host your-host-url -db your-database-name -s your-database-schema -u your-username -p your-password -connprops "ssl\\=true;sslfactory\\=org.postgresql.ssl.NonValidatingFactory" -o path-to-your-output-directory -dp path-to-your-jdbc-driver-jar-file java -jar schemaSpy_5.0.0 -t pgsql -host your-host-url -db your-database-name -s your-database-schema -u your-username -p your-password -connprops“ ssl \\ = true; sslfactory \\ = org.postgresql.ssl.NonValidatingFactory” -o您的输出目录的路径-dp您的jdbc驱动程序的jar文件的路径

The trick: adding some additional parameters using the -connprops option: we are setting SSL to true ( ssl parameter) and we are asking the client (ie, the driver) to unconditionally accept the SSL connection ( sslfactory parameter). 诀窍:使用-connprops选项添加一些其他参数:我们将SSL设置为true( ssl参数),并要求客户端(即驱动程序)无条件接受SSL连接( sslfactory参数)。

Per the PgJDBC documentation , use the ssl=true option in your URL's parameters, eg 根据PgJDBC文档 ,在URL的参数中使用ssl=true选项,例如

jdbc:postgresql://myhost/mydb?ssl=true

If the host doesn't have a valid certificate or the cert doesn't match its hostname you can disable SSL validation too . 如果主机没有有效的证书或证书与主机名不符,您也可以禁用SSL验证

SchemaSpy accepts a JDBC URL for the connection, so this will work fine. SchemaSpy接受连接的JDBC URL,因此可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM