Skip to content

Instantly share code, notes, and snippets.

View mafiuss's full-sized avatar
:octocat:
AppSec & Cloud Protection

Benigno Gutierrez mafiuss

:octocat:
AppSec & Cloud Protection
View GitHub Profile
@mafiuss
mafiuss / gist:d47b9520e4d565cd702c
Created June 27, 2014 19:51
Install mongodb in Debian 7
# followed instructons in http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/
# experienced issues detailed in https://groups.google.com/forum/#!topic/mongodb-user/qA6VSKuQIvc
# so Iused the init.d/mongod script found in https://github.com/mongodb/mongo/blob/master/debian/init.d
var fs = require('fs');
var file = __dirname + '/test.json';
fs.readFile(file, 'utf8', function (err, data) {
if (err) {
console.log('Error: ' + err);
return;
}
data = JSON.parse(data);
@mafiuss
mafiuss / gist:00548ceb50ac8e6008ad
Last active August 29, 2015 14:06
Node installation in Debian 7
$(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p')
fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p') make -j$(($(nproc)+1)) install
dpkg -i node_*_amd64.deb
@mafiuss
mafiuss / gist:e14a50f3d68c0c73576d
Last active September 23, 2015 00:28
modsecurity installation in Debian 7
# as root run
apt-get update
apt-get install libxm
apt-get install libxml2
apt-get install libxml2-dev libxml2-utils
apt-get install libaprutil1 libaprutil1-dev
# if no apache 2 present install
# apt-get install apache2
apt-get install libapache-mod-security
a2enmod headers
# BASH function to get the result
# of a ^ b when a, b are in the
# following hexadecimal string
# form: AF396463D8705 ...
# Obtained from here:
# http://www.codeproject.com/Tips/470308/XOR-Hex-Strings-in-Linux-Shell-Script
# Author is Sanjay1982 (see http://www.codeproject.com/Members/Sanjay1982)
# Usage:
### Keybase proof
I hereby claim:
* I am mafiuss on github.
* I am benigno (https://keybase.io/benigno) on keybase.
* I have a public key ASD-7DHKddgYtIsGI9uRB6DOQMbDKIEbog9gTh1EC2fZ-Ao
To claim this, I am signing this object:
@mafiuss
mafiuss / gist:5dd95796549718af9422038fb95eedf6
Created January 18, 2019 20:18
Key and certificate for localhost
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
@mafiuss
mafiuss / CSR
Created January 18, 2019 20:25
Certificate Signing Request
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
C=MX
ST=Jalisco
L=GDL
@mafiuss
mafiuss / v3.ext
Created January 18, 2019 20:28
X509 v3
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
@mafiuss
mafiuss / localhostsslkey
Created January 18, 2019 20:34
private key using openssl csr.cnf
openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config <( cat server.csr.cnf )