Skip to content

Instantly share code, notes, and snippets.

View rasjani's full-sized avatar
🎧

Jani Mikkonen rasjani

🎧
View GitHub Profile
@ms5
ms5 / verbos-argpary-example.py
Last active August 24, 2023 13:37
manipulating log level with python argparse
import argparse
import logging
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', action='count', default=1)
args = parser.parse_args()
args.verbose = 70 - (10*args.verbose) if args.verbose > 0 else 0
logging.basicConfig(level=args.verbose, format='%(asctime)s %(levelname)s: %(message)s',
@michaelneale
michaelneale / gist:9635744
Last active February 27, 2018 03:39
systemd script for jenkins OPEs (slaves)
[Unit]
Description=CloudBeees On Prem executor
Documentation=https://developer.cloudbees.com/bin/view/DEV/On-Premise+Executors
Requires=network.target
After=multi-user.target
[Service]
Type=simple
ExecStart=/opt/java6/bin/java -jar /usr/share/jenkins-cli.jar -s https://cloudbees.ci.cloudbees.com on-premise-executor -fsroot /workspace -labels docker -nam\
e docker-builder-1
@ahpook
ahpook / gist:1182243
Created August 30, 2011 22:14
Use a generic client certificate with puppet

The problem

There's enough trouble with puppet's ssl model (mandatory client certs) that people go and do odd things to get around it. The primary problem is that for lab/preproduction environments, if you reinstall machines frequently, you lose access to the private key that generated the original cert but (absent some puppet cert --clean [node] operation) the cert still exists, leading to the dreaded Retrieved certificate doesn't match private key error.

A solution

Generate a single client certificate which all your nodes use, and have the master determine node names from facter rather than the SSL DN. This way you can re-install nodes with impunity and as long as your bootstrap plops down the correct config and the cert+key, you don't have any more SSL issues.

The caveats

If you have autosign turned on, this change represents a shift in security tradeoffs: you can turn off autosign and therefore more tightly control which clients can talk to your server because they need to have your clie