Skip to content

Instantly share code, notes, and snippets.

View mig5's full-sized avatar

mig5

View GitHub Profile
@mig5
mig5 / ossec-install.sh
Last active August 29, 2015 14:03
OSSEC quick install script
#!/bin/bash
#
# Written by mig5 2014
# Variables
VERSION=2.8.2
CHECKSUM="ossec-hids-${VERSION}-checksum.txt"
TARBALL="ossec-hids-${VERSION}.tar.gz"
echo "Downloading packages and checksums"
@mig5
mig5 / vcloud-vm-lookup.sh
Created July 31, 2014 01:36
vcloud-vm-lookup
#!/bin/bash
usage() {
cat << EOF
usage: $0 ARGUMENTS
Simple wrapper script to query the vCloud API and return a
YAML object of a specific virtual machine.
Written by mig5 July 2014

Keybase proof

I hereby claim:

  • I am mig5 on github.
  • I am mig5 (https://keybase.io/mig5) on keybase.
  • I have a public key whose fingerprint is E414 4692 2E11 B8DD 0D43 80E9 5418 373D FF79 BA19

To claim this, I am signing this object:

@mig5
mig5 / deploy.yml
Last active August 9, 2016 07:21
Ansible playbook to deploy Drupal
---
- hosts: all
gather_facts: no
tasks:
- name: Backup database
shell: "{{ item }}"
with_items:
- mkdir -p ~jenkins/dbbackups
- drush @{{ shortname }}_{{ env }} sql-dump --skip-tables-key=common | gzip > ~jenkins/dbbackups/{{ shortname }}_{{ env }}_prior_to_{{ build }}.sql.gz
[miguel@dom0 ~]$ sudo tar c /var/lib/rpm /etc/yum.repos.d /etc/yum.conf 2>/dev/null | qvm-run -p "dom0-update-vm" 'tar x -C /var/lib/qubes/dom0-updates'
tar: var: Cannot mkdir: Permission denied
tar: var/lib/rpm: Cannot mkdir: No such file or directory
tar: var: Cannot mkdir: Permission denied
tar: var/lib/rpm/__db.001: Cannot open: No such file or directory
tar: var: Cannot mkdir: Permission denied
tar: var/lib/rpm/Dirnames: Cannot open: No such file or directory
tar: var: Cannot mkdir: Permission denied
@mig5
mig5 / qubes-template-update.sh
Last active July 18, 2018 12:04
qubes-template-update
#!/bin/bash
#
# Script to update template images in a big batch
#
# Get a list of templates
TEMPLATES=$(qvm-ls | grep Tpl | awk {'print $1'} |cut -d[ -f2 | cut -d] -f1)
usage()
{
Jul 29 09:15:07 dom0 systemd[1]: Started Qubes NetVM startup.
Jul 29 09:15:07 dom0 systemd[1]: Starting Start Qubes VM gpg...
Jul 29 09:15:07 dom0 systemd[1]: Starting Start Qubes VM yubi...
Jul 29 09:15:07 dom0 systemd[1]: Starting Start Qubes VM vpn...
Jul 29 09:15:07 dom0 qvm-start[2812]: --> Creating volatile image: /var/lib/qubes/appvms/gpg/volatile.img...
Jul 29 09:15:07 dom0 qvm-start[2814]: --> Creating volatile image: /var/lib/qubes/servicevms/vpn/volatile.img...
Jul 29 09:15:07 dom0 qvm-start[2813]: --> Creating volatile image: /var/lib/qubes/appvms/yubi/volatile.img...
Jul 29 09:15:07 dom0 kernel: loop9: p1 p2
Jul 29 09:15:07 dom0 qvm-start[2813]: Lock is already obtained.. waiting 5 seconds til we try again (attempt #1)
Jul 29 09:15:07 dom0 qvm-start[2814]: Lock is already obtained.. waiting 5 seconds til we try again (attempt #1)
@mig5
mig5 / gist:a89af7d113f403521cd7
Last active January 22, 2016 17:35
Bring Vagrant VM up if it's off and you tried to vagrant ssh
vagrant() {
if [[ $@ == "ssh" ]]; then
command vagrant ssh || command vagrant up && command vagrant ssh
else
command vagrant $@
fi
}

Keybase proof

I hereby claim:

  • I am mig5 on github.
  • I am mig5 (https://keybase.io/mig5) on keybase.
  • I have a public key whose fingerprint is 0E6B 7951 85FC A187 066D 339C EEA4 341C 6D97 A0B6

To claim this, I am signing this object:

#!/bin/sh
KEY1="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
KEY2="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
challenge=`head -c63 /dev/urandom | xxd -c 63 -ps`
response=`qvm-run -a --nogui -u root -p sys-usb "ykchalresp -2 -x $challenge"`
function yubi_auth() {