Skip to content

Instantly share code, notes, and snippets.

View tuxfight3r's full-sized avatar
:octocat:
Working from home

Mohan Balasundaram tuxfight3r

:octocat:
Working from home
View GitHub Profile
@tuxfight3r
tuxfight3r / gist:7f313cffcebae078d362
Created November 28, 2014 18:00
apache mod_proxy ssl vhost with location based access
#Sample apache mod_proxy ssl vhost with location based access
<VirtualHost *:443 *:60443>
ServerName www.nerdplanet.co.uk
ServerAlias nerdplanet.co.uk
DocumentRoot /var/www/vhosts/nerdplanet.co.uk/
#LogLevel debug
CustomLog /var/log/httpd/nerdplanet.co.uk_access_log combined
ErrorLog /var/log/httpd/nerdplanet.co.uk_error_log
SSLEngine on
@tuxfight3r
tuxfight3r / gist:838dbc4b1464615a016c
Created November 28, 2014 18:08
apache vhost url redirection tricks
#Redirect NonSSL to SSL
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#Redirect if the host name not begins with WWW
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.nerdplanet.co.uk$ [NC]
RewriteRule ^(.*)$ https://www.nerdplanet.co.uk$1 [R=301]
@tuxfight3r
tuxfight3r / gist:2767954b71b8e774e086
Last active August 29, 2015 14:10
sync apache configs/ via git and www folders between nodes
########### apache-sync.sh
#!/bin/bash
#Purpose:To update apache configs via git to the rest of the apache servers
#Note: This script should only be run from node01 to keep things consistent
#Date: 11/09/2014
#Author: Mohan
#HOST IPS are read from hosts file in the current dir
. hosts
@tuxfight3r
tuxfight3r / sslserver_notes.txt
Last active February 13, 2022 03:28
openssl tricks
#connect to ssl site
openssl s_client -connect ip:port
#vhost connect
openssl s_client -servername mysite.co.uk -connect mysite.co.uk:443
#Reading CSR
openssl req -noout -text -in uat-mobi.scotrail.co.uk.csr
#Reading certificates
@tuxfight3r
tuxfight3r / create_new_lvm.txt
Last active June 6, 2017 15:43
lvm extend tips
#create new LVM 100% space with single disk
###########################################
[root@nodem01 ~]# pvcreate /dev/sdc1
Physical volume "/dev/sdc1" successfully created
[root@nodem01 ~]# vgcreate DataVG /dev/sdc1
Volume group "DataVG" successfully created
#create a lvm with 100% usage on DataVG
@tuxfight3r
tuxfight3r / gist:593f35f297f8b619a470
Created November 28, 2014 18:43
openssh proxy tricks
METHOD 1: (with nc in localbox)
ssh -D 60002 mohan@10.1.1.20
sftp -o 'ProxyCommand=nc -xlocalhost:60002 %h %p' USER@remotehost.com
METHOD 2: (with nc in remote box)
sftp -o 'ProxyCommand ssh -q -l mohan 10.1.1.20 nc remotehost.com 22' USER@remotehost.com
METHOD 3: (without nc at all)
ssh -L 60002:remotehost.com:22 mohan@10.1.1.20
sftp -o Port=60002 USER@localhost

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tuxfight3r
tuxfight3r / puppet-bootstrap
Last active August 29, 2015 14:11
kickstart post reboot puppet bootstrap script
#!/bin/bash
#
#puppet bootstrap script
#
#chkconfig: 2345 99 99
#description: simple bash script to run puppet after reboot
#Date: 16/12/2014
#Author:Mohan
#Bootstrapping startup process
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active May 4, 2024 16:58
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@tuxfight3r
tuxfight3r / tcp_flags.txt
Last active May 7, 2024 08:40
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)