Skip to content

TSIG secret can also be a path to a file, but what's the formula? #709

Description

@jpmens

cascade 0.1.0-beta2-dev at 2f9fee2

I was provoked by the sentence

Can also be a path to a file containing the Base64 encoded secret key material

in the help text of cascade tsig add --help.

It would appear that if a file exists, its content is used, otherwise the specified SECRET. I think this ought to be briefly documented in the help text.

filename which looks like base64 is used

$ echo "vmvBDFsB2vX5C0QqRUmuVMOvr52a3MgfQRu65hsRhM4=" > $(echo J | base64)
$ ls -l S*
-rw-rw-r-- 1 jpm jpm 45 Jun  7 06:55 'Sgo='

$ cat Sgo= 
vmvBDFsB2vX5C0QqRUmuVMOvr52a3MgfQRu65hsRhM4=

$ cascade tsig add sunday1 hmac-sha256 Sg*
Added TSIG key 'sunday1'

$ jq .map.sunday1 < tsig-keys.db 
{
  "alg": "hmac-sha256",
  "data": "vmvBDFsB2vX5C0QqRUmuVMOvr52a3MgfQRu65hsRhM4="
}

use base64 secret

$ echo JP | base64
SlAK

$ cascade tsig add sunday2 hmac-sha256 SlAK
Added TSIG key 'sunday2'

$ jq .map.sunday2 < tsig-keys.db 
{
  "alg": "hmac-sha256",
  "data": "SlAK"
}

use any old clear text

$ cascade tsig add sunday3 hmac-sha256 blabla17
Added TSIG key 'sunday3'

$ jq .map.sunday3 < tsig-keys.db 
{
  "alg": "hmac-sha256",
  "data": "blabla17"
}

and I lose track because file is ENOENT, but it is valid base64 :-D

$ cascade tsig add sunday4 hmac-sha256 /tmp/404
Added TSIG key 'sunday4'

$ jq .map.sunday4 < tsig-keys.db 
{
  "alg": "hmac-sha256",
  "data": "/tmp/404"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions