Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the scripts and added a read me #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions cmu-cyber-range-setup.md
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes to this document and sent them to you. Cheers!

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Setting up the SEI CMU Cyberrange with ESXi
#### This guide was written with using VMWare ESXi Version 7 Update 3
##### Hardware Specifications: Intel Exeon E5-2695 @2.30 GHz, 3 TB RAID 6, and 132 GB of RAM
##### Contents can be found in https://github.com/cmu-sei/foundry-appliance
## Installing a Nested ESXi, Foundry OVA, and configuring Scripts loaded
### Install the Nested ESXi
The first step would be looking into installing a nested ESXi. Nested ESXis can be easily installed and deployed into the server. Install ESXi that matches the server's version: `https://williamlam.com/nested-virtualization/nested-esxi-virtual-appliance`

Set a chosen volume disk to at least 100 GBs as this VM server will be holding the devices

**DO NOT SET THE SYSTEM TO BOOT AUTOMATICALLY**

Go into the ESXi shell by remoting in with the main ESXi's IP Address and login credentials.

Go into `/vmfs/volumes/[Insert Datastore name here]/[Insert Virtual Machine Name] `:

Run `vi [Insert Virtual Machine Name].vmx` and insert these two lines at the end of the .vmx file


guestinfo.ssh = "TRUE"
guestinfo.createvmfs = "TRUE"`
This will enable the ESXi SSH daemon and create a new VMFS datastore from the largest disk in the appliance.

After inserting the two lines inside your .vmx file, boot up the nested ESXi.
### Deploy the Foundry OVA
The second step looking is installing your OVA from the foundry appliance repository. For a easy and quick install, go through the process of visiting the github and installing the latest OVA.

Drop it into your server's ESXi client and now the website can be accessed through:
`https://foundry.local`

### Configuring Scripts to your individual client
#### ONLY FOLLOW THESE STEPS IF THE SCRIPTS ARE NOT PERFORMING PROPERLY, IF IT IS, DISREGARD
* Change to the /foundry/foundry/certs directory and run the *generate-certs* script
* Edit the setup-esxi script and find lines 17,18, and 19. It should look like this:

RUI_CRT=$(cat ../certs/host.pem ../certs/int-ca.pem)
RUI_KEY=$(<certs/host-key.pem)
APPLIANCE_IP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')

* Change the RUI_CRT, RUI_KEY, APPLIANCE_IP variable to the full directory of the certs, here's an example:

RUI_CRT = /home/foundry/foundry/certs/host.pem /home/foundry/foundry/certs/int-ca.pem
RUI_KEY = /home/foundry/foundry/certs/host-key.pem
APPLIACE_IP =**INSERT THE IP ADDRESS OF THE APPLIANCE**

* Edit the import-content script on line 115, and rewrite it by only leaving one postgres:

The original:

kubectl exec --stdin --tty postgresql-postgresql-0 \
The edited:

kubectl exec --stdin --tty postgresql-0 \
### Import the Presidents Cup json file with the import-content script and access TopoMojo through Foundry Local. Then the VMs should now be accessible. Any future references and directions from here would be on the foundry docs repository inside the CMU SEI GitHub
2 changes: 1 addition & 1 deletion foundry/content/import-content
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ EOF
)

# Move template from stock area to workspace
kubectl exec --stdin --tty postgresql-postgresql-0 \
kubectl exec --stdin --tty postgresql-0 \
-- env PGPASSWORD=foundry psql -U postgres -d topomojo \
-c "update \"Templates\" set \"WorkspaceId\" = '$workspace_id' where \"Id\" = '$template_id';"
fi
Expand Down
2 changes: 1 addition & 1 deletion foundry/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ helm install --wait -f postgresql.values.yaml postgresql bitnami/postgresql --ve
# Install pgAdmin4
helm repo add runix https://helm.runix.net/
kubectl create secret generic pgpassfile --from-literal=pgpassfile=postgresql:5432:\*:postgres:foundry
helm install -f pgadmin4.values.yaml pgadmin4 runix/pgadmin4 --version 1.18.2
helm install -f pgadmin4.values.yaml pgadmin4 runix/pgadmin4 --version 1.9.10

# Install code-server (browser-based VS Code)
helm repo add sei https://helm.cmusei.dev/charts
Expand Down
2 changes: 1 addition & 1 deletion foundry/pgadmin4.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ image:
registry: docker.io
repository: dpage/pgadmin4
# Overrides the image tag whose default is the chart appVersion.
tag: "7.8"
tag: "6.8"
pullPolicy: IfNotPresent

## Deployment annotations
Expand Down
6 changes: 3 additions & 3 deletions foundry/scripts/setup-esxi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes on lines 17-19 apply to the pre-built OVA image only. The original did not work for us, but we also see that the script is written this way for users who are building it.

These are the changes we had to make when using the OVA image.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ HOSTS_FILE=/etc/hosts
ESXI_USER=root
ESXI_HOSTNAME=esxi.foundry.local
ESXI_CERTDIR=/etc/vmware/ssl
RUI_CRT=$(cat ../certs/host.pem ../certs/int-ca.pem)
RUI_KEY=$(<certs/host-key.pem)
APPLIANCE_IP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')
RUI_CRT=$(cat /home/foundry/foundry/certs/host.pem /home/foundry/foundry/certs/int-ca.pem)
RUI_KEY=$(</home/foundry/foundry/certs/host-key.pem)
APPLIANCE_IP=$(ip route get 1 | awk '{print $7; exit}')
TOPOMOJO_NFS_PV=$(kubectl get pvc topomojo-nfs -n foundry --output=jsonpath='{.spec.volumeName}')
TOPOMOJO_STOCK_PATH=/vmfs/volumes/datastore1/topomojo/00000000-0000-0000-0000-000000000000
TOPOMOJO_ACCESS_TOKEN=$(curl --silent --request POST \
Expand Down