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

Test tests #910

Open
wants to merge 44 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f40c45a
changed test_tests, created 2 images one for compliant on efor non co…
MariusBaldovin Oct 17, 2024
3b69fec
updates
MariusBaldovin Oct 17, 2024
0267741
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 17, 2024
5868acf
updates
MariusBaldovin Oct 17, 2024
7561150
changes
MariusBaldovin Oct 18, 2024
a3e3ee2
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 18, 2024
b110221
added all modules
MariusBaldovin Oct 18, 2024
9f160a0
fixes
MariusBaldovin Oct 18, 2024
bc73864
updated package.yml to start testrun after the package has been insta…
MariusBaldovin Oct 18, 2024
be16237
fixed test_tests workflow error
MariusBaldovin Oct 18, 2024
4046790
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 18, 2024
82e949e
updated package.yml
MariusBaldovin Oct 18, 2024
1158f4d
updated package.yml
MariusBaldovin Oct 18, 2024
9b79a5b
updates
MariusBaldovin Oct 18, 2024
eb61d4d
changed package.yml in separate jobs start and verify if started
MariusBaldovin Oct 18, 2024
bff777b
removed comments
MariusBaldovin Oct 18, 2024
66171cd
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 21, 2024
9a6e250
updated package.yml
MariusBaldovin Oct 21, 2024
c8dc118
enable onlye services for testr1 and tester2
MariusBaldovin Oct 21, 2024
2dafcdc
updated package.yml
MariusBaldovin Oct 21, 2024
972f414
reverted package.yml to its original state
MariusBaldovin Oct 21, 2024
4f4a899
added comments
MariusBaldovin Oct 21, 2024
918d573
updated comments
MariusBaldovin Oct 21, 2024
e509c0b
removed push from testing.yml
MariusBaldovin Oct 21, 2024
89f90d9
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 21, 2024
8609367
updates on docker images
MariusBaldovin Oct 21, 2024
67537b6
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 21, 2024
227710b
updated testing.yml
MariusBaldovin Oct 21, 2024
36cbfb4
added tests for DNS Module
MariusBaldovin Oct 21, 2024
e43d4a3
updates
MariusBaldovin Oct 21, 2024
a82df9a
Merge branch 'dev' of https://github.com/MariusBaldovin/testrun into …
MariusBaldovin Oct 22, 2024
80a3b90
Merge branch 'dev' into test_tests
jhughesbiot Oct 22, 2024
2eacad5
Merge branch 'dev' into test_tests
jboddey Oct 24, 2024
6d32bbe
Merge branch 'dev' into test_tests
jboddey Oct 25, 2024
d7737e1
Merge branch 'dev' into test_tests
MariusBaldovin Oct 29, 2024
26b0cf1
Merge branch 'dev' into test_tests
MariusBaldovin Oct 30, 2024
fc70a30
Updated the scrip for starting testrun with no ui
MariusBaldovin Oct 30, 2024
b76de80
Merge branch 'dev' into test_tests
MariusBaldovin Oct 31, 2024
8776136
Merge branch 'dev' into test_tests
MariusBaldovin Nov 1, 2024
b65a363
Merge branch 'dev' into test_tests
MariusBaldovin Nov 4, 2024
32e5cb1
Merge branch 'dev' into test_tests
MariusBaldovin Nov 8, 2024
37c46eb
Merge branch 'dev' into test_tests
MariusBaldovin Nov 15, 2024
2723451
Merge branch 'dev' into test_tests
MariusBaldovin Nov 20, 2024
7952db3
Merge branch 'dev' into test_tests
jboddey Dec 10, 2024
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
19 changes: 19 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ on:
- cron: '0 13 * * *'

jobs:
testrun_tests:
permissions: {}
name: Tests
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install dependencies
shell: bash {0}
run: cmd/prepare
- name: Install Testrun
shell: bash {0}
run: TESTRUN_DIR=. cmd/install
timeout-minutes: 30
- name: Run tests
shell: bash {0}
run: testing/tests/test_tests

testrun_baseline:
permissions: {}
name: Baseline
Expand Down
29 changes: 13 additions & 16 deletions testing/device_configs/tester1/device_config.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
{
{
"mac_addr": "02:42:aa:00:00:01",
"manufacturer": "Google",
"model": "Tester 1",
"mac_addr": "02:42:aa:00:00:01",
"type": "Controller - FCU",
"technology": "Hardware - Fitness",
"type": "IoT Gateway",
"technology": "Hardware - Access Control",
"test_pack": "Device Qualification",
"test_modules": {
"dns": {
"enabled": true
},
"connection": {
"protocol": {
"enabled": false
},
"ntp": {
"enabled": true
},
"baseline": {
"services": {
"enabled": true
},
"nmap": {
"enabled": true
},
"protocol": {
"ntp": {
"enabled": false
},
"tls": {
"enabled": false
},
"connection": {
"enabled": false
},
"dns": {
"enabled": true
}
},
"additional_info": [
Expand Down
81 changes: 39 additions & 42 deletions testing/device_configs/tester2/device_config.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
{
"mac_addr": "02:42:aa:00:00:02",
"manufacturer": "Google",
"model": "Tester 2",
"mac_addr": "02:42:aa:00:00:02",
"type": "Controller - FCU",
"technology": "Hardware - Fitness",
"type": "IoT Gateway",
"technology": "Hardware - Access Control",
"test_pack": "Device Qualification",
"test_modules": {
"dns": {
"enabled": true
"additional_info": [
{
"question": "What type of device is this?",
"answer": "IoT Gateway"
},
"connection": {
"enabled": true
{
"question": "Please select the technology this device falls into",
"answer": "Hardware - Access Control"
},
"ntp": {
"enabled": false
{
"question": "Does your device process any sensitive information?",
"answer": "Yes"
},
"baseline": {
"enabled": true
{
"question": "Can all non-essential services be disabled on your device?",
"answer": "Yes"
},
"nmap": {
"enabled": true
{
"question": "Is there a second IP port on the device?",
"answer": "Yes"
},
{
"question": "Can the second IP port on your device be disabled?",
"answer": "Yes"
}
],
"test_modules": {
"protocol": {
"enabled": false
},
"services": {
"enabled": true
},
"ntp": {
"enabled": false
},
"tls": {
"enabled": false
}
},
"additional_info": [
{
"question": "What type of device is this?",
"answer": "Controller - FCU"
},
{
"question": "Please select the technology this device falls into",
"answer": "Hardware - Fitness"
},
{
"question": "Does your device process any sensitive information? ",
"answer": "No"
},
{
"question": "Can all non-essential services be disabled on your device?",
"answer": "Yes"
},
{
"question": "Is there a second IP port on the device?",
"answer": "No"
},
{
"question": "Can the second IP port on your device be disabled?",
"answer": "N/A"
}
]
},
"connection": {
"enabled": false
},
"dns": {
"enabled": true
}
}
}
19 changes: 19 additions & 0 deletions testing/docker/ci_test_device1/compliant/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

FROM ubuntu@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7dd060a74

ENV DEBIAN_FRONTEND=noninteractive

# Update the package list and upgrade the installed packages to their latest versions
RUN apt-get update && apt-get -y upgrade

# Install the necessary packages
RUN apt-get update && apt-get install -y isc-dhcp-client dnsutils netcat-openbsd arping

# Clean up the package lists to reduce the image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
39 changes: 39 additions & 0 deletions testing/docker/ci_test_device1/compliant/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash -x

# Display network interfaces
ip a

# Set paths and servers
NTP_SERVER=10.10.10.5
DNS_SERVER=8.8.8.8
INTF=eth0

# DHCP
ip addr flush dev $INTF
PID_FILE=/var/run/dhclient.pid
if [ -f $PID_FILE ]; then
kill -9 $(cat $PID_FILE) || true
rm -f $PID_FILE
fi
dhclient -v $INTF
DHCP_TPID=$!
echo $DHCP_TPID

# SERVICES MODULE

# No FTP, SSH, Telnet, SMTP, HTTP, POP, IMAP services
echo "FTP, SSH, Telnet, SMTP, HTTP, POP, IMAP, SNMP, VNC, TFTP, NTP services not running"

# DNS MODULE

# Test DNS resolution
echo "Sending DNS request to $DNS_SERVER"
dig @$DNS_SERVER +short www.google.com

# Keep network monitoring (can refactor later for other network modules)
(while true; do arping 10.10.10.1; sleep 10; done) &
(while true; do ip a | cat; sleep 10; done) &

# Keep the script running
tail -f /dev/null

19 changes: 19 additions & 0 deletions testing/docker/ci_test_device1/non_compliant/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

FROM ubuntu@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7dd060a74

ENV DEBIAN_FRONTEND=noninteractive

# Update the package list and upgrade the installed packages to their latest versions
RUN apt-get update && apt-get -y upgrade

# Install the necessary packages
RUN apt-get update && apt-get install -y isc-dhcp-client ntp coreutils dnsutils netcat-openbsd arping

# Clean up the package lists to reduce the image size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
79 changes: 79 additions & 0 deletions testing/docker/ci_test_device1/non_compliant/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash -x

# Display network interfaces
ip a

# Set paths and servers
NTP_SERVER=10.10.10.5
DNS_SERVER="nonexistent.dns.server"
INTF=eth0

# Check if the interface is up
ip link show $INTF | grep "state UP" || echo "Warning: $INTF is not up"

# DHCP setup
ip addr flush dev $INTF
PID_FILE=/var/run/dhclient.pid
if [ -f $PID_FILE ]; then
kill -9 $(cat $PID_FILE) || true
rm -f $PID_FILE
fi
dhclient -v $INTF
DHCP_TPID=$!
echo $DHCP_TPID

# SERVICES MODULE

# Start FTP service
echo "Starting FTP on ports 20, 21"
nc -nvlt -p 20 &
nc -nvlt -p 21 &

# Start Telnet service
echo "Starting Telnet on port 23"
nc -nvlt -p 23 &

# Start SMTP service
echo "Starting SMTP on ports 25, 465, and 587"
nc -nvlt -p 25 &
nc -nvlt -p 465 &
nc -nvlt -p 587 &

# Start HTTP service
echo "Starting HTTP on port 80 "
nc -nvlt -p 80 &

# Start POP service
echo "Starting POP on ports 109 and 110 "
nc -nvlt -p 109 &
nc -nvlt -p 110 &

# Start IMAP service
echo "Starting IMAP on port 143 "
nc -nvlt -p 143 &

# Start SNMPv2 service
echo "Starting SNMPv2 on ports 161/162 "
(while true; do echo -ne " \x02\x01\ " | nc -u -l -w 1 161; done) &

# Start TFTP service
echo "Starting TFTP on port 69 "
(while true; do echo -ne "\0\x05\0\0\x07\0" | nc -u -l -w 1 69; done) &

# Start NTP service
echo "Starting NTP service"
service ntp start

# DNS MODULE

# Test DNS resolution
echo "Sending DNS request to $DNS_SERVER"
dig @$DNS_SERVER +short www.google.com || echo "DNS resolution failed"

# Keep network monitoring
(while true; do arping 10.10.10.1; sleep 10; done) &
(while true; do ip a | cat; sleep 10; done) &

# Keep the script running
tail -f /dev/null

Loading
Loading