Skip to content

Commit 745bb9c

Browse files
authored
Land rapid7#19301, Update setting up a developer environment documentation
2 parents 7ad7b95 + cbdbb8e commit 745bb9c

File tree

1 file changed

+54
-21
lines changed

1 file changed

+54
-21
lines changed

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

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ This guide has details for setting up both **Linux** and **Windows**.
2222

2323
### Linux
2424

25-
1. Open a terminal on your Linux host and set up Git, build tools, and Ruby dependencies:
25+
* Open a terminal on your Linux host and set up Git, build tools, and Ruby dependencies:
2626

2727
```bash
2828
sudo apt update && sudo apt install -y git autoconf build-essential libpcap-dev libpq-dev zlib1g-dev libsqlite3-dev
@@ -32,9 +32,9 @@ sudo apt update && sudo apt install -y git autoconf build-essential libpcap-dev
3232

3333
If you are running a Windows machine
3434

35-
1. Install [chocolatey](https://chocolatey.org/)
36-
2. Install [Ruby x64 with DevKit](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.3-1/rubyinstaller-devkit-3.0.3-1-x64.exe)
37-
3. Install pcaprub dependencies from your cmd.exe terminal:
35+
* Install [chocolatey](https://chocolatey.org/)
36+
* Install [Ruby x64 with DevKit](https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.3-1/rubyinstaller-devkit-3.0.3-1-x64.exe)
37+
* Install pcaprub dependencies from your cmd.exe terminal:
3838

3939
```
4040
powershell -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} ; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object System.Net.WebClient).DownloadFile('https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip', 'C:\Windows\Temp\WpdPack_4_1_2.zip')"
@@ -43,7 +43,7 @@ choco install 7zip
4343
7z x "C:\Windows\Temp\WpdPack_4_1_2.zip" -o"C:\"
4444
```
4545

46-
4. Install a version of PostgreSQL:
46+
Install a version of PostgreSQL:
4747

4848
```
4949
choco install postgresql12
@@ -53,9 +53,8 @@ choco install postgresql12
5353

5454
You will need to use Github to create a fork for your contributions and receive the latest updates from our repository.
5555

56-
1. Login to Github and click the "Fork" button in the top-right corner of the [metasploit-framework] repository.
57-
58-
2. Create a `git` directory in your home folder and clone your fork to your local machine:
56+
* Login to Github and click the "Fork" button in the top-right corner of the [metasploit-framework] repository.
57+
* Create a `git` directory in your home folder and clone your fork to your local machine:
5958

6059
```bash
6160
export GITHUB_USERNAME=YOUR_USERNAME_FOR_GITHUB
@@ -66,25 +65,24 @@ git clone [email protected]:$GITHUB_USERNAME/metasploit-framework
6665
cd ~/git/metasploit-framework
6766
```
6867

69-
3. If you encounter a "permission denied" error on the above command, research the error message. If there isn't an explicit reason given, confirm that your [Github SSH key is configured correctly][github-ssh-instructions]. You will need to associate your [public SSH key][ssh-key] with your GitHub account, otherwise if you set up a SSH key and don't associate it with your GitHub account, you will receive this "permission denied" error.
70-
71-
4. To receive updates, you will create an `upstream-master` branch to track the Rapid7 remote repository, alongside your `master` branch which will point to your personal repository's fork:
68+
* If you encounter a "permission denied" error on the above command, research the error message. If there isn't an explicit reason given, confirm that your [Github SSH key is configured correctly][github-ssh-instructions]. You will need to associate your [public SSH key][ssh-key] with your GitHub account, otherwise if you set up a SSH key and don't associate it with your GitHub account, you will receive this "permission denied" error.
69+
* To receive updates, you will create an `upstream-master` branch to track the Rapid7 remote repository, alongside your `master` branch which will point to your personal repository's fork:
7270

7371
```bash
7472
git remote add upstream [email protected]:rapid7/metasploit-framework.git
7573
git fetch upstream
7674
git checkout -b upstream-master --track upstream/master
7775
```
7876

79-
5. Configure your Github username, email address, and username. Ensure your `user.email` matches the email address you registered with your Github account.
77+
* Configure your Github username, email address, and username. Ensure your `user.email` matches the email address you registered with your Github account.
8078

8179
```bash
8280
git config --global user.name "$GITHUB_USERNAME"
8381
git config --global user.email "$GITHUB_EMAIL"
8482
git config --global github.user "$GITHUB_USERNAME"
8583
```
8684

87-
6. Set up [msftidy] to run before each `git commit` and after each `git merge` to quickly identify potential issues with your contributions:
85+
* Set up [msftidy] to run before each `git commit` and after each `git merge` to quickly identify potential issues with your contributions:
8886

8987
```bash
9088
cd ~/git/metasploit-framework
@@ -129,27 +127,60 @@ Congratulations! You have now set up a development environment and the latest ve
129127

130128
## Optional: Set up the REST API and PostgreSQL database
131129

132-
The following optional section describes how to manually install PostgreSQL and set up the Metasploit database. Alternatively, use our Omnibus installer which handles this more reliably.
130+
Installing the REST API and PostgreSQL is optional, and can be done in two ways.
131+
Recommended is to use the Docker approach, and fairly simple to do once you have docker installed on your
132+
system, [Docker Desktop][docker-desktop] is recommended, but not mandatory.
133+
On Linux systems, simply having docker-cli is sufficient.
134+
135+
### Docker Installation
136+
137+
**Make sure, you have docker available on your system: [Docker Installation Guide][docker-installation]**
138+
139+
**Note**: Depending on your environment, these commands might require `sudo`
140+
141+
* Start the postgres container:
142+
143+
```bash
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"
160+
```
161+
162+
### Manual Installation
133163

134-
1. Confirm that the PostgreSQL server and client are installed:
164+
The following optional section describes how to manually install PostgreSQL and set up the Metasploit database.
165+
Alternatively, use our Omnibus installer which handles this more reliably.
166+
167+
* Confirm that the PostgreSQL server and client are installed:
135168

136169
```bash
137170
sudo apt update && sudo apt-get install -y postgresql postgresql-client
138171
sudo service postgresql start && sudo update-rc.d postgresql enable
139172
```
140173

141-
2. Ensure that you are not running as the root user.
142-
143-
3. Initialize the Metasploit database:
174+
* Ensure that you are not running as the root user.
175+
* Initialize the Metasploit database:
144176

145177
```bash
146178
cd ~/git/metasploit-framework
147179
./msfdb init
148180
```
149181

150-
4. If you receive an error about a component not being installed, confirm that the binaries shown are in your path using the [which] and [find] commands, then modifying your [$PATH] environment variable. If it was something else, open a [new issue] to let us know what happened.
151-
152-
5. If the `msfdb init` command succeeds, then confirm that the database is accessible to Metasploit:
182+
* If you receive an error about a component not being installed, confirm that the binaries shown are in your path using the [which] and [find] commands, then modifying your [$PATH] environment variable. If it was something else, open a [new issue] to let us know what happened.
183+
* If the `msfdb init` command succeeds, then confirm that the database is accessible to Metasploit:
153184

154185
```bash
155186
$ ./msfconsole -qx "db_status; exit"
@@ -272,3 +303,5 @@ Finally, we welcome your feedback on this guide, so feel free to reach out to us
272303
[@ffmike]:https://github.com/ffmike
273304

274305
[BetterSpecs.org]:https://www.betterspecs.org/
306+
[docker-desktop]:https://www.docker.com/products/docker-desktop/
307+
[docker-installation]:https://www.docker.com/get-started/

0 commit comments

Comments
 (0)