Skip to content

Instantly share code, notes, and snippets.

View sumitsaiwal's full-sized avatar

Sumit Kumar sumitsaiwal

View GitHub Profile
@sumitsaiwal
sumitsaiwal / Docker connect to remote server.md
Created January 2, 2018 09:25 — forked from kekru/Docker connect to remote server.md
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.
For HTTPS connection use whiledo/docker-remote-api-tls.

@sumitsaiwal
sumitsaiwal / Azure vpn root client certificate
Last active January 31, 2018 06:28
powershell command used to create certificates for point to site connectivity
root
$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature `
-Subject "CN=P2SRootCert" -KeyExportPolicy Exportable `
-HashAlgorithm sha256 -KeyLength 2048 `
-CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign
Client
@sumitsaiwal
sumitsaiwal / service principal for Azure Container Service
Last active March 2, 2018 01:36
Service principal for a Kubernetes cluster in Container Service using Azure CLI
##Connect to ACS##https://docs.microsoft.com/en-us/azure/container-service/dcos-swarm/container-service-connect
##Kubectl.exe: https://storage.googleapis.com/kubernetes-release/release/v1.9.3/bin/windows/amd64/kubectl.exe
##clientID==appId
##cleintPassword==password
az login
az account set --subscription "mySubscriptionID"
az group create --name "myResourceGroup" --location "westus"
@sumitsaiwal
sumitsaiwal / Install Docker
Last active October 8, 2018 04:44
Docker installation for Ubuntu 16.04
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
#sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install -y docker-engine
#sudo apt-cache policy docker-engine
#sudo apt-get install -y docker-engine=1.13.1-0~ubuntu-xenial
sudo service docker start
@sumitsaiwal
sumitsaiwal / openssl cert azure vpn.md
Last active October 5, 2022 02:36
openssl certs for azure VPN

The sole dependency is a build of openssl for your platform. Without further due, our first step is to provide Azure with a certificate that will be used to sign client certificates. We call this the root certificate and by importing it to Azure we trust certificates signed by it. Most of the following commands will ask you to guard the output files with a passphrase, leave them empty until you have a working solution, then follow the guide again and add strong passwords when you’re asked to.

Generate CARoot private key

openssl genrsa -aes256 -out MyAzureVPN.key 2048

Generate a CARoot certificate valid for 10 years

openssl req -x509 -sha256 -new -key MyAzureVPN.key -out MyAzureVPN.cer -days 3650 -subj /CN="ca_name"

Note: fix for opesssl random number issue: openssl rand -out ~/.rnd -writerand ~/.rnd In Azure portal navigate to “Virtual Networks Gateway/Configuration/Point-to-site” and cert name and data from MyAzureVPN.cer removing '--Begin/end certificate'.

@sumitsaiwal
sumitsaiwal / MoveResourceToDiffAzureSubscription.ps1
Created February 1, 2018 10:35
Moving Azure resources from one Subscription's resource group to another Subscriptions's resource group
#Login
Login-AzureRmAccount
#Variables
$oldSubscription = Read-Host 'oldSubscriptionID' #Name of source susbcription
$newSubscription = Read-Host 'newSubscriptionID' #Name of destination subscription
$sourceRG = Read-Host 'sourceRG' #Name of ource Resource Group
$destinationRG = Read-Host 'destinationRG' #Name of destinatino Resource Group
#Get resources
@sumitsaiwal
sumitsaiwal / MoveAzureResouces2diffRG.ps1
Created February 2, 2018 12:05
Moving Azure resources from one RG to another.
#Login
Login-AzureRmAccount
#Variables
$sourceRG = Read-Host 'sourceRG' #Name of source Resource Group
$destinationRG = Read-Host 'destinationRG' #Name of destinatino Resource Group
$Subscription = Read-Host 'SubscriptionName' #Name of Subscription
#Get resources
Select-AzureRmSubscription -SubscriptionName $Subscription
@sumitsaiwal
sumitsaiwal / introrx.md
Created February 5, 2018 05:01 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@sumitsaiwal
sumitsaiwal / connection_proxy
Created February 7, 2018 06:33
SSH through Proxy
## ssh connection behind proxy, requires netcat(nc) installed
ssh USER@FINAL_DEST -o "ProxyCommand=nc -X connect -x PROXYHOST:PROXYPORT %h %p"
@sumitsaiwal
sumitsaiwal / Docker for Windows: Shared Drives Issue.md
Last active June 26, 2019 13:13
Docker for Windows: Shared Drives Issue
Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceAlias "vEthernet (DockerNAT)" -NetworkCategory Private
##keep this running for Decryption
while ($true)
{
 if ($(Get-SmbServerConfiguration).EncryptData)