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

(t) Samba shares not accessible 5.0.6-0 & 5.0.7-0 #2794

Closed
Hooverdan96 opened this issue Jan 31, 2024 · 4 comments
Closed

(t) Samba shares not accessible 5.0.6-0 & 5.0.7-0 #2794

Hooverdan96 opened this issue Jan 31, 2024 · 4 comments
Assignees

Comments

@Hooverdan96
Copy link
Member

Hooverdan96 commented Jan 31, 2024

Thanks to forum user Mark93, it appears that in the latest testing channels (5.0.6 & 5.07) samba shares are not accessible and fail in the area related to the recently revamped secrets management. For details of symptoms and troubleshooting refer to the thread:

SMB Shares inaccessible after update to 5.0.6-0

@FroggyFlox has identified a possible fix for this situation here:

Comment 18.

If that is indeed the solve, two questions (and they can be handled in separate issues):

  • will other services be affected in a similar manner?
  • since that environment variable is used in multiple places now, can the keyring directory path be parameterized, so if in the future design decisions affect its location, it does not have to be adjusted in multiple places?
@phillxnet phillxnet added this to the 5.1.X-X Stable release milestone Feb 1, 2024
@phillxnet
Copy link
Member

Adding associated forum reporters:
Warbucks, DrHolzer, Tex1954, McFaul.

@phillxnet phillxnet self-assigned this Feb 5, 2024
@phillxnet phillxnet changed the title (t) Samba shares not accessible after testing channel upgrade (affecting upgrades to 5.0.6-0 & 5.0.7-0) (t) Samba shares not accessible after testing channel upgrade too 5.0.6-0 & 5.0.7-0 Feb 5, 2024
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 5, 2024
….6-0 & 5.0.7-0 rockstor#2794

Introduce 'poetry-plugin-dotenv' to enable Poetry to establish
environmental variables from a .env file. Add PASSWORD_STORE_DIR
variable to inform OS level 'password-store' app of our configuration.

## Includes:
- Additional logging to poetry-install.txt to indicate plugins installed.
- modify export statement for PASSWORD_STORE_DIR in build.sh, this is also
now set via our recent rockstor-build.service file.
@phillxnet
Copy link
Member

phillxnet commented Feb 5, 2024

It would be nice to have a linux cli client reproducer for this, i.e. a command line smbclient command or the like to reproduce the issue. We then have a simple proof of fix reproducer. A pull request is now in the works (draft - in-development status).

@Hooverdan96
Re:

... since that environment variable is used in multiple places now, can the keyring directory path be parameterized,

The hope is we can clean this up a tad. Take a look at the linked draft PR, I think on the poetry side we can use the indicated plugin (yet to be proven), but I'm hoping we can use this same file equally in systemd scripts via EnvironmentFile= or the like. Still a work in progress however. And likely also in bash scripts via source: again still as yet untested as I'm not yet familiar with the expected file format.

EnvironmentFile: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#EnvironmentFile=

@FroggyFlox
Copy link
Member

FroggyFlox commented Feb 5, 2024

It would be nice to have a linux cli client reproducer for this

My apologies for the slightly rushed troubleshooting on the forum thread linked above. I should have provided a more clear list of steps.

The following was tested on a Rockstor-5.0.7 RPM, as well as on Rockstor built-from-source using current Testing branch:

  1. Create a new share in rockstor: test_share01
  2. Set Rockstor user radmin as owner, users as group for this share.
  3. Configure Samba Service using Rocsktor's default (workgroup = WORKGROUP)
  4. Create a Samba export for this Share using defaults: no admin user, browsable OK, no guest access, no special config.
  5. On Rockstor server, check logs from client (note, this file should only be created if this client has already accessed Rocsktor's SMB server). I'm monitoring them using a simple tail:
$ tail -f /var/log/samba/log.<client_hostname>
  1. Use client (Tumbleweed), to access that Samba share using smbclient:
$ smbclient --version
Version 4.19.2-git.324.fa0b54b91bSUSE-oS16.9-x86_64

$ smbclient //<Rockstor-IP-Address>/test_share01 -U radmin
Password for [WORKGROUP\radmin]:
tree connect failed: NT_STATUS_ACCESS_DENIED

The samba log shows:

$ tail -f /var/log/samba/log.<client_hostname>
[2024/02/05 17:08:47.152009,  3] ../../source3/smbd/vfs.c:141(vfs_init_custom)
  Initialising custom vfs hooks from [/[Default VFS]/]
Error: password store is empty. Try "pass init".
Traceback (most recent call last):
  File "/opt/rockstor/.venv/bin/mnt-share", line 3, in <module>
    from scripts.mount_share import mount_share
  File "/opt/rockstor/src/rockstor/scripts/__init__.py", line 8, in <module>
    django.setup()
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/django/conf/__init__.py", line 102, in __getattr__
    self._setup(name)
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/django/conf/__init__.py", line 89, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/django/conf/__init__.py", line 217, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/src/rockstor/settings.py", line 120, in <module>
    SECRET_KEY = keyring.get_password("rockstor", "SECRET_KEY")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/rockstor/.venv/lib/python3.11/site-packages/keyring/backends/fail.py", line 25, in get_password
    raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
[2024/02/05 17:08:47.645028,  1] ../../source3/smbd/service.c:721(make_connection_snum)

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 6, 2024
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 6, 2024
…kstor#2794

- Include new `.env` file in project.toml for sdist inclusion.
- Adopt new `poetry run mnt-share share-name`, with required `cd`, in
new `root preexec` Samba share config creation.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 7, 2024
…kstor#2794

- fix incorrect plugin url reference in build.sh
- NO SECRETS indicator in .env file.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 7, 2024
…kstor#2794

- Fix legacy Poetry removal regression introduced when build.sh
execution was moved to a systemd service from rpm %posttrans.
- Add python-dotenv to .env file compatibility comments.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 7, 2024
…kstor#2794

- Add smb.conf preexec migration procedure to initrock.
- Modify samba.py smb.conf machine edits to aid above migration target.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 7, 2024
…kstor#2794

- remove smb nmb restarts on prior preexec migrations.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 7, 2024
…kstor#2794

- Add DJANGO_SETTINGS_MODULE environment variable to .env file.
- Resource .env file in all relevant rockstor*.service files
via `EnvironmentFile=` directive.
- Normalise on `/usr/local/bin/poetry run` script invocation
in all relevant rockstor*.service files.
- Modify developer instructions (build.sh) to account for new
poetry-plugin-dotenv.
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 7, 2024
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 8, 2024
…kstor#2794

- Update build.sh `pipx inject poetry`: poetry-plugin-dotenv==0.6.11
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Feb 8, 2024
Introduce 'poetry-plugin-dotenv' to enable Poetry to establish
environmental variables from a .env file. Add PASSWORD_STORE_DIR &
DJANGO_SETTINGS_MODULE variables to inform OS level 'password-store'
app, & our .venv Django of their configuration.

## Includes:
- Additional logging to poetry-install.txt to indicate plugins installed.
- Include new `.env` file in project.toml for sdist inclusion.
- NO SECRETS indicator in new .env file.
- Add `source .env` to build.sh to ease development, the .env file is
also read by build.sh's dedicated rockstor-build.service.
- Pin, in build.sh, poetry-plugin-dotenv to latest 0.6.11
- Adopt new `poetry run mnt-share share-name`, with required `cd`, in
new `root preexec` Samba share config creation.
- Incidentally fix legacy Poetry removal regression introduced when
build.sh execution was moved to a systemd service from rpm %posttrans.
- Add smb.conf preexec migration procedure to initrock.
- Remove redundant smb & nmb restarts from prior preexec migrations.
- Resource .env file in all relevant rockstor*.service files
via `EnvironmentFile=` directive.
- Normalise on `/usr/local/bin/poetry run` script invocation
in all relevant rockstor*.service files.
- Modify developer instructions (build.sh) to account for new
poetry-plugin-dotenv.
@phillxnet phillxnet changed the title (t) Samba shares not accessible after testing channel upgrade too 5.0.6-0 & 5.0.7-0 (t) Samba shares not accessible 5.0.6-0 & 5.0.7-0 Feb 8, 2024
phillxnet added a commit that referenced this issue Feb 12, 2024
…essible-5.0.6-0-&-5.0.7-0

(t) Samba shares not accessible - 5.0.6-0 & 5.0.7-0 #2794
@phillxnet
Copy link
Member

Closing as:
Fixed by #2797

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

No branches or pull requests

3 participants