KDE Connect would open and close firewall

KDE Connect doesn’t get connect to phone, if the computer has firewall. To make a hole to it you have do:

sudo ufw allow 1714:1764/udp
sudo ufw allow 1714:1764/tcp
sudo ufw reload

I think that those command should be in KDE Connect application. You could be able to open firewall with push button and close it again. So, the holes in firewall are open only when you use KDE Connect.

I don’t think this is really required. Holes in the firewall are fine since no other program is listening on the same ports. Leaving them open is fine imo.
Also it isnt the application’s responsibility to tinker with the firewall

1 Like

Hello, I’ve been experiencing issues with KDE Connect connections for a while now, and I can’t figure out the cause. Sometimes, on rare occasions, the connection is established, but then it quickly disconnects and I can’t reconnect. I’ve reported this several times, and I’ve seen other users experiencing the same issue. Despite several updates, the problem hasn’t been resolved. Therefore, I’m considering trying the method you suggested.

On Fedora 44, with the help of AI, I found that my wifi connections are listed as in public zones:

$ sudo firewall-cmd --get-active-zones 
 public (default) 
  interfaces: wlp82s0 
$ sudo firewall-cmd --zone=public --list-all 
 public (default, active) 
  target: default 
  ingress-priority: 0 
  egress-priority: 0 
  icmp-block-inversion: no 
  interfaces: wlp82s0 
  sources:  
  services: dhcpv6-client mdns ssh 
  ports:  
  protocols:  
  forward: yes 
  masquerade: no 
  forward-ports:  
  source-ports:  
  icmp-blocks:  
  rich rules:

Allowing KDE Connect:

sudo firewall-cmd --permanent --zone=public --add-service=kdeconnectect
sudo firewall-cmd --reload

fixed the issue.

There is a Red Hat bug about it:

Old Phabricator thread: ⚓ T5191 KDE Connect should warn user if it can't open needed ports

And a bugzilla bug: https://bugs.kde.org/show_bug.cgi?id=358440

This is a hard problem to solve but very frustrating too.