-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update NTP report (#666) * Update NTP report * cleanup imports * pylint updates * Add not started and disabled as test statuses * Fix disabled test * Check if profiles format has loaded (#665) * Feature/dhcp disconnect (#626) * Initial work on giving host access to test containers * Change external ip resolving method to use docker0 * Resolve device interface for test containers * Add gRPC methods to control the interface state Implement dhcp disconnect test * Fix host network module option * Misc cleanup * Move ip resolving method to IPControl class * pylint fixes * refactor func to handle case when network interface not exists * set test result "Error" * check device connected * thread for monitoring device connection * Minor changes * check the device connection only before each test * send testrun status using mqtt * remove duplicatied line * refactor setting remaining tests to error * Pylint fixes * pylint * Use mqtt service instead of calling GET /status every 5 seconds. (#644) * Use mqtt service instead of calling GET /status every 5 seconds. * Adds tooltip (#638) Adds tooltip * Fix focus after profile delete - track by name (#640) Fix focus after profile delete - track by name * Update the requests dependency (#643) * Update requests dependency * Update requests dependency * Update dependency in TLS test * Update docker dependency --------- Signed-off-by: J Boddey <boddey@google.com> * remove unused output * encode mqtt message to json * Revert "Expired profile (#619)" (#645) Prevent opening of Expired risk profile * Improve documentation (#639) * Improve docs * Remove paragraph * Text changes * Fix text for the BE error * Change tooltip (#650) * Change tooltip * Allows draft profiles to become expired (#636) * Allow draft profiles to expire * Move status method into risk profile class * Use existing method * Check for expiry in validate method * Remove unused variable * Build UI during package instead of install (#621) * Build UI during package * Fix local build * Install npm * Remove duplicate build message * Fix ESLint * Fix script * Modify scripts * Improve scripts * Fix copy command * Try installing package * Depend on package job * Add sudo * Add sudo * Troubleshoot * Fix workflow * Checkout source for prepare command * Built ui within a container * Mount src files for build instead of static copy in build image * Attempt to fix actions * Remove manual build container cleanup methods * undo failed attempts to fix actions * Fix path * Remove -it flag --------- Signed-off-by: J Boddey <boddey@google.com> Co-authored-by: kurilova <sonnycactus@gmail.com> Co-authored-by: jhughesbiot <jonathan.hughes@buildingsiot.com> * Feature/risk in selected (#654) * Adds risk to selected value * Adds risk to selected value --------- Co-authored-by: J Boddey <boddey@google.com> * Show risk for each question in the Risk profile (#647) * Show risk for each question in the Risk profile * set top position to 0 --------- Co-authored-by: J Boddey <boddey@google.com> * Use mqtt service instead of calling GET /status every 5 seconds. * Use mqtt service instead of calling GET /status every 5 seconds. * Use mqtt service instead of calling GET /status every 5 seconds. * pylint --------- Signed-off-by: J Boddey <boddey@google.com> Co-authored-by: J Boddey <boddey@google.com> Co-authored-by: Aliaksandr Nikitsin <aliaksandrn@google.com> Co-authored-by: jhughesbiot <jonathan.hughes@buildingsiot.com> * Allow ICMP response to DHCP messages in DHCP snooping test (#608) * Allow ICMP response to DHCP messages * Bug/unit test runtime (#655) * Change base test module startup to allow setup script to run independent of module startup process Update connection_module to allow for unit testing Update unit test run script to use new process * enable all unit tests update google cert * Remove binary fix lines from docker files pylint updates * pylint updates --------- Co-authored-by: jhughesbiot <jonathan.hughes@buildingsiot.com> * The risk profile saved with old format is shown improperly while loading based on a new format (#664) * Fill only fields that are present in profile * GAR : The alt text for the expired risk profile should be communicated on Enter key (#662) * Change Expired profile title on Enter; announce Expired profile title on Enter * Update wording of tls cipher results (#671) * Show error message if provided; show default message if no (#680) * Test install on supported operating systems (#675) * Test install on multiple versions * Update step names * Do not give Non-Compliant if error given --------- Signed-off-by: J Boddey <boddey@google.com> Co-authored-by: J Boddey <boddey@google.com> Co-authored-by: Aliaksandr Nikitsin <aliaksandrn@google.com> Co-authored-by: Sofia Kurilova <kurilova@google.com> * Fix host module docker name --------- Signed-off-by: J Boddey <boddey@google.com> Co-authored-by: jhughesbiot <jonathan.hughes@buildingsiot.com> Co-authored-by: Aliaksandr Nikitsin <aliaksandrn@google.com> Co-authored-by: Sofia Kurilova <kurilova@google.com>
- Loading branch information
1 parent
6bbb803
commit dba2636
Showing
20 changed files
with
586 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,105 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Directory where all binaries will be loaded | ||
BIN_DIR="/testrun/bin" | ||
|
||
# Default interface should be veth0 for all containers | ||
DEFAULT_IFACE=veth0 | ||
|
||
# Create a local user that matches the same as the host | ||
# to be used for correct file ownership for various logs | ||
# HOST_USER mapped in via docker container environemnt variables | ||
useradd $HOST_USER | ||
|
||
# Enable IPv6 for all containers | ||
sysctl net.ipv6.conf.all.disable_ipv6=0 | ||
sysctl -p | ||
|
||
# Read in the config file | ||
CONF_FILE="/testrun/conf/module_config.json" | ||
CONF=`cat $CONF_FILE` | ||
|
||
if [[ -z $CONF ]] | ||
then | ||
echo "No config file present at $CONF_FILE. Exiting startup." | ||
exit 1 | ||
fi | ||
|
||
# Extract the necessary config parameters | ||
MODULE_NAME=$(echo "$CONF" | jq -r '.config.meta.name') | ||
DEFINED_IFACE=$(echo "$CONF" | jq -r '.config.network.interface') | ||
GRPC=$(echo "$CONF" | jq -r '.config.grpc') | ||
|
||
# Validate the module name is present | ||
if [[ -z "$MODULE_NAME" || "$MODULE_NAME" == "null" ]] | ||
then | ||
echo "No module name present in $CONF_FILE. Exiting startup." | ||
exit 1 | ||
fi | ||
|
||
# Select which interace to use | ||
if [[ -z $DEFINED_IFACE || "$DEFINED_IFACE" == "null" ]] | ||
then | ||
echo "No Interface Defined, defaulting to veth0" | ||
INTF=$DEFAULT_IFACE | ||
else | ||
INTF=$DEFINED_IFACE | ||
fi | ||
|
||
# Setup the PYTHONPATH so all imports work as expected | ||
echo "Setting up PYTHONPATH..." | ||
export PYTHONPATH=$($BIN_DIR/setup_python_path) | ||
echo "PYTHONPATH: $PYTHONPATH" | ||
|
||
echo "Configuring binary files..." | ||
$BIN_DIR/setup_binaries $BIN_DIR | ||
|
||
echo "Starting module $MODULE_NAME on local interface $INTF..." | ||
|
||
# Wait for interface to become ready | ||
$BIN_DIR/wait_for_interface $INTF | ||
|
||
# Small pause to let the interface stabalize before starting the capture | ||
#sleep 1 | ||
|
||
# Start network capture | ||
$BIN_DIR/capture $MODULE_NAME $INTF | ||
|
||
# Start the grpc server | ||
if [[ ! -z $GRPC && ! $GRPC == "null" ]] | ||
then | ||
GRPC_PORT=$(echo "$GRPC" | jq -r '.port') | ||
if [[ ! -z $GRPC_PORT && ! $GRPC_PORT == "null" ]] | ||
then | ||
echo "gRPC port resolved from config: $GRPC_PORT" | ||
$BIN_DIR/start_grpc "-p $GRPC_PORT" | ||
else | ||
$BIN_DIR/start_grpc | ||
fi | ||
fi | ||
|
||
# Small pause to let all core services stabalize | ||
sleep 3 | ||
|
||
# Start the networking service | ||
#!/bin/bash | ||
|
||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Directory where all binaries will be loaded | ||
BIN_DIR="/testrun/bin" | ||
|
||
# Default interface should be veth0 for all containers | ||
DEFAULT_IFACE=veth0 | ||
|
||
# Create a local user that matches the same as the host | ||
# to be used for correct file ownership for various logs | ||
# HOST_USER mapped in via docker container environemnt variables | ||
useradd $HOST_USER | ||
|
||
# Enable IPv6 for all containers | ||
sysctl net.ipv6.conf.all.disable_ipv6=0 | ||
sysctl -p | ||
|
||
# Read in the config file | ||
CONF_FILE="/testrun/conf/module_config.json" | ||
CONF=`cat $CONF_FILE` | ||
|
||
if [[ -z $CONF ]] | ||
then | ||
echo "No config file present at $CONF_FILE. Exiting startup." | ||
exit 1 | ||
fi | ||
|
||
# Extract the necessary config parameters | ||
MODULE_NAME=$(echo "$CONF" | jq -r '.config.meta.name') | ||
DEFINED_IFACE=$(echo "$CONF" | jq -r '.config.network.interface') | ||
HOST=$(echo "$CONF" | jq -r '.config.network.host') | ||
GRPC=$(echo "$CONF" | jq -r '.config.grpc') | ||
|
||
# Validate the module name is present | ||
if [[ -z "$MODULE_NAME" || "$MODULE_NAME" == "null" ]] | ||
then | ||
echo "No module name present in $CONF_FILE. Exiting startup." | ||
exit 1 | ||
fi | ||
|
||
# Select which interace to use | ||
if [[ -z $DEFINED_IFACE || "$DEFINED_IFACE" == "null" ]] | ||
then | ||
echo "No Interface Defined, defaulting to veth0" | ||
INTF=$DEFAULT_IFACE | ||
else | ||
INTF=$DEFINED_IFACE | ||
fi | ||
|
||
# Setup the PYTHONPATH so all imports work as expected | ||
echo "Setting up PYTHONPATH..." | ||
export PYTHONPATH=$($BIN_DIR/setup_python_path) | ||
echo "PYTHONPATH: $PYTHONPATH" | ||
|
||
echo "Configuring binary files..." | ||
$BIN_DIR/setup_binaries $BIN_DIR | ||
|
||
echo "Starting module $MODULE_NAME on local interface $INTF..." | ||
|
||
# Only non-host containers will have a specific | ||
# interface for capturing | ||
if [[ "$HOST" != "true" ]]; then | ||
|
||
# Wait for interface to become ready | ||
$BIN_DIR/wait_for_interface $INTF | ||
|
||
# Small pause to let the interface stabalize before starting the capture | ||
#sleep 1 | ||
|
||
# Start network capture | ||
$BIN_DIR/capture $MODULE_NAME $INTF | ||
fi | ||
|
||
# Start the grpc server | ||
if [[ ! -z $GRPC && ! $GRPC == "null" ]] | ||
then | ||
GRPC_PORT=$(echo "$GRPC" | jq -r '.port') | ||
if [[ ! -z $GRPC_PORT && ! $GRPC_PORT == "null" ]] | ||
then | ||
echo "gRPC port resolved from config: $GRPC_PORT" | ||
$BIN_DIR/start_grpc "-p $GRPC_PORT" | ||
else | ||
$BIN_DIR/start_grpc | ||
fi | ||
fi | ||
|
||
# Small pause to let all core services stabalize | ||
sleep 3 | ||
|
||
# Start the networking service | ||
$BIN_DIR/start_network_service $MODULE_NAME $INTF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,5 @@ def run(): | |
print('gRPC server starting on port ' + port) | ||
serve(port) | ||
|
||
|
||
if __name__ == '__main__': | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2023 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
echo "Starting Host Service..." | ||
|
||
|
||
# Keep host container running until stopped | ||
while true; do | ||
sleep 3 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"config": { | ||
"meta": { | ||
"name": "host", | ||
"display_name": "Host", | ||
"description": "Used to access host level networking operations" | ||
}, | ||
"network": { | ||
"host": true | ||
}, | ||
"grpc":{ | ||
"port": 5001 | ||
}, | ||
"docker": { | ||
"depends_on": "base", | ||
"mounts": [ | ||
{ | ||
"source": "runtime/network", | ||
"target": "/runtime/network" | ||
} | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.