CaliDog / certstream-server

Certificate Transparency Log aggregation, parsing, and streaming service written in Elixir
https://certstream.calidog.io
MIT License
271 stars 75 forks source link

Issue with easy_ssl.ex #116

Open Cyb0rg42 opened 8 months ago

Cyb0rg42 commented 8 months ago

I trying to run certstream-server and got the following error:

root@vrfcanalyzer:/usr/src/certstream-server# mix run --no-halt warning: use Mix.Config is deprecated. Use the Config module instead config/config.exs:1

warning: Mix.Config.config/2 is deprecated. Use the Config module instead config/config.exs:3

warning: Mix.Config.config/2 is deprecated. Use the Config module instead config/config.exs:8

warning: Mix.Config.config/2 is deprecated. Use the Config module instead config/config.exs:12

warning: Mix.Config.config/2 is deprecated. Use the Config module instead config/config.exs:19

==> easy_ssl Compiling 1 file (.ex)

== Compilation error in file lib/easy_ssl.ex == ** (ArgumentError) lib file public_key/include/OTP-PUB-KEY.hrl could not be found (elixir 1.15.7) lib/record/extractor.ex:41: Record.Extractor.from_lib_file/1 (elixir 1.15.7) lib/record/extractor.ex:18: Record.Extractor.from_or_from_lib_file/1 (elixir 1.15.7) lib/record/extractor.ex:9: Record.Extractor.extract_all/1 lib/easy_ssl.ex:10: (module) could not compile dependency :easy_ssl, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile easy_ssl --force", update it with "mix deps.update easy_ssl" or clean it with "mix deps.clean easy_ssl"

Running Ubuntu Server 20.04.6 LTS (Focal Fossa) fully patched. mix deps.compile easy_ssl --force doesn't fix the error. Same error message as above Any idea what is wrong?

remil1000 commented 8 months ago

you may need to install erlang-dev - apt-get install erlang-dev

dpkg -L erlang-dev | grep OTP
/usr/lib/erlang/lib/public_key-1.7.1/include/OTP-PUB-KEY.hrl
Cyb0rg42 commented 8 months ago

apt-get install erlang-dev Reading package lists... Done Building dependency tree Reading state information... Done erlang-dev is already the newest version (1:26.2.2-1rmq1ppa1~ubuntu20.04.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

dpkg -L erlang-dev | grep OTP /usr/lib/erlang/lib/public_key-1.15/include/OTP-PUB-KEY.hrl

Already didn't fix the issue.

remil1000 commented 8 months ago

Could you give it a try with the Ubuntu managed packages ? it seems you're installing from a rabbitmq PPA So it may be an erlang version mixup or the rabbitmq ppa packages this differently

update: I can reproduce with add-apt-repository ppa:rabbitmq/rabbitmq-erlang in a ubuntu:20.04 docker container - using Ubuntu packaged elixir and erlang-dev everything compiles fine. Probably the Ubuntu packaged elixir (1.15.7) can't run against erlang 26 provided by the rabbitmq PPA

You may need to run this in docker or use something like asdf to manage multiple versions of erlang (I have zero experience with asdf)

Cyb0rg42 commented 8 months ago

Thanks. Removed all erlang packages from rabbitmq and installed erlang from the Ubuntu repo BTW: I followed the instructions on https://elixir-lang.org/install.html A link to this page can be found at: https://github.com/CaliDog/certstream-server?tab=readme-ov-file -> "instructions for your platform"

Debian (and Ubuntu) alternative

Use the [RabbitMQ Packages](https://launchpad.net/~rabbitmq) (might not be up-to-date however likely newer than the distribution)

$ sudo add-apt-repository ppa:rabbitmq/rabbitmq-erlang
$ sudo apt update
$ sudo apt install elixir erlang-dev erlang-xmerl
remil1000 commented 8 months ago

ws:// vs wss:// like http:// vs https://

you probably have no SSL/TLS configured on this localhost:4000 websocket endpoint, try the same using ws://localhost:4000

update: answering a deleted question by OP

bertdg commented 5 months ago

This pull request fixes the issue:
https://github.com/CaliDog/EasySSL/pull/17

You can test by manually editing deps/easy_ssl/mix.exs and adding :public_key to extra_applications.

extra_applications: [:logger, :public_key]
edwardwc commented 3 months ago

For all future MacOS users (and maybe users from other platforms) - the issue probably stems with using the latest Elixir. Going into mix.exs and changing the EasySSL dependency to: {:easy_ssl, github: "CaliDog/EasySSL", branch: "master"} worked!