Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
vyos,
minirouter,
ubuntu-soaptools,
ot-sim
]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -124,6 +125,7 @@ jobs:
vyos,
minirouter,
ubuntu-soaptools,
ot-sim
]
# Only run on main branch for scheduled or manual workflow_dispatch events
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help check_clean bookworm kali kali-harmonie jammy noble bennu minirouter _minirouter_img docker-hello-world ntp ubuntu-soaptools clean
.PHONY: help check_clean bookworm kali kali-harmonie jammy noble bennu minirouter _minirouter_img docker-hello-world ntp ubuntu-soaptools clean ot-sim

.ONESHELL: # for heredoc and exit

Expand Down Expand Up @@ -77,6 +77,13 @@ docker-hello-world:
@$(PHENIX) image create -T $(CURDIR)/scripts/atomic/docker.sh $(UBUNTU_MIRROR) $(COMPRESS) $(@)
@$(PHENIX_IMAGE_BUILD) $(@)

# Build ot-sim.qc2 -- Ubuntu Focal, OTSim, Pandas,
ot-sim:
@$(CHECK_IMAGE)
@$(PHENIX) image create -r focal -T $(CURDIR)/scripts/ot-sim.sh $(UBUNTU_MIRROR) $(COMPRESS) $(@)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can this be bumped up to jammy?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The pydnp3 library utilized by otsim only supported up to ubuntu 20 focal, and I have not gotten it working on Ubuntu 22

@$(PHENIX_IMAGE_BUILD) $(@)
@$(INJECT_MINICCC)

# Build ntp.qc2 -- Ubuntu Jammy, ntpd
ntp:
@$(CHECK_IMAGE)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ the Makefile are shown below.
| minirouter | Ubuntu / noble | miniccc/minirouter | Minimega-based router | :x: |
| soaptools | Ubuntu / jammy | filebeat,zeek,msf | preconfigured image for the [soap-hil topology](https://github.com/sandialabs/sceptre-phenix-topologies/tree/main/soap-hil) | :white_check_mark: |
| kali-harmonie | Kali / kali-rolling | Scapy, pybind11, HELICS, pyOpenDNP3, elasticsearch-py | Kali Linux image for the HARMONIE-SPS LDRD. | :white_check_mark: |
| OT-Sim | Ubuntu / focal | OT-Sim, PandaPower, pyOpenDNP3, HELICS | Ubuntu image for OT-SIM and Panda Power projects | :x: |
65 changes: 65 additions & 0 deletions scripts/ot-sim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
set -ex

export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export PIP_DISABLE_PIP_VERSION_CHECK=1

# Set timezone information
ln -fs /usr/share/zoneinfo/America/Denver /etc/localtime

apt-get install -y apt-utils

# Install Man Pages
apt-get install -y man-db manpages-dev

# Install the OT-Sim/PandaPower APT Requirements
apt-get install -y python3 python3-pip python2.7-dev python3-setuptools build-essential cmake libboost-dev libczmq-dev libxml2-dev libzmq5-dev pkg-config python3-dev python3-pip software-properties-common git

# Install Go lang 1.21.8
wget -O go.tgz https://golang.org/dl/go1.21.8.linux-amd64.tar.gz && tar -C /usr/local -xzf go.tgz && rm go.tgz && ln -s /usr/local/go/bin/* /usr/local/bin

# Make move to /opt and git clone the ot-sim project
cd /opt
git clone https://github.com/patsec/ot-sim.git

# Move into ot-sim
cd /opt/ot-sim

# Compile OT Sim
cmake -S . -B build && sudo cmake --build build -j$(nproc) --target install && sudo ldconfig && sudo make -C src/go install

# Compile OT Sim Python
sudo python3 -m pip install src/python

# Install Hivemind
wget -O hivemind.gz https://github.com/DarthSim/hivemind/releases/download/v1.1.0/hivemind-v1.1.0-linux-amd64.gz
gunzip hivemind.gz
sudo mv hivemind /usr/local/bin/hivemind
sudo chmod +x /usr/local/bin/hivemind

# Install MBPoll
wget -O- http://www.piduino.org/piduino-key.asc | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.piduino.org xenial piduino'
sudo apt update
sudo apt install mbpoll -y

# Install OpenDSS
sudo python3 -m pip install opendssdirect.py~=0.8.4

# Install PandaPower Requirements
sudo python3 -m pip install pandapower==2.14.11
sudo python3 -m pip install pandas==2.0.3
sudo python3 -m pip install numba==0.58.1

# Change root password
echo "root:SiaSd3te" | chpasswd

# Add "sceptre" user set their login shell to bash
adduser sceptre --UID 1001 --gecos "" --shell /bin/bash --disabled-login || true
echo "sceptre:sceptre" | chpasswd

#Ensure /etc is owned by root
chown -R root:root /etc

## Clean APT install
apt-get -y clean || true
Loading