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

Remove special casing for sd-whonix #618

Merged
merged 1 commit into from Oct 14, 2020
Merged

Remove special casing for sd-whonix #618

merged 1 commit into from Oct 14, 2020

Conversation

eloquence
Copy link
Member

@eloquence eloquence commented Oct 2, 2020

Part of #583

Description

Removes Salt logic for custom handling of whonix-gw-15 integration with sd-log and instead treats it like any other TemplateVM.

Removes the vmname testing from dom0 tests. The functionality remains in securedrop-log, but is only likely to be used during development.

Status

Ready for review.

Test plan

Prerequisites

Instructions

  1. Remove ~/QubesIncomingLogs/host directory on sd-log if it exists from previous runs
  2. make clone from this branch.
  3. make staging with a valid config. This will apply the Salt states from this PR.
  4. Ensure the sd-whonix VM, the sd-app VM, and the sd-log VM are all booted.
  • On sd-whonix: Observe that /rw/config/rc.local no longer contains any customizations
  • On sd-whonix: Observe that /rw/config/sdlog.conf no longer exists.
  • On sd-log: Observe that no files exist under host in ~/QubesIncomingLogs
  • On sd-log: Observe that logs are correctly ingested under sd-whonix.
  • On sd-log: Observe that logs are correctly ingested under sd-app.
  1. make clean in dom0.
  • On whonix-gw-15: Observe that /etc/rsyslog.d/sdlog.conf has been removed

- source: "salt://sdlog.conf"

# Because whonix-gw-15 template is not allowing to create the config file on
# package install time, we do it via rc.local call.
Copy link
Member Author

@eloquence eloquence Oct 6, 2020

Choose a reason for hiding this comment

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

For the record, this was added in 232c56f. @kushaldas, can you elaborate on what you meant at the time with "whonix-gw-15 template is not allowing to create the config file on package install time"? As far as I can tell, the config file /etc/rsyslog.d/sdlog.conf is installed just fine from the securedrop-log package, and I've not observed any behavior specific to whonix-gw-15 that would prevent this from being the case.

Copy link
Contributor

Choose a reason for hiding this comment

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

#447 this is the PR and as I can see in my logs, the file was still missing even after the package was installed.

Here is my note from that work:

* https://github.com/freedomofpress/securedrop-workstation/pull/447  howt to remove the files?
  - how to remove gpg key? sudo apt-key del KEY_ID
  - `make clean`
  - remove works properly 
  - `make all` agagin.
  - most of the vms decided not to reply to Qubes calls :(
  - cleaned, and `make all` again 
  - Someday Qubes and Salt will play nicely together. Question is in which year?
  - this try, the package is there, but, no logs. 
  - because the sdlog.conf file is missing, WHY WHY WHY
  - I this before, i commented on the issue, dpkg did not create the sdlog.conf file at all on the system.
  - one idea, if the file is missing, just copy it over via rc.local file
  - testing again 
  - testing again, adding sdlog.conf only for sd-whonix if missing.
  - testing once more, things look better now
  - meeting with Mickael
  - need to test some more changes
  - make clean and make all again at super late night :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @kushaldas, I experienced this once during testing with dpkg, and in my experience it happens when you've previously removed the file by hand and uninstalled (rather than purged) the package - regardless of the order of the two operations. It's not specific to Whonix, and is just how Debian handles configuration files. Because we purge the file correctly with our uninstall logic, I don't believe it should be an issue on production systems.

@@ -14,7 +14,6 @@ remove-securedrop-log-package-from-whonix:
sd-cleanup-whonix-gw-15:
cmd.run:
- names:
- sudo rm -f /etc/rsyslog.d/sdlog.conf
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that we use pkg.purged to remove the securedrop-log package, which removes config files:

Verify that a package is not installed, calling pkg.purge if necessary to purge the package. All configuration files are also removed.

Removing a configuration file on a Debian system by other means can have unpredictable consequences: the package manager will not reinstate it , because it will assume that the user removed it intentionally. For this reason, I think it's best to rely on pkg.purged alone here.

@eloquence eloquence added this to Ready for Review in SecureDrop Team Board Oct 6, 2020
@eloquence
Copy link
Member Author

I've added a test plan. I would recommend the following order of operations:

  1. Initial visual review by @kushaldas of the logic changes here and in Use qubesdb-read instead of gethostname securedrop-log#18. Specifically, if there' s anything I'm overlooking that makes the use of /rw/config necessary for sd-whonix, that would be good to know (see comment here: Remove special casing for sd-whonix #618 (comment))
  2. Review and merge of Use qubesdb-read instead of gethostname securedrop-log#18
  3. Review and merge of this PR.

@conorsch
Copy link
Contributor

conorsch commented Oct 8, 2020

See comment in freedomofpress/securedrop-log#18 (review): we must also update the tests/test_sd_whonix.py checks here in order to get all tests passing!

@eloquence
Copy link
Member Author

eloquence commented Oct 9, 2020

we must also update the tests/test_sd_whonix.py checks here in order to get all tests passing!

Roger that, will update the tests on Tuesday and then promote to ready. :)

@eloquence eloquence moved this from Ready for Review to In Development in SecureDrop Team Board Oct 13, 2020
@eloquence eloquence removed the blocked label Oct 13, 2020
@eloquence eloquence marked this pull request as ready for review October 13, 2020 22:17
@eloquence
Copy link
Member Author

This is ready for review, but to take it for a spin with the associated securedrop-log changes, it would IMO be best to kick off a nightly build of that package; nightlies seem to have gotten stuck around October 5.

@eloquence eloquence moved this from In Development to Ready for Review in SecureDrop Team Board Oct 13, 2020
@@ -54,9 +54,6 @@ def test_sd_whonix_repo_enabled(self):
"""
assert self._fileExists(self.whonix_apt_list)

def test_logging_configured(self):
self.logging_configured(vmname=True)

Copy link
Contributor

Choose a reason for hiding this comment

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

The test_logging_configured shouldn't be removed, it should just have its call updated to pass no args (matching the modified test logic).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed (I misread the inheritance logic).

@conorsch
Copy link
Contributor

nightlies seem to have gotten stuck around October 5.

You're right! Resolved out of band. Latest version of securedrop-log is now served on apt-test, so testers should not see a sd-log:~/QubesIncomingLogs/host/ dir created any more.

Started, but did not finish review. Left one comment about the test logic—to any future reviewers, e.g. @zenmonkeykstop, please tack on a test if you agree. Also make sure to run make test as part of review, since we should see 100% of tests passing now.

We now handle this in the logger by avoiding reliance on
gethostname().

Enforce removal of sd-whonix configuration in /rw/config/rc.local
and ensure that /rw/config/sdlog.conf is absent.

Don't rm a file that's already being purged as part of
package removal.
@conorsch
Copy link
Contributor

Reviewing now!

@rmol rmol self-assigned this Oct 14, 2020
@rmol rmol moved this from Ready for Review to Under Review in SecureDrop Team Board Oct 14, 2020
Copy link
Contributor

@rmol rmol left a comment

Choose a reason for hiding this comment

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

👍 Ran through the test plan, and other than sd-app not being started by make staging, the changes specific to this PR look good and worked.

  1. Remove ~/QubesIncomingLogs/host directory on sd-log if it exists from previous runs
  2. make clone from this branch.
  3. make staging with a valid config. This will apply the Salt states from this PR.
  4. Ensure the sd-whonix VM, the sd-app VM, and the sd-log VM are all booted.

⚠️ sd-app was not booted after make staging completed.

  • On sd-whonix: Observe that /rw/config/rc.local no longer contains any customizations
  • On sd-whonix: Observe that /rw/config/sdlog.conf no longer exists.
  • On sd-log: Observe that no files exist under host in ~/QubesIncomingLogs
  • On sd-log: Observe that logs are correctly ingested under sd-whonix.
  • On sd-log: Observe that logs are correctly ingested under sd-app.
  1. make clean in dom0.
  • On whonix-gw-15: Observe that /etc/rsyslog.d/sdlog.conf has been removed

@conorsch
Copy link
Contributor

sd-app was not booted after make staging completed.

That makes sense: we don't actually enforce that state (although we should). So, my read of the test plan is "manually start those VMs before you proceed to the next step."

@rmol rmol merged commit 396ec0c into main Oct 14, 2020
SecureDrop Team Board automation moved this from Under Review to Done Oct 14, 2020
@rmol rmol deleted the 583-host-to-ghost branch October 14, 2020 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants