Skip to content

Commit cbdbb8e

Browse files
Update docs/metasploit-framework.wiki/dev/Setting-Up-a-Metasploit-Development-Environment.md
Co-authored-by: adfoster-r7 <[email protected]>
1 parent 1112ab5 commit cbdbb8e

File tree

1 file changed

+17
-40
lines changed

1 file changed

+17
-40
lines changed

docs/metasploit-framework.wiki/dev/Setting-Up-a-Metasploit-Development-Environment.md

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -138,48 +138,25 @@ On Linux systems, simply having docker-cli is sufficient.
138138

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

141-
* Pull the Docker container: `docker pull postgres:14`
142-
* Start the container:
141+
* Start the postgres container:
143142

144143
```bash
145-
docker run --rm -p 127.0.0.1:5432:5432 -e POSTGRESS_PASSWORD="mysecretpassword" postgres:14
146-
```
147-
148-
Wait till the container is fully running.
149-
We need to make some changes in the container to be able to connect to it remotely using the `psql` client.
150-
151-
* Open a shell to the running container: `docker exec -it "postgres" bash`
152-
* Install an editor: `sudo apt update && sudo apt install -y nano`
153-
* Edit `/var/lib/postgresql/data/postgresql.conf` and uncomment: `# password_encryption = scram-sha-256 # scram-sha-256 or md5`
154-
* Exit the shell on the container
155-
* Ensure the postgres client is installed on your host system
156-
* connect to the running container (the password is `mysecretpassword`): `psql -h 127.0.0.1 -U postgres`
157-
158-
After this you should be able to connect with the `postgres` user using the password from the commands.
159-
We highly recommend to use the same credentials and use the `database.yml` below as example.
160-
With this approach you do not require the `./msfdb init` command. The standard Rails commands for creating
161-
the database are sufficient: `bundle exec rails db:create db:migrate db:seed`
162-
163-
### database.yml
164-
165-
```yaml
166-
development: &defaults
167-
adapter: postgresql
168-
database: metasploit_pro_development
169-
username: postgres
170-
password: mysecretpassword
171-
host: 127.0.0.1
172-
port: 5432
173-
pool: 200
174-
timeout: 5
175-
176-
production:
177-
<<: *defaults
178-
database: metasploit_pro_production
179-
180-
test:
181-
<<: *defaults
182-
database: metasploit_pro_test
144+
docker run --rm -it -p 127.0.0.1:5433:5432 -e POSTGRES_PASSWORD="mysecretpassword" postgres:14
145+
```
146+
147+
Wait till the postgres container is fully running.
148+
149+
* Configure the Metasploit database:
150+
151+
```
152+
cd ~/git/metasploit-framework
153+
./msfdb init --connection-string="postgres://postgres:[email protected]:5433/postgres"
154+
```
155+
156+
* If the `msfdb init` command succeeds, then confirm that the database is accessible to Metasploit:
157+
158+
```bash
159+
$ ./msfconsole -qx "db_status; exit"
183160
```
184161

185162
### Manual Installation

0 commit comments

Comments
 (0)