MinIO/MC: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 51: Line 51:


==Create » Random » Key==
==Create » Random » Key==
{|class='wikitable mw-collapsible'
{|class='wikitable sortable' style='text-align:right'
!scope='col' style='width:1100px' colspan='2'|
!scope="col" rowspan='2' style='width:540px'|Access Key
'''Generate » Random » Key » Access & Secret'''
!scope="col" colspan='4' style='width:240px'|Time (Seconds)
|-
|-
!scope="col"| Access Key
!scope="col" style='width: 60px'|Real
!scope="col"| Secret Key
!scope="col" style='width: 60px'|User
 
!scope="col" style='width: 60px'|System
!scope="col" style='width: 60px'|Status
|-
|-
|valign='top'|
|style='text-align:left'| <code>time echo "$(cat /dev/urandom|tr -dc 'A-Za-z0-9'|head -c 20)"</code> || 0.007    || 0.001    || 0.012    ||style='text-align:center'| 🟢
<syntaxhighlight lang='bash' highlight='2,4'>
|-
cat /dev/urandom       | tr -dc 'A-Za-z0-9' | head -c 20
|style='text-align:left'| <code>time echo "$(openssl rand -base64 16|tr -d /=+|cut -c1-20)"</code>  || 0.009    || 0.002    || 0.012    ||style='text-align:center'| 🟡
openssl rand -base64 32 | tr -d /=+         | cut -c1-20
|-
openssl rand -hex   12 | tr -d /=+         | cut -c1-20
|style='text-align:left'| <code>time echo "$(openssl rand -hex 12|tr -d /=+|cut -c1-20)"</code>      || 0.008    || 0.003    || 0.009    ||style='text-align:center'| 🟡
makepasswd --chars 20
|-
</syntaxhighlight>
|style='text-align:left'| <code>time echo "$(makepasswd --chars 20)"</code>                         || 0.023    || 0.020    || 0.003    ||style='text-align:center'| 🔴
 
|}
|valign='top'|
----
<syntaxhighlight lang='bash' highlight='2,4' line>
{|class='wikitable sortable' style='text-align:right'
cat /dev/urandom       | tr -dc 'A-Za-z0-9' | head -c 40
!scope="col" rowspan='2' style='width:540px'|Secret Key
openssl rand -base64 32 | tr -d /=+         | cut -c1-40
!scope="col" colspan='4' style='width:240px'|Time (Seconds)
openssl rand -hex   24 | tr -d /=+         | cut -c1-40
|-
makepasswd --chars 40
!scope="col" style='width: 60px'|Real
</syntaxhighlight>
!scope="col" style='width: 60px'|User
!scope="col" style='width: 60px'|System
!scope="col" style='width: 60px'|Status
|-
|style='text-align:left'| <code>time echo "$(cat /dev/urandom|tr -dc 'A-Za-z0-9'|head -c 40)"</code> || 0.006    || 0.003    || 0.007    ||style='text-align:center'| 🟢
|-
|style='text-align:left'| <code>time echo "$(openssl rand -base64 32|tr -d /=+|cut -c1-40)"</code>  || 0.007    || 0.003    || 0.009    ||style='text-align:center'| 🟡
|-
|style='text-align:left'| <code>time echo "$(openssl rand -hex 24|tr -d /=+|cut -c1-40)"</code>      || 0.009    || 0.003    || 0.011    ||style='text-align:center'| 🟡
|-
|style='text-align:left'| <code>time echo "$(makepasswd --chars 40)"</code>                         || 0.021    || 0.016    || 0.005    ||style='text-align:center'| 🔴
|}
|}



Revision as of 16:07, 30 June 2025

MinIO » MC » Register » Alias

cat <<'EXE'| sudo bash
wget  -c https://dl.min.io/client/mc/release/linux-amd64/mc \
      -P /usr/local/bin/
chmod +x /usr/local/bin/mc
EXE
xdg-open http://minio.host.k8s.local &>/dev/null &

echo -n 'Username|AccessKey: ';read -s MC_ACCESS_KEY;export MC_ACCESS_KEY;echo
echo -n 'Password|SecretKey: ';read -s MC_SECRET_KEY;export MC_SECRET_KEY;echo

cat << EXE | bash
mc alias set  s3_minio_host_k8s_local_admin http://s3.minio.host.k8s.local ${MC_ACCESS_KEY} ${MC_SECRET_KEY}
mc admin info s3_minio_host_k8s_local_admin
mc alias list
EXE

MC » Bucket » Manage

mc ready  s3_minio_host_k8s_local_admin
mc ping   s3_minio_host_k8s_local_admin -c=3
mc mb     s3_minio_host_k8s_local_admin/academia
mc rb     s3_minio_host_k8s_local_admin/academia
mc mb     s3_minio_host_k8s_local_admin/agronomy
mc mirror s3_minio_host_k8s_local_admin/academia \
          s3_minio_host_k8s_local_admin/agronomy
mc rb     s3_minio_host_k8s_local_admin/academia

Create » Random » Key

Access Key Time (Seconds)
Real User System Status
time echo "$(cat /dev/urandom|tr -dc 'A-Za-z0-9'|head -c 20)" 0.007 0.001 0.012 🟢
time echo "$(openssl rand -base64 16|tr -d /=+|cut -c1-20)" 0.009 0.002 0.012 🟡
time echo "$(openssl rand -hex 12|tr -d /=+|cut -c1-20)" 0.008 0.003 0.009 🟡
time echo "$(makepasswd --chars 20)" 0.023 0.020 0.003 🔴

Secret Key Time (Seconds)
Real User System Status
time echo "$(cat /dev/urandom|tr -dc 'A-Za-z0-9'|head -c 40)" 0.006 0.003 0.007 🟢
time echo "$(openssl rand -base64 32|tr -d /=+|cut -c1-40)" 0.007 0.003 0.009 🟡
time echo "$(openssl rand -hex 24|tr -d /=+|cut -c1-40)" 0.009 0.003 0.011 🟡
time echo "$(makepasswd --chars 40)" 0.021 0.016 0.005 🔴

Playground

jq -r '.aliases.s3_minio_host_k8s_local_admin' ~/.mc/config.json
mc alias export s3_minio_host_k8s_local_admin|jq -r .
mc alias remove s3_minio_host_k8s_local_admin
mc admin info   s3_minio_host_k8s_local_admin

jq -r '.aliases|keys[]' ~/.mc/config.json
mc alias list
cat <<'JSN'| mc alias import s3_minio_host_k8s_local_admin
{ "url": "http://s3.minio.host.k8s.local",
  "accessKey": "admin",
  "secretKey": "sadaqah!",
  "path": "auto",
  "api": "s3v4" }
JSN
set +o history
echo -e "academia\nsadaqah!" | \
mc admin user add s3_minio_host_k8s_local_admin



set -o history

References