Skip to content

Instantly share code, notes, and snippets.

View kyxap1's full-sized avatar

Oleksandr Kukhar kyxap1

View GitHub Profile
format = """
$username\
@\
$hostname\
$directory\
${custom.git_current_branch}\
$git_branch\
$git_state\
$git_status\
$aws\
#!/usr/bin/env bash
set -euo pipefail
# Script to assist with disabling DNSSEC signing
# Usage:
# DOMAIN=sparta.kyxap.pro ./$0
type -P dig shuf 2>&1 >/dev/null
DOMAIN="${DOMAIN}."
@kyxap1
kyxap1 / containers-policies.sh
Last active September 14, 2021 19:51
Generate selinux policies for ecs containers with udica on amazon linux
#!/usr/bin/env bash
# generate selinux policies for ecs containers with udica on amazon linux
#requirements: xargs, jq, udica
jq='(.[].HostConfig | select(.Devices == null) | .Devices) |= []'
jq="jq '${jq}' > %s"
docker='{{slice .ID 0 12}} {{slice .Name 1}} {{.State.Pid}}'
audit='ausearch -m avc,user_avc,selinux_err,user_selinux_err --input-logs --raw -w -su %s > %s.avc'
#audit='ausearch -m avc,user_avc,selinux_err,user_selinux_err --input-logs --raw -w -su %s | audit2allow -M %s'
@kyxap1
kyxap1 / .dircolors
Created April 30, 2021 20:34
dircolors - customized database
# LS_COLORS
# Maintainers: Magnus Woldrich <[email protected]>,
# Ryan Delaney <[email protected]> OpenGPG: 0D98863B4E1D07B6
# URL: https://github.com/trapd00r/LS_COLORS
# Version: 0.254
# Updated: Tue Mar 29 21:25:30 AEST 2016
#
# This is a collection of extension:color mappings, suitable to use as your
# LS_COLORS environment variable. Most of them use the extended color map,
# described in the ECMA-48 document; in other words, you'll need a terminal
@kyxap1
kyxap1 / .bash_logout
Last active April 30, 2021 21:57
Brume (GL-MV1000) Edge Computing Gateway
# sync history
history -a
history -w
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
```nginx
http {
...
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$http_x_fasten_backend" "$ssl_client_s_dn"';
log_format upstream_log '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"'
@kyxap1
kyxap1 / nssm.jenkins.txt
Created February 24, 2021 15:29
Jenkins agent as windows service with Non-Sucking Service Manager (NSSM)
nssm install Jenkins "%COMMONPROGRAMFILES(x86)%\Oracle\Java\javapath\java.exe"
nssm set Jenkins AppParameters -jar agent.jar -jnlpUrl https://<jenksins-server-url>/computer/<jenkins-worker-node>/slave-agent.jnlp -secret <worker-secret> -workDir "C:\jenkins\"
nssm set Jenkins AppDirectory C:\Jenkins
nssm set Jenkins AppStdout C:\Jenkins\jenkins.log
nssm set Jenkins AppStderr C:\Jenkins\jenkins.log
nssm set Jenkins AppStopMethodSkip 6
nssm set Jenkins AppStopMethodConsole 1000
nssm set Jenkins AppThrottle 5000
nssm start Jenkins
@kyxap1
kyxap1 / auditbeat.md
Last active February 11, 2021 23:03
Auditbeat autodiscover

Auditbeat autodiscover

Все beats используют библиотеку libbeat, в которой есть механизм autodiscover для различных провайдеров.
Бит подключается к сокету докера и ждет событий create, delete от контейнеров.
Для каждого из событий он вычитывает описание контейнера и формирует набор значений,
которые можно использовать для динамического темплейтинга в конфигурационном файле.

Список полей для динамической конфигурации

host
@kyxap1
kyxap1 / !vpnc-script.sh
Last active February 22, 2021 19:13
Asus RT-N56U custom vpn client script
#!/bin/sh
ACTION=${1}
DEBUG=1
func_res() {
[[ ${DEBUG:-0} -ge 1 ]] && set 2>&1 | logger -t vpnc-script
# how to get cidrs: http://kyxap.org.ua/articles/google_ip_range
CIDRS="$(cat /opt/home/admin/cidrs/*.txt)"
EXCLUDE="$(cat /opt/home/admin/cidrs/exclude/*.txt)"
kyxap@powerless:~$ wget -q -S https://warp.plus/34eMa -O -
HTTP/1.1 302 Found
Connection: keep-alive
Content-Length: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Security-Policy: script-src 'nonce-gyHQeSOiPw59FXBBimduCg' 'unsafe-inline';object-src 'none';base-uri 'self';report-uri /_/DurableDeepLinkUi/cspreport;worker-src 'self'
Content-Type: application/binary
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Location: https://one.one.one.one/ref?referrer=8d04705c-3485-4fa2-9d2a-8909c7237ffb
Pragma: no-cache