rustdesk / rustdesk-server-pro

Some scripts for RustDesk Server Pro are hosted here.
107 stars 48 forks source link

Client deployment, exe vs MSI #241

Closed mmallejac closed 2 months ago

mmallejac commented 2 months ago

Hello !

I am trying to deploy the rustdesk pro client, using ansible.

Using the .exe is ok for the installation, including the service, but I am not able to set up a script for the uninstall.

So using the MSI sounds like a better plan here, but unfortunately - as stated in #239 - the service is then not installed / started. I've tried with the --install-service but no luck (that is for the .exe ?).

Another question: if not using a preset password, is the random generated password communicated when the client announce itself to the Rustdesk Console ?

Many thanks in advance !

rustdesk commented 2 months ago

1, rustdesk.exe --uninstall 2, https://github.com/rustdesk/rustdesk-server-pro/issues/239#issuecomment-2082837342 3, I can not get you about your Another question.

mmallejac commented 2 months ago

With ansible, 1 doesn't work. Not sure why, but I've checked the code and saw that a cmd bat file is run. Maybe ansible (or I) do not know how to deal with that. I could mimic with ansible what the uninstall bat does, but this is not easy to maintain.

2, ok !

3 should I try to reformulate or ?

Thanks !

rustdesk commented 2 months ago

is the random generated password communicated when the client announce itself to the Rustdesk Console ?

We do not do this magic, and for security concern we will never do this, though you thought it is convenient for you. That's why we do not allow preset password via strategies which has been discussed here https://www.reddit.com/r/rustdesk/comments/1bqg7p8/device_password_management/.

rustdesk commented 2 months ago

So using the MSI sounds like a better plan here, but unfortunately - as stated in #239 - the service is then not installed / started.

Could you confirm if it is ok if you do not use ansible?

mmallejac commented 2 months ago

Ok, doing it manually the client starts, but :

When pressing this option, a password is generated and the service is added and started.

So with an MSI an action must be done on the machine before it gets fully functional. Not ideal for mass deployment.

So far, using the .exe along with a preset password has been the closest to ideal, for me. We're not using GPO/strategies here.

I've just done a quick test, and I am under the impression that using an MSI containing a preset password does the job, I mean in that case the service is installed and started ! Could it be a leftover of a previous installation ?

I also notice that uninstalling the MSI (using the Windows apps in the control panel) stops the service but does not remove it, while the install folder is actually removed.

fufesou commented 2 months ago

the bottom area says that the service is not running, and offer to start it

@mmallejac Hi, have you mannually stopped the RustDesk before uninstalling it?

If the msi detects that RustDesk service has been manually stopped and not previously started, it will not attempt to install and start the service.

mmallejac commented 2 months ago

Yes, very possible. I've just done another test : manual MSI install and all went fine, the service is running.

Also done another test with ansible and MSI... all went fine as well.

So most probably the system wasn't clean enough in between each test, sorry ! At least it allow to see that service is not deleted after MSI removal.

mmallejac commented 2 months ago

For the MSI uninstall part, I think something is missing in the registry HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[rustDeskProductName]

The UninstallString value is: MsiExec.exe /X {61FF4832-A09F-4F45-85B3-0D9F5AD02237}

Another string should be present: QuietUninstallString which value could be: MsiExec.exe /qn /X {61FF4832-A09F-4F45-85B3-0D9F5AD02237}

Without the /qn ansible is unable to remove rustdesk, since a confirmation dialog is shown. Ansible does unattended work and therefore this dialog is not visible and the uninstall is never run.

Ansible is able to deal with QuietUninstallString, see https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_package_module.html#notes

rustdesk commented 2 months ago

We had a fix for this, please rebuild a msi and test. The uninstall did have a bug.

https://github.com/rustdesk/rustdesk/pull/7872/files/b074810c5cc8a53a60386494ff734f717e87ac29..052ca1759a58001c0f77542dd4b8f35ba124c6ac

mmallejac commented 2 months ago

Good, thanks, I confirm that now the service gets stopped and removed when uninstalling the MSI.

The QuietUninstallString would really be great, since it would allow a complete unattended deployment / removal.

rustdesk commented 2 months ago

QuietUninstallString

@fufesou will follow up

rustdesk commented 2 months ago

https://github.com/rustdesk/rustdesk/pull/7873, please build a new msi to test.

mmallejac commented 2 months ago

Great !!

The unattended uninstall works just fine now, many thanks :+1: