legba icon indicating copy to clipboard operation
legba copied to clipboard

Fix cross compilation in order to generate and distribute precompiled binaries.

Open evilsocket opened this issue 2 years ago • 3 comments

Currently, when a new release is published, docker images for linux/amd64 and linux/arm64 are automatically built and pushed to https://hub.docker.com/r/evilsocket/legba. While this allows users to just pull the image and use it on any platform supported by Docker, it'd be ideal to also be able to generate and distribute precompiled binaries that might be better suited for certain scenarios (embedded devices for one).

While I had some success in cross compiling this project for x86_64-unknown-linux-gnu using cross with this Cross.toml project file, the build still fails for some OS/arch, mostly due to the libsmbclient and libssl native dependencies that somehow I still am trying to cross compile and/or install incorrectly.

It'd be awesome if someone with more experience than me on Rust cross compilation could help.

To start we'd need to generate binaries for:

  • aarch64-unknown-linux-gnu
  • arm-unknown-linux-gnueabi
  • armv7-unknown-linux-gnueabi
  • x86_64-pc-windows-gnu
  • aarch64-apple-darwin
  • x86_64-apple-darwin

Ideally support Android and iOS targets in the future too.

evilsocket avatar Jan 12 '24 11:01 evilsocket

的确,我在编译windows二进制过程中出现了很多困难

enomothem avatar Feb 26 '24 03:02 enomothem

I have had some success with this, though some features needed to be disabled to get a static binary. (They might work if dynamically linked binaries are acceptable) This should provide some hints to https://github.com/evilsocket/legba/issues/1 & https://github.com/evilsocket/legba/issues/31

  • Linux x86_64

  • Script: https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/x86_64_Linux/bins/legba.sh
  • Binary: https://bin.ajam.dev/x86_64_Linux/legba
ENABLED_FEATURES="amqp dns ftp http http_relative_paths imap kerberos ldap mongodb mqtt mssql pop3 rdp redis scylla smtp socks5 sql ssh stomp tcp_ports telnet vnc"
DISABLED_FEATURES="oracle samba (breaks, unable to find libs)"
  • Linux aarch64

  • Script: https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/aarch64_Linux/bins/legba.sh
  • Binary: TBA
ENABLED_FEATURES="amqp dns ftp http http_relative_paths imap kerberos ldap mongodb mqtt mssql pop3 rdp redis scylla smtp socks5 sql ssh stomp tcp_ports telnet vnc"
DISABLED_FEATURES="oracle samba (breaks, unable to find libs)"
  • Windows x64

  • Script: https://github.com/Azathothas/Toolpacks/blob/main/.github/scripts/x64_Windows/bins/legba.ps1
  • Binary: https://bin.ajam.dev/x64_Windows/legba.exe
ENABLED_FEATURES="amqp dns ftp http http_relative_paths imap kerberos ldap mongodb mssql pop3 rdp redis scylla smtp socks5 sql ssh stomp tcp_ports telnet vnc"
DISABLED_FEATURES="mqtt ( https://github.com/eclipse/paho.mqtt.rust/issues?q=is%3Aissue+is%3Aopen+windows ) ; oracle samba (breaks, unable to find libs) "

Azathothas avatar Apr 05 '24 10:04 Azathothas

@Azathothas yes, as I said compiling legba without said libraries (especially smbclient) is trivial on any OS. The point of this issue is finding solutions to cross compile binaries including the samba feature.

evilsocket avatar Apr 05 '24 16:04 evilsocket