Skip to content

Investigate argon2 issue (Termux/Raspberry Pi) #4422

Closed

Description

@jsjoeio

We've had numerous reports of argon2 causing issues on Raspberry Pi and Linux (see here). We need to investigate argon2 (repo here) to see if it's possible to build from source on those devices.

I have a Pixel 2 with Termux so I can test there. Or we can spin up a dev environment on Coder that mimics Termux (Alpine Linux I think) or Raspberry Pi and test there.

If we can get argon2 working, then we'll be able to unblock both Termux and Pi users of code-server.

Special thanks to @im-coder-lg for all their help debugging this!

Activity

  1. self-assigned this
    on Nov 1, 2021
  2. lg-nineoneninethreenine commented on Nov 2, 2021

    @lg-nineoneninethreenine
    Contributor

    I kinda feel like Termux is a combination of FreeBSD and Debian since it includes apt and pkg package managers. But the Argon2 error is affecting the entire NPM package.
    Yesterday, I was exploring my Raspberry Pi that has MATE, and an idea flashed in my mind. In one of the discussions, @Slodziak190q told to install code-server's 3.10.0 version and that worked successfully, providing that it took some time. It works now, and it included a hashed password there.

    Wait a minute, let's go a minute back. What if Argon2's 0.28.0 release has the error?

    I just had a fantastic idea! @jsjoeio can you tell me when did Argon2 get implemented, before 3.10.0 or after 3.10.0? If it's after that, then why can't we use the older hashing module? Because, I observed, the password was hashed in my Pi, and I changed it, but it was hashed. If Argon2 was implemented before 3.10.0, we need to use an older version of Argon2, that might work, right?

  3. lg-nineoneninethreenine commented on Nov 2, 2021

    @lg-nineoneninethreenine
    Contributor

    Can we create an x86 installer for code-server?

  4. jsjoeio commented on Nov 2, 2021

    @jsjoeio
    ContributorAuthor

    I just had a fantastic idea! @jsjoeio can you tell me when did Argon2 get implemented, before 3.10.0 or after 3.10.0? If it's after that, then why can't we use the older hashing module? Because, I observed, the password was hashed in my Pi, and I changed it, but it was hashed. If Argon2 was implemented before 3.10.0, we need to use an older version of Argon2, that might work, right?

    Hmm...possibly! For hashing, we used sha256 which I think came from crypto which is built-in/native to Node. I added argon2 in this PR which came out in 3.11.0. That explains why 3.10.0 works.

    It's supposed to be more secure because it requires more computational effort for the password hashing. I still think we need to look more into argon2 to fix this.

  5. jwannebo commented on Nov 3, 2021

    @jwannebo

    I appear to have picked the worst time to try code-server out on Termux, but I may have a lead on the argon issue. I unzipped the pre-built package in my Termux install, then changed the launch script to use the system node, and got this error:

    ~/.../code-server-3.12.0-linux-arm64/bin $ ./code-server
    node:internal/modules/cjs/loader:1183
      return process.dlopen(module, path.toNamespacedPath(filename));
                     ^
    
    Error: dlopen failed: library "libstdc++.so.6" not found: needed by /data/data/com.termux/files/home/code/code-server-3.12.0-linux-arm64/node_modules/argon2/lib/binding/napi-v3/argon2.node in namespace (default)
        at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
        at Module.load (node:internal/modules/cjs/loader:981:32)
        at Function.Module._load (node:internal/modules/cjs/loader:822:12)
        at Module.require (node:internal/modules/cjs/loader:1005:19)
        at require (node:internal/modules/cjs/helpers:102:18)
        at Object.<anonymous> (/data/data/com.termux/files/home/code/code-server-3.12.0-linux-arm64/node_modules/argon2/argon2.js:9:56)
        at Module._compile (node:internal/modules/cjs/loader:1101:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
        at Module.load (node:internal/modules/cjs/loader:981:32)
        at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
      code: 'ERR_DLOPEN_FAILED'
    }
    

    I can confirm there's no libstdc++.so of any flavor in the libs folder, build-essentials omitted it, and gcc isn't on pkg to install it.

    Edit: I just extracted 3.10 with the script edited in the same way, and was able to launch it ok.

  6. jsjoeio commented on Nov 3, 2021

    @jsjoeio
    ContributorAuthor

    Thanks for the notes @jwannebo! Right now we're recommending people install on Termux via yarn/npm but I know there are also Node version errors.

    3.10 doesn't have issues because argon2 was adding in 3.11.0 I believe. Thanks for confirming though!

  7. lg-nineoneninethreenine commented on Nov 25, 2021

    @lg-nineoneninethreenine
    Contributor

    Any updates? Should we open a ticket at Argon2 and mention this issue there?

  8. lg-nineoneninethreenine commented on Nov 25, 2021

    @lg-nineoneninethreenine
    Contributor

    I just hopped onto the Argon2 repo and discovered something. Issue 317, ranisalt/node-argon2(don't want to mention it here because it might cause problems, idk but @jsjoeio what do you say? Linking our related Argon2 problems here?
    Title: node-argon2 version 0.28.2 uses a vulnerable strip-ANSI package
    We use 0.28.2, right? Might be related.
    Issue 278, 276 and 305 on node-argon2 seems kinda related.
    278's title: Installing fails on Windows(is this related?)
    276's title: Broken argon2.node on RHEL7(Red Hat Enterprise Linux, I think it's similar to Fedora, I think it uses dnf)
    305: Build fails on Node 16.4 ARM M1(this seems too related except the Node version, what processor does your Mac run on @jsjoeio?)
    If you want to link them, feel free, but also I think we must open a ticket at Argon2 and get help from the maintainers there.

  9. jsjoeio commented on Nov 29, 2021

    @jsjoeio
    ContributorAuthor

    @im-coder-lg I don't have any updates yet but once we get 4.0.0 out, we can prioritize this!

    Thanks for linking those node-argon2 issues. We may have to switch away from node-argon2 but I don't want to make any decisions until we can investigate this further.

  10. jsjoeio commented on Jan 3, 2022

    @jsjoeio
    ContributorAuthor

    node-rs now publishes an argon2 package. Might help here: https://github.com/napi-rs/node-rs/tree/main/packages/argon2

  11. yisibl commented on Jan 4, 2022

    @yisibl

    Yes, @node-rs/argon2 https://github.com/napi-rs/node-rs/tree/main/packages/argon2 relies on the power of napi-rs to solve cross-platform compatibility issues.

    Feel free to try and give feedback!

  12. lg-nineoneninethreenine commented on Jan 4, 2022

    @lg-nineoneninethreenine
    Contributor

    @jsjoeio can we test this on a separate branch? You can try building it(also can you tell hardware requirements for building code-server?) and sending a build to me over here(aarch64 please) and I'll test on Raspberry Pi with Ubuntu 21.10, what do you think? Also @yisibl can you tell us how to implement this over here?

  13. 20 remaining items

  14. jsjoeio commented on Jan 10, 2022

    @jsjoeio
    ContributorAuthor

    I'll see if I can get to this tomorrow or Wednesday which should give you enough time to help. Thank you for helping on your holidays!

  15. lg-nineoneninethreenine commented on Jan 11, 2022

    @lg-nineoneninethreenine
    Contributor

    I'll see if I can get to this tomorrow or Wednesday which should give you enough time to help.

    👍

    Thank you for helping on your holidays!

    No worries! I like something to keep me occupied during my free time. What'd the branch name be?

  16. lg-nineoneninethreenine commented on Jan 11, 2022

    @lg-nineoneninethreenine
    Contributor

    Also(unrelated topic coming up!), I went to see the README, it has an extra comma beside the Coder link, it seems wrong to me, can you please inspect it? Also, since the Coder GitHub org changed the name from cdr to coder, you need to change this line in docs/MAINTAINING.md.

  17. lg-nineoneninethreenine commented on Jan 11, 2022

    @lg-nineoneninethreenine
    Contributor

    Also, we need to update all the cdr links to coder. Do you mind if I do this?

  18. jsjoeio commented on Jan 12, 2022

    @jsjoeio
    ContributorAuthor

    Also, we need to update all the cdr links to coder. Do you mind if I do this?

    @im-coder-lg that would be fantastic!

  19. jsjoeio commented on Jan 12, 2022

    @jsjoeio
    ContributorAuthor

    What'd the branch name be?

    Let me see if I can work on this this afternoon and get back to you!

  20. jsjoeio commented on Jan 12, 2022

    @jsjoeio
    ContributorAuthor

    Alright I have a PR up. Once CI finishes, there will be a release-packages artifact that you can download and test: https://github.com/coder/code-server/actions/runs/1690093340

    I'll add steps to the PR description for how to test.

  21. lg-nineoneninethreenine commented on Jan 13, 2022

    @lg-nineoneninethreenine
    Contributor

    alr is the artifact ready?

  22. lg-nineoneninethreenine commented on Jan 13, 2022

    @lg-nineoneninethreenine
    Contributor

    It's the new argon2's error.

  23. jsjoeio commented on Jan 13, 2022

    @jsjoeio
    ContributorAuthor

    @im-coder-lg not yet. We'll have to check that PR again. I had to rerun the end-to-end tests

  24. lg-nineoneninethreenine commented on Aug 8, 2022

    @lg-nineoneninethreenine
    Contributor

    I think this is happening again, any ideas on a fix?

  25. jsjoeio commented on Aug 8, 2022

    @jsjoeio
    ContributorAuthor

    @im-coder-lg can you open a new issue? 🙏🏼

  26. lg-nineoneninethreenine commented on Aug 9, 2022

    @lg-nineoneninethreenine
    Contributor

    Yeah, will do so. But I want to get more info, so I'll post it by tonight(take IST, perhaps 8 pm here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions