Browse Source

create cluster

master
zeus 4 years ago
parent
commit
9ffc00788d
  1. 4
      index-lab.adoc
  2. 46
      index-lab.adoc.html
  3. 1801
      index-lab.adoc.pdf
  4. 122
      labs/sec/sec.adoc
  5. 138
      labs/sec/sec.adoc.html
  6. 1465
      labs/sec/sec.adoc.pdf

4
index-lab.adoc

@ -149,6 +149,10 @@ This is the reason why effective controls require the integration with the softw
==== ====
=== http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/sec.adoc.html[Create cluster^]
TIP: This tutorial describes how to create and set up clusters
=== http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html[Scan and network statistics^] === http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html[Scan and network statistics^]
TIP: This tutorial demonstrates some common *nmap* port scanning scenarios and explains the output. TIP: This tutorial demonstrates some common *nmap* port scanning scenarios and explains the output.

46
index-lab.adoc.html

@ -472,16 +472,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</li> </li>
<li><a href="#_security">4. Security</a> <li><a href="#_security">4. Security</a>
<ul class="sectlevel2"> <ul class="sectlevel2">
<li><a href="#_scan_and_network_statistics">4.1. Scan and network statistics</a></li> <li><a href="#_create_cluster">4.1. Create cluster</a></li>
<li><a href="#_network_analysis">4.2. Network analysis</a></li> <li><a href="#_scan_and_network_statistics">4.2. Scan and network statistics</a></li>
<li><a href="#_network_filter">4.3. Network Filter</a> <li><a href="#_network_analysis">4.3. Network analysis</a></li>
<li><a href="#_network_filter">4.4. Network Filter</a>
<ul class="sectlevel3"> <ul class="sectlevel3">
<li><a href="#_traversing_of_tables_and_chains">4.3.1. Traversing of tables and chains</a></li> <li><a href="#_traversing_of_tables_and_chains">4.4.1. Traversing of tables and chains</a></li>
</ul> </ul>
</li> </li>
<li><a href="#_iptables_with_shorewall_three_interface_firewall">4.4. Iptables with shorewall! - Three-Interface Firewall</a></li> <li><a href="#_iptables_with_shorewall_three_interface_firewall">4.5. Iptables with shorewall! - Three-Interface Firewall</a></li>
<li><a href="#_virtual_private_network_vpn">4.5. virtual private network (VPN)</a></li> <li><a href="#_virtual_private_network_vpn">4.6. virtual private network (VPN)</a></li>
<li><a href="#_ssh_tunneling">4.6. SSH Tunneling</a></li> <li><a href="#_ssh_tunneling">4.7. SSH Tunneling</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -697,7 +698,22 @@ How It Works, Apps, Swarm: The Five Principles of Swarm Intelligence
</div> </div>
</div> </div>
<div class="sect2"> <div class="sect2">
<h3 id="_scan_and_network_statistics">4.1. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html" target="_blank" rel="noopener">Scan and network statistics</a></h3> <h3 id="_create_cluster">4.1. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/sec.adoc.html" target="_blank" rel="noopener">Create cluster</a></h3>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="Tip"></i>
</td>
<td class="content">
This tutorial describes how to create and set up clusters
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="_scan_and_network_statistics">4.2. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html" target="_blank" rel="noopener">Scan and network statistics</a></h3>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -712,7 +728,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</div> </div>
</div> </div>
<div class="sect2"> <div class="sect2">
<h3 id="_network_analysis">4.2. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-2_iptables.adoc.html" target="_blank" rel="noopener">Network analysis</a></h3> <h3 id="_network_analysis">4.3. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-2_iptables.adoc.html" target="_blank" rel="noopener">Network analysis</a></h3>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -727,7 +743,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</div> </div>
</div> </div>
<div class="sect2"> <div class="sect2">
<h3 id="_network_filter">4.3. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-3_iptables.adoc.html" target="_blank" rel="noopener">Network Filter</a></h3> <h3 id="_network_filter">4.4. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-3_iptables.adoc.html" target="_blank" rel="noopener">Network Filter</a></h3>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -746,7 +762,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</table> </table>
</div> </div>
<div class="sect3"> <div class="sect3">
<h4 id="_traversing_of_tables_and_chains">4.3.1. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-3a_iptables-flow-chart.adoc.html" target="_blank" rel="noopener">Traversing of tables and chains</a></h4> <h4 id="_traversing_of_tables_and_chains">4.4.1. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-3a_iptables-flow-chart.adoc.html" target="_blank" rel="noopener">Traversing of tables and chains</a></h4>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -767,7 +783,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</div> </div>
</div> </div>
<div class="sect2"> <div class="sect2">
<h3 id="_iptables_with_shorewall_three_interface_firewall">4.4. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-4_iptables.adoc.html" target="_blank" rel="noopener">Iptables with shorewall! - Three-Interface Firewall</a></h3> <h3 id="_iptables_with_shorewall_three_interface_firewall">4.5. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-4_iptables.adoc.html" target="_blank" rel="noopener">Iptables with shorewall! - Three-Interface Firewall</a></h3>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -784,7 +800,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</div> </div>
</div> </div>
<div class="sect2"> <div class="sect2">
<h3 id="_virtual_private_network_vpn">4.5. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-5_iptables.adoc.html" target="_blank" rel="noopener">virtual private network (VPN)</a></h3> <h3 id="_virtual_private_network_vpn">4.6. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-5_iptables.adoc.html" target="_blank" rel="noopener">virtual private network (VPN)</a></h3>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -801,7 +817,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</div> </div>
</div> </div>
<div class="sect2"> <div class="sect2">
<h3 id="_ssh_tunneling">4.6. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-6_iptables.adoc.html" target="_blank" rel="noopener">SSH Tunneling</a></h3> <h3 id="_ssh_tunneling">4.7. <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-6_iptables.adoc.html" target="_blank" rel="noopener">SSH Tunneling</a></h3>
<div class="admonitionblock tip"> <div class="admonitionblock tip">
<table> <table>
<tr> <tr>
@ -822,7 +838,7 @@ This tutorial demonstrates some common <strong>nmap</strong> port scanning scena
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2020-10-28 20:27:28 UTC Last updated 2020-10-29 13:37:00 UTC
</div> </div>
</div> </div>
</body> </body>

1801
index-lab.adoc.pdf

File diff suppressed because it is too large

122
labs/sec/sec.adoc

@ -12,9 +12,129 @@ Apostolos rootApostolos@swarmlab.io
:sectnums: :sectnums:
{empty} + {empty} +
== Install swarmlab-sec (Home PC)
- Install docker + - Install docker +
http://docs.swarmlab.io/Howtos/docker/install.adoc.html[^] http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html[^]
- Clone repo https://git.swarmlab.io:3000/swarmlab/swarmlab-sec[^] +
== Usage (swarmlab-sec)
- Open a console
- cd to swarmlab-sec
- Create a directory
```
cd <dir>
../install/usr/share/swarmlab.io/sec/swarmlab-sec
create create project (swarmlab-sec create)
up start swarmlab-sec (swarmlab-sec up size=10)
scale resize swarmlab-sec (swarmlab-sec scale size=30)
reload rebuild image (swarmlab-sec reload size=15)
login login swarmlab-sec (swarmlab-sec login)
exec execute command (swarmlab-sec exec [SHELL COMMAND])
down stop swarmlab-sec (swarmlab-sec down)
clean clean project (swarmlab-sec clean)
list show instances (swarmlab-sec swarmlab-sec list)
help show help (swarmlab-sec help)
```
[[cheat-swarmlab-create]]
== Create swarmlab project
```
mkdir myproject
cd myproject
../install/usr/share/swarmlab.io/sec/swarmlab-sec create
```
.Relevant files:
```
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
├── docker-compose.yml # Container orchestration
```
[[cheat-swarmlab-up]]
== Spin up the swarmlab cluster
```
cd myproject
../install/usr/share/swarmlab.io/sec/swarmlab-sec up size=5
```
.We built a high-performing, scalable infrastructure
image:./swarmlab-network.png[alt="Swarmlab"] +
[[cheat-swarmlab-up1]]
== Login to the swarmlab cluster
```
cd myproject
../install/usr/share/swarmlab.io/sec/swarmlab-sec login
```
[NOTE]
====
When you are inside a container
[source,bash]
----
ssh docker@<IP>
----
User password: docker
sudo password: docker
====
CAUTION: If you don't have the *<IP>* address - you can use the http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html["Scan and network statistics"^] tools.
[[cheat-swarmlab-scale]]
== Scale cluster in real-time
As the cluster running, without having to close the session, open a different terminal and go back to the project directory.
```
cd myproject
../install/usr/share/swarmlab.io/sec/swarmlab-sec scale size=10
```
[[cheat-swarmlab-down]]
== shutdown swarmlab-sec cluster
```
cd myproject
../install/usr/share/swarmlab.io/sec/swarmlab-sec down
```
:hardbreaks:
{empty} +
{empty} +
{empty}
:!hardbreaks:
'''

138
labs/sec/sec.adoc.html

@ -449,8 +449,8 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<div id="toc" class="toc2"> <div id="toc" class="toc2">
<div id="toctitle">Πίνακας περιεχομένων</div> <div id="toctitle">Πίνακας περιεχομένων</div>
<ul class="sectlevel1"> <ul class="sectlevel1">
<li><a href="#cheat-Docker">1. Install swarmlab-sec (Home PC)</a></li> <li><a href="#_install_swarmlab_sec_home_pc">1. Install swarmlab-sec (Home PC)</a></li>
<li><a href="#cheat-swarmlab-sec">2. Usage (swarmlab-sec)</a></li> <li><a href="#_usage_swarmlab_sec">2. Usage (swarmlab-sec)</a></li>
<li><a href="#cheat-swarmlab-create">3. Create swarmlab project</a></li> <li><a href="#cheat-swarmlab-create">3. Create swarmlab project</a></li>
<li><a href="#cheat-swarmlab-up">4. Spin up the swarmlab cluster</a></li> <li><a href="#cheat-swarmlab-up">4. Spin up the swarmlab cluster</a></li>
<li><a href="#cheat-swarmlab-up1">5. Login to the swarmlab cluster</a></li> <li><a href="#cheat-swarmlab-up1">5. Login to the swarmlab cluster</a></li>
@ -468,55 +468,23 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</div> </div>
</div> </div>
<div class="sect1"> <div class="sect1">
<h2 id="cheat-Docker">1. Install swarmlab-sec (Home PC)</h2> <h2 id="_install_swarmlab_sec_home_pc">1. Install swarmlab-sec (Home PC)</h2>
<div class="sectionbody"> <div class="sectionbody">
<div class="ulist"> <div class="ulist">
<ul> <ul>
<li> <li>
<p>Install docker<br> <p>Install docker<br>
<a href="http://docs.swarmlab.io/Howtos/docker/install.adoc.html" class="bare" target="_blank" rel="noopener">http://docs.swarmlab.io/Howtos/docker/install.adoc.html</a></p> <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html" class="bare" target="_blank" rel="noopener">http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/docker/install.adoc.html</a></p>
</li> </li>
<li> <li>
<p>Clone repo <a href="https://git.swarmlab.io:3000/swarmlab/swarmlab-sec" class="bare">https://git.swarmlab.io:3000/swarmlab/swarmlab-sec</a><br> <p>Clone repo <a href="https://git.swarmlab.io:3000/swarmlab/swarmlab-sec" class="bare" target="_blank" rel="noopener">https://git.swarmlab.io:3000/swarmlab/swarmlab-sec</a><br></p>
HowTo: See <a href="http://docs.swarmlab.io/Howtos/git/use-git.adoc.html" class="bare">http://docs.swarmlab.io/Howtos/git/use-git.adoc.html</a></p>
</li> </li>
</ul> </ul>
</div> </div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">INSTALL</div>
<div class="paragraph">
<p>See INSTALL.md for Installation Instruction</p>
</div>
</td>
</tr>
</table>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">lab</div>
<div class="paragraph">
<p>In Lab&#8217;s everything is ready!
Goto "create"</p>
</div>
</td>
</tr>
</table>
</div>
</div> </div>
</div> </div>
<div class="sect1"> <div class="sect1">
<h2 id="cheat-swarmlab-sec">2. Usage (swarmlab-sec)</h2> <h2 id="_usage_swarmlab_sec">2. Usage (swarmlab-sec)</h2>
<div class="sectionbody"> <div class="sectionbody">
<div class="ulist"> <div class="ulist">
<ul> <ul>
@ -524,14 +492,18 @@ Goto "create"</p>
<p>Open a console</p> <p>Open a console</p>
</li> </li>
<li> <li>
<p>cd to swarmlab-sec</p>
</li>
<li>
<p>Create a directory</p> <p>Create a directory</p>
</li> </li>
</ul> </ul>
</div> </div>
<div class="listingblock"> <div class="listingblock">
<div class="content"> <div class="content">
<pre class="highlight"><code>cd dir <pre class="highlight"><code>cd &lt;dir&gt;
swarmlab-sec &lt;tab&gt;&lt;tab&gt;
../install/usr/share/swarmlab.io/sec/swarmlab-sec
create create project (swarmlab-sec create) create create project (swarmlab-sec create)
up start swarmlab-sec (swarmlab-sec up size=10) up start swarmlab-sec (swarmlab-sec up size=10)
@ -545,20 +517,6 @@ list show instances (swarmlab-sec swarmlab-sec list)
help show help (swarmlab-sec help)</code></pre> help show help (swarmlab-sec help)</code></pre>
</div> </div>
</div> </div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>Using the tab key to automatically complete unambiguous commands and paths in Bash</p>
</div>
</td>
</tr>
</table>
</div>
</div> </div>
</div> </div>
<div class="sect1"> <div class="sect1">
@ -568,7 +526,7 @@ help show help (swarmlab-sec help)</code></pre>
<div class="content"> <div class="content">
<pre class="highlight"><code>mkdir myproject <pre class="highlight"><code>mkdir myproject
cd myproject cd myproject
swarmlab-sec create</code></pre> ../install/usr/share/swarmlab.io/sec/swarmlab-sec create</code></pre>
</div> </div>
</div> </div>
<div class="listingblock"> <div class="listingblock">
@ -592,7 +550,7 @@ swarmlab-sec create</code></pre>
<div class="listingblock"> <div class="listingblock">
<div class="content"> <div class="content">
<pre class="highlight"><code>cd myproject <pre class="highlight"><code>cd myproject
swarmlab-sec up size=5</code></pre> ../install/usr/share/swarmlab.io/sec/swarmlab-sec up size=5</code></pre>
</div> </div>
</div> </div>
<div class="paragraph"> <div class="paragraph">
@ -607,9 +565,46 @@ swarmlab-sec up size=5</code></pre>
<div class="listingblock"> <div class="listingblock">
<div class="content"> <div class="content">
<pre class="highlight"><code>cd myproject <pre class="highlight"><code>cd myproject
swarmlab-sec login</code></pre> ../install/usr/share/swarmlab.io/sec/swarmlab-sec login</code></pre>
</div> </div>
</div> </div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>When you are inside a container</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash">ssh docker@&lt;IP&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>User password: docker</p>
</div>
<div class="paragraph">
<p>sudo password: docker</p>
</div>
</td>
</tr>
</table>
</div>
<div class="admonitionblock caution">
<table>
<tr>
<td class="icon">
<i class="fa icon-caution" title="Caution"></i>
</td>
<td class="content">
If you don&#8217;t have the <strong>&lt;IP&gt;</strong> address - you can use the <a href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/sec/ex-1_iptables.adoc.html" target="_blank" rel="noopener">"Scan and network statistics"</a> tools.
</td>
</tr>
</table>
</div>
</div> </div>
</div> </div>
<div class="sect1"> <div class="sect1">
@ -621,7 +616,7 @@ swarmlab-sec login</code></pre>
<div class="listingblock"> <div class="listingblock">
<div class="content"> <div class="content">
<pre class="highlight"><code>cd myproject <pre class="highlight"><code>cd myproject
swarmlab-sec scale size=10</code></pre> ../install/usr/share/swarmlab.io/sec/swarmlab-sec scale size=10</code></pre>
</div> </div>
</div> </div>
</div> </div>
@ -632,7 +627,7 @@ swarmlab-sec scale size=10</code></pre>
<div class="listingblock"> <div class="listingblock">
<div class="content"> <div class="content">
<pre class="highlight"><code>cd myproject <pre class="highlight"><code>cd myproject
swarmlab-sec down</code></pre> ../install/usr/share/swarmlab.io/sec/swarmlab-sec down</code></pre>
</div> </div>
</div> </div>
<div class="paragraph"> <div class="paragraph">
@ -641,35 +636,12 @@ swarmlab-sec down</code></pre>
</p> </p>
</div> </div>
<hr> <hr>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">Reminder</div>
<div class="paragraph">
<p>Caminante, no hay camino,<br>
se hace camino al andar.</p>
</div>
<div class="paragraph">
<p>Wanderer, there is no path,<br>
the path is made by walking.</p>
</div>
<div class="paragraph">
<p><strong>Antonio Machado</strong> Campos de Castilla</p>
</div>
</td>
</tr>
</table>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id="footer"> <div id="footer">
<div id="footer-text"> <div id="footer-text">
Last updated 2020-10-13 10:16:40 UTC Last updated 2020-10-29 13:27:08 UTC
</div> </div>
</div> </div>
</body> </body>

1465
labs/sec/sec.adoc.pdf

File diff suppressed because it is too large
Loading…
Cancel
Save