openssl – Connect and verify

To connect to a remote host and verify the TLS connection, run this command:

openssl s_client -verify -showcerts \
-connect remote-hostname.com:443 -msg \
-CAfile allca.cer -cert myhostname.cer -key myhostname.key

The example above is for a mutual TLS connection where the client offers its certs too.

To view the parsed certificate of a remote host, do this:

echo | \
openssl s_client  -connect remote-hostname.com:443 2>/dev/null | \
openssl x509 -text

Cleaning up docker cruft

Here’s a quick tip I discovered recently:

I was tired of having complex shell commands to look at docker’s dead containers and unused images. Happily, new versions (API v1.25 onwards) have simple equivalents:

docker system prune
docker container prune
docker network prune
docker volume prune

Here’s a link to the documentation.

Searching notes in Emacs with Deft

I have mentioned the notes system I use already. I use GNU/Emacs heavily and have come up with a neat system that fits my needs. I take notes in org-mode, commit them using git and occasionally publish them to html if I need a clean look at all of them.

For information retrieval, I use Deft in GNU/Emacs. I have it configured with the following snippet in my init.el:

;;deft for notes
(require 'deft)
(setq deft-extensions '("txt" "tex" "org"))
(setq deft-directory "~/notes")
(setq deft-recursive t)
(global-set-key [f8] 'deft)

Whenever I need to dig something up, I hit F-8 and type a string of text and that’s pretty much it. Deft recursively searches for the string and narrows the files down to the hits.

Here’s a quick gif of me searching for ‘s_client’ so I can see the exact args I need to use for openssl’s TLS client.

deft

Vim with Vundle

Full credit to this amazing post: it made my .vimrc so much neater and understandable. Until now I had a mess of plugins pulled from different sources, and I didn’t know which extension was enabling which feature.


Below is my full .vimrc, mostly identical to the one in the post, with a few minor tweaks that I’m used to. I copied this to a couple of VMs I use, and it is ridiculously simple to clone the Vundle repo and hit :PluginInstall to get everything set up nicely.

" Get vundle from here:
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible              " required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'vim-scripts/indentpython.vim'
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'sjl/badwolf'
Plugin 'tpope/vim-markdown'
Plugin 'klen/python-mode'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'mhinz/vim-startify'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'airblade/vim-gitgutter'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

"split navigations
nnoremap  
nnoremap  
nnoremap  
nnoremap  

" tagbar at F8
nmap  :TagbarToggle

" my favourite font
set guifont=Hack:h11:cANSI

" markdown mode for .page files
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
autocmd BufNewFile,BufReadPost *.page set filetype=markdown

set nofoldenable    " disable folding

" python settings
au BufRead,BufNewFile *.py,*.pyw set tabstop=4
au BufRead,BufNewFile *.py,*.pyw set softtabstop=4
au BufRead,BufNewFile *.py,*.pyw set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw set textwidth=79
au BufRead,BufNewFile *.py,*.pyw set expandtab
au BufRead,BufNewFile *.py,*.pyw set autoindent
" au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
" au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /\s\+$/
au         BufNewFile *.py,*.pyw set fileformat=unix
au BufRead,BufNewFile *.py,*.pyw let b:comment_leader = '#'

" General settings
set tabstop=4        " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set expandtab        " tabs are spaces
set wildignore=*.o,*~,*.pyc
set encoding=utf-8

let python_highlight_all=1
syntax on
colorscheme badwolf
let NERDTreeIgnore=['\.pyc
, '\~
] "ignore files in NERDTree
set ignorecase
set paste
set nohlsearch
set incsearch
nmap  a=strftime("%A %Y%m%d")
imap  =strftime("%A %Y%m%d")
:set pastetoggle=
set laststatus=2 "airline needs this
let g:airline#extensions#tabline#enabled = 1
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn|pyc)