Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.17k stars 560 forks source link

meshcmd prompt for password #4136

Open MrManor opened 2 years ago

MrManor commented 2 years ago

Describe the bug Not a bug, more like a improvement. I am not a big fan of having my password laying around in plain txt files (meshaction.txt) and do not like to specify passwords directly on the command line:

To Reproduce Steps to reproduce the behavior:

klsl@ituska:~> meshcmd --password not2beseenbyothers --token 737598
[1] 14230
klsl@ituska:~> Redirecting local port 1234 to remote port 3389.
Press ctrl-c to exit.

Now anybody on the same machine can grep my password:

evilhacker@ituska:~> ps ax | grep meshcmd
14230 pts/1    Sl     0:00 meshcmd --password not2beseenbyothers --token 737598

Expected behavior Would it be possible to promt for password, when not specified. Or have --ask-password as option.

Even better would be the possibility to specify a script/program in place of the actual password in meshaction.txt. Something like

 "username": "klaus",
 "password": "~/bin/getwalletpw.sh",

It would the be possible for the user to use whatever he likes, as long as it returns the actual password on stdout

Remote Device (please complete the following information):

Ylianst commented 2 years ago

Bryan got password prompting to work in MeshCmd, but it requires a new version of the native executable (C code) so, it will take a bit to get that released.

MrManor commented 2 years ago

Glad you are looking into this, no hurry. For for now I made a simple obfuscation:

I made a .meshcmd directory in my home folder, and changed permissions on this folder to 700. I place meshaction.txt in this folder (with password) and call meshcmd using this bash script:

#!/bin/bash

if [ -z "$1" ]
  then
    echo "No token supplied"
    exit 1
fi

cd ~/.meshcmd/
~/bin/meshcmd --token $1