Skip to content

Instantly share code, notes, and snippets.

View foxutech's full-sized avatar

FoxuTech foxutech

View GitHub Profile
---
- hosts: newnode
remote_user: root
become: yes
become_method: sudo
tasks:
- command: bash -c "uname -r | grep ^4."
register: kernelversion
ignore_errors: yes
@foxutech
foxutech / ec2-elb.py
Created May 21, 2018 11:02
Python script to remove/add an EC2 instance into an AWS ELB.
#!/usr/bin/env python
import time
import boto
import boto.ec2.elb
import boto.utils
from flask.ext.script import Manager
from closeio.main import setup_app
FROM ubuntu:16.04
RUN apt-get update -y && apt-get install -y curl apt-transport-https lsb-release libopenscap8 xsltproc
RUN curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | apt-key add -
RUN echo "deb https://packages.wazuh.com/apt xenial main"| tee /etc/apt/sources.list.d/wazuh.list
RUN apt-get -y update && apt-get -y install wazuh-agent
RUN echo "TopSecret" >> /var/ossec/etc/authd.pass
RUN chown -R ossec /var/ossec
<!--
Wazuh - Agent - Default configuration for ubuntu 16.04
More info at: https://documentation.wazuh.com
Mailing list: https://groups.google.com/forum/#!forum/wazuh
-->
<ossec_config>
<client>
<server-ip>172.31.27.23</server-ip>
<config-profile>ubuntu, ubuntu16, ubuntu16.04</config-profile>
#/bin/bash
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo apt-get -y install gcc make linux-headers-$(uname -r) dkms
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install virtualbox-5.2
VBoxManage -v
curl -O http://download.virtualbox.org/virtualbox/5.2.4/Oracle_VM_VirtualBox_Extension_Pack-5.2.4-119785.vbox-extpack
@foxutech
foxutech / saltinstall.sh
Created July 26, 2018 08:25
salt-master installation on Ubuntu 16.04 https://foxutech.com
#!/bin/bash
apt-get update
apt-get install wget -y
wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main" > /etc/apt/sources.list.d/saltstack.list
apt-get update
apt-get install salt-master salt-minion -y
cat << EOF > /etc/salt/master
file_ignore_regex:
@foxutech
foxutech / dockercontainernewterminal.md
Last active August 13, 2018 14:13
Open Another Terminal In A Running Docker Container #docker #bash #foxutech

Open Another Terminal In A Running Docker Container

Add the following to your bashrc.

function dock()
{
  if [ "$1" == "-h" ]
  then
 printf "Accepts container name or id, or attach to first running process \n"
@foxutech
foxutech / seccompgist.txt
Created August 17, 2018 18:53
seccomp in docker-compose
version: '2'
services:
db:
container_name: db
image: mariadb:5.5
ports:
- 3306
cap_add:
- SYS_PTRACE
security_opt:
@foxutech
foxutech / auto-register-route53.sh
Created August 19, 2018 17:58
Auto-register an EC2 host with Route53 DNS #route53 #aws #ec2 https://foxutech.com
#!/bin/sh
# Script to bind a CNAME to our HOST_NAME in ZONE
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Defaults
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress
spec:
type: nodePort
ports:
- port: 80
name: http
- port: 443