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

Provide end-of life messaging and disable on source interface after Xenial EOL #5789

Merged
merged 2 commits into from
Feb 19, 2021

Conversation

sssoleileraaa
Copy link
Contributor

@sssoleileraaa sssoleileraaa commented Feb 13, 2021

Status

Ready for review

Description of Changes

Resolves #5688

Needs review of messaging to admins/source/journalists.

Changes proposed in this pull request:

Testing

  1. build both xenial and focal securedrop-app-code debs off of this pr branch with the edit from step 1
  2. install one on your home server to make sure app armor changes are working and install the other on a staging vm
  3. log into the journalist interface
  4. visit the source interface
    • for xenial, confirm you see that the interface is disabled
    • for focal, confirm you see that the interface is enabled
  5. change the dates in source_app/disable.py and jouranlist_app/os_eol.py to year 2020 instead of 2021
  6. build the debs and install again
  7. log into the journalist interface
  8. visit the source interface
    • for xenial, confirm you see that the interface is disabled
    • for focal, confirm you see that the interface is enabled

New test

  1. log into the source interface on a dev server
  2. change EOL date so that the source interface is disabled
  3. try hitting endpoints while source interface is disabled
    • you see a message about securedrop being unavailable
    • no logout button shows up
  4. change EOL date so that the source interface is not longer disabled
  5. try hitting endpoints
    • verify that you have to log in again

Checklist

  • Linting (make lint) and tests (make test) pass in the development container
  • I have updated AppArmor rules to include the change

@lgtm-com
Copy link

lgtm-com bot commented Feb 13, 2021

This pull request introduces 6 alerts when merging 6973797 into f4b7805 - view on LGTM.com

new alerts:

  • 5 for Unused import
  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Feb 13, 2021

This pull request introduces 1 alert when merging 6e382b5 into f4b7805 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Feb 13, 2021

This pull request introduces 1 alert when merging 2f99b13 into f4b7805 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@emkll emkll changed the title V2 and xenial eol Provide end-of life messaging and disable on source interface after Xenial EOL Feb 15, 2021
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 @creviera , I've gone through the test plan on a staging instance and functionally everything is working with the exception of the instance's logo (see below)

SI-disabled

This is because the decorators are applied for the org-logo route serving the icon, and not behind /static, so we may need to add the following changes to the decorators:

diff --git a/securedrop/source_app/decorators.py b/securedrop/source_app/decorators.py
index 2fae92b3d..786a80a3d 100644
--- a/securedrop/source_app/decorators.py
+++ b/securedrop/source_app/decorators.py
@@ -22,7 +22,7 @@ def ignore_static(f: Callable) -> Callable:
     a static resource."""
     @wraps(f)
     def decorated_function(*args: Any, **kwargs: Any) -> Any:
-        if request.path.startswith('/static'):
+        if request.path.startswith('/static')  or request.path == '/org-logo':
             return  # don't execute the decorated function
         return f(*args, **kwargs)
     return decorated_function

Good idea updating the language once the source interface is disabled:
si-disabled-ji

securedrop/journalist_app/os_eol.py Outdated Show resolved Hide resolved
securedrop/source_app/disable.py Outdated Show resolved Hide resolved
securedrop/journalist_templates/base.html Outdated Show resolved Hide resolved
@sssoleileraaa
Copy link
Contributor Author

This is because the decorators are applied for the org-logo route serving the icon, and not behind /static, so we may need to add the following changes to the decorators:

diff --git a/securedrop/source_app/decorators.py b/securedrop/source_app/decorators.py
index 2fae92b3d..786a80a3d 100644
--- a/securedrop/source_app/decorators.py
+++ b/securedrop/source_app/decorators.py
@@ -22,7 +22,7 @@ def ignore_static(f: Callable) -> Callable:
     a static resource."""
     @wraps(f)
     def decorated_function(*args: Any, **kwargs: Any) -> Any:
-        if request.path.startswith('/static'):
+        if request.path.startswith('/static')  or request.path == '/org-logo':
             return  # don't execute the decorated function
         return f(*args, **kwargs)
     return decorated_function

Trying to figure out why this doesn't work for me. The logo still doesn't show up.

@sssoleileraaa
Copy link
Contributor Author

Okay, the logo started showing up after I add that change ^ and uploaded a custom logo.

@eloquence eloquence added this to the 1.8.0 milestone Feb 17, 2021
@sssoleileraaa
Copy link
Contributor Author

sssoleileraaa commented Feb 17, 2021

In the case where someone is logged in during which the eol of the os is reached, we should log that user out before showing the "We're sorry, our SecureDrop is currently offline." Right now we show the logout button with the error message but the user actually won't be able to log out since everything is disabled.

Update

See new test (#5789 (comment)) to verify ^

@sssoleileraaa sssoleileraaa force-pushed the v2-and-xenial-eol branch 3 times, most recently from 4c56f48 to 68e332b Compare February 17, 2021 18:39
@sssoleileraaa
Copy link
Contributor Author

"ERROR: Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon" is the same error seen in #5798. Perhaps we are not configuring the daemon properly or something wrong with the image. This is from our config file:

  deb-tests-focal:
    docker:
      - image: cimg/python:3.7
    environment:
      LC_ALL: C.UTF-8
      LANG: C.UTF-8
    steps:
      - run: sudo apt-get update && sudo apt-get install -y make virtualenv enchant jq python3-dev build-essential rsync
      - checkout
      - setup_remote_docker
      - run:
          name: Test Debian package build on Focal
          command: |
            make ci-deb-tests-focal

versus xenial:

  deb-tests:
    docker:
      - image: cimg/python:3.7
    environment:
      LC_ALL: C.UTF-8
      LANG: C.UTF-8
    steps:
      - run: sudo apt-get update && sudo apt-get install -y make virtualenv enchant jq python3-dev build-essential rsync
      - checkout
      - setup_remote_docker
      - run:
          name: Test Debian package build
          command: |
            BRANCH_MATCH=$(devops/scripts/match-ci-branch.sh "^update-builder")
            if ! [[ $BRANCH_MATCH =~ ^found ]]; then echo "Skipping: ${BRANCH_MATCH}"; exit 0; fi
            make ci-deb-tests

🤔

@emkll
Copy link
Contributor

emkll commented Feb 18, 2021

rebased on latest develop after merge of #5801

@eloquence
Copy link
Member

I've committed to helping with UI/string review before merge.

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 @creviera for the changes. I went through the test plan and confirmed the functionality is still working as expected

I've added a minor suggestion inline to reduce the diff, since we will likely revert these changes once SecureDrop 2.0.0 is released and Xenial support is eliminated.

Once @eloquence's reviews the strings, I would ask that you please rebase/squash in a single commit.

I will be happy to provide final review once the steps above have been completed, otherrwise we should consider these changes approved.

{% if 'logged_in' in session %}
<a href="{{ url_for('main.logout') }}" class="btn pull-right" id="logout">{{ gettext('LOG OUT') }}</a>
<a href="{{ url_for('main.logout') }}" class="btn pull-right" id="logout">{{ gettext('LOG OUT') }}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like the changes on lines 37, 41, 44 and 46 are not strictly required here and make the diff more complicated to read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, i see. i was trying to mimic the code style i saw in other areas of the code. it looked like other areas of the code try to keep the indents of the html correct rather than the template code, but if you want i can revert to make it easier for you to review.

Copy link
Contributor

Choose a reason for hiding this comment

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

easier to review but also preserves a cleaner history, making it easier to revert changes in the future if/when this code is no longer be necessary (i.e. 2.0)

@eloquence
Copy link
Member

(Taking a look now.)

</div>
{% elif g.show_os_near_eol_warning %}
<div id="os-near-eol" class="alert-banner">
<img src="{{ url_for('static', filename='i/bang-circle.png') }}" width="20" height="20"> {{ gettext ('<strong>Critical Security:</strong>&nbsp;&nbsp;The operating system used by your SecureDrop servers is approaching its end-of-life on April 30, 2021. A manual update is urgently required to remain safe. Please contact your adminstrator. <a href="//securedrop.org/xenial-eol" rel="noreferrer">Learn More</a>') }}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I would say will reach its end-of-life on April 30 and not is approaching its end-of-life on April 30; the latter could be interpreted (and translated) to suggest that end-of-life will start approaching on April 30.

@@ -1,4 +1,4 @@
# Last Modified: Wed Oct 29 08:16:32 2014
# Last Modified: Wed Feb 10 16:27:32 2021
Copy link
Member

Choose a reason for hiding this comment

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

Clearly not the most well-maintained timestamp. ;-) Maybe we should just ditch it?

@eloquence
Copy link
Member

eloquence commented Feb 18, 2021

I verified

  • pre-EOL state
  • post-EOL state
  • Source Interface post-EOL state

in the Docker-based dev env. UI and strings look great to me; just one small recommended tweak.

@sssoleileraaa
Copy link
Contributor Author

sssoleileraaa commented Feb 18, 2021

the only reason id like to push back a little on the request to rebase into a single commit is because each unit is in a clear commit and we'll probably revisit these commits once focal approaches its EOL. the three commits are:

  • remove v2 and v2+v3 warning
  • disable source interface for xenial after april 30th
  • add server os eol warning

actually, it might make sense to combine the bottom two.

@emkll
Copy link
Contributor

emkll commented Feb 19, 2021

Good point, I agree: a separate commit to remove the v2/v2+v3 warnings makes sense here. I would still suggest squashing the two others, at your option.

Allie Crevier added 2 commits February 19, 2021 10:43
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!

@emkll emkll merged commit 33f94c9 into develop Feb 19, 2021
@emkll emkll deleted the v2-and-xenial-eol branch February 19, 2021 22:00
@kushaldas kushaldas mentioned this pull request Feb 26, 2021
27 tasks
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.

Add EOL warning and disable Source Interface on instances running Ubuntu 16.04 after April 30
3 participants