Skip to content

Instantly share code, notes, and snippets.

@mbentley
mbentley / iis_auth_allsteps.md
Created December 15, 2017 22:10 — forked from PatrickLang/iis_auth_allsteps.md
Setting up IIS with User Authorization in Windows Server containers

Create a resource group

Create a resource group in Azure to hold all of the resources you'll be creating:

  • Virtual Network
  • Virtual Machines

Create a VNet

  • Don't use 172.* IPs. I used 10.3.0.0/24
@mbentley
mbentley / wintest.sh
Last active December 19, 2017 19:29
Windows Overlay Test
# create overlay network to test
docker network create -d overlay --attachable winoverlaytest
# run iis on two different nodes, attached to the same network
docker service create --name iis1 --network winoverlaytest --constraint "node.hostname==server2016-1" --endpoint-mode dnsrr microsoft/iis:nanoserver
docker service create --name iis2 --network winoverlaytest --constraint "node.hostname==server2016-2" --endpoint-mode dnsrr microsoft/iis:nanoserver
# hit iis2 from iis1
docker exec -it $(docker inspect --format '{{.Status.ContainerStatus.ContainerID}}' $(docker service ps --filter desired-state=running --format '{{.ID}}' iis1)) powershell Invoke-WebRequest http://iis2/
@mbentley
mbentley / daemon.json
Last active December 1, 2017 16:32
Docker daemon.json insecure registry + nondistributable artifacts
{
"insecure-registry": [
"dtr.example.com"
],
"allow-nondistributable-artifacts": [
"dtr.example.com"
]
}
@mbentley
mbentley / stack_certs.sh
Created November 21, 2017 18:47
Stack certs for UCP and DTR from LetsEncrypt
#!/bin/bash
set -e
### stack certs for UCP
CERT_DIR="ucp.demo.dckr.org"
cd ~/letsencrypt/"${CERT_DIR}"
mkdir -p ucp
# ca.pem
@mbentley
mbentley / ucp_remove_client_bundles.sh
Created November 2, 2017 13:53
Remove all UCP bundles for a user
#!/bin/bash
set -e
USERNAME=""
PASSWORD=""
UCP_FQDN=""
AUTH_TOKEN="$(curl -sk -d '{"username":"'${USERNAME}'","password":"'${PASSWORD}'"}' "https://${UCP_FQDN}/auth/login" | jq -r .auth_token 2>/dev/null)"
CURL_OPTS=(-ks --header "Content-Type: application/json" --header "Accept: application/json" -H "Authorization: Bearer ${AUTH_TOKEN}")
@mbentley
mbentley / ucp_create_rbac.sh
Last active April 3, 2020 16:23
Docker EE 17.06 UCP API Examples
#!/bin/bash
# set environment variables
USERNAME="admin"
PASSWORD="docker123"
UCP_URL="10.1.2.3:4443"
# get auth token
AUTH_TOKEN="$(curl -sk -d '{"username":"'${USERNAME}'","password":"'${PASSWORD}'"}' https://${UCP_URL}/auth/login | jq -r .auth_token 2>/dev/null)"
@mbentley
mbentley / notary_easy_button.sh
Last active November 18, 2021 12:54
Docker Content Trust Delegation Script
#!/bin/bash
# check to see if a cert.pem exists in the current directory
if [ ! -f "cert.pem" ]
then
echo "ERROR - cert.pem not found (are you in the right directory?)"
exit 1
fi
# check to see if CA cert exists for your DTR
@mbentley
mbentley / check_for_deferred_deletion.sh
Created March 10, 2017 21:22
Check to see if deferred deletion is supported
#!/bin/bash
PIPE1=/run/dss-$$-fifo1
PIPE2=/run/dss-$$-fifo2
TEMPDIR=$(mktemp --tmpdir -d)
platform_supports_deferred_deletion() {
local deferred_deletion_supported=1
trap cleanup_pipes EXIT
if [ ! -x "./dss-child-read-write.sh" ];then
@mbentley
mbentley / nginx.conf
Created February 23, 2017 18:03
nginx load balancer for UCP
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@mbentley
mbentley / 0_dct_demo.sh
Last active August 24, 2021 20:02
Docker Content Trust Demo (January 2017)
### set environment variables
DTR_URL="ddcbeta.mac"
# Make sure you have downloaded DTR's CA (if the certs are not trusted by valid root CA on your client already) and are placed in the path specified by --tlscacert
# The DTR's CA cert can be downloaded from https://${DTR_URL}/ca
# If it is already trusted, you can leave of the --tlscacert argument
alias notary="notary -s https://${DTR_URL} -d ~/.docker/trust --tlscacert ~/.docker/tls/${DTR_URL}/ca.crt"
REPO="admin/signtest"
USERNAME="admin"
### admin