Bug 508477 - In some distros, KRDP service is autostarted by default, contradicting what the KCM says
Summary: In some distros, KRDP service is autostarted by default, contradicting what t...
Status: RESOLVED FIXED
Alias: None
Product: KRdp
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 6.4.80
Platform: KDE Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-19 14:48 UTC by Nate Graham
Modified: 2025-08-20 15:14 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.5.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2025-08-19 14:48:08 UTC
STEPS TO REPRODUCE
1. Don't manually turn on autostart in the KRDP KCM 
2. Restart computer


OBSERVED RESULT
The KRDP service autostarts:

$ systemctl status --user app-org.kde.krdpserver.service
○ app-org.kde.krdpserver.service - KRDP Server
     Loaded: loaded (/usr/lib/systemd/user/app-org.kde.krdpserver.service; enabled; preset: enable>
     Active: inactive (dead) since Tue 2025-08-19 07:38:25 MDT; 1h 6min ago
   Duration: 2.519s
 Invocation: 5682b3bc841f4319b111d943adccd341
    Process: 4579 ExecStart=/usr/bin/krdpserver (code=exited, status=0/SUCCESS)
   Main PID: 4579 (code=exited, status=0/SUCCESS)
   Mem peak: 36.9M
        CPU: 208ms

Aug 19 07:38:22 engine systemd[1323]: Starting app-org.kde.krdpserver.service...
Aug 19 07:38:22 engine systemd[1323]: Started app-org.kde.krdpserver.service.


EXPECTED RESULT
It doesn't autostart.


ADDITIONAL INFORMATION
This is because Systemd enables it by default if not told otherwise. From https://systemd.io/PRESET/:
>  If no policy exists the default implied policy of “enable everything” is enforced, i.e. in Debian style.

And indeed:

$ systemctl --user list-unit-files | grep krdp
app-org.kde.krdpserver.service                    enabled   enabled
Comment 1 Nate Graham 2025-08-19 15:15:18 UTC
This is also distro-specific. I didn't see this on Fedora because they disable user units by default and then selectively enable them; in KDE Linux all user units are enabled by default.

Being distro-specific doesn't really make sense here; we want the software to encode its preference for "please don't enable me by default unless the user chooses to do so".
Comment 2 David Edmundson 2025-08-20 14:12:10 UTC
FWIW on a completely out the box setup if the service gets enabled but the user has never enabled it in the KCM the daemon will autostart 
BUT it will not have ever generated a certificate and immediately exit.

This means this is not a security issue \o/.
But we do want to fix it regardless.
Comment 3 Nate Graham 2025-08-20 15:14:50 UTC
Git commit 9c6ea0f03ad79e7cdafdac278e79adc84bffb9e0 by Nate Graham.
Committed on 20/08/2025 at 14:36.
Pushed by ngraham into branch 'master'.

Ship a Systemd preset to disable the service by default

Systemd leaves the default enablement state of user units up to the
distro. If a distro enables them all by default, that will include KRDP,
which is not desirable and will cause the actual enablement state to be
out of sync with the KCM.

Instead, ship our own .preset file to make sure the service is always
disabled by default on all Systemd-using distros.
FIXED-IN: 6.5.0

A  +6    -0    server/00-krdp.preset
M  +1    -0    server/CMakeLists.txt

https://invent.kde.org/plasma/krdp/-/commit/9c6ea0f03ad79e7cdafdac278e79adc84bffb9e0