-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tarefa/firewall (EticaAI/aguia-pescadora#34): criado firewall-debug.y…
…ml para aplicar NMAP de localhost e sugerido sites gratuitos que podem permitir escanear de IPs externos
- Loading branch information
Showing
3 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,49 @@ | ||
# firewall | ||
|
||
> **:warning: Cuidado ao usar esta tarefa diretamente e/ou em produção em especial sem especificar os hosts :warning:** | ||
> **:warning: Use `--check` (modo do Ansible testar sem executar) mesmo que você | ||
saiba o que está fazendo** | ||
|
||
> :green_heart: `firewall.yml`, para proteger usuários, não irá bloquear acesso | ||
a porta 22 SSH por padrão (porém irá limitar brute forces). Então _na pior das | ||
hipóteses_ poderá abrir porta 22 que não estava bloqueada antes e/ou bloquear | ||
outras portas mas não vai trancar um usuário de acessar o próprio servidor. | ||
|
||
```bash | ||
# Caso esteja no diretório tarefa/firewall/, use: | ||
ansible-playbook -i hosts firewall.yml --check | ||
ansible-playbook -i hosts firewall.yml | ||
|
||
# Do contrário, use o caminho completo | ||
ansible-playbook -i inventory/1-node-example/inventory.ini tarefa/firewall/firewall.yml --check | ||
ansible-playbook -i inventory/1-node-example/inventory.ini tarefa/firewall/firewall.yml | ||
``` | ||
|
||
## Testar antes de aplicar | ||
## Debug | ||
|
||
### Acessando maquina remota | ||
|
||
```bash | ||
ssh [email protected] | ||
sudo ufw status verbose | ||
``` | ||
|
||
### Escanear portas com NMAP | ||
|
||
```bash | ||
# Escaneia hosts remotos com programa NMAP instalado localmente (scan rápido) | ||
ansible-playbook -i hosts firewall-debug.yml | ||
``` | ||
|
||
### Escanear usando serviços gratúitos externos | ||
|
||
Alguns sites podem permitir que você escaneie de um IP que não deveria acessar | ||
portas de seu servidor. Note que maioria dos hosts gratuitos não permite | ||
escaneamento completo. | ||
|
||
_TODO: considerar https://github.com/ansible/ansible/issues/45604 (fititnt, 2019-07-21 05:07 BRT)_ | ||
- <http://www.t1shopper.com/tools/port-scan/> | ||
- <https://pentest-tools.com/network-vulnerability-scanning/tcp-port-scanner-online-nmap> | ||
- <http://www.ipv6scanner.com/cgi-bin/main.py> | ||
- <https://hackertarget.com/nmap-online-port-scanner/> | ||
|
||
# Licença | ||
[![Domínio Público](../../img/public-domain.png)](UNLICENSE) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
# ---------------------------------------------------------------------------- # | ||
# LICENSE: Public Domain <https://unlicense.org/> # | ||
# # | ||
# Work dedicated to the public domain. This file (whole or parts) can # | ||
# be used without needing to quote from previous source. You can relicense. # | ||
# -----------------------------------------------------------------------------# | ||
|
||
- hosts: all | ||
gather_facts: no | ||
tasks: | ||
|
||
## [localhost] nmap {{ inventory_hostname }} ___________________________________ | ||
- name: "[localhost] nmap {{ inventory_hostname }}" | ||
shell: "nmap {{ inventory_hostname }}" | ||
delegate_to: localhost | ||
register: localhost_nmap | ||
|
||
- name: "ufw status verbose print (after)" | ||
debug: var=localhost_nmap.stdout_lines | ||
|
||
## Recomend remote scanners ___________________________________ | ||
- name: "[remote hosts] try NMAP from free scanners to {{ inventory_hostname }}" | ||
debug: | ||
msg: "http://www.t1shopper.com/tools/port-scan/ , https://pentest-tools.com/network-vulnerability-scanning/tcp-port-scanner-online-nmap, http://www.ipv6scanner.com/cgi-bin/main.py, https://hackertarget.com/nmap-online-port-scanner/" | ||
#when: "1 = 1" | ||
|
||
## TODO: implementar debug da maquina local usando nmap (fititnt, 2019-07-21 06:29 BRT) | ||
## TODO: implementar debug de maquina remota apontando para alvo (fititnt, 2019-07-21 06:29 BRT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters