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

tarball-based installation should not depend on UID inside of tarball, prevents installation if UID with which tarball's contents were created don't match installing user's #519

Closed
gustavoberman opened this issue Jul 22, 2024 · 3 comments
Assignees
Labels
bug Something isn't working install.py Relating to the install.py configuration script regression It worked at one point...
Milestone

Comments

@gustavoberman
Copy link

Describe the bug
install.py fails with

KeyError: 'getpwuid(): uid not found: 1001'

I only have one sudo user "sim" and its UID is 1000

To Reproduce
Steps to reproduce the behavior:

  1. download all *py and tar.gz from release 24.06.0
  2. chmod +x install.py
  3. sudo ./install.py
  4. Follow options and when asked from Store PCAP, log, indexes fails with:
Store PCAP, log and index files in /opt/malcom? (Y / n): 
Creating /opt/malcom/opensearch failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/opensearch-backup failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/pcap/arkime-live failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/pcap/processed failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/pcap/upload/tmp/spool failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/pcap/upload/variants failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/suricata-logs/live failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/zeek-logs/current failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/zeek-logs/live failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/zeek-logs/upload failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/zeek-logs/extract_files/preserved failed: 'getpwuid(): uid not found: 1001'
Creating /opt/malcom/zeek-logs/extract_files/quarantine failed: 'getpwuid(): uid not found: 1001'

  1. The installation script keep asking more questions and at the end it gives:

KeyError: 'getpwuid(): uid not found: 1001'

Expected behavior
No error

**Screenshots and/or Logs **

$ id
uid=1000(sim) gid=1000(sim) groups=1000(sim),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),135(lxd),136(sambashare),999(docker)

$ uname -a
Linux sim 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

Malcolm Version:

  • Version 24.06.0

How are you running Malcolm?

  • [X ] other (please describe)

Trying to install it in a ubuntu 22.04.

@gustavoberman gustavoberman added the bug Something isn't working label Jul 22, 2024
@mmguero
Copy link
Collaborator

mmguero commented Jul 22, 2024

Hmmm, I'm not sure where the 1001 came from as (like you said) you only have the one user ID and I can't see a reference to 1001 anywhere in the Malcolm source code.

When you saw this (or the equivalent non-dialog version of it) did you answer "Y"?

image

I'll spin up an Ubuntu 22.04 vm and see if i get the same thing as you.

@gustavoberman
Copy link
Author

Hmmm, I'm not sure where the 1001 came from as (like you said) you only have the one user ID and I can't see a reference to 1001 anywhere in the Malcolm source code.

When you saw this (or the equivalent non-dialog version of it) did you answer "Y"?

Yes, exactly.

I think the problem is the extracted tar.gz:

At this point in the install, it already extracts with those permisions:

$ sudo ./install.py 
Installing required packages: ['apache2-utils', 'make', 'openssl', 'python3-dialog', 'python3-dotenv', 'python3-requests', 'python3-yaml', 'xz-utils']

Add a non-root user to the "docker" group? (Y / N): n

Extract Malcolm runtime files from /home/sim/Downloads/Malcomv24.06.0/malcolm_20240626_134945_75fe54ba.tar.gz? (Y / n): 

Enter installation path for Malcolm [/home/sim/Downloads/Malcomv24.06.0/malcolm] (/home/sim/Downloads/Malcomv24.06.0/malcolm): /opt/malcom
Malcolm runtime files extracted to /opt/malcom
$ ll /opt/malcom/
total 108
drwxr-xr-x 19 root root  4096 jul 22 14:46 ./
drwxr-xr-x  5 root root  4096 jul 22 14:46 ../
drwxr-xr-x  3 1001 1001  4096 jun 26 17:47 arkime/
drwxr-xr-x  2 1001 1001  4096 jun 26 17:47 config/
-rw-r--r--  1 1001 1001 22493 jun 26 17:47 docker-compose.yml
drwxr-xr-x  3 1001 1001  4096 jun 26 17:47 filebeat/
drwxr-xr-x  2 1001 1001  4096 jun 26 17:47 htadmin/
drwxr-xr-x  2 1001 1001  4096 jun 26 17:47 kubernetes/
drwxr-xr-x  4 1001 1001  4096 jun 26 17:47 logstash/
drwxr-xr-x  7 1001 1001  4096 jun 26 17:47 netbox/
-rw-r--r--  1 1001 1001     2 jun 26 17:47 net-map.json
drwxr-xr-x  4 1001 1001  4096 jun 26 17:47 nginx/
drwxr-xr-x  3 1001 1001  4096 jun 26 17:47 opensearch/
drwxr-xr-x  2 1001 1001  4096 jun 26 17:47 opensearch-backup/
-rw-------  1 1001 1001     0 jun 26 17:47 .opensearch.primary.curlrc
-rw-------  1 1001 1001     0 jun 26 17:47 .opensearch.secondary.curlrc
drwxr-xr-x  5 1001 1001  4096 jun 26 17:47 pcap/
-rw-r--r--  1 1001 1001  3657 jun 26 17:47 README.md
drwxr-xr-x  2 1001 1001  4096 jun 26 17:47 scripts/
drwxr-xr-x  4 1001 1001  4096 jun 26 17:47 suricata/
drwxr-xr-x  3 1001 1001  4096 jun 26 17:47 suricata-logs/
drwxr-xr-x  3 1001 1001  4096 jun 26 17:47 yara/
drwxr-xr-x  4 1001 1001  4096 jun 26 17:47 zeek/
drwxr-xr-x  7 1001 1001  4096 jun 26 17:47 zeek-logs/

@mmguero
Copy link
Collaborator

mmguero commented Jul 22, 2024

I see what you're saying. the sudo install.py should be chowning the directory and its contents and extraction but apparently is not. Thanks for bringing this to my attention, I'll get it fixed. In the meantime if you manually extract that tarball, then chown it and its contents to your UID it should work.

@mmguero mmguero self-assigned this Jul 22, 2024
@mmguero mmguero added the install.py Relating to the install.py configuration script label Jul 22, 2024
@mmguero mmguero added this to the v24.07.0 milestone Jul 22, 2024
@mmguero mmguero added the regression It worked at one point... label Jul 22, 2024
@mmguero mmguero changed the title Installation problem tarball-based installation should not depend on UID inside of tarball, prevents installation if UID with which tarball's contents were created don't match installing user's Jul 22, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jul 28, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jul 29, 2024
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Jul 29, 2024
@mmguero mmguero closed this as completed Jul 29, 2024
This was referenced Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working install.py Relating to the install.py configuration script regression It worked at one point...
Projects
Status: Released
Development

No branches or pull requests

2 participants