diff --git a/install_files/ansible-base/group_vars/securedrop_application_server.yml b/install_files/ansible-base/group_vars/securedrop_application_server.yml index 761a2c2fe47..5cc4a0f1f66 100644 --- a/install_files/ansible-base/group_vars/securedrop_application_server.yml +++ b/install_files/ansible-base/group_vars/securedrop_application_server.yml @@ -7,7 +7,7 @@ ip_info: ### Used by the install_local_deb_pkgs role ### local_deb_packages: - "securedrop-keyring-0.1.2+{{ securedrop_app_code_version }}-amd64.deb" - - "securedrop-config-0.1.2+{{ securedrop_app_code_version }}-amd64.deb" + - "securedrop-config-0.1.3+{{ securedrop_app_code_version }}-amd64.deb" - "securedrop-ossec-agent-3.0.0+{{ securedrop_app_code_version }}-amd64.deb" - "{{ securedrop_app_code_deb }}.deb" - "ossec-agent-3.0.0-amd64.deb" diff --git a/install_files/ansible-base/group_vars/securedrop_monitor_server.yml b/install_files/ansible-base/group_vars/securedrop_monitor_server.yml index 921c639b45f..45db3040cb4 100644 --- a/install_files/ansible-base/group_vars/securedrop_monitor_server.yml +++ b/install_files/ansible-base/group_vars/securedrop_monitor_server.yml @@ -7,7 +7,7 @@ ip_info: ### Used by the install_local_deb_pkgs role ### local_deb_packages: - "securedrop-keyring-0.1.2+{{ securedrop_app_code_version }}-amd64.deb" - - "securedrop-config-0.1.2+{{ securedrop_app_code_version }}-amd64.deb" + - "securedrop-config-0.1.3+{{ securedrop_app_code_version }}-amd64.deb" - "securedrop-ossec-server-3.0.0+{{ securedrop_app_code_version }}-amd64.deb" - ossec-server-3.0.0-amd64.deb diff --git a/install_files/ansible-base/roles/common/files/bashrc_securedrop_additions b/install_files/ansible-base/roles/common/files/bashrc_securedrop_additions deleted file mode 100644 index a0797bb7647..00000000000 --- a/install_files/ansible-base/roles/common/files/bashrc_securedrop_additions +++ /dev/null @@ -1,9 +0,0 @@ -# If not running interactively, do not do anything -[[ $- != *i* ]] && return - -# Auto-launch tmux on login -# https://wiki.archlinux.org/index.php/Tmux#Start_tmux_on_every_shell_login -if which tmux >/dev/null 2>&1; then - #if not inside a tmux session, and if no session is started, start a new session - test -z "$TMUX" && (tmux attach || tmux new-session) -fi \ No newline at end of file diff --git a/install_files/ansible-base/roles/common/tasks/create_users.yml b/install_files/ansible-base/roles/common/tasks/create_users.yml index f3382c7b250..56b5bd414ff 100644 --- a/install_files/ansible-base/roles/common/tasks/create_users.yml +++ b/install_files/ansible-base/roles/common/tasks/create_users.yml @@ -23,17 +23,6 @@ - users - sudoers -- name: Set SecureDrop bash profile additions. - copy: - src: bashrc_securedrop_additions - dest: /etc/profile.d/securedrop_additions.sh - owner: root - group: root - mode: "0644" - tags: - - users - - environment - # Backwards-compatibility. Previously, the SecureDrop bashrc additions # for forcing a terminal multiplexer during interactive login sessions were # added to ~/.bashrc for each admin user account. It's cleaner to add the diff --git a/install_files/securedrop-config/DEBIAN/control b/install_files/securedrop-config/DEBIAN/control index abee3880f1b..a46e87002c5 100644 --- a/install_files/securedrop-config/DEBIAN/control +++ b/install_files/securedrop-config/DEBIAN/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: SecureDrop Team Homepage: https://securedrop.org Package: securedrop-config -Version: 0.1.2+0.13.0~rc1 +Version: 0.1.3+0.13.0~rc1 Architecture: all Description: Establishes baseline system state for running SecureDrop. Configures apt repositories. diff --git a/install_files/securedrop-config/etc/profile.d/securedrop_additions.sh b/install_files/securedrop-config/etc/profile.d/securedrop_additions.sh new file mode 100644 index 00000000000..e6358c03fd4 --- /dev/null +++ b/install_files/securedrop-config/etc/profile.d/securedrop_additions.sh @@ -0,0 +1,17 @@ +[[ $- != *i* ]] && return + +which tmux >/dev/null 2>&1 || return + +function tmux_attach_via_proc() { + pid=$(pgrep --newest tmux) + if test -n "$pid" + then + /proc/$pid/exe attach + fi + return 1 +} + +if test -z "$TMUX" +then + (tmux attach || tmux_attach_via_proc || tmux new-session) +fi diff --git a/molecule/testinfra/staging/common/test_user_config.py b/molecule/testinfra/staging/common/test_user_config.py index 3dc6051d3a6..2e67f2eb647 100644 --- a/molecule/testinfra/staging/common/test_user_config.py +++ b/molecule/testinfra/staging/common/test_user_config.py @@ -1,3 +1,5 @@ +import hashlib +import os import re @@ -38,16 +40,19 @@ def test_sudoers_tmux_env(host): the corresponding settings there. """ - f = host.file('/etc/profile.d/securedrop_additions.sh') - non_interactive_str = re.escape('[[ $- != *i* ]] && return') - tmux_check = re.escape('test -z "$TMUX" && (tmux attach ||' - ' tmux new-session)') + host_file = host.file('/etc/profile.d/securedrop_additions.sh') + source_file = os.path.abspath( + os.path.join( + os.path.dirname(__file__), + '../../../../install_files/securedrop-config/etc/profile.d', + 'securedrop_additions.sh' + ) + ) + expected_content = open(source_file).read() + h = hashlib.sha256() + h.update(expected_content) - assert f.contains("^{}$".format(non_interactive_str)) - assert f.contains("^if which tmux >\/dev\/null 2>&1; then$") - - assert 'test -z "$TMUX" && (tmux attach || tmux new-session)' in f.content - assert f.contains(tmux_check) + assert host_file.sha256sum == h.hexdigest() def test_tmux_installed(host):