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

add centralized logging VM #340

Merged
merged 2 commits into from
Dec 18, 2019
Merged

add centralized logging VM #340

merged 2 commits into from
Dec 18, 2019

Conversation

redshiftzero
Copy link
Contributor

@redshiftzero redshiftzero commented Nov 18, 2019

Fixes #19, integrating the logging service @kushaldas wrote (which works beautifully based on qubesbuilder.BuildLog) using a new centralized logging VM:

  • Adds a non-networked sd-log AppVM which starts on boot
  • Allows RPC calls to sd-log from any sd-workstation tagged VM

Testing

  1. make all should provision the sd-log VM
  2. You can test this functionally using this branch from securedrop-client. When you run the client, you should see logs continue to appear in ~/.securedrop_client/logs/ as well as in the sd-log AppVM in ~/QubesIncomingLogs
  3. new tests should pass (make test)

TODO after merge:

  1. Add the qubes logging handler on all the Python subcomponents of the workstation
  2. Go through each subcomponent/VM and audit the logging that is currently performed
    (will file more detailed followups about these things)

@redshiftzero
Copy link
Contributor Author

(lint failure is due to a file that we're going to package up anyway so not fixing for now)

@redshiftzero
Copy link
Contributor Author

(note that I still need to update the docs and rpm-build/SPECS/securedrop-workstation-dom0-config.spec for this)

@redshiftzero
Copy link
Contributor Author

rebased on top of latest master and tested, all looks good except freedomofpress/securedrop-builder#107 needs addressing before this is ready for review

@redshiftzero redshiftzero marked this pull request as ready for review December 13, 2019 00:58
@redshiftzero redshiftzero changed the title [wip] add centralized logging VM add centralized logging VM Dec 13, 2019
@redshiftzero
Copy link
Contributor Author

@emkll expressed interest in looking at this in particular so let's hold off on merge until he gets a chance to review

Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

The PR needs a rebase against master, behind 16 commits. That caused an endless loop of errors related to stretch apt repos for me. Was really confused why.

We should also add that sd-upgrade-templates sls dependency (which @emkll was working on) to the vm (after #372 gets merged).

Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

Thanks @redshiftzero I've had a few issues setting up (see comments inline and error below).
I've built securedrop-client on the branch, but i suspect I am missing a wheel/package during the build:

  • checkout centralized-logging branch, python3 setup.py dist
  • checkout master is packaging repo, make securedrop-client
  • the build completes without error but running the client fails:
user@sd-svs:~$ securedrop-client 
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 2f363b3d680e, init
INFO  [alembic.runtime.migration] Running upgrade 2f363b3d680e -> fecf1191b6f0, remove decryption_vs_content contraint
INFO  [alembic.runtime.migration] Running upgrade fecf1191b6f0 -> bafdcae12f97, Add files.original_filename
INFO  [alembic.runtime.migration] Running upgrade bafdcae12f97 -> 36a79ffcfbfb, add first_name, last_name, fullname, initials
INFO  [alembic.runtime.migration] Running upgrade 36a79ffcfbfb -> 86b01b6290da, add reply draft
Traceback (most recent call last):
  File "./bin/sd-client", line 5, in <module>
    from securedrop_client.app import run
  File "/opt/venvs/securedrop-client/lib/python3.7/site-packages/securedrop_client/app.py", line 38, in <module>
    from oqubeslogging import OQubesLog
ModuleNotFoundError: No module named 'oqubeslogging'
user@sd-svs:~$ 

Am I missing something when building the client deb?

[1] : https://www.qubes-os.org/doc/salt/
[2]: https://www.qubes-os.org/doc/resize-disk-image/

dom0/sd-log.sls Show resolved Hide resolved
tests/test_log_vm.py Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@redshiftzero
Copy link
Contributor Author

thanks, will fix, rebase (likely on top of #372) then ping for re-review

@redshiftzero
Copy link
Contributor Author

still testing but heads up, my expectation is that the branch above for securedrop-client is used in the staging environment in sd-svs (I haven't made that branch work with the packaged code as that handler will be (eventually) included as a dependency, but I can if using staging is too annoying)

@redshiftzero
Copy link
Contributor Author

OK this should be ready for another spin

emkll
emkll previously approved these changes Dec 16, 2019
Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @redshiftzero , changes look good, tested as follows:

Clean install testing

  • make all should provision the sd-log VM
  • You can test this functionally using this branch from securedrop-client. When you run the client, you should see logs continue to appear in ~/.securedrop_client/logs/ as well as in the sd-log AppVM in ~/QubesIncomingLogs (see [1] below, but logging feature is functional 🎉 )
  • new tests should pass (make test)
  • make clean removes the rpc policies

Upgrade testing

  • make sd-log sd-log VM
  • You can test this functionally using this branch from securedrop-client. When you run the client, you should see logs continue to appear in ~/.securedrop_client/logs/ as well as in the sd-log AppVM in ~/QubesIncomingLogs (see [1] below, but logging feature is functional 🎉 )
  • new tests should pass (make test)

I just realized after make clean that the dev-requirements in the client repo are out of sync [2], will open a PR over there .

Approving but not merging as @kushaldas requested changes
[1]:

user@sd-log:~/QubesIncomingLogs/sd-svs$ cat log_2019-12-16_22-07-29 
2019-12-16 22:07:29.563389 +0000 > starting log
2019-12-16 22:07:29.563875 +0000 sd-svs: Starting SecureDrop Client 0.0.9
2019-12-16 22:07:48.231374 +0000 sd-svs: Completed API call. Cleaning up and running callback.
2019-12-16 22:07:48.231457 +0000 sd-svs: user successfully logged in
2019-12-16 22:07:48.252780 +0000 sd-svs: Unrecoverable error
2019-12-16 22:07:48.252859 +0000 sd-svs: Traceback (most recent call last):
2019-12-16 22:07:48.252881 +0000 sd-svs:   File "/home/user/securedrop-client/securedrop_client/logic.py", line 259, in <lambda>
2019-12-16 22:07:48.252899 +0000 sd-svs:     lambda: self.completed_api_call(new_thread_id, success_callback))
2019-12-16 22:07:48.252917 +0000 sd-svs:   File "/home/user/securedrop-client/securedrop_client/logic.py", line 302, in completed_api_call
2019-12-16 22:07:48.252931 +0000 sd-svs:     user_callback(result_data)
2019-12-16 22:07:48.252948 +0000 sd-svs:   File "/home/user/securedrop-client/securedrop_client/logic.py", line 324, in on_authenticate_success
2019-12-16 22:07:48.252963 +0000 sd-svs:     self.api.journalist_first_name,
2019-12-16 22:07:48.252979 +0000 sd-svs: AttributeError: 'API' object has no attribute 'journalist_first_name'
2019-12-16 22:07:48.322761 +0000 > closing log

[2]https://github.com/freedomofpress/securedrop-client/blob/centralized-logging/dev-requirements.txt#L161

README.md Show resolved Hide resolved
Copy link
Contributor

@emkll emkll left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!
Went through another round of local testing:

  • make sd-log
  • make remove-sd-log
  • make sd-log
  • ✔️ make test
  • ✔️ test functionality with securedrop-client as described in the description

@emkll emkll merged commit f4ae1e4 into master Dec 18, 2019
@emkll emkll deleted the centralized-logging branch December 18, 2019 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging
3 participants