Skip to content
Extraits de code Groupes Projets
Valider 41142925 rédigé par François De Keersmaeker's avatar François De Keersmaeker
Parcourir les fichiers

Decoupled firewall from translator

parent bfe8fa2d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# Sample profile for the TP-Link smart plug.
---
device-info:
name: tplink-plug
mac: 50:c7:bf:ed:0a:54
ipv4: 192.168.1.135
network: wireless
single-policies:
### LAN ###
## TCP with phone
lan-tcp-to-phone:
protocols:
tcp:
src-port: 9999
ipv4:
src: self
dst: 192.168.1.222
bidirectional: true
## UDP with phone
lan-udp-to-phone:
protocols:
udp:
src-port: 9999
ipv4:
src: self
dst: 192.168.1.222
bidirectional: true
## DNS for domain name use1-api.tplinkra.com
dns-query-tplinkapi:
protocols:
dns:
qtype: A
domain-name: use1-api.tplinkra.com
udp:
dst-port: 53
ipv4:
src: self
dst: gateway
bidirectional: true
## DNS for domain name n-devs.tplinkcloud.com
dns-query-tplinkcloud:
protocols:
dns:
qtype: A
domain-name: n-devs.tplinkcloud.com
udp:
dst-port: 53
ipv4:
src: self
dst: gateway
bidirectional: true
### WAN ###
## HTTPS with domain use1-api.tplinkra.com
wan-https-to-domain-tplinkapi:
protocols:
tcp:
dst-port: 443
ipv4:
src: self
dst: use1-api.tplinkra.com
bidirectional: true
## HTTPS with domain n-devs.tplinkcloud.com
wan-https-to-domain-tplinkcloud:
protocols:
tcp:
dst-port: 443
ipv4:
src: self
dst: n-devs.tplinkcloud.com
bidirectional: true
...
\ No newline at end of file
#!/bin/bash
## CONSTANTS
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # This script's path
DEVICES_DIR="$SCRIPT_DIR/devices"
TRANSLATOR_PATH="$SCRIPT_DIR/../../src/translator/translator.py"
# Ensure globbing expands to an empty list if no matches are found
shopt -s nullglob
# Loop over devices
NFQ_BASE_ID=0
for DEVICE in "$DEVICES_DIR"/*/; do
python3 "$TRANSLATOR_PATH" "$DEVICE"profile.yaml $NFQ_BASE_ID
((NFQ_BASE_ID=NFQ_BASE_ID+100))
done
Fichier déplacé
...@@ -11,7 +11,7 @@ VAGRANTFILE_API_VERSION = "2" ...@@ -11,7 +11,7 @@ VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# https://vagrantcloud.com/ubuntu # https://vagrantcloud.com/ubuntu
config.vm.box = "ubuntu/jammy64" # Ubuntu 22.04 config.vm.box = "ubuntu/jammy64" # Ubuntu 22.04
config.vm.hostname = "firewall-test" config.vm.hostname = "native-build"
config.vm.network "private_network", type: "dhcp", name: "vboxnet0" config.vm.network "private_network", type: "dhcp", name: "vboxnet0"
config.vm.provider "virtualbox" do |vb| config.vm.provider "virtualbox" do |vb|
...@@ -32,7 +32,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| ...@@ -32,7 +32,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", inline: <<-SHELL config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update sudo apt-get update
sudo apt-get upgrade -y sudo apt-get upgrade -y
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake net-tools tshark nftables libnetfilter-queue-dev libnetfilter-log-dev python3-pip sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake net-tools tshark nftables libnetfilter-queue-dev libnetfilter-log-dev
sudo pip3 install scapy sudo pip3 install scapy
SHELL SHELL
......
Fichier déplacé
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter