Loading...

The Base64 tool for Linux

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

HTTP basic authentication does base64 encoding. base64 exists on nearly every Linux distribution.

To encode a authorization (user:password)

tan@omega:~/sources/fo-app-authenticator$ echo "mapper:mapperking" | base64
bWFwcGVyOm1hcHBlcmtpbmcK

Check and test for instance with Elasticsearch X-Pack Security

tan@omega:~/sources/fo-app-authenticator$ curl -v elasticsearch:9200 -u mapper:mapperking
* Rebuilt URL to: elasticsearch:9200/
*   Trying 10.0.2.2...
* Connected to 10.0.2.2 (10.0.2.2) port 3128 (#0)
* Server auth using Basic with user 'mapper'
> GET http://elasticsearch:9200/ HTTP/1.1
> Host: elasticsearch:9200
> Authorization: Basic bWFwcGVyOm1hcHBlcmtpbmc=
> User-Agent: curl/7.47.0
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-length: 317
< Proxy-Connection: keep-alive
< Connection: keep-alive
<
{
  "name" : "dev",
  "cluster_name" : "test",
  "cluster_uuid" : "sE_HoGSZRKyhGHN9lk2gSA",
  "version" : {
    "number" : "5.4.3",
    "build_hash" : "eed30a8",
    "build_date" : "2017-06-22T00:34:03.743Z",
    "build_snapshot" : false,
    "lucene_version" : "6.5.1"
  },
  "tagline" : "You Know, for Search"
}
* Connection #0 to host 10.0.2.2 left intact

To decode:

tan@omega:/media/sf_TEMP$ echo "bWFwcGVyOm1hcHBlcmtpbmcK" | base64 -d
mapper:mapperking
Please remember the terms for blog comments.