diff --git a/consts.go b/consts.go new file mode 100644 index 0000000..7daafd4 --- /dev/null +++ b/consts.go @@ -0,0 +1,11 @@ +// Common constants for the HKExSh +// +// Copyright (c) 2017-2018 Russell Magee +// Licensed under the terms of the MIT license (see LICENSE.mit in this +// distribution) +// +// golang implementation by Russ Magee (rmagee_at_gmail.com) +package hkexsh + +const Version = "0.5pre (NO WARRANTY)" + diff --git a/hkexnet/consts.go b/hkexnet/consts.go new file mode 100644 index 0000000..114d6b6 --- /dev/null +++ b/hkexnet/consts.go @@ -0,0 +1,37 @@ +// consts.go - consts for hkexnet + +// Copyright (c) 2017-2018 Russell Magee +// Licensed under the terms of the MIT license (see LICENSE.mit in this +// distribution) +// +// golang implementation by Russ Magee (rmagee_at_gmail.com) +package hkexnet + +const ( + KEX_HERRADURA = iota // this MUST be first for default if omitted in ctor + KEX_FOO + //KEX_DH + //KEX_ETC +) + +// const CSExtendedCode - extended (>255 UNIX exit status) codes +// This indicate channel-related or internal errors +const ( + CSENone = 32 + iota + CSEBadAuth // Failed login password + CSETruncCSO // No CSOExitStatus in payload + CSEStillOpen // Channel closed unexpectedly + CSEExecFail // cmd.Start() (exec) failed + CSEPtyExecFail // pty.Start() (exec w/pty) failed +) + +const ( + CSONone = iota // No error, normal packet + CSOHmacInvalid // HMAC mismatch detected on remote end + CSOTermSize // set term size (rows:cols) + CSOExitStatus // Remote cmd exit status + CSOChaff // Dummy packet, do not pass beyond decryption +) + +const MAX_PAYLOAD_LEN = 4*1024*1024*1024 - 1 + diff --git a/hkexnet/hkexnet.go b/hkexnet/hkexnet.go index 6a762ce..9a637c6 100644 --- a/hkexnet/hkexnet.go +++ b/hkexnet/hkexnet.go @@ -52,34 +52,6 @@ import ( // algo shall be used (eg., HerraduraKEx, [TODO: others...]) type KEX uint8 -const ( - KEX_HERRADURA = iota // this MUST be first for default if omitted in ctor - KEX_FOO - //KEX_DH - //KEX_ETC -) - -// const CSExtendedCode - extended (>255 UNIX exit status) codes -// This indicate channel-related or internal errors -const ( - CSENone = 32 + iota - CSEBadAuth // Failed login password - CSETruncCSO // No CSOExitStatus in payload - CSEStillOpen // Channel closed unexpectedly - CSEExecFail // cmd.Start() (exec) failed - CSEPtyExecFail // pty.Start() (exec w/pty) failed -) - -const ( - CSONone = iota // No error, normal packet - CSOHmacInvalid // HMAC mismatch detected on remote end - CSOTermSize // set term size (rows:cols) - CSOExitStatus // Remote cmd exit status - CSOChaff // Dummy packet, do not pass beyond decryption -) - -const MAX_PAYLOAD_LEN = 4*1024*1024*1024 - 1 - /*---------------------------------------------------------------------*/ type ( diff --git a/hkexsh/hkexsh.go b/hkexsh/hkexsh.go index a82237c..49be663 100755 --- a/hkexsh/hkexsh.go +++ b/hkexsh/hkexsh.go @@ -346,7 +346,7 @@ func rejectUserMsg() string { // connection (app-specific, passed through to the server to use or // ignore at its discretion). func main() { - version := "0.2pre (NO WARRANTY)" + version := hkexsh.Version var vopt bool var gopt bool //login via password, asking server to generate authToken var dbg bool diff --git a/hkexshd/hkexshd.go b/hkexshd/hkexshd.go index ea53657..6251ff7 100755 --- a/hkexshd/hkexshd.go +++ b/hkexshd/hkexshd.go @@ -352,15 +352,7 @@ func GenAuthToken(who string, connhost string) string { // Listener and Conns. The KEx and encrypt/decrypt is done within the type. // Compare to 'serverp.go' in this directory to see the equivalence. func main() { - // This string is purely arbitrary, and is based on the - // author's current impression of how near (and far) this - // code is to being useful in the real world. - // Version 1.0 is an idealistic fever-dream, filled with - // cryptographically-secure rainbows and unicorns flying - // high above the clouds, ignoring various government - // TLAs who shake their fists impotently at the happy - // scene above, where all communicate securely beyond their reach. - version := "0.5pre (NO WARRANTY)" + version := hkexsh.Version var vopt bool var chaffEnabled bool