From bac07800b48ef52b46b6603c56dbc5229d02fe76 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 13 Nov 2024 13:02:11 +0100 Subject: [PATCH 1/7] #1139 change default user and directories --- installer/installer.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/installer/installer.sh b/installer/installer.sh index 0015672..4548b7b 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -6,8 +6,8 @@ GIT_BRANCH=$1 GIT_REPO=https://ognproject.evlt.uma.es/gitea/opengnsys/ogrepository.git GIT_SSL_NO_VERIFY=true REPO_IP=${REPO_IP:-"127.0.0.1"} -SMBUSER=${SMBUSER:-"ogrepository"} -SMBPASS=${SMBPASS:-"ogrepository"} +OGUSER=${OGUSER:-"opengnsys"} +OGPASS=${OGPASS:-"og"} INSTALL_DIR=/opt/opengnsys/ogrepository DOWNLOAD_DIR=/tmp/ogrepository DEBIAN_FRONTEND=noninteractive @@ -37,13 +37,13 @@ install_updcast () { } add_user_ogrepository() { - if ! id "ogrepository" &>/dev/null; then + if ! id "$OGUSER" &>/dev/null; then echo "User ogrepository does not exist, creating it" - useradd -r -s /bin/bash ogrepository + useradd -r -s /bin/bash $OGUSER fi - if [ ! -f /etc/sudoers.d/ogrepository ]; then - echo "User ogrepository does not have sudo permissions, adding it" - echo 'ogrepository ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/ogrepository + if [ ! -f /etc/sudoers.d/$OGUSER ]; then + echo "User $OGUSER does not have sudo permissions, adding it" + echo 'ogrepository ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/"$OGUSER" fi } @@ -85,10 +85,10 @@ install_files() { configure_samba() { echo "include = /etc/samba/smb.conf.ogrepository" >> /etc/samba/smb.conf cp $DOWNLOAD_DIR/installer/files/ogrepo-smb.conf /etc/samba/smb.conf.ogrepository - sed -i "s/%%OGREPOSITORY_USER%%/$SMBUSER/g" /etc/samba/smb.conf.ogrepository + sed -i "s/%%OGREPOSITORY_USER%%/$OGUSER/g" /etc/samba/smb.conf.ogrepository systemctl restart smbd # Create default user ogrepository - (echo $SMBPASS; echo $SMBPASS) | smbpasswd -s -a $SMBUSER + (echo $OGPASS; echo $OGPASS) | smbpasswd -s -a $OGUSER } From 7a7565de7f0a3617933f7949706f99118b70e4ec Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 13 Nov 2024 13:10:26 +0100 Subject: [PATCH 2/7] Fix wrong instaces of username for #1132 --- installer/installer.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installer/installer.sh b/installer/installer.sh index 4548b7b..b17bf42 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -18,7 +18,7 @@ clone_repository() { local BRANCH=$1 rm -rf $DOWNLOAD_DIR git clone -b "$BRANCH" $GIT_REPO $DOWNLOAD_DIR - chown -R ogrepository:ogrepository $DOWNLOAD_DIR + chown -R $OGUSER:$OGUSER $DOWNLOAD_DIR } check_root() { @@ -43,7 +43,7 @@ add_user_ogrepository() { fi if [ ! -f /etc/sudoers.d/$OGUSER ]; then echo "User $OGUSER does not have sudo permissions, adding it" - echo 'ogrepository ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/"$OGUSER" + echo "$OGUSER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/"$OGUSER" fi } @@ -51,7 +51,7 @@ add_user_ogrepository() { create_directories() { mkdir -p $INSTALL_DIR mkdir -p $INSTALL_DIR/images $INSTALL_DIR/images_trash/ $INSTALL_DIR/bin/ $INSTALL_DIR/etc/ $INSTALL_DIR/log/ $INSTALL_DIR/api/ - chown -R ogrepository:ogrepository $INSTALL_DIR + chown -R $OGUSER:$OGUSER $INSTALL_DIR } install_dependencies() { @@ -77,9 +77,9 @@ install_files() { cp -pr $DOWNLOAD_DIR/bin/* $INSTALL_DIR/bin/ cp -pr $DOWNLOAD_DIR/etc/* $INSTALL_DIR/etc/ cp -pr $DOWNLOAD_DIR/api/* $INSTALL_DIR/api/ - chown -R ogrepository:ogrepository $INSTALL_DIR + chown -R $OGUSER:$OGUSER $INSTALL_DIR echo IPlocal="$REPO_IP" > $INSTALL_DIR/etc/ogAdmRepo.cfg - sudo chown ogrepository:ogrepository $INSTALL_DIR/etc/ogAdmRepo.cfg + sudo chown $OGUSER:$OGUSER $INSTALL_DIR/etc/ogAdmRepo.cfg } configure_samba() { From 5b10fdf1bda594f6dae9ba5c83e7d9fea2b4cc25 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 13 Nov 2024 13:21:50 +0100 Subject: [PATCH 3/7] Ticket #1039 fix worong permissions in ogrepo-api service --- installer/files/ogrepo-api.service | 4 ++-- installer/installer.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/installer/files/ogrepo-api.service b/installer/files/ogrepo-api.service index 136de86..a1419c1 100644 --- a/installer/files/ogrepo-api.service +++ b/installer/files/ogrepo-api.service @@ -3,8 +3,8 @@ Description=Gunicorn instance to serve repo_api After=network.target [Service] -User=ogrepository -Group=ogrepository +User=%%OGREPOSITORY_USER%% +Group=%%OGREPOSITORY_USER%% WorkingDirectory=/opt/opengnsys/ogrepository/api ExecStart=/usr/bin/gunicorn -w 4 -b 0.0.0.0:8006 repo_api:app diff --git a/installer/installer.sh b/installer/installer.sh index b17bf42..7512684 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -70,6 +70,7 @@ install_external_packages() { install_ogrepo-api_service() { cp -r $DOWNLOAD_DIR/installer/files/ogrepo-api.service /etc/systemd/system/ogrepo-api.service + sed -i "s/%%OGREPOSITORY_USER%%/$OGUSER/g" /etc/systemd/system/ogrepo-api.service systemctl enable --now ogrepo-api } From 3990648345521d459c5a0416a7d242bf49bf4abf Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 13 Nov 2024 13:45:22 +0100 Subject: [PATCH 4/7] =?UTF-8?q?-=20ticket=20#1140=20se=20a=C3=B1ade=20el?= =?UTF-8?q?=20paquete=20wakeonline=20-ticket=20#1141=20Se=20deshabilita=20?= =?UTF-8?q?uftp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- installer/installer.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/installer/installer.sh b/installer/installer.sh index 7512684..e992b3b 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -30,6 +30,8 @@ check_root() { install_uftp() { apt install uftp -y + systemctl stop uftp + systemctl disable uftp } install_updcast () { @@ -56,7 +58,7 @@ create_directories() { install_dependencies() { apt update -y - apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn + apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn wakeonlan } install_ext_repo() { From f713469f6eb82b3e0ae09e423b8180050ef4e549 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 13 Nov 2024 19:52:23 +0100 Subject: [PATCH 5/7] Updated permissions for all binary files --- installer/installer.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/installer.sh b/installer/installer.sh index e992b3b..94b18a8 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -80,7 +80,8 @@ install_files() { cp -pr $DOWNLOAD_DIR/bin/* $INSTALL_DIR/bin/ cp -pr $DOWNLOAD_DIR/etc/* $INSTALL_DIR/etc/ cp -pr $DOWNLOAD_DIR/api/* $INSTALL_DIR/api/ - chown -R $OGUSER:$OGUSER $INSTALL_DIR + chown -R $OGUSER:$OGUSER $INSTALL_DIR + chmod 755 $INSTALL_DIR/bin/* echo IPlocal="$REPO_IP" > $INSTALL_DIR/etc/ogAdmRepo.cfg sudo chown $OGUSER:$OGUSER $INSTALL_DIR/etc/ogAdmRepo.cfg } From b3366b365edc25e33771b25855dee53e1f4dd5c7 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 20 Nov 2024 18:26:00 +0100 Subject: [PATCH 6/7] Adjust Ipcore parameter for installation --- installer/installer.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/installer/installer.sh b/installer/installer.sh index 94b18a8..4fd4481 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -6,6 +6,7 @@ GIT_BRANCH=$1 GIT_REPO=https://ognproject.evlt.uma.es/gitea/opengnsys/ogrepository.git GIT_SSL_NO_VERIFY=true REPO_IP=${REPO_IP:-"127.0.0.1"} +CORE_IP=${CORE_IP:-"127.0.0.1"} OGUSER=${OGUSER:-"opengnsys"} OGPASS=${OGPASS:-"og"} INSTALL_DIR=/opt/opengnsys/ogrepository @@ -83,6 +84,7 @@ install_files() { chown -R $OGUSER:$OGUSER $INSTALL_DIR chmod 755 $INSTALL_DIR/bin/* echo IPlocal="$REPO_IP" > $INSTALL_DIR/etc/ogAdmRepo.cfg + echo IPcore="$CORE_IP" >> $INSTALL_DIR/etc/ogAdmRepo.cfg sudo chown $OGUSER:$OGUSER $INSTALL_DIR/etc/ogAdmRepo.cfg } From 9976714f79c7c64f1265338d6dec54a18042d447 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Tue, 26 Nov 2024 13:26:53 +0100 Subject: [PATCH 7/7] Add python3-request --- installer/installer.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/installer.sh b/installer/installer.sh index 4fd4481..c1b0e6d 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -59,7 +59,7 @@ create_directories() { install_dependencies() { apt update -y - apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn wakeonlan + apt install -y git python3 python3-pip python3-flask python3-paramiko python3-psutil python3-flasgger debian-archive-keyring samba gunicorn wakeonlan python3-requests } install_ext_repo() {