Skip to content

Instantly share code, notes, and snippets.

View maraca's full-sized avatar

Martin Cozzi maraca

View GitHub Profile
@maraca
maraca / .bashrc
Created March 6, 2014 19:53
.bashrc config for AWS and Packer
#AWS Settings
export AWS_ACCESS_KEY_ID=AKIABCDEFGHIJKLMNOP
export AWS_SECRET_ACCESS_KEY=fweifeoifjwef/thkopyhtkotykhyth
export AWS_X509_CERT_PATH=/home/bob/.packer/bob_certificate.pem
export AWS_X509_KEY_PATH=/home/bob/.packer/bob_key.pem
export AWS_ACCOUNT_ID='1234-5678-9999'
@maraca
maraca / packer_build.sh
Created March 6, 2014 19:59
Builds a packer AMI.
#!/bin/bash
rm -r vendor
bundle exec berks install --path vendor/cookbooks
packer build \
-var "account_id=$AWS_ACCOUNT_ID" \
-var "aws_access_key_id=$AWS_ACCESS_KEY_ID" \
-var "aws_secret_key=$AWS_SECRET_ACCESS_KEY" \
-var "x509_cert_path=$AWS_X509_CERT_PATH" \
-var "x509_key_path=$AWS_X509_KEY_PATH" \
-var "s3_bucket=packer-ami-bucket" \
@maraca
maraca / HelloWorld.json
Created March 6, 2014 20:13
Cloudformation template for our hello-world Packer AMI
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Creates an EC2 instance with our hello-world AMI",
"Parameters" : {
"KeyName" : {
"Description" : "Name of the production EC2 KeyPair to enable SSH to the instance",
"Type" : "String"
},
#!/bin/bash
KEY_NAME=$1
PEM_NAME="${KEY_NAME}-key.pem"
PEM_NAME_PCKS8="${KEY_NAME}-pem-PCKS8-format.pem"
CERTIFICATE_NAME="${KEY_NAME}-certificate.pem"
openssl genrsa 2048 > $PEM_NAME
openssl pkcs8 -topk8 -nocrypt -inform PEM -in $PEM_NAME -out $PEM_NAME_PCKS8
openssl req -new -x509 -nodes -sha1 -days 365 -key $PEM_NAME -outform PEM > $CERTIFICATE_NAME
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.
To fix this issue add an entry like this to your configuration file:
```
# Verify all HTTPS connections (recommended)
ssl_verify_mode :verify_peer
Generated at 2014-04-08 23:33:51 +0000
Ohai::Exceptions::AttributeNotFound: ohai[reload_nginx] (nginx::ohai_plugin line 22) had an error: Ohai::Exceptions::AttributeNotFound: No such attribute: 'nginx'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.0.0/lib/ohai/provides_map.rb:79:in `block in deep_find_providers_for'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.0.0/lib/ohai/provides_map.rb:72:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.0.0/lib/ohai/provides_map.rb:72:in `deep_find_providers_for'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.0.0/lib/ohai/provides_map.rb:110:in `all_plugins'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.0.0/lib/ohai/system.rb:88:in `run_plugins'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.0.0/lib/ohai/system.rb:73:in `all_plugins'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.0/lib/chef/provider/ohai.rb:41:in `block in action_reload'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.12.0/lib/chef/mixin/why_run.rb:52:in `cal
D ------Exception-------
D Class: Kitchen::UserError
D Message: You must first install the Docker CLI tool http://www.docker.io/gettingstarted/
D ---Nested Exception---
D Class: Kitchen::ShellOut::ShellCommandFailed
D Message: Expected process to exit with [0], but received '1'
---- Begin output of sudo -E docker > /dev/null ----
STDOUT:
STDERR: sudo: no tty present and no askpass program specified
---- End output of sudo -E docker > /dev/null ----
@maraca
maraca / chef-deregister-service.rb
Created May 13, 2014 06:35
Chef deregistration service
#!/opt/chef/embedded/bin/ruby
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@maraca
maraca / meraki_vpn_config.txt
Last active August 29, 2015 14:01
VPN w/ ubuntu & Meraki
sudo add-apt-repository ppa:openswan/ppa
sudo apt-get update
sudo apt-get dist-upgrade
========================================
net.ipv4.conf.all.accept_redirects = 1
net.ipv4.conf.all.secure_redirects = 1
net.ipv4.conf.all.send_redirects = 1
net.ipv4.conf.default.accept_redirects = 1
@maraca
maraca / add_crontab
Created June 24, 2014 17:53
How to add a cronjob to synology.
# Edit the crontab
vi /etc/crontab
# Add your entry
52 10 * * * root echo 'hello' >> /tmp/hello
# Restart crond
RackStation> /usr/syno/etc.defaults/rc.d/S04crond.sh stop
stop crond
RackStation> /usr/syno/etc.defaults/rc.d/S04crond.sh start