Skip to content

Instantly share code, notes, and snippets.

View RafPe's full-sized avatar
🎯
Focusing

Rafal Pieniazek RafPe

🎯
Focusing
View GitHub Profile
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
@RafPe
RafPe / ansible_all_ips.yaml
Created March 2, 2016 20:44
Ansible - IP addresses of all hosts in group
---
- hosts: all
vars:
- allips: |
{% set comma = joiner(",") %}
{% for host in groups['mygroup'] -%}
{{ comma() }}{{ hostvars[host]['ansible_eth0']['ipv4']['address']}}
{%- endfor -%}
@RafPe
RafPe / template_lookup.yml
Created April 19, 2016 08:14
Template lookup
---
- name: Testing
hosts: localhost
vars:
- blabla: "Testing123"
- testing: "{{ lookup('template', 'template.j2') }}"
tasks:
- debug: msg="{{testing}}"
@RafPe
RafPe / mysql_ssl_users.sql
Created April 20, 2016 08:31
Create mysql users with SSL
# Creates user which is required to present client side certificate
GRANT ALL PRIVILEGES ON *.* TO 'ssluser'@'%' IDENTIFIED BY 'ssluser' REQUIRE X509;
# Creates user which will use encrypted connection to database
GRANT ALL PRIVILEGES ON *.* TO 'ssluser'@'%' IDENTIFIED BY 'ssluser' REQUIRE SSL;
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
@RafPe
RafPe / Dockerfile_piwik
Last active April 21, 2016 19:36
This is DockerFile for piwik with Apache
FROM tutum/apache-php
RUN rm -rf /app/*
RUN curl -L -O https://builds.piwik.org/latest.tar.gz && \
tar --strip 1 -xzf latest.tar.gz && \
rm latest.tar.gz
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y php5-geoip php5-dev libgeoip-dev && apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN echo "extension=geoip.so" >> /etc/php5/apache2/php.ini
RUN echo "geoip.custom_directory=/app/misc" >> /etc/php5/apache2/php.ini
@RafPe
RafPe / ssl_verify_key_cer.sh
Last active April 28, 2016 20:14
Verify key and certificate with openssl
#!/bin/bash
#==============================================================================
#title : ssl-verify-key-cert.sh
#description : Script verify key and certificate
#authors : RafPe
#date : 20160426
#version : 1.0
#notes :
#==============================================================================
@RafPe
RafPe / docker_composeV2_static.yml
Last active August 24, 2016 15:14
Docker compose V2 static addressing
networks:
widgets:
driver: bridge
ipam:
config:
- subnet: 172.10.0.0/16
gateway: 172.10.5.254
aux_addresses:
haproxy: 172.10.1.2
mariadb: 172.10.1.3
-----BEGIN MY CERTIFICATE-----
-----END MY CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
-----END INTERMEDIATE CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
-----END INTERMEDIATE CERTIFICATE-----
-----BEGIN ROOT CERTIFICATE-----
-----END ROOT CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
@RafPe
RafPe / VTM_ResponseRule_Whitelist_IP_URL.sh
Created May 17, 2016 18:38
This response rule allows for whitelisting URLs for specific IP addresses
$allowedIPs = [ "1.2.0.0/16", "4.3.0.0/16"];
$drop=true;
$FeedsToblock =[
"www.some.com/feed/xyz",
"www.some.com/feed/abc",
"www.some.com/feed/rrr"
];