diff --git a/README.md b/README.md index 2cd3a31..8656660 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,87 @@ -SEC SwarmLab.io -==================== +# hybrid-sec ! -Orchestrate a Swarmlab SEC cluster: -+ Using Docker Compose to replicate production environment on single Docker host +## LabInstance sec -# Single-host with Docker Compose +![alt text](images/swarmlab-network.png "") -See INSTALL -Relevant files: +## Quickstart +This is a quickstart guide of howto use this *LabInstance to deploy Linux sec systems* + +### HowTo use it + + +### Default Configuration + +- Working Directory + +> /project + +- Default user + +> docker + +- Default password + +> docker + +- Default password4root + +> pass + + +#### Find lab workers + + +> ifconfig +> +> nmap -sP 172.130.0.0/24 +> +> or +> +> /project/bin/swarmlab-nmap + + +#### connect to workers + +```bash + ssh docker@[IP] ``` -Project -├── Dockerfile # Image specification -├── project # Sample program source code -│ └── hello_world.c -├── ssh # keys for accessing -│ ├── id_rsa # (could generate your own) -│ └── id_rsa.pub -├── .env # General configuration -├── docker-compose.yml # Container orchestration -└── swarmlab-mpi # Commands wrapper ultility + + +#### Create hosts file + + +```bash +/project/bin/swarmlab-nmap > /project/hosts ``` + + +--- +**NOTE:** copy files to all clients + +```bash +while read -r line; + do + scp /project/file docker@$line:/some_dir/file +done < /project/hosts +``` +--- + + + +--- +**MORE INFO** + +See + +- [sec1](http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html){:target="_blank"} +- http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-2_iptables.adoc.html +- http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-3_iptables.adoc.html +- http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-3a_iptables-flow-chart.adoc.html +--- + diff --git a/images/swarmlab-network.png b/images/swarmlab-network.png new file mode 100644 index 0000000..8a34610 Binary files /dev/null and b/images/swarmlab-network.png differ diff --git a/install/usr/share/swarmlab.io/sec/project/bin/swarmlab-nmap b/install/usr/share/swarmlab.io/sec/project/bin/swarmlab-nmap new file mode 100755 index 0000000..5f54ecf --- /dev/null +++ b/install/usr/share/swarmlab.io/sec/project/bin/swarmlab-nmap @@ -0,0 +1,6 @@ +#/bin/sh + +#ip=`nslookup hybrid-mpi_master_1.hybrid-mpi_hybrid-mpi | grep Addr | cut -d':' -f2 | grep -v 127.0.` +ip=`nslookup $NODENAME | grep Addr | cut -d':' -f2 | grep -v 127.0.` +nmap -sn -oG - $ip/24 | grep Up | grep $NODENETWORK | cut -d ' ' -f 2 + diff --git a/install/usr/share/swarmlab.io/sec/swarmlab-sec b/install/usr/share/swarmlab.io/sec/swarmlab-sec index ecf67bd..6e7b16d 100755 --- a/install/usr/share/swarmlab.io/sec/swarmlab-sec +++ b/install/usr/share/swarmlab.io/sec/swarmlab-sec @@ -36,6 +36,8 @@ IMAGE_origin="ubuntu:18.04" bootstrap="sec_bootstrap" hostnames="auto_update_hosts" hostnames_get="get_hosts" +NODENAME=${HYBRID_NETWORK}_master_1.${HYBRID_NETWORK}_${HYBRID_NETWORK} +NODENETWORK=${HYBRID_NETWORK} # shellcheck disable=SC1091 #. ./.env @@ -305,6 +307,7 @@ fi /bin/mkdir -p $Wdir/project +/bin/cp -rf $DIR/project/bin $Wdir/project /bin/cp -f $DIR/project/hello_world.sh $Wdir/project /bin/cp -f $DIR/$bootstrap $Wdir/$bootstrap /bin/cp -f $DIR/$hostnames $Wdir/$hostnames @@ -327,6 +330,9 @@ services: master: image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME privileged: true + environment: + - NODENAME=${NODENAME} + - NODENETWORK=${NODENETWORK} cap_add: - NET_ADMIN user: root @@ -342,6 +348,9 @@ services: worker: image: $REGISTRY_ADDR:$REGISTRY_PORT/$IMAGE_NAME privileged: true + environment: + - NODENAME=${NODENAME} + - NODENETWORK=${NODENETWORK} cap_add: - NET_ADMIN user: root