Skip to content

Instantly share code, notes, and snippets.

Avatar

Vpnwall Services vpnwall-services

View GitHub Profile
@vpnwall-services
vpnwall-services / ansible-summary.md
Created Dec 1, 2020
[ANSIBLE SUMMARY] Ansible Summary #ansible #summary #bash #python #devops
View ansible-summary.md

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

View security-101.md

Lynis

lynis audit system

List all user-agents in apache2 logs

sudo awk -F\" '($2 ~ "^GET /"){print $6}' /var/log/apache2/access.log|sort|uniq > ua.log

@vpnwall-services
vpnwall-services / ansible-delete-wildcard.yml
Last active Nov 25, 2020
[Ansible Delete Folders And Files Wildcard] Delete folders and files wildcard method with Ansible #script #yml #ansible #delete #wildcard
View ansible-delete-wildcard.yml
- hosts: all
tasks:
- name: Ansible delete file wildcard
find:
paths: /etc/wild_card/example
patterns: "^he.*.txt"
use_regex: true
register: wildcard_files_to_delete
- name: Ansible remove file wildcard
@vpnwall-services
vpnwall-services / Load-Stress-Tests-101.md
Created Nov 24, 2020
[Load/Stress Tests 101] Load/Stress Tests 101 #load #stress #tests #101 #test
View Load-Stress-Tests-101.md

Load Test RAM

stress-ng --vm-bytes $(awk '/MemFree/{printf "%d\n", $2 * 0.9;}' < /proc/meminfo)k --vm-keep -m 1

@vpnwall-services
vpnwall-services / GREP101.md
Last active Nov 23, 2020
[GREP 101] Grep 101 #grep #101
View GREP101.md

GREP 101

  • Grep minimum six numbers grep -E '[0-9]{6}' file.txt

  • Grep files that does not containt string grep -L "foo" *

  • Find file and grep two values in one grep

@vpnwall-services
vpnwall-services / add-disk-to-lvm.sh
Created Nov 16, 2020
[Add disk to LVM] Add disk to LVM #bash #lvm #resize #add #extend #space #disk
View add-disk-to-lvm.sh
#!/bin/bash
umount /vgmountpoint
pvscan
fdisk /dev/sdb => n => p => * => * => t => 8e => w
pvcreate /dev/sdb1
vgextend VolGroup00 /dev/sdb1
pvscan
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
lvm vgchange -a y
e2fsck -f /dev/VolGroup00/LogVol00
@vpnwall-services
vpnwall-services / rsync-101.md
Last active Nov 13, 2020
[RSYNC 101] rsync 101 #rsync #101 #bash #tree #pdf
View rsync-101.md

RSYNC 101

  • Rsync with a user that need to sudo to access files on remote rsync -avr --rsync-path="sudo rsync" user@there.local ./

  • Rsync several distant folders to local for backup rsync -avr root@xxx.xxx.xxx.xxx:{/etc,/root,/home,/var/www,/opt,/srv} .

  • Rsync files created yesterday

@vpnwall-services
vpnwall-services / wordpress-api-whitelist
Created Nov 10, 2020
[Wordpress API Whitelist] Wordpress API Whitelist #bash #apache2 #htaccess #wordpress #api #whitelist #restriction
View wordpress-api-whitelist
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !=xxx.xxx.xxx.xxx
RewriteCond %{REQUEST_URI} /wp-json/ [NC]
RewriteRule . - [F,L]
@vpnwall-services
vpnwall-services / PDHS.py
Created Nov 2, 2020
[Python Dummy Http Server] Python Dummy Http Server #python #dummy #http #server
View PDHS.py
import SimpleHTTPServer
import SocketServer
PORT = 9999
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("localhost", PORT), Handler)
print "serving at port", PORT
@vpnwall-services
vpnwall-services / salt_adhoc_command_for_tunnel.sh
Created Oct 30, 2020
[Saltstack Execute tunnel for remote access] Saltstack Execute tunnel for remote access #bash #saltstack #ssh #tunnel
View salt_adhoc_command_for_tunnel.sh
#!/bin/bash
salt 'mynode' cmd.run '/usr/bin/autossh -M 0 -o "StrictHostKeyChecking=no" -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -o ExitOnForwardFailure=yes -o "ServerAliveInternal=30" -o ServerAliveCountMax=3 -i /root/.ssh/id_rsa -NR 7999:localhost:22 myremoteuser@remoteserver.public -p 2222 &'
You can’t perform that action at this time.