Merge pull request #610 from pstavirs/master

Update Ostinato appliance with official images
This commit is contained in:
Jeremy Grossmann 2021-09-10 05:21:00 -07:00 committed by GitHub
commit c7ecd342e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 461 deletions

View File

@ -1,24 +1,27 @@
{
"name": "Ostinato",
"category": "guest",
"description": "Ostinato is an open-source, cross-platform network packet crafter/traffic generator and analyzer with a friendly GUI. Craft and send packets of several streams with different protocols at different rates.",
"description": "Packet crafter and traffic generator for network engineers",
"vendor_name": "Ostinato",
"vendor_url": "http://ostinato.org/",
"documentation_url": "http://ostinato.org/docs.html",
"vendor_url": "https://ostinato.org/",
"documentation_url": "https://ostinato.org/docs",
"product_name": "Ostinato",
"product_url": "http://ostinato.org/",
"registry_version": 3,
"status": "experimental",
"maintainer": "Bernhard Ehlers",
"maintainer_email": "be@bernhard-ehlers.de",
"usage": "Use interfaces starting with eth1 as traffic interfaces, eth0 is only for the (optional) management of the server/drone.",
"symbol": "ostinato-3d-icon.svg",
"port_name_format": "eth{0}",
"product_url": "https://ostinato.org/",
"registry_version": 4,
"status": "stable",
"availability": "service-contract",
"maintainer": "Srivats P",
"maintainer_email": "support@ostinato.org",
"symbol": ":/symbols/affinity/circle/gray/cog.svg",
"first_port_name": "eth0/mgmt",
"port_name_format": "eth{port1}",
"linked_clone": true,
"qemu": {
"adapter_type": "e1000",
"adapters": 4,
"ram": 256,
"hda_disk_interface": "ide",
"cpus": 2,
"hda_disk_interface": "sata",
"arch": "i386",
"console_type": "vnc",
"kvm": "allow",
@ -26,33 +29,18 @@
},
"images": [
{
"filename": "ostinato-0.9-1.qcow2",
"version": "0.9",
"md5sum": "00b4856ec9fffbcbcab7a8f757355d69",
"filesize": 101646336,
"download_url": "http://www.bernhard-ehlers.de/projects/ostinato4gns3/index.html",
"direct_download_url": "http://www.bernhard-ehlers.de/projects/ostinato4gns3/ostinato-0.9-1.qcow2"
},
{
"filename": "ostinato-0.8-1.qcow2",
"version": "0.8",
"md5sum": "12e990ba695103cfac82f8771b8015d4",
"filesize": 57344000,
"download_url": "http://www.bernhard-ehlers.de/projects/ostinato4gns3/index.html",
"direct_download_url": "http://www.bernhard-ehlers.de/projects/ostinato4gns3/ostinato-0.8-1.qcow2"
"version": "1.1",
"filename": "ostinatostd-1.1-1.qcow2",
"filesize": 134217728,
"md5sum": "aa027e83cefea1c38d0102eb2f28956e",
"download_url": "https://ostinato.org/pricing/gns3"
}
],
"versions": [
{
"name": "0.9",
"name": "1.1",
"images": {
"hda_disk_image": "ostinato-0.9-1.qcow2"
}
},
{
"name": "0.8",
"images": {
"hda_disk_image": "ostinato-0.8-1.qcow2"
"hda_disk_image": "ostinatostd-1.1-1.qcow2"
}
}
]

View File

@ -47,13 +47,3 @@ The GUI version has XFCE4 installed.
packer build -var-file=gui.json alpine.json
Ostinato
'''''''''
A build of Alpine with Ostinato GUI and drone preinstalled.
.. code:: bash
packer build -var-file=ostinato.json alpine.json

View File

@ -1,7 +0,0 @@
{
"ui_mode": "gui",
"vm_name": "ostinato.qcow2",
"file_source": "ostinato",
"setup_script": "ostinato.sh",
"disk_size": "1000"
}

View File

@ -1,114 +0,0 @@
# install packages
alpine_version=$(cat /etc/alpine-release)
alpine_version=${alpine_version%.*}
apk add nano mousepad
apk add --allow-untrusted \
/tmp/uploads/ostinato/$alpine_version/ostinato-drone*.apk \
/tmp/uploads/ostinato/$alpine_version/ostinato-gui*.apk
apk add tshark wireshark
# desktop integration
cat > /usr/share/applications/ostinato.desktop << 'EOF'
[Desktop Entry]
Name=Ostinato
GenericName=Packet Traffic Generator
Exec=ostinato
Icon=ostinato
Terminal=false
Type=Application
Categories=Network;Monitor;Qt;
EOF
cp -p /tmp/uploads/ostinato/logo_256x256.png /usr/share/icons/hicolor/256x256/apps/ostinato.png
gtk-update-icon-cache -f /usr/share/icons/hicolor
# change hostname
sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\tostinato.$(hostname -d) ostinato localhost.localdomain localhost/" /etc/hosts
echo ostinato > /etc/hostname
hostname ostinato
# configure ostinato
mkdir -p /etc/xdg/Ostinato
printf '[General]\nRateAccuracy=Low\n[PortList]\nExclude=any,lo*\n' > /etc/xdg/Ostinato/drone.ini
# allow ostinato group to run drone
addgroup -S ostinato
chgrp ostinato /usr/bin/drone
chmod 750 /usr/bin/drone
setcap cap_net_admin,cap_net_raw=eip /usr/bin/drone
# add user to ostinato and wireshark group
addgroup user ostinato
addgroup user wireshark
# reset terminal modes
sed -i "$(printf '1i\e[?5l\e[?7h\e[?8h')" /etc/motd
# create .profile
cat > /root/.profile << 'EOF'
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
mesg n || true
EOF
find /home -type d -mindepth 1 -maxdepth 1 | while read -r home; do
cp -p /root/.profile "$home/"
chown $(stat -c '%u:%g' "$home") "$home/.profile"
done
# network configuration
cat > /etc/network/interfaces << EOF
#
# This is a sample network config, uncomment lines to configure the network
#
# Loopback interface
auto lo
iface lo inet loopback
# Static config for eth0
#auto eth0
#iface eth0 inet static
# address 192.168.0.2
# netmask 255.255.255.0
# gateway 192.168.0.1
# up echo nameserver 192.168.0.1 > /etc/resolv.conf
# DHCP config for eth0
#auto eth0
#iface eth0 inet dhcp
# hostname $(hostname)
# Minimal configuration for ethernet interfaces
# If static IP or DHCP is enabled for eth0, comment the config for eth0
auto eth0
iface eth0 inet manual
pre-up sysctl -q -w net.ipv6.conf.\$IFACE.disable_ipv6=1
up ip link set dev \$IFACE mtu 9000 up
down ip link set dev \$IFACE down
auto eth1
iface eth1 inet manual
pre-up sysctl -q -w net.ipv6.conf.\$IFACE.disable_ipv6=1
up ip link set dev \$IFACE mtu 9000 up
down ip link set dev \$IFACE down
auto eth2
iface eth2 inet manual
pre-up sysctl -q -w net.ipv6.conf.\$IFACE.disable_ipv6=1
up ip link set dev \$IFACE mtu 9000 up
down ip link set dev \$IFACE down
auto eth3
iface eth3 inet manual
pre-up sysctl -q -w net.ipv6.conf.\$IFACE.disable_ipv6=1
up ip link set dev \$IFACE mtu 9000 up
down ip link set dev \$IFACE down
EOF
cat > /etc/resolv.conf << EOF
EOF

View File

@ -87,18 +87,3 @@ A build of Tiny Core with Firefox preinstalled.
packer build -var-file=tinycore-linux-firefox.json tinycore-linux.json
Ostinato
'''''''''
A build of Tiny Core with Ostinato GUI + drone preinstalled.
.. code:: bash
packer build -var-file=ostinato.json tinycore-linux.json
A drone-only VM without GUI can be build with:
.. code:: bash
packer build -var-file=ostinato-drone.json core-linux.json

View File

@ -1,5 +0,0 @@
{
"vm_name": "ostinato-drone.qcow2",
"setup_script": "ostinato-drone.sh",
"disk_size": "200"
}

View File

@ -1,7 +0,0 @@
{
"tc_iso_url": "http://distro.ibiblio.org/tinycorelinux/8.x/x86/archive/8.2/Core-8.2.iso",
"tc_iso_checksum": "560b6d9da10140f13f22eeea35bf6087",
"vm_name": "ostinato.qcow2",
"setup_script": "ostinato.sh",
"disk_size": "200"
}

View File

@ -1,124 +0,0 @@
set -e
set -x
# git branch, commit or tag
git_commit=v0.9
# setup environment
. /etc/profile
. /etc/init.d/tc-functions
getMirror
# load qt-4.x-base without the X dependecies
# alternatively a "tce-load -wi qt-4.x-base" loads it with all dependecies
wget -P /mnt/sda1/tce/optional $MIRROR/qt-4.x-base.tcz
wget -P /mnt/sda1/tce/optional $MIRROR/qt-4.x-base.tcz.md5.txt
touch /mnt/sda1/tce/optional/qt-4.x-base.tcz.dep
tce-load -i /mnt/sda1/tce/optional/qt-4.x-base.tcz
# load the remaining dependencies for ostinato
tce-load -wi qt-4.x-script
tce-load -wi glib2
tce-load -wi openssl
tce-load -wi libpcap
# load also iperf
tce-load -wi iperf3
# change tcedir to ram disk
mv /etc/sysconfig/tcedir /etc/sysconfig/tcedir.hd
ln -s /tmp/tce /etc/sysconfig/tcedir
sudo cp -a /usr/local/tce.installed /usr/local/tce.installed.hd
# setup compile environment
tce-load -wi compiletc
tce-load -wi squashfs-tools
tce-load -wi curl
export CFLAGS="-march=i486 -mtune=i686 -O2"
export CXXFLAGS="-march=i486 -mtune=i686 -O2"
export LDFLAGS="-Wl,-O1"
# compile protobuf
curl -L -O https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar xfz protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
./configure --prefix=/usr/local
make
sudo make install
sudo rm /usr/local/lib/libprotobuf.so
cd ..
rm -rf protobuf*
# compile ostinato
tce-load -wi qt-4.x-dev
tce-load -wi libpcap-dev
tce-load -wi git
git clone https://github.com/pstavirs/ostinato.git
cd ostinato
[ -n "$git_commit" ] && git checkout "$git_commit"
qmake -config release "QMAKE_CXXFLAGS+=$CXXFLAGS"
make server
sudo INSTALL_ROOT=/tmp/ostinato make server-install_subtargets
sudo chown -R root:root /tmp/ostinato
sudo chmod +s /tmp/ostinato/usr/local/bin/drone
cd ..
mksquashfs /tmp/ostinato ostinato-drone.tcz
md5sum ostinato-drone.tcz > ostinato-drone.tcz.md5.txt
echo -e "qt-4.x-base.tcz\nqt-4.x-script.tcz\nlibpcap.tcz" > ostinato-drone.tcz.dep
mv ostinato-drone.tcz* /mnt/sda1/tce/optional/
echo ostinato-drone.tcz >> /mnt/sda1/tce/onboot.lst
sudo rm -rf /tmp/ostinato
rm -rf ostinato*
# ostinato configuration file
mkdir -p .config/Ostinato
cat > .config/Ostinato/drone.ini <<'EOF'
[General]
RateAccuracy=Low
[PortList]
Include=eth*
Exclude=eth0
EOF
# change tcedir back to hard disk
rm -f /etc/sysconfig/tcedir
mv /etc/sysconfig/tcedir.hd /etc/sysconfig/tcedir
sudo rm -rf /usr/local/tce.installed
sudo mv /usr/local/tce.installed.hd /usr/local/tce.installed
# disable automatic interface configuration with dhcp
sudo sed -i -e '/label .*core/,/append / s/\(append .*\)/\1 nodhcp/' /mnt/sda1/boot/extlinux/extlinux.conf
# add startup script for ostinato
cat >> /opt/bootlocal.sh <<'EOF'
# Boot parameter "nodhcp": network interfaces are not yet configured
if grep -q -w nodhcp /proc/cmdline; then
# This waits until all devices have registered
/sbin/udevadm settle --timeout=10
# configure eth0 with DHCP
/sbin/udhcpc -b -i eth0 -x hostname:$(/bin/hostname) -p /var/run/udhcpc.eth0.pid >/dev/null 2>&1 &
# alternatively configure static interface address and route
#ifconfig eth0 x.x.x.x netmask 255.255.255.0 up
#route add default gw y.y.y.y
#echo 'nameserver z.z.z.z' > /etc/resolv.conf
# activate other eth devices
NETDEVICES="$(awk -F: '/eth[1-9][0-9]*:/{print $1}' /proc/net/dev 2>/dev/null)"
for DEVICE in $NETDEVICES; do
sysctl -q -w net.ipv6.conf.$DEVICE.disable_ipv6=1
ifconfig $DEVICE mtu 9000 up
done
fi
# disable ostinato update, makes no sense in this environment
echo -e '# disable ostinato update\n127.0.0.127 update.ostinato.org' >> /etc/hosts
# start ostinato drone
sleep 2
su -c 'drone < /dev/null > /var/log/ostinato-drone.log 2>&1 &' gns3
EOF
exit 0

View File

@ -1,145 +0,0 @@
set -e
set -x
# git branch, commit or tag
git_commit=v0.9
# setup environment
. /etc/profile
# load the dependencies for ostinato
tce-load -wi qt-4.x-base
tce-load -wi qt-4.x-script
tce-load -wi libpcap
# load also iperf
tce-load -wi iperf3
# change tcedir to ram disk
mv /etc/sysconfig/tcedir /etc/sysconfig/tcedir.hd
ln -s /tmp/tce /etc/sysconfig/tcedir
sudo cp -a /usr/local/tce.installed /usr/local/tce.installed.hd
# setup compile environment
tce-load -wi compiletc
tce-load -wi squashfs-tools
tce-load -wi curl
export CFLAGS="-march=i486 -mtune=i686 -O2"
export CXXFLAGS="-march=i486 -mtune=i686 -O2"
export LDFLAGS="-Wl,-O1"
# compile protobuf
curl -L -O https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar xfz protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
./configure --prefix=/usr/local
make
sudo make install
sudo rm /usr/local/lib/libprotobuf.so
cd ..
rm -rf protobuf*
# compile ostinato
tce-load -wi qt-4.x-dev
tce-load -wi libpcap-dev
tce-load -wi git
git clone https://github.com/pstavirs/ostinato.git
cd ostinato
[ -n "$git_commit" ] && git checkout "$git_commit"
qmake -config release "QMAKE_CXXFLAGS+=$CXXFLAGS"
make
sudo INSTALL_ROOT=/tmp/ostinato make install
sudo mkdir -p /tmp/ostinato/usr/local/share/applications
cat > ostinato.desktop <<'EOF'
[Desktop Entry]
Name=Ostinato
Exec=ostinato > /var/log/ostinato.log 2>&1
Type=Application
X-FullPathIcon=/usr/local/share/pixmaps/ostinato_logo.png
Icon=ostinato_logo.png
Categories=System;
EOF
sudo mv ostinato.desktop /tmp/ostinato/usr/local/share/applications/
sudo mkdir -p /tmp/ostinato/usr/local/share/pixmaps
sudo cp -p client/icons/logo.png /tmp/ostinato/usr/local/share/pixmaps/ostinato_logo.png
chmod 644 /tmp/ostinato/usr/local/share/pixmaps/ostinato_logo.png
sudo chown -R root:root /tmp/ostinato
sudo chmod +s /tmp/ostinato/usr/local/bin/drone
cd ..
mksquashfs /tmp/ostinato ostinato.tcz
md5sum ostinato.tcz > ostinato.tcz.md5.txt
echo -e "qt-4.x-base.tcz\nqt-4.x-script.tcz\nlibpcap.tcz" > ostinato.tcz.dep
mv ostinato.tcz* /mnt/sda1/tce/optional/
echo ostinato.tcz >> /mnt/sda1/tce/onboot.lst
sudo rm -rf /tmp/ostinato
rm -rf ostinato*
# ostinato configuration file
mkdir -p .config/Ostinato
cat > .config/Ostinato/drone.ini <<'EOF'
[General]
RateAccuracy=Low
[PortList]
Include=eth*
Exclude=eth0
EOF
cat > .config/Ostinato/Ostinato.conf <<'EOF'
[General]
WiresharkPath=/usr/local/bin/wireshark-gtk
TsharkPath=/usr/local/bin/tshark
GzipPath=/bin/gzip
DiffPath=/usr/bin/diff
AwkPath=/usr/bin/awk
EOF
# change tcedir back to hard disk
rm -f /etc/sysconfig/tcedir
mv /etc/sysconfig/tcedir.hd /etc/sysconfig/tcedir
sudo rm -rf /usr/local/tce.installed
sudo mv /usr/local/tce.installed.hd /usr/local/tce.installed
# install wireshark
tce-load -wi wireshark adwaita-icon-theme
# install dillo (tiny web browser) for reading documentation
tce-load -wi dillo ca-certificates
echo -e '\nexport BROWSER=dillo' >> .ashrc
sudo ln -s /usr/local/etc/ssl /etc/ssl
echo 'etc/ssl' >> /opt/.filetool.lst
# disable automatic interface configuration with dhcp
sudo sed -i -e '/label .*core/,/append / s/\(append .*\)/\1 nodhcp/' /mnt/sda1/boot/extlinux/extlinux.conf
# add startup script for ostinato
cat >> /opt/bootlocal.sh <<'EOF'
# Boot parameter "nodhcp": network interfaces are not yet configured
if grep -q -w nodhcp /proc/cmdline; then
# This waits until all devices have registered
/sbin/udevadm settle --timeout=10
# configure eth0 with DHCP
/sbin/udhcpc -b -i eth0 -x hostname:$(/bin/hostname) -p /var/run/udhcpc.eth0.pid >/dev/null 2>&1 &
# alternatively configure static interface address and route
#ifconfig eth0 x.x.x.x netmask 255.255.255.0 up
#route add default gw y.y.y.y
#echo 'nameserver z.z.z.z' > /etc/resolv.conf
# activate other eth devices
NETDEVICES="$(awk -F: '/eth[1-9][0-9]*:/{print $1}' /proc/net/dev 2>/dev/null)"
for DEVICE in $NETDEVICES; do
sysctl -q -w net.ipv6.conf.$DEVICE.disable_ipv6=1
ifconfig $DEVICE mtu 9000 up
done
fi
# disable ostinato update, makes no sense in this environment
echo -e '# disable ostinato update\n127.0.0.127 update.ostinato.org' >> /etc/hosts
# start ostinato drone
#sleep 2
#su -c 'drone < /dev/null > /var/log/ostinato-drone.log 2>&1 &' gns3
EOF
exit 0