Skip to content

Instantly share code, notes, and snippets.

View rafaelfoster's full-sized avatar

Rafael Foster rafaelfoster

View GitHub Profile
@rafaelfoster
rafaelfoster / 01-install_google_2factor.sh
Last active January 4, 2016 20:39
Linux - PAM Google Two Factor Module
# RHEL based
yum install gcc make pam-devel
# Debian Based
apt-get install build-essential make libpam0g-dev libpam0g; LDFLAGS="-lpam"
version=1.0
mkdir ${HOME}/tmp
cd ${HOME}/tmp
@rafaelfoster
rafaelfoster / rescan.sh
Last active November 26, 2024 19:59 — forked from skarllot/rescan.sh
Rescan the devices (can detect new space when disk is resized OR new devices that were attached)
# Reference: http://blog.gurudelleccelsopicco.org/2009/09/online-lun-expansion-and-partition-resizing-without-reboot-under-linux/
echo 1 > /sys/block/[DEVICE]/device/rescan
# DETECT IF NEW DISKS ARE ATTACHED TO THE HOST
# Reference: http://www.cyberciti.biz/tips/vmware-add-a-new-hard-disk-without-rebooting-guest.html
ls /sys/class/scsi_host
@rafaelfoster
rafaelfoster / bash_trics.sh
Last active September 11, 2019 14:27
Some bash Trics
# Enable the PageUp and PageDown to search history commands
$EDITOR /etc/inputrc
"\e[5~": history-search-backward
"\e[6~": history-search-forward
# Enable the autocomplete using case INsentitive
echo 'set show-all-if-ambiguous on' >> ~/.inputrc
echo 'set completion-ignore-case on' >> ~/.inputrc
@rafaelfoster
rafaelfoster / gitlab_selinux.sh
Last active February 28, 2025 05:56
Gitlab SELinux Configs
# The lines bellow set the Gitlab to work with SELinux
# As the Documentation Says: DO NOT DISABLE SELinux, just adjust it!
# Tips taken from: https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/README.md
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_relay on
setsebool -P httpd_enable_homedirs on
setsebool -P httpd_read_user_content on
semanage fcontext -a -t user_home_dir_t '/home/git(/.*)?'
semanage fcontext -a -t ssh_home_t '/home/git/.ssh(/.*)?'
@rafaelfoster
rafaelfoster / iptables_rules.sh
Created February 25, 2014 16:19
Some iptables rules.
# This rule, block one IP for 5 minutes, that is trying to connect to SSH port more than 3 times.
# ideal to block Brute Force Attacks
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 300 --hitcount 3 -j DROP
@rafaelfoster
rafaelfoster / repo_get_deps.sh
Created March 18, 2014 16:13
Command line to install dependences from a package
PACKAGE=awstats
# RedHat Like
yum deplist $PACKAGE | grep provider | awk '{print $2}' | sort | uniq | grep -v $PACKAGE | sed ':a;N;$!ba;s/\n/ /g' | xargs yum -y install
# Debian like
apt-get build-dep $PACKAGE
#!/bin/bash
HTTPADDR=http://acraiz.icpbrasil.gov.br/credenciadas/CertificadosAC-ICP-Brasil/ACcompactado.zip
DEST=/etc/ssl/certs/icp-brasil
mkdir -p ${DEST}
cd ${DEST}
rm -f *.crt
rm -f *.zip
@rafaelfoster
rafaelfoster / function_users.php
Last active August 29, 2015 13:59
OCS Inventory NG | OCS Reports
<?php
if ($_SESSION['OCS']['cnx_origine'] == "LOCAL"){
$name_field[]="PASSWORD";
$type_field[]=4; // Changed from '0' to '4' to mask the input field
$tab_name[]=$l->g(217).":";
$value_field[]=$protectedPost['PASSWORD'];
}
<VirtualHost *:80>
ServerName git.domain.com
# Point this to your public folder of teambox
DocumentRoot /home/gitlab/gitlab
RewriteEngine On
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:8080
@rafaelfoster
rafaelfoster / gitlab_https.conf
Created April 28, 2014 13:29
Gitlab configuration to enable HTTPS
# Changes in apache
<VirtualHost *:443>
ServerName git.server.com.br
ServerSignature Off
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key