OPNsense Forum

Archive => 21.7 Legacy Series => Topic started by: eguun on September 17, 2021, 05:25:39 PM

Title: get base64 tool
Post by: eguun on September 17, 2021, 05:25:39 PM
Hello,

I am struggling to find an actionable way to get the tool base64 on opnsense

for reference: https://linux.die.net/man/1/base64
This is the tool to encode/decode string from the shell.

I can't find it in packages, it's not installed by default ...
Am I missing something easy and obvious to get it ?

Any pointers would be welcome.

Thanks
Title: Re: get base64 tool
Post by: fabian on September 17, 2021, 07:00:13 PM
In worst case you should be able to build it from the ports tree however you could use OpenSSL as well.
Title: Re: get base64 tool
Post by: eguun on September 22, 2021, 04:09:01 PM
Sorry for the late response, I hadn't been notified on the activity here.

Thanks for your reply.

I can't find the tool handy in the pkg library.

These 2 options you recommend, would you please be kind to share a link there where I can learn more how to work with ports or openssl to achieve this result?

Thanks
Title: Re: get base64 tool
Post by: fabian on September 22, 2021, 08:21:57 PM
Ports tree:
=========

AFAIK the quick command is opnsense-code tools ports

Then you can build everything from the source code.

Some docs are here:
https://github.com/opnsense/tools


OpenSSL:
========
https://wiki.openssl.org/index.php/Command_Line_Utilities#Base64_Encoding_Strings
Title: Re: get base64 tool
Post by: eguun on September 22, 2021, 08:42:57 PM
Okay many thanks, I can work with this
Title: Re: get base64 tool
Post by: lilsense on September 23, 2021, 02:42:39 PM
It's on Freebsd butjust needs to be broght over...

https://freebsd.pkgs.org/12/freebsd-amd64/base64-1.5_1.txz.html
Title: Re: get base64 tool
Post by: eguun on September 23, 2021, 03:36:43 PM
Many thanks for the response.

To help any other people having this issue and finding this thread.

I managed to make it work via 2 options:
1- I build a oneliner- script to use openssl base64. I named the script base64 and redirect args towards openssl - following fabian's pointers
2- I downloaded the compiled binary from lilsense link: https://freebsd.pkgs.org/12/freebsd-amd64/base64-1.5_1.txz.html - worked right out of the box!

Both solution works.

There is still a 3rd way which would have been to compile from source ... but I haven't gone through this.

My warm thanks for the support!

my bash script (named base64 and placed in /root/bin):
#!/usr/local/bin/bash
/usr/bin/openssl base64 "$@"