Skip to content

Instantly share code, notes, and snippets.

MongoDB Client-Side Field Level Encryption (CSFLE) Using KMIP or Local Master Key (with mongosh)

Assumptions

  • You have a MongoDB Enterprise deployment already running and accessible (self-managed or in Atlas)
  • You have the MongoDB Enterprise binary mongocryptd accessibe on your system path to enable automated encryption
  • You have the modern MongoDB Shell (mongosh) installed locally on your workstation
  • You have a KMIP Server running and accessible, if you don't intend to use a local keyfile (for an example of running and configuring a Hashicorp Vault development instance, see: Hashicorp Vault Configuration For MongoDB KMIP Use)

Configure Local Workstation Context Files

@mholt
mholt / keypairs.js
Created June 25, 2021 20:07
Generate key pairs and PEM-encode them using vanilla JS and browser Crypto API
//
// Convert an ArrayBuffer into a string.
// From https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String
function arrayBufToString(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
function pemEncode(label, data) {
const base64encoded = window.btoa(data);
@n8henrie
n8henrie / .gitignore
Last active October 6, 2023 18:32
Download and install Golang for Raspberry Pi
go*.linux-armv6l.tar.gz
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active August 16, 2024 13:39
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@jgamblin
jgamblin / Streisand.sh
Last active May 31, 2019 18:07
Streisand Server Install Bash Script
Please see: https://gist.github.com/cpu/9fe42bd664c99bff6ae85c0f386a0ae0
#!/bin/bash
# Installs the Streisand server for you https://github.com/jlund/streisand
#sudo apt-get update && sudo apt-get install -y git python-paramiko python-pip python-pycurl python-dev build-essential
#sudo pip install ansible markupsafe dopy==0.3.5
#git clone https://github.com/jlund/streisand.git && cd streisand/playbooks
##sed -i 's/streisand-host/127.0.0.1/g' streisand.yml
#sudo ansible-playbook -i "localhost," -c local streisand.yml
#sed -i "s/localhost/$(curl -s ipecho.net/plain)/g" ../generated-docs/streisand.html
from __future__ import division
import numpy as np
RADIUS_OF_EARTH_IN_KM = 6371.01
def haversine(lat1, lon1, lat2, lon2):
"""
Utility to calcutlate distance between two pointtodo explain regarding height
coverting from geodisc co-ordinate to cartestian gives errors when distances are further apart
@joepie91
joepie91 / vpn.md
Last active November 14, 2024 23:11
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Simple Security Guidelines

Using an iDevice? (Best option)

  • Use an iPod or an iPad without a SIM card
  • Use an iPhone
  • Do not jailbreak
  • Always upgrade to new iOS versions
  • Use Brave browser

Need Secure chat?

@soarez
soarez / ca.md
Last active October 29, 2024 18:12
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.