Skip to content

Instantly share code, notes, and snippets.

View ahmed-bacha's full-sized avatar

AAB ahmed-bacha

View GitHub Profile
@ahmed-bacha
ahmed-bacha / gist:aa60d735b447940c19593884f553e69c
Created May 29, 2017 11:27 — forked from gambol99/gist:d55afd69217b8e2dd727be99f0a20e7d
golang - create ca and build csr for signing
//
// createCertificateAuthority generates a certificate authority request ready to be signed
//
func (r *secretStore) createCertificateAuthority(names pkix.Name, expiration time.Duration, size int) (*caCertificate, error) {
// step: generate a keypair
keys, err := rsa.GenerateKey(rand.Reader, size)
if err != nil {
return nil, fmt.Errorf("unable to genarate private keys, error: %s", err)
}
@ahmed-bacha
ahmed-bacha / SOL_SOCKET-SO_PEERCRED.rb
Created February 24, 2017 16:28 — forked from hiboma/SOL_SOCKET-SO_PEERCRED.rb
SOL_SOCKET, SO_PEERCRED in ruby
#!/usr/bin/env ruby
require 'socket'
include Socket::Constants
UNIXServer.open("\0(abstract socket)") {|server|
clinet = UNIXSocket.new("\0(abstract socket)")
clinet.setsockopt(SOL_SOCKET, SO_PASSCRED, 1)
sock = server.accept
@ahmed-bacha
ahmed-bacha / GIF-Screencast-OSX.md
Created February 16, 2017 20:34 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ahmed-bacha
ahmed-bacha / iterm2-solarized.md
Created February 15, 2017 19:27 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@ahmed-bacha
ahmed-bacha / multi_logger.rb
Created October 12, 2016 19:28 — forked from clowder/multi_logger.rb
Logging to multiple destinations in Ruby
class MultiLogger
attr_reader :level
def initialize(args={})
@level = args[:level] || Logger::Severity::DEBUG
@loggers = []
Array(args[:loggers]).each { |logger| add_logger(logger) }
end
@ahmed-bacha
ahmed-bacha / logger.rb
Last active December 1, 2016 15:15 — forked from kryptykphysh/logger.rb
Ruby: Logging module with class names, output to both STDOUT and file
require 'logger'
module Logging
class MultiDelegator
def initialize(*targets)
@targets = targets
end
def self.delegate(*methods)
methods.each do |m|
@ahmed-bacha
ahmed-bacha / pci_dss.md
Created October 7, 2016 20:50 — forked from diyan/pci_dss.md
PCI DSS. Useful resources
@ahmed-bacha
ahmed-bacha / telnet.rb
Created September 15, 2016 07:45
Inspec check for Telnetd
# Disallow insecure protocols by testing
describe package('telnetd') do
it { should_not be_installed }
end
describe inetd_conf do
its("telnet") { should eq nil }
end
@ahmed-bacha
ahmed-bacha / issue.md
Last active September 13, 2016 16:06
Docker issue : auditd broken auid

###Description

To secure Docker usage and auditability, we monitor Docker as recommanded in CIS Docker. Now we would like (security constraints) to monitor commands like exec. The problem is that Docker breaks auditd information (auid, link), and we lose the context, "What did user X do inside container Y ?"

By losing this information, auditing containers become not possible and we lose all information about what is happening inside each containers even if we are using auditd.

###Configuration