node-krb5 icon indicating copy to clipboard operation
node-krb5 copied to clipboard

Rust migration PoC

Open gboutry opened this issue 3 years ago • 0 comments

This PR is PoC showing what a rust migration could look like.

There should be no change to the interface.

What's new in this PR:

  • feat: remove cpp
  • feat: add rust implementation
  • fix: use asynctask instead of embedding tokio runtime
  • fix: windows build
  • fix: macos build
  • feat: add local testing
  • feat: install_krb5.sh vendors a krb5 version
  • fix: docker test, add ubuntu-vendored target
  • fix: use parameter destructuration

Requirements change

  • Rust
  • LLVM
  • pkg-config

The dependencies change, node-gyp is no longer required for the build, such as python (but python is still needed for src/server.py

How to build

In any case, the build command is: npm install, but os and installation method may vary:

  • Linux with system-wide krb5 libs:
    • Nothing much to do, it should work out of the box
  • With custom prefix:
    • Linux: Either declare the variable export KRB5_HOME=/path/to/your/prefix or export PKG_CONFIG_PATH=/path/to/your/krb5/pkg-config
    • MacOs: Either declare the variableexport KRB5_HOME=/path/to/your/homebrew/cellar/krb5 (this is a custom prefix) or export PKG_CONFIG_PATH=/path/to/your/homebrew/cellar/krb5/lib/pkg-config
  • With Windows:
    • If you installed with MIT Kerberos 4.1, it should work out of the box, in any case you can set the variable $env:KRB5_HOME=X:\path\to\you\mit\kerberos\installation

New

  • The script install_krb5.sh now installs MIT Kerberos into a folder vendor at the root of the project. If you want to build the project with this version, simply set the variable export KRB5_HOME=${project_path}/vendor.
  • It is now possible to run the tests locally on Linux and MacOs, by running npm run local_test, it will instantiate a KDC, a Kadmind and a server.py on your host, without docker. You must have the krb5 sbin binaries in your path. If you don't overwrite your PATH variables and you don't have system-wide binaries, you can set the variable export KRB5_HOME=/path/to/your/krb5/prefix
  • A new Docker target has been added: ubuntu-vendored, it's the same as ubuntu but instead of getting krb5 from apt, it's using the install_krb5.sh script

Breaking Change

  • Since Rust does not support z/OS, if work is to be continued on this pull request, z/OS support must be dropped from this library.

This PR has been tested on Ubuntu 20.04, MacOs 11 Big Sur, Windows 10 20H2, and with the containers. All tests have been performed on a x86_64 processor, would be interested with feedback on ARM (macos).

gboutry avatar Feb 22 '22 16:02 gboutry