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

Allow systemd services to not rely on other per VM configuration #1677

Merged
merged 4 commits into from
May 23, 2024

Conversation

legoktm
Copy link
Member

@legoktm legoktm commented Dec 13, 2023

This PR was migrated from freedomofpress/securedrop-log#34

This change leverages systemd features to start certain services/operations conditionally based on hostname qubes services, allowing us to reduce the complexity of our provisioning logic, i.e. remove modifications to rc.local per VMs.

Partially fixes freedomofpress/securedrop-workstation#1033

Testing

  • CI passes
  • Check out Rely on systemd services for securedrop-log's provisioning securedrop-workstation#840 next to this working directory
  • Build debian packages for securedrop-log
  • setup securedrop-workstation on this branch from a clean install (or sdw-admin --uninstall)
  • Transfer the securedrop-log deb to sd-small-bullseye-template and sd-large-bullseye-template and install it
  • In sd-small-bullseye-template:
  • Shut down sd-small-bullseye-template
  • Confirm that in sd-gpg and sd-log:
    • /rw/config/rc.local in is empty
    • sudo systemctl status securedrop-logging-disabled shows a last successful run (but the service should be inactive since it has finished)
  • When running systemctl is-active securedrop-log-server in …
    • sd-gpg it returns inactive
    • sd-proxy it returns inactive
    • sd-log it returns active
  • When running systemctl status securedrop-logging-disabled in …
    • sd-log is shows a successful run
    • sd-gpg it shows a successful run
    • sd-proxy failed due to condition not met (/var/qubes/service/...)
  • sd-log still receives log output from sd-app, sd-proxy etc.
  • sd-log does not receive log output from sd-app, sd-proxy etc.
  • TBD testing during securedrop-workstation make dev (this requires nightly packages to test)

Order of operation for merging

To not waste CI time, I'd recommend merging in the following order:

  1. This PR
  2. Rely on systemd services for securedrop-log's provisioning securedrop-workstation#840

@deeplow
Copy link
Contributor

deeplow commented May 13, 2024

I have a working PR, but I am running into a situation that requires discussion: freedomofpress/securedrop-workstation#1033 (comment).

@deeplow deeplow force-pushed the log-no-more-rc-local-mods branch from ca949a4 to 9bdafea Compare May 21, 2024 10:00
@deeplow deeplow force-pushed the log-no-more-rc-local-mods branch 2 times, most recently from 42ad584 to 0c9aa5d Compare May 21, 2024 11:07
@deeplow deeplow marked this pull request as ready for review May 21, 2024 11:14
@deeplow deeplow requested a review from a team as a code owner May 21, 2024 11:14
@deeplow
Copy link
Contributor

deeplow commented May 21, 2024

This PR is now back into shape, ready for review.

@deeplow deeplow mentioned this pull request May 21, 2024
12 tasks
Copy link
Member Author

@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.

Just did a pass on the code, will do actual testing in a bit. Since I'm technically the PR owner I can't actually "request changes" :< but pretend I did :)

I really like the conceptual split between log client and log server.

Also for some reason, your git identity is set to deeplow <francisco at freedom.press>, with a literal "at" instead of @, which is throwing off github's account detection.

debian/securedrop-log.securedrop-logging-disabled.service Outdated Show resolved Hide resolved
debian/securedrop-log.install Outdated Show resolved Hide resolved
@legoktm legoktm self-assigned this May 22, 2024
@legoktm legoktm force-pushed the log-no-more-rc-local-mods branch from aa32259 to f5fbb5a Compare May 22, 2024 21:13
Copy link
Member Author

@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.

Test plan mostly checks out, except:

  • sd-log does not receive log output from sd-app, sd-proxy etc.

Did you mean to say it does not receive log output from sd-log and sd-gpg? If so, I verfied that.

Also do you want me to fix your git author metadata? Otherwise I think we're ready to land this \o/

@deeplow
Copy link
Contributor

deeplow commented May 23, 2024

Test plan mostly checks out, except:

   sd-log does not receive log output from sd-app, sd-proxy etc.

Did you mean to say it does not receive log output from sd-log and sd-gpg? If so, I verfied that.

That's a typo and even the opposite of the previous line. I'll remove it. I don't know what happened there.

@deeplow
Copy link
Contributor

deeplow commented May 23, 2024

Also do you want me to fix your git author metadata? Otherwise I think we're ready to land this \o/

Yes, please if you don't mind and have time today. Otherwise I'll do it tomorrow.

deeplow added 4 commits May 23, 2024 15:07
Securedrop-log had a lot of different files belonging to two
distinct architectural components: a server and a client with
no actual coupling. This change will help accommodate the creation
of separate systemd services for the client and server.

Refs securedrop-workstation#1004

NOTE: securedrop-log-saver and securedrop-redis-log now have python
extensions and their binary form is created through setup.py's
console scripts.
Adds the following qubes services for starting the server and
respective client components of securedrop logging. The new qubes
services are:
  - securedrop-log-client
  - securedrop-logging-disabled

Reasoning behind this change is in  securedrop-workstation#1004.
Rsyslog service should only start after this as explicitly stated
by the systemd `Before` parameter.
Even though keeping it in log_server_files would keep the clean
separation between client and server, since it's just one file, we
can keep in the log project root.
@legoktm legoktm force-pushed the log-no-more-rc-local-mods branch from f5fbb5a to d83764d Compare May 23, 2024 19:07
Copy link
Member Author

@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.

Approving, will find someone else to actually press the button :) Thanks to Michael for getting this started and @deeplow for pushing it across the line!

Copy link
Contributor

@zenmonkeykstop zenmonkeykstop left a comment

Choose a reason for hiding this comment

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

Stamping as per @legoktm's review.

@zenmonkeykstop zenmonkeykstop merged commit ce8e8a1 into main May 23, 2024
53 checks passed
@zenmonkeykstop zenmonkeykstop deleted the log-no-more-rc-local-mods branch May 23, 2024 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Refactor logging configuration from Salt (at provisioning) to systemd (at boot)
3 participants