Skip to content

Commit

Permalink
feat: add stealth_stderr/stdout ttyrec support, enable it for scp
Browse files Browse the repository at this point in the history
  • Loading branch information
speed47 committed Sep 18, 2023
1 parent ee149cb commit 981b216
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bin/admin/install
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ trap 'trap_exit' EXIT

declare -A opt

TTYREC_VERSION_NEEDED=1.1.6.1
TTYREC_VERSION_NEEDED=1.1.7.0

set_default_options()
{
Expand Down
2 changes: 1 addition & 1 deletion bin/admin/install-ttyrec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ action_static() {

# only used when/if the API is down and we're in CI mode
default_urls() {
local ver="1.1.6.7"
local ver="1.1.7.0"
local rpmver="${ver}-1"
local list="
-${rpmver}.aarch64.rpm
Expand Down
3 changes: 2 additions & 1 deletion bin/plugin/open/scp.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"execution_mode": "binary"
"execution_mode": "binary",
"stealth_stdout": true
}
30 changes: 19 additions & 11 deletions bin/shell/osh.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1054,17 +1054,25 @@ sub main_exit {

# build ttyrec command that'll prefix the real command
$fnret = OVH::Bastion::build_ttyrec_cmdline(
ip => $osh_command,
port => 0,
user => 0,
account => $self,
uniqid => $log_uniq_id,
home => $home,
realm => $realm,
remoteaccount => $remoteself,
debug => $osh_debug,
tty => $tty,
notty => $notty
ip => $osh_command,
port => 0,
user => 0,
account => $self,
uniqid => $log_uniq_id,
home => $home,
realm => $realm,
remoteaccount => $remoteself,
debug => $osh_debug,
tty => $tty,
notty => $notty,
stealth_stdout => OVH::Bastion::plugin_config(
plugin => $osh_command,
key => "stealth_stdout"
)->value ? 1 : 0,
stealth_stderr => OVH::Bastion::plugin_config(
plugin => $osh_command,
key => "stealth_stderr"
)->value ? 1 : 0,
);
main_exit(OVH::Bastion::EXIT_TTYREC_CMDLINE_FAILED, "ttyrec_failed", $fnret->msg) if !$fnret;

Expand Down
2 changes: 2 additions & 0 deletions lib/perl/OVH/Bastion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ sub build_ttyrec_cmdline_part1of2 {
push @ttyrec, '-v' if $params{'debug'};
push @ttyrec, '-T', 'always' if $params{'tty'};
push @ttyrec, '-T', 'never' if $params{'notty'};
push @ttyrec, '--stealth-stdout' if $params{'stealth_stdout'};
push @ttyrec, '--stealth-stderr' if $params{'stealth_stderr'};

my $fnret = OVH::Bastion::account_config(
account => $params{'account'},
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/fake_ttyrec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -- $(getopt -o 'ZcCupVhvanf:z:d:t:T:k:s:e:l:F:' -l "zstd,level:,verbose,append,cheatcodes,no-cheatcodes,shell-cmd:,dir:,output:,uuid:,no-openpty,lock-timeout:,kill-timeout:,msg:,count-bytes,term:,version,help,zstd-try,max-flush-time:,name-format:" -- "$@")
while [ "$1" != "--" ]; do
if [ "$1" = "-V" ]; then
echo "fake-ttyrec v1.1.6.1"
echo "fake-ttyrec v1.1.7.0"
exit 0
fi
shift
Expand Down

0 comments on commit 981b216

Please sign in to comment.