mirror of
https://github.com/ovh/the-bastion.git
synced 2026-05-09 16:35:33 +02:00
[GH-ISSUE #114] -osh selfPlaySession doesn't play saved sessions on CentOS #27
Labels
No labels
answered
bug
documentation
enhancement
enhancement
feature
feature
kept-open-for-info
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/the-bastion#27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @extrad on GitHub (Jan 10, 2021).
Original GitHub issue: https://github.com/ovh/the-bastion/issues/114
Thank you, guys, you're doing a fantastic job here.
There are small issues that are not working meanwhile:
I'm playing with a fresh CentOS 7 bastion installation (the-bastion-3.01.03), CentOS Linux release 7.9.2009.
The ttyrec-sessions are saved nicely and can be viewed locally through ttyplay but -osh selfPlaySession always returns "There were no terminal recording for this session" (the ids of the saved session on the disk system and returned via "selfListSessions" - are the same.
@speed47 commented on GitHub (Jan 11, 2021):
Hello @extrad , thanks for taking the time to post this issue.
The "There were no terminal recording for this session" message you get appears when we don't have any ttyrec file name stored in the account's local sqlite database for a given session. This is expected if the session was not an ssh connection but just an osh command, for example "--osh help" or such. However if you're trying to play an ssh session, and you can find a file on the local file system with the same ID, this is unexpected.
For a given session ID where you can reproduce the problem (you get the "no terminal recording" message but can find the ttyrec file on the local filesystem), could you dump the sqlite row for this database, this way:
bastion# sqlite3 -readonly -line /home/ACCOUNT/ACCOUNT-log-202101.sqlite "select * from connections where uniqid='SESSIONID'"Of course replacing ACCOUNT and SESSIONID with the proper values you have.
You should get an output like this:
The
ttyrecfilecolumn is whatselfPlaySessionuses to find the ttyrec file name to play from the local filesystem.@extrad commented on GitHub (Jan 11, 2021):
Yes, for some reason the 'ttyrecfile' field is empty in that case (though the correct filename can still be seen in 'params').
I don't know if it's related but in my case 'timestampend', 'timestampendusec' and 'returnvalue' are empty when comparing your output to mine.
@speed47 commented on GitHub (Jan 12, 2021):
Interesting, this would mean the bastion couldn't log those values at the end of the connection. Was the connection terminated in an "abrupt way"? Do you have a returnvalue and comment, or are those empty too?
In any case, the ttyrecfile column is filled at the beggining of the connection, not at the end, so if the "params" is filled, the "ttyrecfile" column should be too. I'll try to dig in the code around that part to see why it could happen. Do you have this behaviour often? all the time? only on rare cases?
EDIT: what version are you using? The latest stable release or the latest commit on the main branch?
@extrad commented on GitHub (Jan 12, 2021):
Latest commit on the main branch. I'm getting this behaviour every time.
sqlite3 -line /home/ACCOUNT/ACCOUNT-log-202101.sqlite "select * from connections where uniqid='25afc639433e'" id = 83 timestamp = 1610457171 timestampusec = 767349 account = ACCOUNT cmdtype = ssh allowed = 1 hostfrom = x.x.x.x ipfrom = x.x.x.x portfrom = 63275 bastionip = y.y.y.y bastionport = 22 hostto = chantal ipto = z.z.z.z portto = 22 user = root plugin = ttyrecfile = ttyrecsize = params = ttyrec -f /home/ACCOUNT/ttyrec/x.x..12.22/2021-01-12.08-12-51.766201.25afc639433e.ACCOUNT.root.x.x..12.22.22.ttyrec -F /home/ACCOUNT/ttyrec/x.x..12.22/%Y-%m-%d.%H-%M-%S.#usec#.25afc639433e.ACCOUNT.root.x.x..12.22.22.ttyrec -- /usr/bin/ssh x.x..12.22 -l root -p 22 -i /home/keykeeper/keyoperators/id_ed25519_operators.1610288534 -o PreferredAuthentications=publickey timestampend = timestampendusec = returnvalue = comment = uniqid = 25afc639433e@speed47 commented on GitHub (Jan 12, 2021):
OK, this is a regression from a commit between the latest release and the current release candidate (just out 1 hour ago), thanks for the report, fortunately the fix is easy!
BTW, it's advised to always use the latest stable tagged version, as outlined in the install doc, you're less likely to bump into little bugs like that, the main branch is always usable and should never be completely broken, but as some big code chunks are merged, it can take some time to stabilize and catch the few bugs that made it past the tests ;)
Now if course if you did it on purpose, that's also fine: it helps squashing potential bugs between releases! I'm preparing the fix.
@speed47 commented on GitHub (Jan 12, 2021):
#119 should be merged soon.
@speed47 commented on GitHub (Jan 14, 2021):
v3.01.99-rc2 is out, with a fix for this
@extrad commented on GitHub (Jan 14, 2021):
Can confirm that it's working fine now, thanks for the prompt updates.