{ssh&vars}

how to forward envars through ssh ...

13 02 2023

puffy$ export myvar="SuperSecret" 

puffy$ ssh localhost              
Last login: Mon Feb 13 15:53:47 2023 from 127.0.0.1
OpenBSD 7.2 (GENERIC.MP) #6: Sat Jan 21 01:03:04 MST 2023

Welcome to OpenBSD: The proactively secure Unix-like operating system.

puffy$ env |grep myvar
puffy$ 
# PRESENTING CODE

vars not forwarded ...

# /etc/ssh/sshd_config

...
Match Address localhost
  AcceptEnv               myvar
  AllowAgentForwarding    yes


# /etc/ssh/ssh_config

Host localhost
  ForwardAgent          yes
  SendEnv               myvar
...


# restart sshd
doas rcctl restart sshd
# PRESENTING CODE

update sshd_config, ssh_config

puffy$ export myvar="TopSecret1234" 
puffy$ env |grep myvar
myvar=TopSecret1234

puffy$ ssh localhost                
Last login: Mon Feb 13 19:36:07 2023 from 127.0.0.1
OpenBSD 7.2 (GENERIC.MP) #6: Sat Jan 21 01:03:04 MST 2023

Welcome to OpenBSD: The proactively secure Unix-like operating system.

puffy$ env |grep myvar
myvar=TopSecret1234
# PRESENTING CODE

and now ... ?

Get in touch

or check my blog ...

https://blog.stoege.net

twitter: @stoege