Skip to content

Instantly share code, notes, and snippets.

@selivan
selivan / docker-compose.yml
Created February 5, 2021 00:51
docker-compose for test one-node elastic and kibana
version: '3'
services:
elastic-node1:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
container_name: elastic-node1
environment:
- node.name=elastic-node1
- discovery.type=single-node
- bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
@selivan
selivan / generate-bundle-certs.sh
Last active December 1, 2020 22:08
Letsencrypt hook to generate combined fullchain+privkey certificates for software like Haproxy
#!/bin/bash
# SAVE TO /etc/letsencrypt/renewal-hooks/post/generate-bundle-certs.sh
# chmod a+x /etc/letsencrypt/renewal-hooks/post/generate-bundle-certs.sh
find /etc/letsencrypt/live -mindepth 1 -maxdepth 1 -type d -print0 | while IFS='' read -d $'\0' dir; do
# Update only if necessary
test -e "$dir/fullchain.pem" -a \
-e "$dir/privkey.pem" -a \
-e "$dir/fullchain_and_privkey.pem" && \
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/elastalert/util.py", line 26, in get_module
module_path, module_class = module_name.rsplit('.', 1)
ValueError: not enough values to unpack (expected 2, got 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/elastalert/loaders.py", line 461, in load_alerts
alert_field = [create_alert(a, b) for a, b in alert_field]
# change shell title before running ssh
function ssh() {
# mess with title only if shell is interactive
# .bashrc should have a guard against non-interactive execution
# so this is just for additional safety - not good idea to break ssh
if [[ $- == *i* ]]; then
local host=$(echo "$@" | sed 's/-[a-zA-Z] //' | tr -d ' ' | cut -d' ' -f1)
echo -ne "\033]0;$host\007"
fi
$(type -f -p ssh || echo /usr/bin/ssh) "$@"
#!/usr/bin/env python3
import sys
import os
import smtplib
from email.mime.text import MIMEText
mail_host = 'email-smtp.eu-west-1.amazonaws.com'
mail_port = 465
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnicodeEncodeError: 'ascii' codec can't encode characters in position 57566-57569: ordinal not in range(128)
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):
File \"/root/.ansible/tmp/ansible-tmp-1563092412.49-239477708342027/AnsiballZ_zabbix_template.py\", line 125, in <module>
_ansiballz_main()
File \"/root/.ansible/tmp/ansible-tmp-1563092412.49-239477708342027/AnsiballZ_zabbix_template.py\", line 117, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/root/.ansible/tmp/ansible-tmp-1563092412.49-239477708342027/AnsiballZ_zabbix_template.py\", line 54, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File \"/tmp/ansible_zabbix_template_payload_StS_pq/__main__.py\", line 742, in <module>
File \"/tmp/ansible_zabbix_template_payload_StS_pq/__main__.py\", line 689, in main
@selivan
selivan / auditd.conf
Created April 21, 2019 17:25 — forked from sakalajuraj/auditd.conf
Logstash configuration for auditd messages received via syslog
# Content of the file /etc/logstash/conf.d/auditd.conf
# Tested on the CentOS 7 auditspd logs forwarded to logstash via rsyslog
input {
syslog {
type => AUDITD
port => xxxx
host => "xxx.xxx.xxx.xxx"
}
}
@selivan
selivan / upwork.profile
Created January 22, 2019 16:15
upwork firejail profile
noblacklist ${HOME}/.Upwork
mkdir ${HOME}/.Upwork
whitelist ${HOME}/.Upwork
noblacklist ${HOME}/.config/Upwork
mkdir ${HOME}/.config/Upwork
whitelist ${HOME}/.config/Upwork
noblacklist ${HOME}/.cache/Upwork
mkdir ${HOME}/.cache/Upwork
#!/bin/bash
#set -x
function die {
echo "ERROR: $*";
exit 1
}
usage_info="Usage: $0 ca_dir
#!/bin/bash
#set -x
function die {
echo "ERROR: $*";
exit 1
}
usage_info="Usage: $0 ca_dir client|server certificate_name