Skip to content

Instantly share code, notes, and snippets.

View jhowbhz's full-sized avatar
🦴
Um programador apaixonado pelo que faz

Jonathan Henrique jhowbhz

🦴
Um programador apaixonado pelo que faz
View GitHub Profile
@jhowbhz
jhowbhz / resolve.sh
Last active May 31, 2024 14:40
Ubuntu Network Failure
# Se você está enfrentando erros de DNS, experimente fazer o seguinte
# Erro: ping: google.com.br: Temporary failure in name resolution
# Tente isso
ping -c 4 8.8.8.8
# Se der ok, cheque o status
sudo systemctl status systemd-resolved
# Altere o DNS
@jhowbhz
jhowbhz / laravel-permissions-folder.sh
Created May 17, 2024 05:40
Permissions security laravel php nginx
# Caminho do projeto Laravel
LARAVEL_PATH=/opt/...
# Alterar proprietário e grupo
sudo chown -R www-data:www-data $LARAVEL_PATH
# Permissões para diretórios
find $LARAVEL_PATH -type d -exec chmod 755 {} \;
# Permissões para arquivos
@jhowbhz
jhowbhz / sec-brute-force-attack.sh
Last active May 17, 2024 04:44
Install fail2Ban
# 1. Instalar Fail2Ban
sudo apt install fail2ban
# 2. Configurar Fail2Ban
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
# 2.1 Configure os parametros de acordo com a sua necesidade
[DEFAULT]
bantime = 10m
findtime = 10m
@jhowbhz
jhowbhz / sec-nginx-php.bash
Last active May 17, 2024 05:19
Minimal security changes for PHP Nginx
# 1. Configurações do Nginx
# Restringir Acesso a Arquivos Sensíveis:
# Assegure-se de que arquivos sensíveis, como *.env, *.php (fora do diretório de acesso público), e outros arquivos de configuração não sejam acessíveis via web.
location ~ /\.(?!well-known).* {
deny all;
}
# 2. Desativar Execução de Scripts em Diretórios de Upload ou outros:
@jhowbhz
jhowbhz / clamav.sh
Last active May 16, 2024 23:38
Install clamav ubuntu 22.04
# 1. Adiciona o usuário
groupadd clamav
useradd -g clamav -s /bin/false -c "Clam Antivirus" clamav
# 1.1 Instalar o ClamAV
sudo apt update && sudo apt install clamav clamav-daemon -y
# 2. Configurar o ClamAV
sudo nano /etc/clamav/clamd.conf
@jhowbhz
jhowbhz / install.md
Last active April 9, 2024 18:20
Install PHP 8.3 - FPM Nginx Ubuntu 22.04

Add Ondrej's PPA

sudo add-apt-repository ppa:ondrej/php 
sudo apt update
@jhowbhz
jhowbhz / install.sh
Last active April 9, 2024 17:24
Install docker ubuntu 22.04
sudo apt update && sudo apt install apt-transport-https ca-certificates curl software-properties-common &&
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && apt update -y
sudo apt install docker-ce -y
sudo systemctl status docker
@jhowbhz
jhowbhz / supervisor.sh
Created March 8, 2024 18:38
Supervisor config file
# how to install supervisor
apt install supervisor
# how to create config file supervisor
nano /etc/supervisor/conf.d/laravel-worker.conf
# set text in file, save and restart service
# service supervisor restart
[program:laravel-worker]
@jhowbhz
jhowbhz / find.sh
Created March 7, 2024 02:41
Find big files in linux terminal
find / -type f -size +1G -exec du -h {} + | sort -rh | head -n 1
@jhowbhz
jhowbhz / clear docker
Created March 6, 2024 21:54
Clear all docker overlays
docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
docker volume prune -f
// DOT NOT USE IS COMMAND IN PRODUCTION //
// IS ERASE YOUR FILES! AND VOLUMES! //