ThePorgs / Exegol-images

Docker images of the Exegol project
https://exegol.readthedocs.io/
GNU General Public License v3.0
73 stars 56 forks source link

msfdb Not launnching correctly #365

Closed Dourin closed 2 weeks ago

Dourin commented 2 weeks ago

Describe the bug

It happen then you try to init or run the msfdb. fatal: .git/index: index file open failed: Permission denied

Steps To Reproduce

[Jun 19, 2024 - 08:42:27 (CEST)] exegol-htb /workspace # msfdb init Calling DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please callDidYouMean.correct_error(error_name, spell_checker)' instead. fatal: .git/index: index file open failed: Permission denied Running the 'init' command for the database: Existing database found, attempting to start it Starting database at /var/lib/postgresql/.msf4/db...success [Jun 19, 2024 - 08:42:39 (CEST)] exegol-htb /workspace # msfdb status Calling DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please callDidYouMean.correct_error(error_name, spell_checker)' instead. fatal: .git/index: index file open failed: Permission denied

Running the 'status' command for the database: Database started

==================================================================== Running the 'status' command for the webservice: MSF web service is not running: no PID file found at /var/lib/postgresql/.msf4/msf-ws.pid

[Jun 19, 2024 - 08:42:53 (CEST)] exegol-htb /workspace # msfdb run
Calling DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please callDidYouMean.correct_error(error_name, spell_checker)' instead. fatal: .git/index: index file open failed: Permission denied Running the 'run' command for the database: [!] Error: unrecognized command 'run' for database

The solution is to make the right on the /opt/tools/metasploit-framework/.git/index like chmod 777 /opt/tools/metasploit-framework/.git/

Exegol Wrapper Version

exegol version -vvv                                   2 ↵
[*] Exegol is currently in version v4.3.4
[*] Exegol Discord serv.: https://discord.gg/cXThyp7D6P
[*] Exegol documentation: https://exegol.rtfd.io/
[D] Pip installation: On ✔                                                  
[D] Git source installation: Off 🪓                                         
[D] Host OS: Linux (Kernel)                                                 
[D] Arch: amd64                                                             
[D] Raw arch: x86_64                                                        
[D] Docker desktop: Off 🪓                                                  
[D] Shell type: Linux                                                       
[D] Last wrapper update check: 18/06/2024                                   

[*] Exegol is currently in version v4.3.4
[*] Exegol Discord serv.: https://discord.gg/cXThyp7D6P
[*] Exegol documentation: https://exegol.rtfd.io/

Host OS

Linux

Configuration of the concerned container

exegol info -v htb 
[*] Exegol is currently in version v4.3.4
[*] Exegol Discord serv.: https://discord.gg/cXThyp7D6P
[*] Exegol documentation: https://exegol.rtfd.io/
[V] Listing user configurations                                             

🧠 User configurations                                     
┌─────────────────────────────────────────────────────────┐
│ User config file: /home/debian/.exegol/config.yml       │
│ Private workspace: /home/debian/.exegol/workspaces      │
│ Exegol resources: /home/debian/.exegol/exegol-resources │
│ My resources: /home/debian/.exegol/my-resources         │
│ Auto-check updates: On ✔                                │
│ Auto-remove images: On ✔                                │
│ Auto-update fs: Off 🪓                                  │
│ Default start shell: zsh                                │
│ Shell logging method: asciinema                         │
│ Shell logging compression: On ✔                         │
│ Desktop enabled by default: Off 🪓                      │
│ Desktop default protocol: http                          │
│ Desktop default host: localhost                         │
└─────────────────────────────────────────────────────────┘

⭐ Container summary                                                        
┌──────────────────┬───────────────────────────────────────────────────────┐
│             Name │ htb                                                   │
│            Image │ nightly - v.53b086e1 (Up to date) (amd64)             │
├──────────────────┼───────────────────────────────────────────────────────┤
│      Credentials │ root : CW4mdsIHalSxX3vx8rNJFLV6dHoWzU                 │
│   Remote Desktop │ Off 🪓                                                │
│    Creation date │ 18/06/2024 13:31                                      │
│      Console GUI │ On ✔ (X11 + Wayland)                                  │
│          Network │ host with VPN                                         │
│         Timezone │ On ✔                                                  │
│ Exegol resources │ On ✔ (/opt/resources)                                 │
│     My resources │ On ✔ (/opt/my-resources)                              │
│    Shell logging │ Off 🪓                                                │
│              VPN │ academy-regular.ovpn                                  │
│       Privileged │ Off ✔                                                 │
│     Capabilities │ NET_ADMIN                                             │
│        Workspace │ Dedicated (/workspace)                                │
│          Devices │ /dev/net/tun:/dev/net/tun:rwm                         │
│             Envs │ DISPLAY=:1                                            │
│                  │ XDG_SESSION_TYPE=wayland                              │
│                  │ XDG_RUNTIME_DIR=/tmp                                  │
│                  │ WAYLAND_DISPLAY=wayland-0                             │
│                  │ _JAVA_AWT_WM_NONREPARENTING=1                         │
│                  │ QT_X11_NO_MITSHM=1                                    │
│                  │ EXEGOL_RANDOMIZE_SERVICE_PORTS=true                   │
│                  │ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/b… │
│          Volumes │ (RO) /home/debian/Exegol/academy-regular.ovpn ➡       │
│                  │ /.exegol/vpn/config/client.ovpn                       │
│                  │ (RW) /home/debian/.exegol/my-resources ➡              │
│                  │ /opt/my-resources                                     │
│                  │ (RW) /run/user/1000/wayland-0 ➡ /tmp/wayland-0        │
│                  │ (RW) /home/debian/.exegol/exegol-resources ➡          │
│                  │ /opt/resources                                        │
│                  │ (RW) /tmp/.X11-unix ➡ /tmp/.X11-unix                  │
│                  │ (RW) /home/debian/.exegol/workspaces/htb ➡ /workspace │
│                  │ (RO)                                                  │
│                  │ /home/debian/.local/pipx/venvs/exegol/lib/python3.11… │
│                  │ ➡ /.exegol/spawn.sh                                   │
│                  │ (RO) /etc/localtime ➡ /etc/localtime                  │
│                  │ (RO) /etc/timezone ➡ /etc/timezone

Execution logs in debug mode

msfdb init -vvv
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
fatal: .git/index: index file open failed: Permission denied
Running the 'init' command for the database:
Existing database running

Exception

juste make a chmod -R 777 /opt/tools/metasploit-framework/.git to make it work:
[Jun 19, 2024 - 08:54:29 (CEST)] exegol-htb metasploit-framework # msfdb init -vvv
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Running the 'init' command for the database:
Existing database running
[Jun 19, 2024 - 08:54:33 (CEST)] exegol-htb metasploit-framework # msfdb run -vvv 
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Running the 'run' command for the database:
[!] Error: unrecognized command 'run' for database
It doesn't worked here because i tried other thinks but trust me ;)

Anything else?

No response

QU35T-code commented 2 weeks ago

Hello @Dourin,

msfdb is already init by exegol. Can you stop all your active containers and ensure that port 5432 is not used by your system. Then, start a new container and run the following command: msfdb start Then run msfconsole and execute db_status. The database should then be connected.

Can you tell me if you have an error in the process ?

> msfdb start

Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Running the 'start' command for the database:
Starting database at /var/lib/postgresql/.msf4/db...success
> msfconsole

msf6 > db_status
[*] Connected to msf. Connection type: postgresql.

.git/index: index file open failed: Permission denied is just a warning; it will be removed later. This has no impact on database startup and shutdown.

Dourin commented 2 weeks ago

OK thank you for the answer :)

I am not having errors with the process than you shown