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

Unable to build from source on Kali Linux #587

Closed
jsf9k opened this issue Sep 9, 2022 · 9 comments
Closed

Unable to build from source on Kali Linux #587

jsf9k opened this issue Sep 9, 2022 · 9 comments
Labels

Comments

@jsf9k
Copy link

jsf9k commented Sep 9, 2022

Describe the bug

I am currently unable to build this tool from source on Kali Linux.

To Reproduce

Steps to reproduce the behavior:

  1. docker pull kalilinux/kali-rolling:latest
  2. docker run -it kalilinux/kali-rolling:latest /bin/bash
  3. apt-get update
  4. apt-get install npm wget
  5. wget -O master.tar.gz https://github.com/BloodHoundAD/BloodHound/tarball/master
  6. tar xzf master.tar.gz
  7. cd BloodHoundAD-BloodHound-fca1cf8
  8. npm install --global electron-packager
  9. npm ci --legacy-peer-deps
  10. npm run build
  11. Get this error message:
    > bloodhound@4.2.0 build
    > sh -c 'if [ "$(run-s env:os)" == "win32" ]; then run-s compile "package -- --icon=src/img/icon.ico ${*}"; else run-s compile "package -- --icon=src/img/icon.icns ${*}" ; fi' --
    
    --: 1: [: 
    > bloodhound@4.2.0 env:os
    > node -e "console.log(process.platform)"
    
    linux: unexpected operator
    
    > bloodhound@4.2.0 compile
    > webpack --config webpack.config.production.js
    
    node:internal/crypto/hash:71
      this[kHandle] = new _Hash(algorithm, xofLen);
                  ^
      
    Error: error:0308010C:digital envelope routines::unsupported
      at new Hash (node:internal/crypto/hash:71:19)
      at Object.createHash (node:crypto:133:10)
      at module.exports (/BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/util/createHash.js:135:53)
      at NormalModule._initBuildHash (/BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:417:16)
      at handleParseError (/BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:471:10)
      at /BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:503:5
      at /BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:358:12
      at /BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:373:3
      at iterateNormalLoaders (/BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
      at iterateNormalLoaders (/BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
      at /BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:236:3
      at context.callback (/BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
      at /BloodHoundAD-BloodHound-fca1cf8/node_modules/babel-loader/lib/index.js:59:71 {
    opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
    library: 'digital envelope routines',
    reason: 'unsupported',
    code: 'ERR_OSSL_EVP_UNSUPPORTED'
    }
    
    Node.js v18.7.0
    ERROR: "compile" exited with 1.
    


**Expected behavior**

A successful build.
@jsf9k jsf9k added the bug label Sep 9, 2022
@felddy
Copy link

felddy commented Sep 12, 2022

I can confirm the build steps above will lead to the reproduction of the error. ❌

Since I had the container up I attempted to resolve the vulnerabilities to see if it would positively affect the build.
TL;DR: It did not.

The original output was:
25 vulnerabilities (10 moderate, 13 high, 2 critical)

Ran:
npm audit fix

New output:
23 vulnerabilities (9 moderate, 12 high, 2 critical)

Second build continues to fail as documented previously. ❌

Ran:
nom audit fix --force

New output:
9 vulnerabilities (8 moderate, 1 critical)

Third build attempt resulted in new output that failed spectacularly. ❌‼️

└─# npm run build

> bloodhound@4.2.0 build
> sh -c 'if [ "$(run-s env:os)" == "win32" ]; then run-s compile "package -- --icon=src/img/icon.ico ${*}"; else run-s compile "package -- --icon=src/img/icon.icns ${*}" ; fi' --

--: 1: [: 
> bloodhound@4.2.0 env:os
> node -e "console.log(process.platform)"

linux: unexpected operator

> bloodhound@4.2.0 compile
> webpack --config webpack.config.production.js

assets by status 1.93 MiB [cached] 1 asset
orphan modules 2.4 MiB [orphan] 758 modules
runtime modules 1.07 KiB 6 modules
modules by path ./node_modules/ 2.54 MiB 1150 modules
modules by path ./src/ 2.04 MiB
  modules by path ./src/components/SearchContainer/ 25.8 KiB 20 modules
  modules by path ./src/components/Float/ 19.4 KiB 14 modules
  modules by path ./src/components/Modals/ 5.2 KiB 8 modules
  modules by path ./src/components/Spotlight/ 2.66 KiB 2 modules
  modules by path ./src/components/Tooltips/ 2.05 KiB 2 modules
  modules by path ./src/components/*.css 1.87 KiB 2 modules
  ./src/index.js + 513 modules 1.98 MiB [not cacheable] [built] [code generated]
+ 15 modules

ERROR in ./node_modules/@babel/runtime-corejs2/helpers/esm/extends.js 1:0-57
Module not found: Error: Can't resolve '../../core-js/object/assign' in '/BloodHoundAD-BloodHound-fca1cf8/node_modules/@babel/runtime-corejs2/helpers/esm'
Did you mean 'assign.js'?
BREAKING CHANGE: The request '../../core-js/object/assign' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./node_modules/react-bootstrap/es/Accordion.js 1:0-66 18:43-51
 @ ./node_modules/react-bootstrap/es/index.js 1:0-37 2:0-35
 @ ./src/components/Float/Login.jsx 22:0-41 423:38-44
 @ ./src/index.js 9:0-45 461:52-57 463:50-55

ERROR in ./node_modules/@babel/runtime-corejs2/helpers/esm/inheritsLoose.js 1:0-57
Module not found: Error: Can't resolve '../../core-js/object/create' in '/BloodHoundAD-BloodHound-fca1cf8/node_modules/@babel/runtime-corejs2/helpers/esm'
Did you mean 'create.js'?
BREAKING CHANGE: The request '../../core-js/object/create' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./node_modules/react-bootstrap/es/Accordion.js 2:0-78 9:2-16
 @ ./node_modules/react-bootstrap/es/index.js 1:0-37 2:0-35
 @ ./src/components/Float/Login.jsx 22:0-41 423:38-44
 @ ./src/index.js 9:0-45 461:52-57 463:50-55

ERROR in ./node_modules/@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose.js 1:0-53
Module not found: Error: Can't resolve '../../core-js/object/keys' in '/BloodHoundAD-BloodHound-fca1cf8/node_modules/@babel/runtime-corejs2/helpers/esm'
Did you mean 'keys.js'?
BREAKING CHANGE: The request '../../core-js/object/keys' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./node_modules/react-bootstrap/es/Alert.js 3:0-108 38:16-45
 @ ./node_modules/react-bootstrap/es/index.js 3:0-29 4:0-27
 @ ./src/components/Float/Login.jsx 22:0-41 423:38-44
 @ ./src/index.js 9:0-45 461:52-57 463:50-55

3 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.74.0 compiled with 3 errors in 60264 ms
ERROR: "compile" exited with 2.

@rvazarkar
Copy link
Contributor

Did you try npm run package:linux?

@jsf9k
Copy link
Author

jsf9k commented Sep 12, 2022

Did you try npm run package:linux?

Thanks @rvazarkar. I can confirm that command succeeds. Is that what I should be running instead of npm run build or npm run build:linux? I was basing my installation on these instructions, but if there are more up to date instructions please point me to them.

@rvazarkar
Copy link
Contributor

npm run build:linux should work fine, it just runs compile + package. Can you try npm run build:linux and see if that works?

@jsf9k
Copy link
Author

jsf9k commented Sep 12, 2022

npm run build:linux should work fine, it just runs compile + package. Can you try npm run build:linux and see if that works?

I get the same error that I originally reported:

# npm run build:linux

> bloodhound@4.2.0 build:linux
> run-s compile package:linux


> bloodhound@4.2.0 compile
> webpack --config webpack.config.production.js

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:471:10)
    at /BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:503:5
    at /BloodHoundAD-BloodHound-fca1cf8/node_modules/webpack/lib/NormalModule.js:358:12
    at /BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/BloodHoundAD-BloodHound-fca1cf8/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /BloodHoundAD-BloodHound-fca1cf8/node_modules/babel-loader/lib/index.js:59:71 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.7.0
ERROR: "compile" exited with 1.

@jsf9k
Copy link
Author

jsf9k commented Sep 12, 2022

The compilation error appears to be related to this:

# export NODE_OPTIONS=--openssl-legacy-provider 

# npm run build:linux

> bloodhound@4.2.0 build:linux
> run-s compile package:linux


> bloodhound@4.2.0 compile
> webpack --config webpack.config.production.js

Hash: fd26803c78e1f0a75dfd
Version: webpack 4.46.0
Time: 18226ms
Built at: 09/12/2022 4:25:15 PM
    Asset      Size  Chunks             Chunk Names
bundle.js  1.95 MiB       0  [emitted]  main
Entrypoint main = bundle.js
  [26] external "fs" 42 bytes {0} [built]
  [42] external "path" 42 bytes {0} [built]
  [58] external "electron" 42 bytes {0} [built]
 [163] external "stream" 42 bytes {0} [built]
 [259] (webpack)/buildin/module.js 497 bytes {0} [built]
 [280] ./node_modules/rxjs/_esm5/index.js + 19 modules 35.8 KiB {0} [built]
       |    20 modules
 [359] external "events" 42 bytes {0} [built]
 [380] external "assert" 42 bytes {0} [built]
 [381] ./node_modules/rxjs/_esm5/operators/index.js + 97 modules 174 KiB {0} [built]
       |    98 modules
 [481] external "crypto" 42 bytes {0} [built]
 [548] external "child_process" 42 bytes {0} [built]
 [569] multi ./src/index 28 bytes {0} [built]
[1213] external "os" 42 bytes {0} [built]
[1228] ./src/index.js + 512 modules 1.98 MiB {0} [built]
       | ./src/index.js 11.3 KiB [built]
       | ./src/AppContainer.jsx 12.6 KiB [built]
       | ./src/AppContext.jsx 503 bytes [built]
       | ./src/js/utils.js 31.5 KiB [built]
       | ./src/js/newingestion.js 65.4 KiB [built]
       |     + 508 hidden modules
[1229] ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js + 1 modules 4.41 KiB {0} [optional] [built]
       |    2 modules
    + 1321 hidden modules

> bloodhound@4.2.0 package:linux
> run-s "package -- --platform=linux --arch=x64,armv7l,arm64"


> bloodhound@4.2.0 package
> electron-packager . BloodHound --overwrite --prune --ignore=./*.zip --ignore=./BloodHound.* --ignore=BloodHoundExampleDB.db --ignore=docs --ignore=Ingestors --ignore=node_modules/\.bin --platform=linux --arch=x64,armv7l,arm64

Packaging app for platform linux x64 using electron v11.5.0
Packaging app for platform linux armv7l using electron v11.5.0
Packaging app for platform linux arm64 using electron v11.5.0
Wrote new apps to:
/BloodHoundAD-BloodHound-fca1cf8/BloodHound-linux-x64
/BloodHoundAD-BloodHound-fca1cf8/BloodHound-linux-armv7l
/BloodHoundAD-BloodHound-fca1cf8/BloodHound-linux-arm64

@rvazarkar
Copy link
Contributor

You can probably get around this by going back to a lower node version.

@jsf9k
Copy link
Author

jsf9k commented Sep 13, 2022

I think this issue can be closed now. Thank you for your help @rvazarkar!

@jsf9k jsf9k closed this as completed Sep 13, 2022
@1mm0rt41PC
Copy link

You can add a flag to allow the usage of old crypto functions.

Example on Windows

git clone https://github.com/BloodHoundAD/BloodHound --depth 1
cd BloodHound
npm install -g electron-packager
npm install
SET NODE_OPTIONS=--openssl-legacy-provider
npm run build:win32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants