Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions application/http_shefler_server_service.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=HTTP_Shefler_server_5000
After=network.target

[Service]
User=shefler_1
WorkingDirectory=/opt/http_shefler_server
ExecStart=/usr/bin/python3 /opt/http_shefler_server/shefler_5000.py
Restart=always

[Install]
WantedBy=multi-user.target
20 changes: 20 additions & 0 deletions application/shefler_5000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/get', methods=['GET'])
def get():
return jsonify({"method": "GET", "message": "Get response"}), 200

@app.route('/post', methods=['POST'])
def post():
data = request.get_json()
return jsonify({"method": "POST", "received": data}), 200

@app.route('/put', methods=['PUT'])
def put():
data = request.get_json()
return jsonify({"method": "PUT", "received": data}), 200

if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
10 changes: 10 additions & 0 deletions configs/LinuxA/00-installer-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcp4: no
addresses: [192.168.16.10/24]
gateway4: 192.168.16.1
version: 2
12 changes: 12 additions & 0 deletions configs/LinuxA/http_shefler_server_service.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=HTTP_Shefler_server_5000
After=network.target

[Service]
User=shefler_1
WorkingDirectory=/opt/http_shefler_server
ExecStart=/usr/bin/python3 /opt/http_shefler_server/shefler_5000.py
Restart=always

[Install]
WantedBy=multi-user.target
12 changes: 12 additions & 0 deletions configs/LinuxB/00-installer-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcp4: no
addresses: [192.168.16.1/24]
enp0s9:
dhcp4: no
addresses: [192.168.3.1/24]
version: 2
84 changes: 84 additions & 0 deletions configs/LinuxB/15-ip4tables
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/sh

# This file is part of netfilter-persistent
# (was iptables-persistent)
# Copyright (C) 2009, Simon Richter <sjr@debian.org>
# Copyright (C) 2010, 2014 Jonathan Wiltshire <jmw@debian.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.

set -e

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Source configuration
if [ -f "/etc/default/netfilter-persistent" ]; then
. /etc/default/netfilter-persistent
fi

load_rules()
{
if [ "${IPTABLES_RESTORE_NOFLUSH}x" = "yesx" ]; then
NOFLUSH='--noflush'
else
NOFLUSH=''
fi

#load IPv4 rules
if [ ! -f /etc/iptables/rules.v4 ]; then
echo "Warning: skipping IPv4 (no rules to load)"
else
iptables-restore $NOFLUSH < /etc/iptables/rules.v4
fi
}

save_rules()
{
if [ ! "${IPTABLES_SKIP_SAVE}x" = "yesx" ]; then
touch /etc/iptables/rules.v4
chmod 0640 /etc/iptables/rules.v4
iptables-save > /etc/iptables/rules.v4
fi
}

flush_rules()
{
TABLES=$(iptables-save | sed -E -n 's/^\*//p')
for table in $TABLES
do
CHAINS=$(iptables-save -t $table | sed -E -n 's/^:([A-Z]+).*/\1/p')
for chain in $CHAINS
do
# policy can't be set on user-defined chains
iptables -t $table -P $chain ACCEPT || true
done
iptables -t $table -F
iptables -t $table -Z
iptables -t $table -X
done
}

case "$1" in
start|restart|reload|force-reload)
load_rules
;;
save)
save_rules
;;
stop)
# Why? because if stop is used, the firewall gets flushed for a variable
# amount of time during package upgrades, leaving the machine vulnerable
# It's also not always desirable to flush during purge
echo "Automatic flushing disabled, use \"flush\" instead of \"stop\""
;;
flush)
flush_rules
;;
*)
echo "Usage: $0 {start|restart|reload|force-reload|save|flush}" >&2
exit 1
;;
esac
87 changes: 87 additions & 0 deletions configs/LinuxB/25-ip6tables
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/sh

# This file is part of netfilter-persistent
# (was iptables-persistent)
# Copyright (C) 2009, Simon Richter <sjr@debian.org>
# Copyright (C) 2010, 2014 Jonathan Wiltshire <jmw@debian.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.

set -e

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Exit fast if IPv6 is disabled
test -e /proc/sys/net/ipv6 || exit 0

# Source configuration
if [ -f "/etc/default/netfilter-persistent" ]; then
. /etc/default/netfilter-persistent
fi

load_rules()
{
if [ "${IP6TABLES_RESTORE_NOFLUSH}x" = "yesx" ]; then
NOFLUSH='--noflush'
else
NOFLUSH=''
fi

#load IPv6 rules
if [ ! -f /etc/iptables/rules.v6 ]; then
echo "Warning: skipping IPv6 (no rules to load)"
else
ip6tables-restore $NOFLUSH < /etc/iptables/rules.v6
fi
}

save_rules()
{
if [ ! "${IP6TABLES_SKIP_SAVE}x" = "yesx" ]; then
touch /etc/iptables/rules.v6
ip6tables-save > /etc/iptables/rules.v6
chmod 0640 /etc/iptables/rules.v6
fi
}

flush_rules()
{
TABLES=$(ip6tables-save | sed -E -n 's/^\*//p')
for table in $TABLES
do
CHAINS=$(ip6tables-save -t $table | sed -E -n 's/^:([A-Z]+).*/\1/p')
for chain in $CHAINS
do
# policy can't be set on user-defined chains
ip6tables -t $table -P $chain ACCEPT || true
done
ip6tables -t $table -F
ip6tables -t $table -Z
ip6tables -t $table -X
done
}

case "$1" in
start|restart|reload|force-reload)
load_rules
;;
save)
save_rules
;;
stop)
# Why? because if stop is used, the firewall gets flushed for a variable
# amount of time during package upgrades, leaving the machine vulnerable
# It's also not always desirable to flush during purge
echo "Automatic flushing disabled, use \"flush\" instead of \"stop\""
;;
flush)
flush_rules
;;
*)
echo "Usage: $0 {start|restart|reload|force-reload|save|flush}" >&2
exit 1
;;
esac
68 changes: 68 additions & 0 deletions configs/LinuxB/99-sysctl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#

###################################################################
# Magic system request Key
# 0=disable, 1=enable all, >1 bitmask of sysrq functions
# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html
# for what other values do
#kernel.sysrq=438

10 changes: 10 additions & 0 deletions configs/LinuxC/00-installer-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcp4: no
addresses: [192.168.3.100/24]
gateway4: 192.168.3.1
version: 2
Loading