Skip to content

Instantly share code, notes, and snippets.

Avatar

Vpnwall Services vpnwall-services

View GitHub Profile
@vpnwall-services
vpnwall-services / fast-delete.md
Created Oct 15, 2020
[Fast Delete] Fast delete big folders #bash #debian #fast #delete #big #folders
View fast-delete.md

Fast delete with rsync

mkdir /tmp/empty
rsync -a --delete /tmp/empty /tmp/big_folder/

And with Perl

@vpnwall-services
vpnwall-services / Enable-xdebug.php
Created Oct 14, 2020
[DEBUG PHP MEMORY] Debug PHP Memory #bash #php #debug #xdebug #memory
View Enable-xdebug.php
#!/bin/bash
apt install php7.4-xdebug
echo "xdebug.trace_enable_trigger = 1" >> /etc/php7.4/mods-available/xdebug.ini
echo "xdebug.trace_format = 1" >> /etc/php7.4/mods-available/xdebug.ini
service php7.4-fpm restart
curl -L https://myurl.local/index.php?XDEBUG_TRACE=1
cat /tmp/trace*
@vpnwall-services
vpnwall-services / grow_xfs_partition.md
Last active Oct 13, 2020
[Grow XFS Partiion] Grow XFS partition #bash #debian #xfs #fdisk #grow #partition
View grow_xfs_partition.md

Umount partition

umount /dev/sdx1

Modify entire disk

fdisk /dev/sdx

Delete actual partition and recreate it (WITHOUT DELETING XFS SIGNATURE !!!)

@vpnwall-services
vpnwall-services / LOG-CENTRALIZATION-101.md
Last active Oct 6, 2020
[Log centralization 101] Log centralization 101 #bash #log #centralization #101
View LOG-CENTRALIZATION-101.md

LOG CENTRALIZATION 101

In apache2 Vhost

ErrorLog "|/etc/apache2/scripts/apache2-error-syslog.sh" customized_logs
CustomLog "|/etc/apache2/scripts/apache2-access-syslog.sh" customized_logs
@vpnwall-services
vpnwall-services / hash-sha-256-password.sh
Created Sep 23, 2020
[Hash sha256 password] hash sha-256 password #bash #hash #sha #sha256 #sha-256 #password
View hash-sha-256-password.sh
echo -n "Enter Password: " && head -1 </dev/stdin | tr -d '\n' | sha256sum | cut -d" " -f1
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 / openssl-101.md
Created Sep 2, 2020
[OPENSSL 101] OPENSSL 101 #openssl #ssl #101
View openssl-101.md

OPENSSL 101

Convert DER to CRT openssl x509 -inform DER -in certificate.cer > certificate.crt

Retrieve CA Certificate openssl x509 -text -noout -in mycertificatefile.crt

@vpnwall-services
vpnwall-services / Mysql-Master-Master-Replication-Repair-101.md
Created Sep 2, 2020
[Mysql Master-Master Replication Repair 101] Mysql master-master replication repair 101 #linux #debian #mariadb #sync #replication #master #master-master #repair #resync
View Mysql-Master-Master-Replication-Repair-101.md

Mysql Master-Master Replication Repair 101

Shut down the MySQL server on the slave. rsync the master to the slave while the master is still live:

rsync -Sa --progress --exclude=mastername* --exclude=master.info --exclude=relay-log.info /db/* rootsync:/db

Stop MySQL on the master briefly and and run rsync again. I rsync twice so that it, hopefully, takes less time the second time when

@vpnwall-services
vpnwall-services / mysql-password-encrypt.sh
Created Sep 2, 2020
[Mysql Encrypt Password] Encrypt a password the same way as Mysql does #linux #python #mysql #encrypt #password
View mysql-password-encrypt.sh
#!/bin/bash
python -c 'from hashlib import sha1; print "*" + sha1(sha1("mypassword").digest()).hexdigest().upper()'
@vpnwall-services
vpnwall-services / Readonly-Symlink.sh
Created Aug 31, 2020
[Readonly Symlink] Readonly Symlink #linux #debian #bash #symlink #readonly
View Readonly-Symlink.sh
You can’t perform that action at this time.