网络渗透--2(Kali渗透工具GVM部署相关问题解决)

Kali渗透工具GVM部署相关问题解决

GVM漏洞管理框架是Greenbone Vulnerability Manager的简称,采用了客户端 / 服务器架构。服务器端负责管理漏洞数据库、执行扫描任务以及生成报告。客户端可以是图形用户界面(GUI)或命令行工具,用于与服务器进行交互,设置扫描参数、启动扫描任务以及查看报告。
执行kali工具列表中的gvm-setup,会下载搭建gvm的组件与工具,这个过程通常需要花费三十分钟乃至更长时间。
安装完毕,可以通过gvm-check-setup来检查安装状态:
常见问题:

Step 5: Checking Postgresql DB and user ... 
        OK: Postgresql version and default port are OK.
警告:  database "postgres" has a collation version mismatch
描述:  The database was created using collation version 2.38, but the operating system provides version 2.40.
提示:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
        ERROR: The Postgresql DB does not exist.
        FIX: Run 'sudo runuser -u postgres -- /usr/share/gvm/create-postgresql-database'

提示数据库排序规则版本不匹配,数据库是使用2.38的排序规则版本创建的,而操作系统提供的是2.40版本,接下来提示数据库postgresql不存在,并给出了修复命令sudo runuser -u postgres -- /usr/share/gvm/create-postgresql-database
执行此命令,出现其他问题:

[*] Creating database
警告:  database "postgres" has a collation version mismatch
描述:  The database was created using collation version 2.38, but the operating system provides version 2.40.
提示:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
createdb: 错误: 创建数据库失败: 错误:  template database "template1" has a collation version mismatch
描述:  The template database was created using collation version 2.38, but the operating system provides version 2.40.
提示:  Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
警告:  database "postgres" has a collation version mismatch
描述:  The database was created using collation version 2.38, but the operating system provides version 2.40.
提示:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.

这里提示在修复过程中尝试创建数据库,但由于模板数据库的排序规则版本也和操作系统提供的不匹配,所以创建数据库的操作也失败了,为了修复这个问题,我们首先需要检查数据库连接问题:

┌──(root㉿kali)-[~]
└─# systemctl status postgresql                                          
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; preset: disabled)
     Active: active (exited) since Mon 2024-09-30 14:08:05 CST; 42min ago
 Invocation: 232c59da3bcc40a8abca57be78a9bbd3
    Process: 2971 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 2971 (code=exited, status=0/SUCCESS)
   Mem peak: 1.6M
        CPU: 14ms

930 14:08:05 kali systemd[1]: Starting postgresql.service - PostgreSQL RDBMS...
930 14:08:05 kali systemd[1]: Finished postgresql.service - PostgreSQL RDBMS.

看起来数据库连接没有问题,那么现在应当解决数据库排序规则版本不一致的问题,解决这个问题后,应该可以正常创建数据库。而postgresql数据库通常是由用户postgres安装和管理的,所以首先切换到postgres用户:

sudo -u postgres bash

以postgres用户的身份启用一个新终端来执行命令,接着执行psql命令来连接到postgres数据库,并更改数据库排序规则版本:

postgres@kali:/root$ psql
警告:  database "postgres" has a collation version mismatch
描述:  The database was created using collation version 2.38, but the operating system provides version 2.40.
提示:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
psql (16.4 (Debian 16.4-1))
输入 "help" 来获取帮助信息.

postgres=# ALTER DATABASE postgres REFRESH COLLATION VERSION;
注意:  将版本从2.38更改为2.40
ALTER DATABASE
postgres=# \q

执行完毕后,使用\q命令退出数据库,由于刚才发现模板数据库的排序规则版本也存在不一致问题,所以也需要修改模板数据库:

postgres@kali:/root$ psql template1
警告:  database "template1" has a collation version mismatch
描述:  The database was created using collation version 2.38, but the operating system provides version 2.40.
提示:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
psql (16.4 (Debian 16.4-1))
输入 "help" 来获取帮助信息.

template1=# ALTER DATABASE template1 REFRESH COLLATION VERSION;
注意:  将版本从2.38更改为2.40
ALTER DATABASE
template1=# \q

修复完成后再使用刚才的命令行提示来进行数据库创建:

sudo runuser -u postgres -- /usr/share/gvm/create-postgresql-database

现在再使用gvm-check-setup来进行检测,报如下问题:

Step 5: Checking Postgresql DB and user ... 
        OK: Postgresql version and default port are OK.
 gvmd      | _gvm     | UTF8     | libc            | zh_CN.UTF-8 | zh_CN.UTF-8 |            |           | 
24627|pg-gvm|10|2200|f|22.6||
        ERROR: No users found. You need to create at least one user to log in.
        FIX: create a user by running 'sudo runuser -u _gvm -- gvmd --create-user=<name> --password=<password>'

看来gvmd数据库没有用户,必须创建用户来使用,执行命令行提示来创建用户:

sudo runuser -u _gvm -- gvmd --create-user=newuser --password=newuser123456

创建好后再使用gvm-check-setup来检查,发现gvm安装好了。使用https://127.0.0.1:9392/来访问gvm的web页面,注意https不可省略
gvm web界面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值