forked from NationTech/harmony
Compare commits
4 Commits
7b542c9865
...
28476fbac4
| Author | SHA1 | Date | |
|---|---|---|---|
| 28476fbac4 | |||
| 06c9d78049 | |||
| e80ad70a4f | |||
| 45b4b082c8 |
36
Cargo.lock
generated
36
Cargo.lock
generated
@@ -1719,6 +1719,24 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "example-ha-cluster"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"brocade",
|
||||
"cidr",
|
||||
"env_logger",
|
||||
"harmony",
|
||||
"harmony_macros",
|
||||
"harmony_secret",
|
||||
"harmony_tui",
|
||||
"harmony_types",
|
||||
"log",
|
||||
"serde",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "example-kube-rs"
|
||||
version = "0.1.0"
|
||||
@@ -1838,6 +1856,24 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "example-opnsense"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"brocade",
|
||||
"cidr",
|
||||
"env_logger",
|
||||
"harmony",
|
||||
"harmony_cli",
|
||||
"harmony_macros",
|
||||
"harmony_secret",
|
||||
"harmony_types",
|
||||
"log",
|
||||
"serde",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "example-opnsense-2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"brocade",
|
||||
"cidr",
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
## OPNSense demo
|
||||
# OPNSense Demo
|
||||
|
||||
Download the virtualbox snapshot from {{TODO URL}}
|
||||
This example demonstrate how to manage an Opnsense server with harmony.
|
||||
|
||||
Start the virtualbox image
|
||||
todo: add more info
|
||||
|
||||
This virtualbox image is configured to use a bridge on the host's physical interface, make sure the bridge is up and the virtual machine can reach internet.
|
||||
## Demo instructions
|
||||
|
||||
Credentials are opnsense default (root/opnsense)
|
||||
todo: add detailed instructions
|
||||
|
||||
Run the project with the correct ip address on the command line :
|
||||
- setup the example execution environment
|
||||
- setup your system configuration
|
||||
- topology
|
||||
- scores
|
||||
- secrets
|
||||
- build
|
||||
- execute
|
||||
- verify/inspect
|
||||
|
||||
## Example execution
|
||||
|
||||
See [learning tool documentation](./scripts/README.md)
|
||||
|
||||
```bash
|
||||
cargo run -p example-opnsense -- 192.168.5.229
|
||||
```
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export HARMONY_SECRET_NAMESPACE=example-opnsense
|
||||
export HARMONY_SECRET_STORE=file
|
||||
export HARMONY_DATABASE_URL=sqlite://harmony_vms.sqlite RUST_LOG=info
|
||||
export RUST_LOG=info
|
||||
|
||||
96
examples/opnsense/scripts/README.md
Normal file
96
examples/opnsense/scripts/README.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Virtualized Execution Environment for Harmony
|
||||
|
||||
Scripts included in this directory have 3 purposes:
|
||||
|
||||
- automate initial setup of localhost or VM (nested virtualization) for this example
|
||||
- prototype a solution for an 'OpensenseLocalhostTopology'
|
||||
- prototype
|
||||
|
||||
This exprimentation aim to find an approach suitable for using harmony on virtualised execution environment such that:
|
||||
|
||||
- it straights forward for a user with minimal knowledge to start testing harmony
|
||||
- installation and execution have **minimal impact on the user desktop**
|
||||
|
||||
## Usage
|
||||
|
||||
### Installation
|
||||
|
||||
1. download this directory
|
||||
2. add this directory in your PATH (example `. setup`)
|
||||
|
||||
|
||||
```
|
||||
# show help page
|
||||
harmony-vee
|
||||
|
||||
# show active configurations
|
||||
harmony-vee config
|
||||
|
||||
# show what will be modified at installation
|
||||
harmony-vee install --dry-run
|
||||
|
||||
# install
|
||||
harmony-vee install
|
||||
|
||||
# show what will be modified at unistallation
|
||||
harmony-vee uninstall --dry-run
|
||||
|
||||
```
|
||||
|
||||
### Create and start a new Virtual Execution Environment
|
||||
|
||||
|
||||
```
|
||||
# Create a HVEE to test opnsense_score
|
||||
harmony-vee init opnsense_score
|
||||
|
||||
# List existing HVEE
|
||||
harmony-vee list
|
||||
|
||||
# Show HVEE information including devices ip and vault type/location
|
||||
harmony-vee show opnsense_score
|
||||
|
||||
# Start/Stop a HVEE
|
||||
harmony-vee stop opnsense_score
|
||||
|
||||
|
||||
# Destroy a HVEE instance
|
||||
harmony-vee destroy opnsense_score
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Variable d'environnement
|
||||
|
||||
```
|
||||
## directory containing harmony-ve data
|
||||
# HVE_ROOT=~/.harmony-ve
|
||||
|
||||
## OPNSENSE SRC
|
||||
# main mirror
|
||||
# HVE_OPNSENSE_URL=https://pkg.opnsense.org/releases
|
||||
# first alternative mirror
|
||||
# HVE_OPENSENSE_URL_ALT1=https://mirror.vraphim.com/opnsense/releases
|
||||
# HVE_OPNSENSE_URL_ALT2=https://mirror.winsub.kr/opnsense/releases
|
||||
|
||||
|
||||
## Network
|
||||
# HVE_NETWORK_LABEL=harmony
|
||||
```
|
||||
|
||||
|
||||
## Remarks
|
||||
|
||||
- A nested VM setup could be safer
|
||||
|
||||
|
||||
|
||||
## Architecture
|
||||
|
||||
### Learning environment directly on host
|
||||
|
||||

|
||||
|
||||
### Learning environment nested in a "workspace vm"
|
||||
|
||||

|
||||
17
examples/opnsense/scripts/common
Normal file
17
examples/opnsense/scripts/common
Normal file
@@ -0,0 +1,17 @@
|
||||
#! /bin/bash
|
||||
|
||||
_warn(){ >&2 echo "WARNING: $*" ; }
|
||||
|
||||
_fatal(){
|
||||
>&2 echo "FATAL ERROR: $*"
|
||||
>&2 echo stopping...
|
||||
exit 1
|
||||
}
|
||||
|
||||
pushd () {
|
||||
command pushd "$@" > /dev/null
|
||||
}
|
||||
|
||||
popd () {
|
||||
command popd "$@" > /dev/null
|
||||
}
|
||||
31
examples/opnsense/scripts/default-env-var
Normal file
31
examples/opnsense/scripts/default-env-var
Normal file
@@ -0,0 +1,31 @@
|
||||
# Conventions:
|
||||
# - Namespaced with HVE, short for Harmony Virtualised Execution Environment
|
||||
# - Prefixed values used internally
|
||||
# - Not prefixed may be supercharged by the user
|
||||
|
||||
# Root of harmony data
|
||||
_HVE_ROOT=${HVE_ROOT:-$HOME/harmony-ve}
|
||||
[ -d "$_HVE_ROOT" ] || mkdir -p "${_HVE_ROOT}"
|
||||
|
||||
|
||||
_HVE_SRC_IMG=${_HVE_ROOT}/src/images
|
||||
[ -d "$_HVE_SRC_IMG" ] || mkdir -p "${_HVE_SRC_IMG}"
|
||||
_HVE_IMG=${_HVE_ROOT}/images
|
||||
[ -d "$_HVE_IMG" ] || mkdir -p "$_HVE_IMG"
|
||||
|
||||
# Opnsense
|
||||
_HVE_OPNSENSE_URL=${HVE_OPNSENSE_URL:-https://pkg.opnsense.org/releases}
|
||||
# first alternative mirror
|
||||
_HVE_OPNSENSE_URL_ALT1=${HVE_OPNSENSE_URL_ALT1:-https://mirror.vraphim.com/opnsense/releases}
|
||||
_HVE_OPNSENSE_URL_ALT2=${HVE_OPNSENSE_URL_ALT2:-https://mirror.winsub.kr/opnsense/releases}
|
||||
|
||||
_HVE_OPNSENSE_SRC_IMG=${_HVE_SRC_IMG}/opnsense
|
||||
[ -d "$_HVE_OPNSENSE_SRC_IMG" ] || mkdir -p "${_HVE_OPNSENSE_SRC_IMG}"
|
||||
_HVE_OPNSENSE_IMG=${_HVE_IMG}/opnsense
|
||||
[ -d "$_HVE_OPNSENSE_IMG" ] || mkdir -p "${_HVE_OPNSENSE_IMG}"
|
||||
|
||||
# Network
|
||||
_HVE_NETWORK=${HVE_NETWORK:-harmony}
|
||||
_HVE_WAN_BRIDGE=${HVE_WAN_BRIDGE:-${_HVE_NETWORK}-wan-brd}
|
||||
_HVE_LAN_BRIDGE=${HVE_LAN_BRIDGE:-${_HVE_NETWORK}-lann-brd}
|
||||
|
||||
48
examples/opnsense/scripts/dependencies-management
Normal file
48
examples/opnsense/scripts/dependencies-management
Normal file
@@ -0,0 +1,48 @@
|
||||
#! /bin/bash
|
||||
is_string_empty(){
|
||||
if [ "${*:-}" != "" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_debian_family()(
|
||||
is_string_empty "$(apt --version 2> /dev/null )"
|
||||
)
|
||||
|
||||
has_ip(){
|
||||
is_string_empty "$(ip -V 2> /dev/null)"
|
||||
}
|
||||
|
||||
has_virsh(){
|
||||
is_string_empty "$(virsh --version 2> /dev/null)"
|
||||
}
|
||||
|
||||
has_virt_customize(){
|
||||
is_string_empty "$(virt-customize --version 2> /dev/null)"
|
||||
}
|
||||
|
||||
has_curl(){
|
||||
is_string_empty "$(curl --version 2> /dev/null)"
|
||||
}
|
||||
has_wget(){
|
||||
is_string_empty "$(wget --version 2> /dev/null)"
|
||||
}
|
||||
|
||||
install_kvm(){
|
||||
sudo apt install -y --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system
|
||||
sudo usermod -aG libvirt "$USER"
|
||||
# todo: finf how to fix image access out of /var/lib/libvirt/images
|
||||
sudo setfacl -Rm u:libvirt-qemu:rx $_HVE_IMG
|
||||
sudo systemctl restart libvirtd
|
||||
}
|
||||
|
||||
install_virt_customize(){
|
||||
sudo apt install -y libguestfs-tools
|
||||
}
|
||||
|
||||
install_wget(){
|
||||
sudo apt install -y wget
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 138 KiB |
321
examples/opnsense/scripts/doc/automate-opnsense-example.drawio
Normal file
321
examples/opnsense/scripts/doc/automate-opnsense-example.drawio
Normal file
@@ -0,0 +1,321 @@
|
||||
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36" version="28.2.9" pages="2">
|
||||
<diagram name="localhost" id="lK0WmoXmZXwFmV5PC-RW">
|
||||
<mxGraphModel dx="1111" dy="487" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="1Ax8jaXdU0J25Zkiwu96-1" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="300" y="230" width="700" height="550" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="VVCo9gNhF-9Hs0fZa6i8-1" value="<b>localhost</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="380" y="240" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-1" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="350" y="283" width="230" height="67" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-2" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="590" y="393" width="310" height="270" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-3" value="<b>opnsense vm</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="620" y="403" width="90" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-4" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="620" y="250" width="280" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-5" value="<b>localhost network</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="610" y="250" width="150" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-6" value="<b>Src repo or</b><div style=""><b>Harmony learning tool</b></div>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="370" y="294" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-7" value="" style="html=1;rounded=0;direction=south;rotation=90;" parent="1" vertex="1">
|
||||
<mxGeometry x="760" y="290" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-8" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="X0RF5wBsf5JYURxROWwA-7" target="X0RF5wBsf5JYURxROWwA-9" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-9" value="" style="ellipse;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="771" y="342" width="8" height="8" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-13" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="810" y="290" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-14" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="X0RF5wBsf5JYURxROWwA-13" target="X0RF5wBsf5JYURxROWwA-15" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-15" value="" style="ellipse;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="820" y="342" width="8" height="8" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-16" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="760" y="383" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-17" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="X0RF5wBsf5JYURxROWwA-16" target="X0RF5wBsf5JYURxROWwA-18" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-18" value="" style="shape=requiredInterface;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;rotation=-90;" parent="1" vertex="1">
|
||||
<mxGeometry x="772.5" y="353" width="5" height="10" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-19" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="809" y="383" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-20" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="X0RF5wBsf5JYURxROWwA-19" target="X0RF5wBsf5JYURxROWwA-21" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-21" value="" style="shape=requiredInterface;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;rotation=-90;" parent="1" vertex="1">
|
||||
<mxGeometry x="821.5" y="353" width="5" height="10" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-22" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="350" y="440" width="230" height="130" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-23" value="<b>Example dependencies</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="360" y="450" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-24" value="<ul><li>kvm</li><li>virt-customize</li><li>...</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="360" y="510" width="150" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-25" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="350" y="590" width="230" height="130" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-26" value="<b>Example resources</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="370" y="600" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-27" value="<ul><li>src opnsense images</li><li>modified opnsense images</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="361" y="650" width="208" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-28" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="350" y="353" width="230" height="77" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-29" value="<b>Local workspace</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="370" y="361.5" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-30" value="<ul><li>provisioned using the learning tool</li><li>managed using harmony</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="620" y="450" width="250" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-31" value="<i><font style="color: rgb(51, 51, 51);">Minimun required to learn Harmony</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="370" y="323" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-33" value="<font color="#333333"><i>A place to store configs and</i></font><div><font color="#333333"><i>runtime info.</i></font></div>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="370" y="395" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-34" value="<i><font style="color: rgb(51, 51, 51);">Modifications of localhost</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="360" y="470" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-35" value="<i><font style="color: rgb(51, 51, 51);">Modifications of localhost</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="626.5" y="264" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-36" value="<i><font style="color: rgb(51, 51, 51);">Data store (image registry, etc.)</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="369" y="620" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="X0RF5wBsf5JYURxROWwA-37" value="<font color="#333333"><i>Execution environment</i></font>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="626.5" y="420" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
<diagram id="oOuscOXp9aWETXQepMaW" name="nested-virtualization">
|
||||
<mxGraphModel dx="1111" dy="487" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-1" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="190" y="60" width="1240" height="660" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-37" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="540" y="210" width="830" height="480" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-2" value="<b>localhost</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="84" width="60" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-3" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="240" y="223" width="230" height="67" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-4" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="855" y="403.75" width="310" height="266.25" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-5" value="<b>opnsense vm</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="885" y="413.75" width="90" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-6" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="810" y="230" width="530" height="120" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-7" value="<b>workspace VM network</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="825" y="234" width="150" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-8" value="<b>Src repo or</b><div style=""><b>Harmony learning tool</b></div>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="234" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-10" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="vj3pG7w7rTpS1tnBMssI-9" target="vj3pG7w7rTpS1tnBMssI-11" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-13" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="vj3pG7w7rTpS1tnBMssI-12" target="vj3pG7w7rTpS1tnBMssI-14" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-15" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1025" y="393.75" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-16" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="vj3pG7w7rTpS1tnBMssI-15" target="vj3pG7w7rTpS1tnBMssI-17" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-17" value="" style="shape=requiredInterface;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;rotation=-90;" parent="1" vertex="1">
|
||||
<mxGeometry x="1037.5" y="363.75" width="5" height="10" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-18" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1074" y="393.75" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-19" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="vj3pG7w7rTpS1tnBMssI-18" target="vj3pG7w7rTpS1tnBMssI-20" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-20" value="" style="shape=requiredInterface;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;rotation=-90;" parent="1" vertex="1">
|
||||
<mxGeometry x="1086.5" y="363.75" width="5" height="10" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-21" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="240" y="380" width="230" height="120" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-22" value="<b>Learning dependencies</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="250" y="391" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-23" value="<ul><li>harmony</li><li>kvm</li><li>virt-customize</li><li>...</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="250" y="450" width="150" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-24" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="240" y="540" width="230" height="130" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-25" value="<b>Example resources</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="550" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-26" value="<ul><li>Can be mounted locally<br>for persistence</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="251" y="600" width="189" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-27" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="240" y="293" width="230" height="67" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-28" value="<b>Local workspace</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="301.5" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-29" value="<ul><li>provisioned using the learning tool</li><li>managed using harmony</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="885" y="460.75" width="250" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-30" value="<i><font style="color: rgb(51, 51, 51);">Minimun required to learn Harmony</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="263" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-31" value="<font color="#333333"><i>A place to store configs</i></font>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="260" y="321" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-32" value="<i><font style="color: rgb(51, 51, 51);">Modifications of localhost</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="250" y="410" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-34" value="<i><font style="color: rgb(51, 51, 51);">Data store (image registry, etc.)</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="259" y="570" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-35" value="<font color="#333333"><i>Execution environment</i></font>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="891.5" y="430.75" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-38" value="<b>workspace VM</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="234" width="130" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-39" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="570" y="305" width="230" height="215" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-40" value="<b>workspace VM dependencies</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="316" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-41" value="<ul><li>kvm</li><li>virt-customize</li><li>...</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="375" width="150" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-44" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="570" y="540" width="230" height="130" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-48" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="830" y="277" width="235" height="45" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-45" value="<b>Example resources</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="590" y="550" width="152" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-46" value="<ul><li>src opnsense images</li><li>modified opnsense images</li></ul>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="581" y="600" width="208" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-47" value="<i><font style="color: rgb(51, 51, 51);">Data store (image registry, etc.)</font></i>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="589" y="570" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-9" value="" style="html=1;rounded=0;direction=south;rotation=90;" parent="1" vertex="1">
|
||||
<mxGeometry x="1025" y="300.75" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-11" value="" style="ellipse;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1036" y="352.75" width="8" height="8" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-49" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1069" y="275" width="251" height="45" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-12" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1075" y="300.75" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-14" value="" style="ellipse;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1085" y="352.75" width="8" height="8" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-50" value="<b>wan</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="821.5" y="277" width="70" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-51" value="<b>lan</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1055" y="275" width="70" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-52" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1181" y="403.75" width="159" height="116.25" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-53" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="vj3pG7w7rTpS1tnBMssI-54" target="vj3pG7w7rTpS1tnBMssI-55" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-54" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1211" y="305" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-55" value="" style="ellipse;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="1221" y="357" width="8" height="8" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-58" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1210" y="393.75" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-59" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="vj3pG7w7rTpS1tnBMssI-58" target="vj3pG7w7rTpS1tnBMssI-60" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-60" value="" style="shape=requiredInterface;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;rotation=-90;" parent="1" vertex="1">
|
||||
<mxGeometry x="1222.5" y="363.75" width="5" height="10" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-61" value="<b>other vm</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="1181" y="430" width="90" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="vj3pG7w7rTpS1tnBMssI-63" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="vj3pG7w7rTpS1tnBMssI-24" target="vj3pG7w7rTpS1tnBMssI-44" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="600" y="770" as="sourcePoint" />
|
||||
<mxPoint x="360" y="885" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-1" value="" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="799" y="84" width="280" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-2" value="<b>localhost network</b>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="789" y="84" width="150" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-6" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="989" y="124" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-7" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="Za91R7Nqk7Jj5VTRes6Y-6" target="Za91R7Nqk7Jj5VTRes6Y-8" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-8" value="" style="ellipse;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="999" y="176" width="8" height="8" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-12" value="" style="html=1;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="988" y="217" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-13" value="" style="endArrow=none;html=1;rounded=0;align=center;verticalAlign=top;endFill=0;labelBackgroundColor=none;endSize=2;" parent="1" source="Za91R7Nqk7Jj5VTRes6Y-12" target="Za91R7Nqk7Jj5VTRes6Y-14" edge="1">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-14" value="" style="shape=requiredInterface;html=1;fontSize=11;align=center;fillColor=none;points=[];aspect=fixed;resizable=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;flipH=1;rotation=-90;" parent="1" vertex="1">
|
||||
<mxGeometry x="1000.5" y="187" width="5" height="10" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="Za91R7Nqk7Jj5VTRes6Y-15" value="<font color="#333333"><i>No modification required</i></font>" style="text;html=1;whiteSpace=wrap;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="805.5" y="98" width="200" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
13
examples/opnsense/scripts/env-var
Normal file
13
examples/opnsense/scripts/env-var
Normal file
@@ -0,0 +1,13 @@
|
||||
## directory containing harmony-ve data
|
||||
# HVE_ROOT=~/.harmony-ve
|
||||
|
||||
## OPNSENSE SRC
|
||||
# main mirror
|
||||
# HVE_OPNSENSE_URL=https://pkg.opnsense.org/releases
|
||||
# first alternative mirror
|
||||
# HVE_OPENSENSE_URL_ALT1=https://mirror.vraphim.com/opnsense/releases
|
||||
# HVE_OPNSENSE_URL_ALT2=https://mirror.winsub.kr/opnsense/releases
|
||||
|
||||
|
||||
## Network
|
||||
# HVE_NETWORK_LABEL=harmony
|
||||
105
examples/opnsense/scripts/harmony-ve
Executable file
105
examples/opnsense/scripts/harmony-ve
Executable file
@@ -0,0 +1,105 @@
|
||||
|
||||
#! /bin/bash
|
||||
|
||||
harmony-ve()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
CLI management toolkit for Harmony Virtualized Execution Environment
|
||||
|
||||
SYNOPSYS
|
||||
|
||||
harmony-ve [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
harmony-ve dependencies # manage localhost depend
|
||||
harmony-ve network # manage localhost netork
|
||||
|
||||
harmony-ve opnsense-img-src # manage opnsense OS source images
|
||||
harmony-ve opnsense-img # manage opnsense OS images
|
||||
|
||||
harmony-ve vm # manage vm
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Automation CLI to easily provision and manage a Virtualized Execution Environment for testing and learning Harmony.
|
||||
|
||||
This tool allows:
|
||||
- new harmony users to start testing within 15 minutes on their development desktop
|
||||
- automate virtualized test in pipeline
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
EOM
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Implement functions
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
"")
|
||||
_short_help
|
||||
;;
|
||||
-h|--help)
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
# Commands entrypoints
|
||||
deps|dependencies)
|
||||
harmony-ve-dependencies "${@:2}"
|
||||
;;
|
||||
net|network)
|
||||
harmony-ve-network"${@:2}"
|
||||
;;
|
||||
img-src|opnsense-img-src)
|
||||
harmony-ve-opnsense-img-src "${@:2}"
|
||||
;;
|
||||
img|opnsense-img)
|
||||
harmony-ve-opnsense-img "${@:2}"
|
||||
;;
|
||||
vm)
|
||||
harmony-ve-vm "${@:2}"
|
||||
;;
|
||||
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve "${@}"
|
||||
|
||||
125
examples/opnsense/scripts/harmony-ve-dependencies
Executable file
125
examples/opnsense/scripts/harmony-ve-dependencies
Executable file
@@ -0,0 +1,125 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# virt-install <= virtinst
|
||||
# quemu-img
|
||||
|
||||
|
||||
|
||||
harmony-ve-dependencies()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve-dependencies
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Manage localhost dependencies needed for Harmony Virtual Execution Environment
|
||||
|
||||
SYNOPSYS
|
||||
|
||||
devops-dependencies [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
devops check # Check that dependencies are installed
|
||||
devops install # Install missing dependencies
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
|
||||
_check_dependencies(){
|
||||
. "${SCRIPTS_DIR}/dependencies-management"
|
||||
missing=0
|
||||
NEED_IP=false
|
||||
NEED_KVM=false
|
||||
NEED_VIRT_CUSTOMIZE=false
|
||||
NEED_WGET=false
|
||||
is_debian_family || _fatal only debian based version is supported
|
||||
has_ip || {
|
||||
missing=$(( missing + 1));
|
||||
_warn "ip command is missing";
|
||||
NEED_IP=true
|
||||
}
|
||||
has_virsh ||{
|
||||
missing=$(( missing + 1));
|
||||
_warn "virsh command is missing";
|
||||
NEED_KVM=true
|
||||
}
|
||||
has_virt_customize || {
|
||||
missing=$(( missing + 1));
|
||||
_warn "virt-customize command is missing";
|
||||
NEED_VIRT_CUSTOMIZE=true
|
||||
}
|
||||
has_wget || has_curl || {
|
||||
missing=$(( missing + 1));
|
||||
_warn "wget and curl commands are missing"; NEED_WGET=true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_install_dependencies(){
|
||||
|
||||
[ "$NEED_KVM" != "true" ] || install_kvm
|
||||
[ "$NEED_VIRT_CUSTOMIZE" != "true" ] || install_virt_customize
|
||||
[ "$NEED_WGET" != "true" ] || install_wget
|
||||
}
|
||||
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
"")
|
||||
_short_help
|
||||
;;
|
||||
-h|--help)
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
cdeps|check-dependencies)
|
||||
_check_dependencies
|
||||
if [ "$missing" -gt 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
_warn No missing dependencies
|
||||
;;
|
||||
ideps|install-dependencies)
|
||||
_check_dependencies
|
||||
_install_dependencies
|
||||
;;
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve-dependencies "${@}"
|
||||
|
||||
232
examples/opnsense/scripts/harmony-ve-network
Executable file
232
examples/opnsense/scripts/harmony-ve-network
Executable file
@@ -0,0 +1,232 @@
|
||||
|
||||
#! /bin/bash
|
||||
# todo: allow wan to switch from ethernet to wifi
|
||||
|
||||
|
||||
harmony-ve-network()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
. "${SCRIPTS_DIR}/default-env-var"
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve-network
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Modify localhost network for Harmony Virtual Execution Environment
|
||||
SYNOPSYS
|
||||
|
||||
harmony-ve-network [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
harmony-ve-network check
|
||||
harmony-ve-network setup
|
||||
harmony-ve-network cleanup
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
|
||||
|
||||
IMPLEMENTATION NOTES
|
||||
|
||||
- use the network manager present to add 2 bridges (wan + lan)
|
||||
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
# dependency management
|
||||
|
||||
_is_service_used(){
|
||||
service=$1
|
||||
sudo systemctl list-unit-files $service || return 1
|
||||
sudo systemctl status --no-pager $service || return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Implement functions
|
||||
|
||||
_list_bridges(){
|
||||
|
||||
ip -o link show type bridge | awk '{print $2}' | sed 's/://g'
|
||||
}
|
||||
|
||||
_is_a_bridge(){
|
||||
bridge=$1
|
||||
matched=$(_list_bridges | grep "$bridge")
|
||||
[ "$matched" = "$bridge" ] || return 1
|
||||
}
|
||||
|
||||
_bridge_is_up(){
|
||||
_fatal Not implemented
|
||||
}
|
||||
|
||||
_rename_nmcli_profile(){
|
||||
device=$1
|
||||
profile=$(nmcli -t -f DEVICE,UUID c show --active | grep "^$device:" | cut -d':' -f2)
|
||||
[ "$profile" != "" ] || _fatal Failed to find nmcli profile
|
||||
|
||||
sudo nmcli con mod "$profile" con-name "$device"
|
||||
|
||||
}
|
||||
|
||||
_create_a_bridge_using_networkmanager(){
|
||||
bridge=$1
|
||||
|
||||
profile=$(nmcli -t -f DEVICE,UUID c show --active | grep "^$PRIMARY_INTERFACE:" | cut -d':' -f2)
|
||||
|
||||
nmcli conn delete "$profile"
|
||||
|
||||
nmcli conn add type bridge ifname $bridge con-name $bridge || _fatal Fail to create a bridge using nmcli
|
||||
|
||||
|
||||
nmcli con add type bridge-slave ifname $PRIMARY_INTERFACE master $bridge || _fatal Fail to create a slave-interface using nmcli
|
||||
|
||||
nmcli con up $bridge || _fatal Fail to set interface up using nmcli
|
||||
|
||||
sudo systemctl restart NetworkManager.service
|
||||
# todo: use a check loop until connection with a timeout
|
||||
#sleep 10
|
||||
#ping nationtech.io | _fatal Internet connection lost
|
||||
|
||||
}
|
||||
|
||||
_delete_a_bridge_using_networkmanager(){
|
||||
device=$1
|
||||
|
||||
nmcli conn delete bridge-slave-$PRIMARY_INTERFACE
|
||||
nmcli conn delete $device
|
||||
|
||||
nmcli con add type ethernet ifname $PRIMARY_INTERFACE con-name $PRIMARY_INTERFACE autoconnect yes ipv4.method auto ipv6.method ignore
|
||||
|
||||
nmcli conn up "$PRIMARY_INTERFACE"
|
||||
sudo systemctl restart NetworkManager.service
|
||||
|
||||
# todo: use a check loop until connection with a timeout
|
||||
#sleep 10
|
||||
#ping nationtech.io | _fatal Internet connection lost
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
_create_a_bridge(){
|
||||
|
||||
bridge=$1
|
||||
|
||||
[ $USE_NETWORKMANAGER = 0 ] | _fatal "Only NetworkManager is implemented"
|
||||
|
||||
_create_a_bridge_using_networkmanager $bridge
|
||||
|
||||
}
|
||||
|
||||
_setup_a_bridge(){
|
||||
|
||||
$bridge
|
||||
|
||||
bridge_exist=1
|
||||
bridge_is_up=1
|
||||
bridge_has_ip=1
|
||||
bridge_has_route=1
|
||||
bridge_is_working=1
|
||||
|
||||
_is_a_bridge $bridge && bridge_exists=0 || _create_a_bridge $bridge || _fatal Fail to create a bridge
|
||||
|
||||
|
||||
}
|
||||
|
||||
_get_networkmanager_profile_from_device(){
|
||||
|
||||
device=$1
|
||||
|
||||
profile=$(nmcli -t -f DEVICE,NAME c show --active | grep "^$device:" | cut -d':' -f2)
|
||||
|
||||
[ "$profile" != "" ] || _fatal Fail to retreive nmcli profile
|
||||
|
||||
echo "$profile"
|
||||
|
||||
}
|
||||
|
||||
_find_primary_interface(){
|
||||
PRIMARY_INTERFACE=$(ip route | grep '^default' | sed 's/ dev /!/g' | cut -d'!' -f 2 | awk '{ print $1 }' )
|
||||
[ "$PRIMARY_INTERFACE" != "" ] || _fatal Fail to find the primary interface
|
||||
}
|
||||
|
||||
_find_used_network_manager(){
|
||||
|
||||
_is_service_used NetworkManager.service && USE_NETWORKMANAGER=0 || USE_NETWORKMANAGER=1
|
||||
_is_service_used systemd-networkd.service && USE_SYSTEMD_NETWORKD=0 || USE_SYSTEMD_NETWORKD=1
|
||||
_is_service_used dhcpd.service && USE_DHCPD=0 || USE_DHCPD=1
|
||||
|
||||
USE_MANUAL=0 && [ $USE_NETWORKMANAGER = 0 ] || [ $USE_SYSTEMD_NETWORKD = 0 ] || [ $USE_DHCPD = 0 ] || USE_MANUAL=0
|
||||
|
||||
}
|
||||
|
||||
_connect(){
|
||||
|
||||
_find_used_network_manager
|
||||
_find_primary_interface
|
||||
|
||||
_setup_a_bridge $_HVE_WAN_BRIDGE
|
||||
_setup_a_bridge $_HVE_LAN_BRIDGE
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
"")
|
||||
_short_help
|
||||
;;
|
||||
-h|--help)
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
connect)
|
||||
_connect "${@:2}"
|
||||
;;
|
||||
disconnect)
|
||||
_disconnect "${@:2}"
|
||||
;;
|
||||
|
||||
dev)
|
||||
|
||||
"${@:2}"
|
||||
;;
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve-network "${@}"
|
||||
|
||||
150
examples/opnsense/scripts/harmony-ve-opnsense-img
Executable file
150
examples/opnsense/scripts/harmony-ve-opnsense-img
Executable file
@@ -0,0 +1,150 @@
|
||||
|
||||
#! /bin/bash
|
||||
|
||||
harmony-ve-opnsense-img()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
. "${SCRIPTS_DIR}/default-env-var"
|
||||
|
||||
export PATH=$SCRIPTS_DIR:$PATH
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve-opnsense-img
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Manage opnsense images needed by Harmony Virtual Execution Environment
|
||||
SYNOPSYS
|
||||
|
||||
harmony-vee-opnsense-img [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
harmony-ve-opnsense-img list
|
||||
harmony-ve-opnsense-img init NAME VERSION
|
||||
harmony-ve-opnsense-img start NAME
|
||||
harmony-ve-opnsense-img update NAME
|
||||
harmony-ve-opnsense-img delete [NAME]
|
||||
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
|
||||
# assertions
|
||||
|
||||
_assert_image_do_not_exists(){
|
||||
name=$1
|
||||
[ ! -d "$_HVE_OPNSENSE_IMG/$name" ] || _fatal "An image '$name' already exists"
|
||||
}
|
||||
_assert_image_exists(){
|
||||
name=$1
|
||||
[ -d "$_HVE_OPNSENSE_IMG/$name" ] || _fatal "Image '$name' do not exists"
|
||||
}
|
||||
|
||||
|
||||
# Implement functions
|
||||
_init(){
|
||||
name=$1
|
||||
version=${2}
|
||||
|
||||
_assert_image_do_not_exists $name
|
||||
mkdir -p "${_HVE_OPNSENSE_IMG}/$name"
|
||||
|
||||
harmony-ve opnsense-img-src download $version
|
||||
|
||||
sudo qemu-img convert -f raw -O qcow2 "$_HVE_OPNSENSE_SRC_IMG/OPNsense-${version}-nano-amd64.img" "/var/lib/libvirt/images/opnsense-$name.qcow2"
|
||||
|
||||
|
||||
|
||||
|
||||
cat <<-EOM > "$_HVE_OPNSENSE_IMG/$name/$name.sh"
|
||||
|
||||
virt-install \
|
||||
--name $name \
|
||||
--os-variant freebsd14.0 \
|
||||
--vcpus=2,sockets=1,cores=2,threads=1 \
|
||||
--memory 4096 \
|
||||
--disk path="/var/lib/libvirt/images/opnsense-$name.qcow2" \
|
||||
--network bridge=${_HVE_WAN_BRIDGE},model=virtio \
|
||||
--network bridge=${_HVE_LAN_BRIDGE},model=virtio \
|
||||
--graphics none \
|
||||
--console pty,target_type=serial \
|
||||
--import \
|
||||
--autostart
|
||||
EOM
|
||||
|
||||
chmod +x "$_HVE_OPNSENSE_IMG/$name/$name.sh"
|
||||
|
||||
}
|
||||
|
||||
|
||||
_start(){
|
||||
name=$1
|
||||
_assert_image_exists $name
|
||||
|
||||
"$_HVE_OPNSENSE_IMG/$name/$name.sh"
|
||||
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
"")
|
||||
_short_help
|
||||
;;
|
||||
-h|--help)
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
# Commands entrypoints
|
||||
init)
|
||||
_init "${@:2}"
|
||||
;;
|
||||
start)
|
||||
_start "${@:2}"
|
||||
;;
|
||||
delete)
|
||||
rm -r ${_HVE_OPNSENSE_IMG}/"$2"
|
||||
;;
|
||||
ls|list)
|
||||
ls ${_HVE_OPNSENSE_IMG} | cat
|
||||
;;
|
||||
show)
|
||||
ls ${_HVE_OPNSENSE_IMG}/"$2" | cat
|
||||
;;
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve-opnsense-img "${@}"
|
||||
|
||||
310
examples/opnsense/scripts/harmony-ve-opnsense-img-src
Executable file
310
examples/opnsense/scripts/harmony-ve-opnsense-img-src
Executable file
@@ -0,0 +1,310 @@
|
||||
|
||||
#! /bin/bash
|
||||
|
||||
harmony-ve-opnsense-img-src()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
. "${SCRIPTS_DIR}/default-env-var"
|
||||
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve-opnsense-img-src
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Manage opnsense source images needed by Harmony Virtual Execution Environment
|
||||
|
||||
SYNOPSYS
|
||||
|
||||
harmony-vee-opnsense-img-src [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
harmony-vee-opnsense-img-src list [--remote]
|
||||
harmony-vee-opnsense-img-src download [VERSION]
|
||||
harmony-vee-opnsense-img-src check [VERSION]
|
||||
harmony-vee-opnsense-img-src delete [VERSION]
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
|
||||
DETAILS
|
||||
|
||||
- for 'list', show local images available
|
||||
- for 'list --remote', show available upstream images
|
||||
- for 'download', when no VERSION is specified, use the latest
|
||||
- for 'delete', when no VERSION is specified, delete all image
|
||||
- use the 'nano' flavor
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Implement functions
|
||||
_parse_version_from_image_file_string(){
|
||||
#https://pkg.opnsense.org/releases/25.7/OPNsense-25.7-nano-amd64.img.bz2
|
||||
echo "$1" | cut -d '/' -f 5
|
||||
}
|
||||
|
||||
|
||||
_list_local_images(){
|
||||
ls "${_HVE_OPNSENSE_SRC_IMG}" | grep "OPNsense-" | grep "\-nano\-amd64\.img" | cut -d'-' -f 2 | sort -u -r
|
||||
}
|
||||
|
||||
|
||||
_list_remote_images(){
|
||||
curl -L -s "${_HVE_OPNSENSE_URL}" | sed 's/</\n</g' | grep href | grep 2 | cut -d'>' -f 2 | cut -d '/' -f 1 | sort -r
|
||||
}
|
||||
|
||||
_latest_version(){
|
||||
_list_remote_images | head -n 1
|
||||
}
|
||||
|
||||
_is_downloaded(){
|
||||
version=$1
|
||||
name="${_HVE_OPNSENSE_SRC_IMG}/OPNsense-${version}-nano-amd64.img"
|
||||
[ -f "$name" ] && return 0 || return 1
|
||||
}
|
||||
|
||||
_is_valid_version(){
|
||||
version=${1}
|
||||
matched_version=$(_list_remote_images | grep "$version")
|
||||
[ "$matched_version" != "" ] && return 0 || return 1
|
||||
}
|
||||
|
||||
_download_img(){
|
||||
version=$1
|
||||
|
||||
_download_crypto_files $version
|
||||
|
||||
|
||||
name="OPNsense-${version}-nano-amd64.img"
|
||||
compressed_name=$name.bz2
|
||||
|
||||
_is_downloaded $version && {
|
||||
_warn "Image '$name' is already downloaded"
|
||||
} || {
|
||||
url=$_HVE_OPNSENSE_URL/$version/$compressed_name
|
||||
>&2 echo DOWNLOAD $url
|
||||
wget -q -c "${url}"
|
||||
|
||||
_verify_image_checksum $version
|
||||
|
||||
>&2 echo DECOMPRESS $url
|
||||
bzip2 -d $compressed_name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_compare_files_checksum(){
|
||||
|
||||
file1=$1
|
||||
file2=$2
|
||||
|
||||
sha256_1=$(openssl sha256 $file1 | cut -d" " -f2)
|
||||
sha256_2=$(openssl sha256 $file2 | cut -d" " -f2)
|
||||
|
||||
[ "$sha256_1" = "$sha256_2" ] || return 1
|
||||
|
||||
}
|
||||
|
||||
_download_crypto_files(){
|
||||
# see: https://docs.opnsense.org/manual/install.html#download-and-verification
|
||||
|
||||
version=$1
|
||||
|
||||
# download multiple pubkeys from different server
|
||||
pubkey="OPNsense-${version}.pub"
|
||||
|
||||
rm -f $pubkey $pubkey.sig $pubkey.alt1 $pubkey.alt2
|
||||
|
||||
url=$_HVE_OPNSENSE_URL/$version/$pubkey
|
||||
wget -q -c "${url}"
|
||||
|
||||
# failing:
|
||||
wget -q -c "${url}.sig"
|
||||
rm -f /tmp/file.sig
|
||||
openssl base64 -d -in $pubkey.sig -out /tmp/file.sig
|
||||
openssl dgst -sha256 -verify $pubkey -signature /tmp/file.sig $pubkey || _fatal "Can't verify the signature of the public key"
|
||||
|
||||
url_alt1=$_HVE_OPNSENSE_URL_ALT1/$version/$pubkey
|
||||
wget -q -c -O "$pubkey.alt1" "${url_alt1}"
|
||||
|
||||
url_alt2=$_HVE_OPNSENSE_URL_ALT2/$version/$pubkey
|
||||
wget -q -c -O "$pubkey.alt2" "${url_alt2}"
|
||||
|
||||
_compare_files_checksum $pubkey $pubkey.alt1 || _fatal "Fail to compare pubkeys" ;
|
||||
|
||||
_compare_files_checksum $pubkey $pubkey.alt2 || _fatal "Fail to compare pubkeys" ;
|
||||
|
||||
|
||||
|
||||
img_sig="OPNsense-${version}-nano-amd64.img.sig"
|
||||
|
||||
sha256_name="OPNsense-${version}-checksums-amd64.sha256"
|
||||
sha256_sig=$sha256_name.sig
|
||||
|
||||
[ ! -f "$img_sig" ] || rm $img_sig
|
||||
[ ! -f "$sha256_name" ] || rm $sha256_name
|
||||
[ ! -f "$sha256_sig" ] || rm $sha256_sig
|
||||
|
||||
|
||||
for file in $img_sig $sha256_name $sha256_sig;
|
||||
do
|
||||
url=$_HVE_OPNSENSE_URL/$version/$file
|
||||
wget -q -c "${url}"
|
||||
done
|
||||
|
||||
|
||||
rm -f /tmp/file.sig
|
||||
openssl base64 -d -in $sha256_sig -out /tmp/file.sig
|
||||
openssl dgst -sha256 -verify $pubkey -signature /tmp/file.sig $sha256_name || _fatal "Can't verify the signature of the checksum file"
|
||||
|
||||
}
|
||||
|
||||
_download(){
|
||||
|
||||
version=${1:-}
|
||||
[ "${version:-}" != "" ] || _fatal "Must pass a VERSION for downloading"
|
||||
|
||||
_is_valid_version $version || _fatal "'$version' is not a valid version number"
|
||||
|
||||
|
||||
_download_img ${version}
|
||||
|
||||
}
|
||||
|
||||
_verify_image_checksum(){
|
||||
|
||||
version=$1
|
||||
name="OPNsense-${version}-nano-amd64.img.bz2"
|
||||
sha256_file="OPNsense-${version}-checksums-amd64.sha256"
|
||||
|
||||
sha256=$(cat $sha256_file | grep "$name" | cut -d'=' -f 2 | tr -s [:space:])
|
||||
|
||||
echo "$sha256 $name" | sha256sum -c || _fatal "Checksum failed for '$name'"
|
||||
|
||||
}
|
||||
|
||||
_verify_image_signature(){
|
||||
version=$1
|
||||
|
||||
# download multiple pubkeys from different server
|
||||
pubkey="OPNsense-${version}.pub"
|
||||
img_name="OPNsense-${version}-nano-amd64.img"
|
||||
img_sig="${img_name}.sig"
|
||||
|
||||
|
||||
rm -f /tmp/file.sig
|
||||
openssl base64 -d -in $img_sig -out /tmp/file.sig
|
||||
openssl dgst -sha256 -verify $pubkey -signature /tmp/file.sig $img_name || _fatal "Can't verify image signature"
|
||||
|
||||
}
|
||||
|
||||
_check(){
|
||||
version=${1:-}
|
||||
if [ "${version:-}" = "" ] ; then
|
||||
for version in $(_list_local_images);
|
||||
do
|
||||
>&2 echo check $version
|
||||
_download_crypto_files $version
|
||||
_verify_image_signature $version
|
||||
done
|
||||
else
|
||||
_download_crypto_files $version
|
||||
_verify_image_signature $version
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
_delete(){
|
||||
version=${1:-}
|
||||
if [ -z "${version:-1}" ]; then
|
||||
_clear
|
||||
rm -f *.img
|
||||
else
|
||||
rm -f *$version*.img
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
_clear(){
|
||||
rm -f *.pub *.sig *.bz2 *.alt1 *.alt2 *.sha256
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
"")
|
||||
_short_help
|
||||
;;
|
||||
-h|--help)
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
ls|list)
|
||||
|
||||
if [ "${2:-}" == "" ]; then
|
||||
_list_local_images
|
||||
elif [ "${2:-}" == "--remote" ]; then
|
||||
_list_remote_images
|
||||
else
|
||||
_warn "Unknown option '$2'"
|
||||
fi
|
||||
;;
|
||||
download)
|
||||
pushd "${_HVE_OPNSENSE_SRC_IMG}"
|
||||
_download "${2:-"$(_latest_version)"}"
|
||||
popd
|
||||
;;
|
||||
delete)
|
||||
pushd "${_HVE_OPNSENSE_SRC_IMG}"
|
||||
_delete "${@:2}"
|
||||
popd
|
||||
;;
|
||||
check)
|
||||
pushd "${_HVE_OPNSENSE_SRC_IMG}"
|
||||
_check "${@:2}"
|
||||
popd
|
||||
;;
|
||||
show)
|
||||
ls $_HVE_OPNSENSE_SRC_IMG | cat
|
||||
;;
|
||||
clear)
|
||||
pushd "${_HVE_OPNSENSE_SRC_IMG}"
|
||||
_clear "${@:2}"
|
||||
popd
|
||||
;;
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve-opnsense-img-src "${@}"
|
||||
|
||||
77
examples/opnsense/scripts/harmony-ve-vm
Executable file
77
examples/opnsense/scripts/harmony-ve-vm
Executable file
@@ -0,0 +1,77 @@
|
||||
|
||||
#! /bin/bash
|
||||
|
||||
harmony-ve-vm()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
BASE_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")/..")
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
|
||||
harmony-ve-mv
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Manage virtalized hosts (VM) dependencies by Harmony Virtual Execution Environment
|
||||
|
||||
SYNOPSYS
|
||||
|
||||
harmony-ve-vm [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
harmony-ve-vm list
|
||||
harmony-ve-vm create
|
||||
harmony-ve-vm start
|
||||
harmony-ve-vm stop
|
||||
harmony-ve-vm login
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Implement functions
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
"")
|
||||
_short_help
|
||||
;;
|
||||
-h|--help)
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
# Commands entrypoints
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || harmony-ve-vm "${@}"
|
||||
|
||||
75
examples/opnsense/scripts/learn-harmony
Executable file
75
examples/opnsense/scripts/learn-harmony
Executable file
@@ -0,0 +1,75 @@
|
||||
#! /bin/bash
|
||||
|
||||
learn-harmony()(
|
||||
|
||||
set -eu
|
||||
|
||||
[ "${1:-}" != "-d" ] || { set -x ; shift ; }
|
||||
trap '[ "$?" = "0" ] || >&2 echo ABNORMAL TERMINATION' EXIT
|
||||
|
||||
BASE_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")/..")
|
||||
SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE}")")
|
||||
. "${SCRIPTS_DIR}/common"
|
||||
export PATH=$SCRIPTS_DIR:$PATH
|
||||
|
||||
_short_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
NAME
|
||||
learn-harmony -- Harmony Learning Tool prototype
|
||||
($(basename ${BASE_DIR}) example)
|
||||
|
||||
SYNOPSYS
|
||||
|
||||
learn-harmony [GLOBAL_OPTIONS] COMMAND [OPTIONS]
|
||||
|
||||
learn-harmony list # List learning steps
|
||||
learn-harmony show STEP # Show instruction of step STEP
|
||||
learn-harmony check [STEP] # Verify that your ready to begin step STEP+1
|
||||
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
_extra_help(){
|
||||
|
||||
cat <<-EOM
|
||||
|
||||
GLOBAL_OPTIONS
|
||||
|
||||
-d Debug mode.
|
||||
|
||||
WARNINGS
|
||||
|
||||
This script is experimetal. Use with caution.
|
||||
EOM
|
||||
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
|
||||
-h|--help|"")
|
||||
_short_help
|
||||
_extra_help
|
||||
;;
|
||||
ls|list)
|
||||
echo "not implemented"
|
||||
;;
|
||||
show)
|
||||
echo "not implemented"
|
||||
;;
|
||||
verify)
|
||||
echo "not implemented"
|
||||
;;
|
||||
*)
|
||||
_warn "Unknown COMMAND '$1'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
)
|
||||
|
||||
|
||||
[ "$0" != "${BASH_SOURCE}" ] || learn-harmony "${@}"
|
||||
|
||||
4
examples/opnsense/scripts/setup
Normal file
4
examples/opnsense/scripts/setup
Normal file
@@ -0,0 +1,4 @@
|
||||
#! /bin/bash
|
||||
|
||||
|
||||
export PATH=$(readlink -f "$(dirname "${BASH_SOURCE}")"):"${PATH}"
|
||||
@@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let firewall = LogicalHost {
|
||||
ip: ip!("192.168.55.1"),
|
||||
ip: ip!("192.168.1.1"),
|
||||
name: String::from("opnsense-1"),
|
||||
};
|
||||
|
||||
@@ -30,8 +30,8 @@ async fn main() {
|
||||
|
||||
let dhcp_score = DhcpScore {
|
||||
dhcp_range: (
|
||||
ipv4!("192.168.55.100").into(),
|
||||
ipv4!("192.168.55.150").into(),
|
||||
ipv4!("192.168.1.100").into(),
|
||||
ipv4!("192.168.1.150").into(),
|
||||
),
|
||||
host_binding: vec![],
|
||||
next_server: None,
|
||||
|
||||
Reference in New Issue
Block a user