#!/usr/bin/env ruby require 'time' require 'pathname' require 'shellwords' require 'getoptlong' require 'active_support/time' require 'json' def help msg=nil STDERR.puts msg if msg STDERR.puts <<-EOHELP.gsub( /^\s*:/, '') :Usage: ssh .... renew [force] [show] : ssh .... show : ssh .... help : ssh .... jsonl : :[h]elp :[r]enew Renews (if expires in graceperiod) or creates (if not existing) certificate : [f]orce forces renewal, also if valid for graceperiod :[s]how Shows current certificate :jsonl Expect commands via STDIN as JSONL and responses via STDOUT in JSONL : Request format: [0, CMD, ARGS...] : Response format: [SCODE, BODY] : SCODEs are like HTTP. : :possible CMD: :}]> => : => : : RENEWED indicates if file was renewed (true|false). : CONTENT is the content of the certfile (String). : DATA is the parsed file (ssh-keygen -L) (Hash). EOHELP exit 1 end class Die