Skip to content

Commit

Permalink
Update docs/metasploit-framework.wiki/dev/Setting-Up-a-Metasploit-Dev…
Browse files Browse the repository at this point in the history
…elopment-Environment.md

Co-authored-by: adfoster-r7 <[email protected]>
  • Loading branch information
adeherdt-r7 and adfoster-r7 authored Jul 9, 2024
1 parent 1112ab5 commit cbdbb8e
Showing 1 changed file with 17 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,48 +138,25 @@ On Linux systems, simply having docker-cli is sufficient.

**Note**: Depending on your environment, these commands might require `sudo`

* Pull the Docker container: `docker pull postgres:14`
* Start the container:
* Start the postgres container:

```bash
docker run --rm -p 127.0.0.1:5432:5432 -e POSTGRESS_PASSWORD="mysecretpassword" postgres:14
```

Wait till the container is fully running.
We need to make some changes in the container to be able to connect to it remotely using the `psql` client.

* Open a shell to the running container: `docker exec -it "postgres" bash`
* Install an editor: `sudo apt update && sudo apt install -y nano`
* Edit `/var/lib/postgresql/data/postgresql.conf` and uncomment: `# password_encryption = scram-sha-256 # scram-sha-256 or md5`
* Exit the shell on the container
* Ensure the postgres client is installed on your host system
* connect to the running container (the password is `mysecretpassword`): `psql -h 127.0.0.1 -U postgres`

After this you should be able to connect with the `postgres` user using the password from the commands.
We highly recommend to use the same credentials and use the `database.yml` below as example.
With this approach you do not require the `./msfdb init` command. The standard Rails commands for creating
the database are sufficient: `bundle exec rails db:create db:migrate db:seed`

### database.yml

```yaml
development: &defaults
adapter: postgresql
database: metasploit_pro_development
username: postgres
password: mysecretpassword
host: 127.0.0.1
port: 5432
pool: 200
timeout: 5

production:
<<: *defaults
database: metasploit_pro_production

test:
<<: *defaults
database: metasploit_pro_test
docker run --rm -it -p 127.0.0.1:5433:5432 -e POSTGRES_PASSWORD="mysecretpassword" postgres:14
```

Wait till the postgres container is fully running.

* Configure the Metasploit database:

```
cd ~/git/metasploit-framework
./msfdb init --connection-string="postgres://postgres:[email protected]:5433/postgres"
```

* If the `msfdb init` command succeeds, then confirm that the database is accessible to Metasploit:

```bash
$ ./msfconsole -qx "db_status; exit"
```

### Manual Installation
Expand Down

0 comments on commit cbdbb8e

Please sign in to comment.