GithubHelp home page GithubHelp logo

helderco / univ-asr Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 2.0 1.01 MB

Simulation for a small business network and systems. For a class in Network Security and Management.

License: MIT License

Ruby 82.78% Shell 17.22%

univ-asr's Introduction

Simulation for a small business network, using Vagrant and Chef

This was made for a class in Network Security and Management. The idea was to configure a small business network according to a set of requirements. These requirements are in docs/Projecto_Final.pdf (in portuguese). Our solution is represented in the following diagram.

Deployment diagram

To simulate this network and be able to test the configurations as best we could, we used Vagrant and Chef. In VirtualBox, we can simulate the same network using the following setup.

Vagrant diagram

Guide

You need to have Vagrant and VirtualBox installed first.

After that, through the command line, cd into the project's folder, and run:

$ vagrant up

This will start to download the base box from the web, start 7 virtual machines, and apply configurations (provision), which includes downloading all necessary packages (e.g. named, http).

You can also up only one machine:

$ vagrant up dmz

Or all client machines using a regular expression:

$ vagrant up /client*/

Note: The names of these machines are represented in the above diagram.

After doing up for the first time, you can skip provisioning to save time:

$ vagrant up server --no-provision

It only makes sense to run up when the machine is down. To reboot, use reload, or halt to shutdown. There's also suspend and resume. Run vagrant -h for available options.

When you're done, you can destroy it all with:

$ vagrant destroy -f
$ vagrant box remove centos virtualbox

The first command removes all virtual machines from disk. The second, removes the base image where the VMs are based off of.

Using the DNS server externally

During provisioning, the DNS server is automatically updated with the public/external IP attributed to the dmz, so that it's possible to access from outside.

There's a script that checks and updates the IP address in the DNS server, in case it has changed. In any case, the current IP address is printed on screen so you can use it to update the list of nameservers in your host machine or any other computer in your LAN that are trying to access the dmz.

To find your dmz IP:

$ ./dns.sh
Already up to date for IP 192.168.1.131!

If your VM has already been started and that IP changed for some reason (e.g. roaming to another network), you can also restart the interface so that the new IP is updated:

$ ./dns.sh -r
Determining IP information for eth2... done.
Recovering from backup... done.
Updating files... done.
Stopping named: .[  OK  ]
Starting named: [  OK  ]
Your nameserver is at 192.168.0.105

Accessing through SSH

All the VMs can be accessed through the command vagrant ssh [vm]. That access is created automatically by Vagrant through the eth0 interface, with NAT. This access makes it easier o manage each individual VM, but, to simulate what would happen in production, we should access the DMZ and through it, the rest of the network. Since Vagrant also creates the user vagrant with administration privileges, all the VMs make use of this by being the only user that is allowed to ssh to.

To gain root access to the internal server:

$ ssh [email protected]
[email protected]’s password:
[vagrant@dmz ~]$ ssh vagrant@server
vagrant@server’s password:
[vagrant@server ~]# su -
Password:
[root@server ~]#

The password for the users vagrant and root is vagrant.

Shared folder

Vagrant sets up automatically a shared folder at /vagrant which points to the current folder in the host machine, where Vagrantfile is located. This can be useful to transfer files from the VM to the host machine and vice versa.

Bootup order

The order in which the VMs are booted up matters, since there's dependencies between them. The VM dmz has it's own connection to the Internet e so it can be used independently, except for ownCloud which needs LDAP from server.

All other VMs need the router to be able to access the Internet and the dmz for the DNS, including router itself.

This only matters if using vagrant up [vm] though. vagrant up by itself will boot all VMs in the right order.

Problems

If a VM doesn't respond when it's being shutdown or booted up, the following error may appear:

stderr: VBoxManage: error: The object is not ready

If that happens, just keep insisting.

For errors during the provision phase, just keep repeating the provisioning as many times as you want:

$ vagrant provision server

It's built in a way that it tries to make sure the VM is in the intended state.

If a VM can't connect to the Internet it will fail during the provision phase. If the VM has already gone through a completely successful vagrant up, then you can skip this phase with the option --no-provision as seen at the beginning of this guide.

Todo

  • Make a secure connection with TLS between ownCloud and the LDAP server;
  • Use LDAP with FTPS to authenticate:
    • the real estate group (imobiliária) into their userdirs;
    • the web designers to the /var/www dir.

More information (in portuguese)

O enunciado e relatório está em docs.

univ-asr's People

Watchers

Miguel Luís avatar Helder Correia avatar James Cloos avatar  avatar

Forkers

mluis nilpo

univ-asr's Issues

Criar acesso FTPS para upload de ficheiros para os sites

transferência de ficheiros por comunicação segura, para os web designers poderem fazer upload dos ficheiros que desenvolvem

Os vendedores imobiliários devem ter acesso FTPS no servidor web para as suas home (para poder colocar ficheiros em /home/*/public_html), uma vez que estes têm o mod_userdir activo.

Como diz no enunciado:

Também, o web server irá conter as HomePages dos vendedores imobiliários (Rui Pacheco, Nélia Furtado, Paulo Santos) que serão alojadas nas “homes” (/home/user) dos vendedores, para que o público tenha conhecimento das suas vendas

Quanto aos designers, devem ter acesso FTPS à pasta /var/www. Aí está contido tanto a root do http://www.imbcc.pt como do http://imob.imbcc.pt.

Configurar DHCP em todas as redes

No domínio principal, a empresa deseja que exista:
– Os computadores da Filial_1 estarão numa rede diferente dos computadores da sede e obtêm por DHCP as configurações de rede. O servidor de DHCP será um dos PC's da sede.

No subdomínio principal, a empresa deseja que exista:
– as máquinas obterão as suas configurações de rede, via DHCP, por um
servidor DHCP existente na rede do subdomínio

Actualizar DNS com IP público sem provision

Isto está relacionado com o #15

Separar o script que renova o DNS com o IP público actual para poder ser executado em separado. Isto é preciso para poder remover dependência do provision.

Desenhar topologias para usar no relatório

Já temos uma topologia que seria para implementar na vida real:
diagrama-deployment

Falta criar outra para ajudar a compreender como a infraestrutura com o vagrant está criada.

Representar todas as interfaces e seus nomes e ips. Pode-se usar um switch para representar o que o VirtualBox faz internamente (dar nome ao switch igual ao nome da intnet), mas representa-se o router com um PC.

Automatizar testes à infraestrutura

É um bom objectivo ter uma forma de testar a infraestrutura pedida de forma cómoda e reproduzível. Isto permite assegurar que tudo funcionaria num ambiente real e também ajuda a colaboração entre os colegas de grupo permitindo trabalhar sobre a mesma base.

Configurar servidor HTTP

É preciso dois sites principais:

Domínio principal
http://imbcc.pt, que redirecciona para http://www.imbcc.pt

Subdomínio filial 2
http://imob.imbcc.pt

Também, o web server irá conter as HomePages dos vendedores imobiliários (Rui Pacheco, Nélia Furtado, Paulo Santos) que serão alojadas nas “homes” (/home/user) dos vendedores, para que o público tenha conhecimento das suas vendas

Para isto, activa-se o mod_userdir no apache.

Guardar regras iptables de forma permanente

Os comandos do iptables estão a ser executados pela bash em cada provision. As regras assim não sobrevivem um vagrant up --no-provision portanto é preferível guardá-las de forma permanente.

Partilha segura de informação para os funcionários da Filial 1 (ownCloud)

Partilha de informação para os funcionários da Filial_1 poederem aceder de
forma segura. Para a implementação da partilha de ficheiros os técnicos informáticos optaram pela solução ownCloud 5.0 (http://owncloud.org), onde a autenticação é realizada por LDAP e a conexão é estabelecida por um canal seguro. Os funcionários da Filial_1 poderão aceder à cloud pelo seu Desktop (sistema operativo Windows, Macintosh e/ou Linux) e pelo seu mobile.

Não fica claro se os da sede e filial 2 poderão usar isto também, mas não deve dificultar adicionar esse suporte quando for preciso.

Permitir SSH apenas ao utilizador vagrant

administração remota dos Pc's, através de shell e com comunicação segura,
somente para os especialistas informáticos

vagrant é um utilizador criado automaticamente pelo Vagrant e pode ser usado para representar a equipa técnica.

Activar serviço de DNS para todas as redes

Ambos os domínios imbcc.pt e imob.imbcc.pt devem ser resolvidos.

Os próprios endereços devem apontar para o servidor na DMZ, onde está o serviço HTTP.

Hosts

Para os hosts nesses domínios, devem apontar para as máquinas privadas (view internal).

DMZ

servX.imbcc.pt

Sede

server.imbcc.pt
dhcp0XX.imbcc.pt

Filial 1

dhcp1XX.imbcc.pt

Filial 2

server.imob.imbcc.pt
dhcpXX.imob.imbcc.pt

Criar script para exportar configurações em cada máquina para uma pasta

Não vamos obrigar a professora a instalar o Vagrant mas podemos fazer como ela pede e ter as configurações de cada máquina em pastas dedicadas com facilidade.

Com todas as máquinas em up, podemos correr comandos do tipo

vagrant ssh dmz -c "cp /etc/named.conf /vagrant/export/dmz/etc/"

E assim sugiro esta estrutura de pastas para cada VM:

export
├── dmz
│   └── dmz
├── filial1
│   └── client_f1
│   └── relay
├── filial2
│   ├── client_f2
│   └── server2
└── sede
    ├── client
    └── server

Isso pode ser abstraído numa função que apenas precisa da máquina e lista de ficheiros a copiar.

Atenção ao relay. Aí fica apenas a configuração para o DHCP Relay uma vez que o router não é para entrega. O router não é entregue porque na vida real será um aparelho dedicado configurado pelo ISP. Portanto o nosso DHCP Relay seria feito através de uma máquina na filial1, só no ambiente de testes foi aproveitado o router para não ter que criar mais uma VM sem necessidade.

Using TLS with LDAP

OpenLDAP clients and servers are capable of using the Transport Layer Security (TLS) framework to provide integrity and confidentiality protections and to support LDAP authentication using the SASL EXTERNAL mechanism.

Remover dependência de fazer provision

Este issue está relacionado com o #14. Seria interessante não depender de fazer provision para que tudo funcionasse correctamente (excepção óbvia é dmz que precisa actualizar a interface pública no DNS).

O objectivo disto é poder fazer um vagrant up --no-provision em ambiente restrito (e.g. universidade com proxies), depois de ter feito up sem problemas anteriormente (e.g. em casa).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.