evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
10.74k stars 498 forks source link

OpenSnitch UI: KeyError (uid not found) #185

Closed ghost closed 3 years ago

ghost commented 6 years ago

Hi,

Yesterday I installed OpenSnitch with the steps mentioned. The service is running and it starts automatically on reboot. However I have problems starting the UI.

When I issue opensnitch-ui to start the UI, I get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/opensnitch/dialogs/stats.py", line 204, in _on_update_triggered
    by_users["%s (%s)" % (pwd.getpwuid(int(uid)).pw_name, uid)] = hits
KeyError: 'getpwuid(): uid not found: 62582'
Aborted

I have no idea what causes this (other than /etc/passwd does not have this uid [but why it should have?]) and where to go for a solution.

Any help is highly appreciated! Thanks.

Northern-Lights commented 6 years ago

Just jotting down some notes, here...

My guess is that somehow, the parsing is failing, possibly due to a missing field or some other factor. I see that all of the columns in my tcp and udp entries line up, and I am not able to reproduce the original issue. However, looking at the data in my entries, it's plausible that the 62852 number is coming from the inode column, if parsing is, indeed, the issue.

Would you be able to post your /proc/net/tcp and /proc/net/udp when the issue occurs? We may be able to nail down whether parsing is the issue and fix it quickly.

OderDochNicht commented 6 years ago

After cleaning up the issue 184 Northern-Lights referenced above:

Shortly after starting opensnitch-ui I get: opensnitch-ui E0816 10:34:07.664790433 16327 tcp_server_posix.cc:210] Failed accept4: Zu viele offene Dateien Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/opensnitch/dialogs/stats.py", line 204, in _on_update_triggered KeyError: 'getpwuid(): uid not found: 114' Abgebrochen uid 114: egrep 114 /etc/passwd: pulse:x:110:114:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin colord:x:114:121:colord colour management daemon,,,:/var/lib/colord:/usr/sbin/nologin cat /proc/net/tcp sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 0: 00000000:006F 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 13655 1 00000000b1412eb6 100 0 0 10 0 1: 00000000:90D5 00000000:0000 0A 00000000:00000000 00:00000000 00000000 112 0 13238 1 000000009a91778a 100 0 0 10 0 2: 0100007F:0277 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 2596922 1 0000000095d5ffb7 100 0 0 10 0 3: 0100007F:0400 00000000:0000 0A 00000000:00000000 00:00000000 00000000 1026 0 32558 1 00000000a0cac882 100 0 0 10 0 4: 00000000:08C1 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 2546709 1 00000000ffe63924 100 0 0 10 0 5: 0100007F:0401 00000000:0000 0A 00000000:00000000 00:00000000 00000000 1026 0 21439 1 00000000624239f4 100 0 0 10 0 6: 0100007F:0402 00000000:0000 0A 00000000:00000000 00:00000000 00000000 1026 0 39029 1 000000002bae57b4 100 0 0 10 0 7: 00000000:9203 00000000:0000 0A 00000000:00000000 00:00000000 00000000 0 0 2028 1 00000000f1c9f631 100 0 0 10 0 8: 0100007F:0402 0100007F:C7A0 06 00000000:00000000 03:000011DB 00000000 0 0 0 3 00000000841bb7d2 9: 0100007F:0402 0100007F:C7B2 06 00000000:00000000 03:000013CF 00000000 0 0 0 3 00000000016b31c0 10: 36E9A8C0:C98C 13E9A8C0:1A22 06 00000000:00000000 03:00000D9F 00000000 0 0 0 3 000000005caa9681 11: 36E9A8C0:E462 A7C62934:01BB 01 00000000:00000000 02:00000057 00000000 1026 0 3071948 2 000000006d43ea39 62 4 9 10 -1 12: 0100007F:0402 0100007F:C78A 06 00000000:00000000 03:00000F1E 00000000 0 0 0 3 00000000173d6a3b 13: 0100007F:0402 0100007F:C778 06 00000000:00000000 03:00000CC6 00000000 0 0 0 3 000000009939b6c1 14: 36E9A8C0:8182 70FD1EC0:01BB 06 00000000:00000000 03:00000924 00000000 0 0 0 3 0000000000708af0 15: 0100007F:0402 0100007F:C788 06 00000000:00000000 03:00000EBA 00000000 0 0 0 3 00000000329c8f45 16: 0100007F:0402 0100007F:C766 06 00000000:00000000 03:00000B9A 00000000 0 0 0 3 0000000037e3f736 17: 36E9A8C0:E464 A7C62934:01BB 01 00000000:00000000 02:00000057 00000000 1026 0 3071949 2 000000002ea2f198 65 5 13 10 -1 18: 36E9A8C0:C93E 13E9A8C0:1A22 06 00000000:00000000 03:000005DB 00000000 0 0 0 3 000000007dc00dcb 19: 0100007F:0402 0100007F:C74C 06 00000000:00000000 03:00000941 00000000 0 0 0 3 00000000b63fd4a3 20: 36E9A8C0:E466 A7C62934:01BB 01 00000000:00000000 02:00000057 00000000 1026 0 3071950 2 00000000bdae7ae7 66 4 13 10 -1 21: 0100007F:0402 0100007F:C722 06 00000000:00000000 03:000003C8 00000000 0 0 0 3 000000005cc80479 22: 36E9A8C0:C9D8 13E9A8C0:1A22 04 00000001:00000000 01:00000013 00000000 1026 0 3085704 3 000000005408670a 21 4 26 10 16 23: 0100007F:0402 0100007F:C704 06 00000000:00000000 03:00000043 00000000 0 0 0 3 00000000dad6cdbf 24: 0100007F:0402 0100007F:C710 06 00000000:00000000 03:00000170 00000000 0 0 0 3 000000000d9da956 25: 0100007F:0402 0100007F:C750 06 00000000:00000000 03:000009A6 00000000 0 0 0 3 000000003788e361 26: 0100007F:0402 0100007F:C73C 06 00000000:00000000 03:0000074D 00000000 0 0 0 3 00000000ae4ca9b3 27: 36E9A8C0:C9B4 13E9A8C0:1A22 06 00000000:00000000 03:000012BA 00000000 0 0 0 3 00000000f5e0f787 28: 36E9A8C0:A7F4 EB292734:01BB 01 00000000:00000000 02:0000005A 00000000 1026 1 3089615 2 000000004be7bf3d 56 4 13 10 -1 29: 36E9A8C0:C922 13E9A8C0:1A22 06 00000000:00000000 03:0000028E 00000000 0 0 0 3 00000000bd48ee30 30: 0100007F:0402 0100007F:C736 06 00000000:00000000 03:00000621 00000000 0 0 0 3 00000000ba91396d 31: 0100007F:0402 0100007F:C74A 06 00000000:00000000 03:000008DD 00000000 0 0 0 3 000000004fa68489 32: 0100007F:0402 0100007F:C742 06 00000000:00000000 03:00000815 00000000 0 0 0 3 00000000dbad9551 33: 36E9A8C0:D274 2881DC53:008F 01 00000000:00000000 00:00000000 00000000 1026 0 2601219 1 0000000028b41ca8 22 4 20 10 -1 34: 0100007F:0402 0100007F:C724 06 00000000:00000000 03:0000042C 00000000 0 0 0 3 0000000076a6c8d1 35: 0100007F:0402 0100007F:C754 06 00000000:00000000 03:00000A6E 00000000 0 0 0 3 0000000010285b7c 36: 0100007F:0402 0100007F:C7CA 06 00000000:00000000 03:00001754 00000000 0 0 0 3 000000008f1f74bf 37: 0100007F:0402 0100007F:C7B4 06 00000000:00000000 03:00001433 00000000 0 0 0 3 00000000dfaa7d3d 38: 0100007F:0402 0100007F:C7AA 06 00000000:00000000 03:00001307 00000000 0 0 0 3 00000000b9528786 39: 0100007F:0402 0100007F:C752 06 00000000:00000000 03:00000A0A 00000000 0 0 0 3 000000002f627a03 40: 0100007F:0402 0100007F:C730 06 00000000:00000000 03:000005BD 00000000 0 0 0 3 00000000aa109703 41: 0100007F:0402 0100007F:C72A 06 00000000:00000000 03:000004F4 00000000 0 0 0 3 00000000ce852394 42: 0100007F:0402 0100007F:C78E 06 00000000:00000000 03:00000F82 00000000 0 0 0 3 0000000031da7647 43: 0100007F:0402 0100007F:C79C 06 00000000:00000000 03:00001113 00000000 0 0 0 3 00000000a2b43a7e 44: 36E9A8C0:D050 2881DC53:008F 01 00000000:00000000 00:00000000 00000000 1026 0 2569403 1 00000000e3708408 22 4 22 10 -1 45: 0100007F:0402 0100007F:C776 06 00000000:00000000 03:00000C62 00000000 0 0 0 3 0000000082db1f6b 46: 0100007F:0402 0100007F:C7C2 06 00000000:00000000 03:000015C4 00000000 0 0 0 3 00000000501960be 47: 36E9A8C0:CECE 2881DC53:008F 01 00000000:00000000 00:00000000 00000000 1026 0 2549310 1 00000000de2b6131 22 4 20 10 -1 48: 0100007F:0402 0100007F:C71C 06 00000000:00000000 03:00000300 00000000 0 0 0 3 00000000b8f6599a 49: 0100007F:0402 0100007F:C77E 06 00000000:00000000 03:00000D8E 00000000 0 0 0 3 0000000065896ba9 50: 36E9A8C0:CED0 2881DC53:008F 01 00000000:00000000 00:00000000 00000000 1026 0 2549311 1 000000000f3fdc2b 22 4 20 10 -1 51: 0100007F:0402 0100007F:C7A2 06 00000000:00000000 03:0000123F 00000000 0 0 0 3 000000004fe6e207 52: 0100007F:0402 0100007F:C7A6 06 00000000:00000000 03:000012A3 00000000 0 0 0 3 00000000ad19d586 53: 0100007F:0402 0100007F:C72C 06 00000000:00000000 03:00000559 00000000 0 0 0 3 00000000c2f32c67 54: 0100007F:0402 0100007F:C79E 06 00000000:00000000 03:00001177 00000000 0 0 0 3 00000000b52e2229 55: 0100007F:0402 0100007F:C7BA 06 00000000:00000000 03:000014FC 00000000 0 0 0 3 00000000d9138e52 56: 36E9A8C0:817A 70FD1EC0:01BB 06 00000000:00000000 03:0000092E 00000000 0 0 0 3 000000008fb8f160 57: 0100007F:0402 0100007F:C782 06 00000000:00000000 03:00000DF2 00000000 0 0 0 3 0000000035e5d679 58: 0100007F:0402 0100007F:C79A 06 00000000:00000000 03:000010AF 00000000 0 0 0 3 000000003365d9b6 59: 0100007F:0402 0100007F:C712 06 00000000:00000000 03:000001D4 00000000 0 0 0 3 000000002cccdd18 60: 36E9A8C0:C9C4 13E9A8C0:1A22 06 00000000:00000000 03:0000155A 00000000 0 0 0 3 00000000614f6105 61: 36E9A8C0:C968 13E9A8C0:1A22 06 00000000:00000000 03:00000B08 00000000 0 0 0 3 0000000070b01d5e 62: 0100007F:0402 0100007F:C738 06 00000000:00000000 03:00000685 00000000 0 0 0 3 00000000f8c86a80 63: 36E9A8C0:C962 13E9A8C0:1A22 06 00000000:00000000 03:00000B06 00000000 0 0 0 3 00000000b818be6c 64: 0100007F:0402 0100007F:C784 06 00000000:00000000 03:00000E56 00000000 0 0 0 3 00000000b7722845 65: 0100007F:0402 0100007F:C774 06 00000000:00000000 03:00000BFE 00000000 0 0 0 3 00000000647349dc 66: 36E9A8C0:C9B0 13E9A8C0:1A22 06 00000000:00000000 03:000012B7 00000000 0 0 0 3 00000000a9c1f92b 67: 36E9A8C0:ECF2 13E9A8C0:008B 01 00000000:00000000 00:00000000 00000000 1026 0 774102 1 000000005f5e7ae9 20 4 18 10 16 68: 36E9A8C0:8176 70FD1EC0:01BB 06 00000000:00000000 03:00000927 00000000 0 0 0 3 00000000c4dac98c 69: 0100007F:0402 0100007F:C746 06 00000000:00000000 03:00000879 00000000 0 0 0 3 00000000d3e9c8ea 70: 0100007F:0402 0100007F:C718 06 00000000:00000000 03:0000029C 00000000 0 0 0 3 00000000d2beac3f 71: 0100007F:0402 0100007F:C702 06 00000000:00000000 03:00000000 00000000 0 0 0 3 0000000077fc49ea 72: 36E9A8C0:DB44 2881DC53:008F 01 00000000:00000000 00:00000000 00000000 1026 0 2713433 1 00000000a8b03c19 22 4 22 10 -1 73: 36E9A8C0:C9C8 13E9A8C0:1A22 06 00000000:00000000 03:0000155E 00000000 0 0 0 3 000000001801f1b7 74: 0100007F:0402 0100007F:C7C8 06 00000000:00000000 03:000016F0 00000000 0 0 0 3 00000000ce97df07 75: 0100007F:0402 0100007F:C7AC 06 00000000:00000000 03:0000136B 00000000 0 0 0 3 0000000054529fdb 76: 36E9A8C0:8898 707EA523:01BB 01 00000000:00000000 02:00000009 00000000 1026 0 3076935 2 000000007ba0ba37 50 4 9 10 -1 77: 36E9A8C0:CC06 7CFD1EC0:01BB 01 00000000:00000000 02:0000B01B 00000000 1026 0 2542591 2 00000000556b9dbe 31 4 29 10 -1 78: 36E9A8C0:C92A 13E9A8C0:1A22 06 00000000:00000000 03:00000368 00000000 0 0 0 3 000000005120c9af 79: 36E9A8C0:C9A0 13E9A8C0:1A22 06 00000000:00000000 03:00001033 00000000 0 0 0 3 00000000946f8dcf 80: 0100007F:0402 0100007F:C73E 06 00000000:00000000 03:000007B1 00000000 0 0 0 3 000000001d5c4e1b 81: 0100007F:0402 0100007F:C7BE 06 00000000:00000000 03:00001560 00000000 0 0 0 3 000000001ed51664 82: 0100007F:0402 0100007F:C758 06 00000000:00000000 03:00000AD2 00000000 0 0 0 3 000000005ff9e27f 83: 0100007F:0402 0100007F:C764 06 00000000:00000000 03:00000B36 00000000 0 0 0 3 0000000043130b0a 84: 0100007F:0402 0100007F:C7C6 06 00000000:00000000 03:0000168C 00000000 0 0 0 3 00000000c9f80ffd 85: 36E9A8C0:D318 AA11E3D4:03E1 01 00000000:00000000 00:00000000 00000000 1026 0 2584207 1 00000000e2af0443 22 4 12 10 -1 86: 36E9A8C0:E45E A7C62934:01BB 01 00000000:00000000 02:00000057 00000000 1026 0 3071946 2 00000000c46e6c4d 56 4 8 10 -1 87: 0100007F:0402 0100007F:C77A 06 00000000:00000000 03:00000D2A 00000000 0 0 0 3 000000009f274f30 88: 36E9A8C0:03A2 13E9A8C0:0801 01 00000000:00000000 02:00000394 00000000 0 0 2546565 2 000000009c23900f 20 4 28 10 16 89: 36E9A8C0:9CFE 13E9A8C0:01BD 01 00000000:00000000 00:00000000 00000000 1026 0 2589792 1 000000005f421309 20 4 10 10 16 90: 36E9A8C0:A2C0 6FA1DA22:01BB 01 00000000:00000000 02:0000005A 00000000 1026 1 3082686 2 0000000097c9c4fb 55 4 11 10 -1 91: 0100007F:0402 0100007F:C720 06 00000000:00000000 03:00000364 00000000 0 0 0 3 0000000082a33ec4 92: 36E9A8C0:C988 13E9A8C0:1A22 06 00000000:00000000 03:00000D9B 00000000 0 0 0 3 00000000ded5d895 93: 36E9A8C0:C950 13E9A8C0:1A22 06 00000000:00000000 03:00000880 00000000 0 0 0 3 00000000fac8eebb 94: 0100007F:0402 0100007F:C792 06 00000000:00000000 03:00000FE6 00000000 0 0 0 3 0000000073ee877d 95: 36E9A8C0:DB3C 13E9A8C0:D9A3 08 00000000:00000001 00:00000000 00000000 0 0 3062320 1 00000000c68a7f7c 21 4 0 10 16 96: 0100007F:0402 0100007F:C714 06 00000000:00000000 03:00000238 00000000 0 0 0 3 0000000017b67d90 97: 0100007F:0402 0100007F:C7C4 06 00000000:00000000 03:00001628 00000000 0 0 0 3 00000000e07708ea 98: 36E9A8C0:C926 13E9A8C0:1A22 06 00000000:00000000 03:00000363 00000000 0 0 0 3 000000005e8fa44d 99: 36E9A8C0:C954 13E9A8C0:1A22 06 00000000:00000000 03:00000884 00000000 0 0 0 3 000000002931b90b 100: 0100007F:0402 0100007F:C798 06 00000000:00000000 03:0000104B 00000000 0 0 0 3 00000000972dfb26 101: 36E9A8C0:C912 13E9A8C0:1A22 06 00000000:00000000 03:000000AE 00000000 0 0 0 3 0000000089155d71 102: 36E9A8C0:C93A 13E9A8C0:1A22 06 00000000:00000000 03:000005D8 00000000 0 0 0 3 00000000a11482d2 103: 0100007F:0402 0100007F:C708 06 00000000:00000000 03:000000A7 00000000 0 0 0 3 0000000090c662d8 104: 0100007F:0402 0100007F:C728 06 00000000:00000000 03:00000490 00000000 0 0 0 3 00000000d9ea836e 105: 0100007F:0402 0100007F:C70E 06 00000000:00000000 03:0000010C 00000000 0 0 0 3 00000000702afa93 106: 0100007F:0402 0100007F:C73A 06 00000000:00000000 03:000006E9 00000000 0 0 0 3 0000000020a68fdc 107: 36E9A8C0:C99C 13E9A8C0:1A22 06 00000000:00000000 03:00001032 00000000 0 0 0 3 0000000068cd9e88 108: 36E9A8C0:DF8E B5BBA223:01BB 01 00000000:00000000 02:0000D883 00000000 1026 0 2544924 2 000000004716a2f5 40 4 27 10 -1 109: 36E9A8C0:E468 A7C62934:01BB 01 00000000:00000000 02:00000056 00000000 1026 0 3071951 2 000000003ce84f51 66 4 13 10 -1 110: 0100007F:0402 0100007F:C7B6 06 00000000:00000000 03:00001497 00000000 0 0 0 3 000000006e74b90b 111: 36E9A8C0:E460 A7C62934:01BB 01 00000000:00000000 02:00000070 00000000 1026 0 3071947 2 0000000030a31c73 54 4 4 10 -1 112: 36E9A8C0:A9E6 5C359436:01BB 06 00000000:00000000 03:00000F38 00000000 0 0 0 3 00000000de6c39fc 113: 36E9A8C0:C916 13E9A8C0:1A22 06 00000000:00000000 03:000000B0 00000000 0 0 0 3 00000000736ef655

cat /proc/net/udp sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode ref pointer drops 2877: 00000000:14E9 00000000:0000 07 00000000:00000000 00:00000000 00000000 107 0 20761 2 00000000ff0918ae 0 8318: 00000000:EA2A 00000000:0000 07 00000000:00000000 00:00000000 00000000 112 0 13236 2 00000000b9c26b64 0 14019: 00000000:006F 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 13653 2 000000006d02421b 0 14524: 00000000:0268 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 13654 2 00000000538dc32f 0 14539: 00000000:0277 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 2596296 2 00000000c746aae5 0 14697: 00000000:8315 00000000:0000 07 00000000:00000000 00:00000000 00000000 107 0 20763 2 00000000959dd2dc 0 14819: 0100007F:038F 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 13232 2 000000009a5357df 0

Translation: Zu viele offene Dateien: Too many open files Abgebrochen: Aborted

Northern-Lights commented 6 years ago

I can't see anything related to a UID 114 from your output... I am not sure then what the issue might be.

My PR (#188 ) handles the exception so that the UI should be able to proceed showing (error) where the bad UID is occurring. I am not able to test it since I am not seeing the issue myself, but it should at least allow you to run the UI.

To dig deeper to find the problem, you may be able to import "github.com/evilsocket/opensnitch/daemon/log" and instrument the Parse() function in parse.go:70, maybe saving scanner.Text() in a variable and printing it to the log. That might help us nail down where the UI is getting the bad UID.

OderDochNicht commented 6 years ago

OK, the problem solved itself - in a way :-) Because of a wine issue I purged libfreetype6 (not recommended - apt will deinstall all dependencies and that's are a lot. Especially gui-related ones.) After a reinstall of most of the purged packets (xfce4, libreoffice, recoll, ocrmypdf, ...) and a reboot opensnitch works without issues.

So probably an issue from some leftover libs?

apt now recommends an autoremove of these packages: docbook-xml espeak-ng-data evince-common fonts-font-awesome fonts-roboto-slab gir1.2-atk-1.0 gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gnome-desktop3-data gstreamer1.0-alsa libatk-adaptor libbrlapi0.6 libchm1 libdbusmenu-glib4 libdotconf0 libdv4 libept1.5.0 libespeak-ng1 libglib-perl libid3tag0 libiec61883-0 libjs-modernizr libjs-sphinxdoc libjs-underscore libjsoncpp1 libkchart2-l10n libkf5khtml-data libkpathsea6 libmarkdown2 libmediainfo0v5 libpcaudio0 libqt4-dbus libqt4-network libqt4-script libqt4-sql libqt4-sql-mysql libqt4-test libqt4-xml libqt4-xmlpatterns libqtassistantclient4 libqtcore4 libqtdbus4 librarian0 libsdl2-2.0-0 libsonic0 libspeechd2 libspnav0 libstemmer0d libtar0 libtinyxml2-6a libu2f-udev libvkd3d1 libzen0v5 libzip4 mobile-broadband-provider-info python3-brlapi python3-dbus.mainloop.qt python3-feedparser python3-gst-1.0 python3-louis python3-musicbrainzngs python3-mutagen python3-pyinotify python3-sip python3-speechd qdbus qtchooser qtcore4-l10n rarian-compat sgml-base sgml-data sound-icons speech-dispatcher speech-dispatcher-audio-plugins speech-dispatcher-espeak-ng sphinx-rtd-theme-common xml-core

Perhaps the issue is with one of those packages.

gustavo-iniguez-goya commented 3 years ago

This problem should be fixed with latest packages.