summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/monkeysphere-server12
-rwxr-xr-xsrc/monkeysphere-ssh-proxycommand9
2 files changed, 10 insertions, 11 deletions
diff --git a/src/monkeysphere-server b/src/monkeysphere-server
index 34b06b7..a1844ee 100755
--- a/src/monkeysphere-server
+++ b/src/monkeysphere-server
@@ -132,13 +132,13 @@ show_server_key() {
fingerprint=$(fingerprint_server_key)
gpg_authentication "--fingerprint --list-key --list-options show-unusable-uids $fingerprint"
- # dumping to a file named ' ' so that the ssh-keygen output
- # doesn't claim any potentially bogus hostname(s):
- tmpkey=$(mktemp ${TMPDIR:-/tmp}/tmp.XXXXXXXXXX) || failure "Could not create temporary directory!"
- gpg_authentication "--export $fingerprint" | openpgp2ssh "$fingerprint" 2>/dev/null > "$tmpkey"
+ # do some crazy "Here Strings" redirection to get the key to
+ # ssh-keygen, since it doesn't read from stdin cleanly
echo -n "ssh fingerprint: "
- ssh-keygen -l -f "$tmpkey" | awk '{ print $1, $2, $4 }'
- rm -rf "$tmpkey"
+ ssh-keygen -l -f /dev/stdin \
+ <<<$(gpg_authentication "--export $fingerprint" | \
+ openpgp2ssh "$fingerprint" 2>/dev/null) | \
+ awk '{ print $1, $2, $4 }'
echo -n "OpenPGP fingerprint: "
echo "$fingerprint"
}
diff --git a/src/monkeysphere-ssh-proxycommand b/src/monkeysphere-ssh-proxycommand
index b3dc562..a609199 100755
--- a/src/monkeysphere-ssh-proxycommand
+++ b/src/monkeysphere-ssh-proxycommand
@@ -77,12 +77,11 @@ output_no_valid_key() {
log "An OpenPGP key matching the ssh key offered by the host was found:"
log
- # get the fingerprint of the ssh key
- tmpkey=$(mktemp ${TMPDIR:-/tmp}/tmp.XXXXXXXXXX)
- echo "$sshKeyGPG" > "$tmpkey"
- sshFingerprint=$(ssh-keygen -l -f "$tmpkey" | \
+ # do some crazy "Here Strings" redirection to get the key to
+ # ssh-keygen, since it doesn't read from stdin cleanly
+ sshFingerprint=$(ssh-keygen -l -f /dev/stdin \
+ <<<$(echo "$sshKeyGPG") | \
awk '{ print $2 }')
- rm -rf "$tmpkey"
# get the sigs for the matching key
gpgSigOut=$(gpg --check-sigs \
#39;=<>`\\x00-\\x20]+";
  • var SINGLEQUOTEDVALUE = "'[^']*'";
  • var DOUBLEQUOTEDVALUE = '"[^"]*"';
  • var ATTRIBUTEVALUE = "(?:" + UNQUOTEDVALUE + "|" + SINGLEQUOTEDVALUE + "|" + DOUBLEQUOTEDVALUE + ")";
  • var ATTRIBUTEVALUESPEC = "(?:" + "\\s*=" + "\\s*" + ATTRIBUTEVALUE + ")";
  • var ATTRIBUTE = "(?:" + "\\s+" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)";
  • var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*" + "\\s*/?>";
  • var CLOSETAG = "</" + TAGNAME + "\\s*[>]";
  • var HTMLCOMMENT = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
  • var PROCESSINGINSTRUCTION = "[<][?].*?[?][>]";
  • var DECLARATION = "<![A-Z]+" + "\\s+[^>]*>";
  • var CDATA = "<!\\[CDATA\\[[\\s\\S]*?\]\\]>";
  • var HTMLTAG = "(?:" + OPENTAG + "|" + CLOSETAG + "|" + HTMLCOMMENT + "|" +
  • PROCESSINGINSTRUCTION + "|" + DECLARATION + "|" + CDATA + ")";
  • var ENTITY = "&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});";
  • var rePunctuation = new RegExp(/^[\u2000-\u206F\u2E00-\u2E7F\\'!"#\$%&\(\)\*\+,\-\.\/:;<=>\?@\[\]\^_`\{\|\}~]/);
  • var reHtmlTag = new RegExp('^' + HTMLTAG, 'i');
  • var reLinkTitle = new RegExp(
  • '^(?:"(' + ESCAPED_CHAR + '|[^"\\x00])*"' +
  • '|' +
  • '\'(' + ESCAPED_CHAR + '|[^\'\\x00])*\'' +
  • '|' +
  • '\\((' + ESCAPED_CHAR + '|[^)\\x00])*\\))');
  • var reLinkDestinationBraces = new RegExp(
  • '^(?:[<](?:[^<>\\n\\\\\\x00]' + '|' + ESCAPED_CHAR + '|' + '\\\\)*[>])');
  • var reLinkDestination = new RegExp(
  • '^(?:' + REG_CHAR + '+|' + ESCAPED_CHAR + '|' + IN_PARENS_NOSP + ')*');
  • var reEscapable = new RegExp(ESCAPABLE);
  • var reEntityHere = new RegExp('^' + ENTITY, 'i');
  • var reTicks = new RegExp('`+');
  • var reTicksHere = new RegExp('^`+');
  • var reEmailAutolink = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;
  • var reAutolink = /^<(?:coap|doi|javascript|aaa|aaas|about|acap|cap|cid|crid|data|dav|dict|dns|file|ftp|geo|go|gopher|h323|http|https|iax|icap|im|imap|info|ipp|iris|iris.beep|iris.xpc|iris.xpcs|iris.lwz|ldap|mailto|mid|msrp|msrps|mtqp|mupdate|news|nfs|ni|nih|nntp|opaquelocktoken|pop|pres|rtsp|service|session|shttp|sieve|sip|sips|sms|snmp|soap.beep|soap.beeps|tag|tel|telnet|tftp|thismessage|tn3270|tip|tv|urn|vemmi|ws|wss|xcon|xcon-userid|xmlrpc.beep|xmlrpc.beeps|xmpp|z39.50r|z39.50s|adiumxtra|afp|afs|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|chrome|chrome-extension|com-eventbrite-attendee|content|cvs|dlna-playsingle|dlna-playcontainer|dtn|dvb|ed2k|facetime|feed|finger|fish|gg|git|gizmoproject|gtalk|hcp|icon|ipn|irc|irc6|ircs|itms|jar|jms|keyparc|lastfm|ldaps|magnet|maps|market|message|mms|ms-help|msnim|mumble|mvn|notes|oid|palm|paparazzi|platform|proxy|psyc|query|res|resource|rmi|rsync|rtmp|secondlife|sftp|sgn|skype|smb|soldat|spotify|ssh|steam|svn|teamspeak|things|udp|unreal|ut2004|ventrilo|view-source|webcal|wtai|wyciwyg|xfire|xri|ymsgr):[^<>\x00-\x20]*>/i;
  • var reSpnl = /^ *(?:\n *)?/;
  • var reWhitespaceChar = /^\s/;
  • var reWhitespace = /\s+/g;
  • var reFinalSpace = / *$/;
  • var reInitialSpace = /^ */;
  • var reAsciiAlnum = /[a-z0-9]/i;
  • var reLinkLabel = /^\[(?:[^\\\[\]]|\\[\[\]]){0,1000}\]/;
  • // Matches a string of non-special characters.
  • var reMain = /^[^\n`\[\]\\!<&*_]+/m;
  • // Normalize reference label: collapse internal whitespace
  • // to single space, remove leading/trailing whitespace, case fold.
  • var normalizeReference = function(s) {
  • return s.trim()
  • .replace(/\s+/, ' ')
  • .toUpperCase();
  • };
  • var text = function(s) {
  • var node = new Node('Text');
  • node.literal = s;
  • return node;
  • };
  • // INLINE PARSER
  • // These are methods of an InlineParser object, defined below.
  • // An InlineParser keeps track of a subject (a string to be
  • // parsed) and a position in that subject.
  • // If re matches at current position in the subject, advance
  • // position in subject and return the match; otherwise return null.
  • var match = function(re) {
  • var m = re.exec(this.subject.slice(this.pos));
  • if (m) {
  • this.pos += m.index + m[0].length;
  • return m[0];
  • } else {
  • return null;
  • }
  • };
  • // Returns the code for the character at the current subject position, or -1
  • // there are no more characters.
  • var peek = function() {
  • if (this.pos < this.subject.length) {
  • return this.subject.charCodeAt(this.pos);
  • } else {
  • return -1;
  • }
  • };
  • // Parse zero or more space characters, including at most one newline
  • var spnl = function() {
  • this.match(reSpnl);
  • return 1;
  • };
  • // All of the parsers below try to match something at the current position
  • // in the subject. If they succeed in matching anything, they
  • // return the inline matched, advancing the subject.
  • // Attempt to parse backticks, adding either a backtick code span or a
  • // literal sequence of backticks.
  • var parseBackticks = function(block) {
  • var ticks = this.match(reTicksHere);
  • if (!ticks) {
  • return 0;
  • }
  • var afterOpenTicks = this.pos;
  • var foundCode = false;
  • var matched;
  • var node;
  • while (!foundCode && (matched = this.match(reTicks))) {
  • if (matched === ticks) {
  • node = new Node('Code');
  • node.literal = this.subject.slice(afterOpenTicks,
  • this.pos - ticks.length)