Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically log into the client application #1188

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

deeplow
Copy link
Contributor

@deeplow deeplow commented Oct 2, 2024

Status

Ready for review

Description of Changes

Most of the time we're developing the client, we are not testing the login screen, and just want to quickly log in. With a combination of xdotool and oathtool, we can script typing the correct values and login.

It's a bit fragile for two reasons. First, we're just blindly typing, so if some other window takes focus or switch, it'll be typed into that window. Second, we're kicking off a background process that sleeps, launching the window in the foreground, and then the background process will do the typing into the foreground.

Adapted from work by @legoktm: freedomofpress/securedrop-client#2237

Testing

  • visual review
  • run make run-client
  • confirm that it asks you to install dependencies in dom0
  • install dependencies (xdotool and oathtool)
  • run again make run-client

Deployment

dev-facing - no deployment considerations

Checklist

If you have made changes to the provisioning logic

  • All tests (make test) pass in dom0

If documentation is required

  • I have opened a PR in the docs repo for these changes, or will do so later
  • I would appreciate help with the documentation

Most of the time we're developing the client, we are not testing the
login screen, and just want to quickly log in. With a combination of
xdotool and oathtool, we can script typing the correct values and login.

It's a bit fragile for two reasons. First, we're just blindly typing, so
if some other window takes focus or switch, it'll be typed into that
window. Second, we're kicking off a background process that sleeps,
launching the window in the foreground, and then the background process
will do the typing into the foreground.

Adapted from work by @legoktm [1]

[1]: freedomofpress/securedrop-client#2237
Copy link
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome \o/ left a suggestion!

Makefile Outdated
@echo 'please install oathtool with "sudo qubes-dom0-update oathtool"'
@false
endif
sdw-updater
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe qvm-run sd-app securedrop-client so it doesn't accidentally trigger the updater and type into it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. How does d75911b sound? I preferred to run the desktop file like the launcher does instead of the client application itself.

Makefile Outdated
@@ -7,6 +7,11 @@ CONTAINER := $(if $(shell grep "Thirty Seven" /etc/fedora-release),,./scripts/co

HOST=$(shell hostname)

# Client autologin variables
CLIENT_TOTP=$(shell oathtool --totp --base32 JHCOGO7VCER3EJ4L --start-time "$(shell date -d "+5 seconds" +"%Y-%m-%d %H:%M:%S")")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just inline this below instead of putting it at the top

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Addressed in 9c97d7d

@legoktm legoktm self-assigned this Oct 2, 2024
Starting the launcher could lead to autotyping into launcher
application instead of the client login prompt.
@deeplow
Copy link
Contributor Author

deeplow commented Oct 28, 2024

@legoktm what shall we do regarding this one. Shall we close it, unmerged?

@deeplow
Copy link
Contributor Author

deeplow commented Nov 4, 2024

@legoktm from a team meeting my understanding is that this is mergeable, actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Under Review
Development

Successfully merging this pull request may close these issues.

2 participants