-
Notifications
You must be signed in to change notification settings - Fork 38
Install WebAdmin dependencies in a dedicated venv #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,9 @@ npm -v | |
|
|
||
| ### Install Python packages | ||
| ```bash | ||
| python3 -m pip install --break-system-packages --ignore-installed urllib3==1.26.15 mysqlclient | ||
| python3 -m venv /opt/fitcrack-webadmin-venv | ||
| /opt/fitcrack-webadmin-venv/bin/python3 -m pip install --upgrade pip | ||
| /opt/fitcrack-webadmin-venv/bin/python3 -m pip install --ignore-installed urllib3==1.26.15 mysqlclient | ||
| ``` | ||
|
|
||
| ### Setup the MariaDB server | ||
|
|
@@ -190,7 +192,9 @@ dnf install -y \ | |
|
|
||
| ### Install Python packages for Fitcrack | ||
| ```bash | ||
| python3 -m pip install --ignore-installed mysqlclient urllib3==1.26.15 | ||
| python3 -m venv /opt/fitcrack-webadmin-venv | ||
| /opt/fitcrack-webadmin-venv/bin/python3 -m pip install --upgrade pip | ||
| /opt/fitcrack-webadmin-venv/bin/python3 -m pip install --ignore-installed mysqlclient urllib3==1.26.15 | ||
|
Comment on lines
+195
to
+197
|
||
| ``` | ||
|
|
||
| ### Install Node 16.15 | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,8 @@ | |||||||||
| ################################## | ||||||||||
|
|
||||||||||
| echo "Installing back-end requirements..." | ||||||||||
| python3 -m pip install --break-system-packages --ignore-installed -r webadmin/fitcrackAPI/src/requirements.txt | ||||||||||
| WEBADMIN_VENV_PATH="$APACHE_DOCUMENT_ROOT/fitcrackAPI/.venv" | ||||||||||
| echo "Back-end dependencies will be installed into a dedicated virtualenv: $WEBADMIN_VENV_PATH" | ||||||||||
| echo "Done." | ||||||||||
|
Comment on lines
11
to
14
|
||||||||||
|
|
||||||||||
| #################################### | ||||||||||
|
|
@@ -191,7 +192,7 @@ else | |||||||||
| fi | ||||||||||
|
|
||||||||||
| echo "<VirtualHost *:$BACKEND_PORT>" >> $BE_CONFIG_FILE | ||||||||||
| echo " WSGIDaemonProcess fitcrack user=$APACHE_USER group=$APACHE_USER threads=5" >> $BE_CONFIG_FILE | ||||||||||
| echo " WSGIDaemonProcess fitcrack user=$APACHE_USER group=$APACHE_USER threads=5 python-home=$WEBADMIN_VENV_PATH" >> $BE_CONFIG_FILE | ||||||||||
|
||||||||||
| echo " WSGIDaemonProcess fitcrack user=$APACHE_USER group=$APACHE_USER threads=5 python-home=$WEBADMIN_VENV_PATH" >> $BE_CONFIG_FILE | |
| echo " WSGIDaemonProcess fitcrack user=$APACHE_USER group=$APACHE_GROUP threads=5 python-home=$WEBADMIN_VENV_PATH" >> $BE_CONFIG_FILE |
Copilot
AI
Apr 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The venv is being made writable/owned by the Apache runtime user (chmod -R 775 + chown -R $APACHE_USER...). That allows a web-server compromise to modify Python packages/code inside the venv and persist RCE. Prefer keeping the venv owned by root (or a dedicated admin user) and only readable/executable by Apache; avoid recursive group-writable permissions.
| chmod -R 775 "$WEBADMIN_VENV_PATH" | |
| chown -R $APACHE_USER:$APACHE_GROUP "$WEBADMIN_VENV_PATH" | |
| chown -R root:root "$WEBADMIN_VENV_PATH" | |
| chmod -R a+rX,u+w "$WEBADMIN_VENV_PATH" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,6 @@ systemctl restart apache2 | |
| On Centos/RHEL: | ||
| ``` | ||
| yum install -y python3-devel python3 python3-pip python3-mod_wsgi | ||
| pip3 install mysqlclient | ||
| ``` | ||
|
|
||
|
|
||
|
|
@@ -22,7 +21,9 @@ pip3 install mysqlclient | |
| Install backend dependencies | ||
| ``` | ||
| cd /var/www/fitcrackAPI/src | ||
| sudo pip3 install -r requirements.txt | ||
| python3 -m venv /var/www/fitcrackAPI/.venv | ||
| /var/www/fitcrackAPI/.venv/bin/python3 -m pip install --upgrade pip | ||
| /var/www/fitcrackAPI/.venv/bin/python3 -m pip install -r requirements.txt | ||
|
Comment on lines
+24
to
+26
|
||
| ``` | ||
|
|
||
|
|
||
|
|
@@ -80,7 +81,7 @@ Change `/etc/apache2/sites-available/000-default.conf` to: | |
| Listen 5000 | ||
| <VirtualHost *:5000> | ||
|
|
||
| WSGIDaemonProcess fitcrack user=boincadm group=boincadm threads=5 | ||
| WSGIDaemonProcess fitcrack user=boincadm group=boincadm threads=5 python-home=/var/www/fitcrackAPI/.venv | ||
| WSGIScriptAlias / /var/www/fitcrackAPI/src/wsgi.py | ||
|
|
||
| <Directory /var/www/fitcrackAPI/src/> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a venv in
/opt/fitcrack-webadmin-venv, but the rest of the installer flow (and scripts likemeasureUsage.pywith#!/usr/bin/python3) won’t use it unless you explicitly reference that interpreter. If these packages are needed by system-Python daemons, they should be installed via distro packages or the daemon should be updated to run using the venv’s python; otherwise, clarify/remove this step to avoid a non-functional venv.