Verified Commit b94634ce authored by Marco Marinello's avatar Marco Marinello
Browse files

Added script to download configuration

parent f6378528
Pipeline #254 passed with stage
in 40 seconds
#!/usr/bin/python3
# Copyright (C) 2022 The FUSS Project <info@fuss.bz.it>
# Author: Marco Marinello <contact-nohuman@marinello.bz.it>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import requests
import subprocess
import socket
# Clean veyon db
subprocess.call(["/usr/bin/veyon-cli", "networkobjects", "clear"])
# Need to bypass proxy configuration
session = requests.Session()
session.trust_env = False
# Try to get list from server
server = session.get("http://proxy:13402/veyon/client_conf", params={"hostname": socket.gethostname()})
if server.status_code != 200:
exit(0)
for cluster in server.json():
subprocess.call(["/usr/bin/veyon-cli", "networkobjects", "add", "location", cluster["name"]])
for pc in cluster["computers"]:
subprocess.call(["/usr/bin/veyon-cli", "networkobjects", "add", "computer", pc, "", pc, cluster["name"]])
......@@ -18,12 +18,15 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Stop system-wide Veyon daemon
systemctl stop veyon
# This file is recovered by a daemon from the FUSS Server, if it
# doesn't exists, will default as below.
if [ -e /var/lib/fuss-client/veyon-excluded-groups ]; then
EXCLUDED_GROUPS="$(xargs < /var/lib/fuss-client/veyon-excluded-groups)"
else
EXCLUDED_GROUPS="root docenti insegnanti veyon-master"
EXCLUDED_GROUPS="root docenti insegnanti veyon-master tecnici"
fi
# We don't want teachers to be monitored.
......@@ -33,12 +36,11 @@ BELONGING_GROUPS=" $(id -nG $USER) "
for group in $EXCLUDED_GROUPS; do
if echo "$BELONGING_GROUPS" | grep " $group "; then
python3 /usr/share/fuss-client/roles/veyon/veyon-sync-pc-list || true
exit 0
fi
done
# Stop system-wide Veyon daemon
systemctl stop veyon
# Launch Veyon daemon in background as the
# user that logged-in.
su -c veyon-service $USER &
......@@ -54,7 +54,7 @@
- name: "AccessControl/AuthorizedUserGroups"
value: "veyon-master"
- name: "Features/DisabledFeatures"
value: "{f483c659-b5e7-4dbc-bd91-2c9403e70ebd};{09bcb3a1-fc11-4d03-8cf1-efd26be8655b};{7310707d-3918-460d-a949-65bd152cb958}"
value: "{09bcb3a1-fc11-4d03-8cf1-efd26be8655b};{f483c659-b5e7-4dbc-bd91-2c9403e70ebd};{7310707d-3918-460d-a949-65bd152cb958}"
# No daemon restart or activation here:
# we would cause a problem if upgraded un-interactively.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment