This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. | |
# Will include all hosts the playbook is run on. | |
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html | |
- name: "Build hosts file" | |
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present | |
when: hostvars[item].ansible_default_ipv4.address is defined | |
with_items: groups['all'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example -1 | |
===================== | |
input { | |
file { | |
path => [ "/usr/local/var/log/suricata/eve.json", "/var/log/ulogd.json" ] | |
codec => json | |
type => "json-log" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Following on from other Gists I have posted, this one shows a neat way of using Includes to centralise general blocking rules for Bad Bots, creepy crawlers and irritating IPs | |
see the full post at http://www.blue-bag.com/blog/apache-better-blocking-common-rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
align multiple layers to the center of an image in gimp | |
layer = gimp.image_list()[0].layers[0] | |
image = gimp.image_list()[0] | |
for layer in gimp.image_list()[0].layers : | |
x = (image.width - layer.width) / 2 | |
y = (image.height - layer.height) / 2 | |
layer.set_offsets(x, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import msfrpc | |
import time | |
if __name__ == '__main__': | |
# Create a new instance of the Msfrpc client with the default options | |
client = msfrpc.Msfrpc({}) | |
# Login to the msf server using the password "abc123" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//CSP only works in modern browsers Chrome 25+, Firefox 23+, Safari 7+ | |
$headerCSP = "Content-Security-Policy:". | |
"connect-src 'self' ;". // XMLHttpRequest (AJAX request), WebSocket or EventSource. | |
"default-src 'self';". // Default policy for loading html elements | |
"frame-ancestors 'self' ;". //allow parent framing - this one blocks click jacking and ui redress | |
"frame-src 'none';". // vaid sources for frames | |
"media-src 'self' *.example.com;". // vaid sources for media (audio and video html tags src) | |
"object-src 'none'; ". // valid object embed and applet tags src | |
"report-uri https://example.com/violationReportForCSP.php;". //A URL that will get raw json data in post that lets you know what was violated and blocked |
Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.
# start the console
sudo gitlab-rails console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sets CORS headers for request from example1.com and example2.com pages | |
# for both SSL and non-SSL | |
SetEnvIf Origin "^https?://[^/]*(example1|example2)\.com$" ORIGIN=$0 | |
Header set Access-Control-Allow-Origin %{ORIGIN}e env=ORIGIN | |
Header set Access-Control-Allow-Credentials "true" env=ORIGIN | |
# Always set Vary: Origin when it's possible you may send CORS headers | |
Header merge Vary Origin |