From ab2485c063e6a500abc8eccecf0bb579be5d2b3d Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 27 Mar 2024 11:28:21 +0100 Subject: [PATCH 01/10] Unlicense --- LICENSE | 1 + UNLICENSE | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 120000 LICENSE create mode 100644 UNLICENSE diff --git a/LICENSE b/LICENSE new file mode 120000 index 0000000..4761def --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ +UNLICENSE \ No newline at end of file diff --git a/UNLICENSE b/UNLICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to From d33fec65a2c5dfe8bc009e587b1d8ace177762dc Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 22 Apr 2024 10:43:50 +0200 Subject: [PATCH 02/10] system: support LDAP queries with no user_group set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Though it might be better to allow multiple groups. On the other hand the main filter is in the group→ipset settings file anyway; any VPN user not in one of those groups will not get forwarded to anywhere. --- web/system.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/web/system.py b/web/system.py index 8d2d699..75d77c4 100644 --- a/web/system.py +++ b/web/system.py @@ -68,10 +68,18 @@ def save_config(): user_networks = collections.defaultdict(set) ldap = ldap3.Connection(ldap3.Server(settings.get('ldap_host'), use_ssl=True), settings.get('ldap_user'), settings.get('ldap_pass'), auto_bind=True) + + # All of these must match to consider an LDAP object. + ldap_query = [ + '(objectClass=user)', # only users + '(objectCategory=person)', # that are people + '(!(userAccountControl:1.2.840.113556.1.4.803:=2))', # with enabled accounts + ] + if group := settings.get('user_group'): + ldap_query += [f'(memberOf:1.2.840.113556.1.4.1941:={group})'] # in given group, recursively + ldap.search(settings.get('ldap_base_dn', ''), - '(&(objectClass=user)(objectCategory=person)' + # only people - '(!(userAccountControl:1.2.840.113556.1.4.803:=2))' + # with enabled accounts - f'(memberOf:1.2.840.113556.1.4.1941:={settings.get("user_group", "")}))', # in given group, recursively + f'(&{"".join(ldap_query)})', # conjuction (&(…)(…)(…)) of queries attributes=['userPrincipalName', 'memberOf']) for entry in ldap.entries: for group in entry.memberOf: From 880c6b41403cc489256c94aeb6d7c74388568840 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 23 Apr 2024 12:38:32 +0200 Subject: [PATCH 03/10] friwall: tweak instructions For no particularly good reason. --- web/templates/vpn/index.html | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/web/templates/vpn/index.html b/web/templates/vpn/index.html index a65bdad..f1291c6 100644 --- a/web/templates/vpn/index.html +++ b/web/templates/vpn/index.html @@ -19,7 +19,10 @@ Zaženite WireGuard, izberite Scan from QR code in skenirajte kodo, pri
Linux / BSD

-Nastavitve shranite (kot skrbnik) v /etc/wireguard/wg-fri.conf. VPN nato (de)aktivirate s sudo wg-quick up wg-fri oz. sudo wg-quick down wg-fri. Povezavo lahko uvozite tudi v NetworkManager ali podobno. +Nastavitve shranite (kot skrbnik) v /etc/wireguard/wg-fri.conf. VPN nato (de)aktivirate s sudo wg-quick up wg-fri oz. sudo wg-quick down wg-fri. + +

+Povezavo lahko uvozite tudi v NetworkManager z ukazom nmcli connection import type wireguard file wg-fri.conf.

@@ -27,21 +30,23 @@ Nastavitve shranite (kot skrbnik) v /etc/wireguard/wg-fri.conf. VPN

-Vnesite poljubno oznako in kliknite Ustvari ključ. Če vklopite prvo opcijo, bo vaš računalnik čez VPN usmeril ves mrežni promet, ne le tistega, ki je namenjen strežnikom na FRI. Če izklopite drugo opcijo, bodo nekatere storitve dostopne le prek naslova IP. Če ste v dvomih, pustite privzete nastavitve. +Za vsako napravo, ki jo želite povezati v omrežje FRI, ustvarite nov ključ.


+


-

-

+

+Privzete nastavitve čez VPN usmerijo le promet, namenjen strežnikom na FRI in UL. Če vklopite prvo opcijo, bo vaš računalnik čez VPN usmeril ves promet. Če izklopite drugo opcijo, bodo nekateri strežniki dostopni le prek naslova IP. Če ste v dvomih, pustite privzete nastavitve. Podrobnejše informacije so v dokumentaciji. +