Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
django-yunohost-integration
Advanced tools
Python package django_yunohost_integration with helpers for integrate a Django project as YunoHost package.
A example usage of this package is here:
Pull requests welcome ;)
These projects used django_yunohost_integration
:
scripts/install
local_test
)pytest
against local_test
"installation"SSOwat is fully supported:
$YNH_APP_ARG_ADMIN
) will be created as Django's super userTo create/update the first user in install
/upgrade
, e.g.:
./manage.py create_superuser --username="$admin" --email="$admin_mail"
This Create/update Django superuser and set a unusable password. A password is not needed, because auth done via SSOwat ;)
Main parts in settings.py
:
from pathlib import Path as __Path
from django_yunohost_integration.base_settings import * # noqa
from django_yunohost_integration.secret_key import get_or_create_secret as __get_or_create_secret
DEBUG = bool(int('__DEBUG_ENABLED__')) # Set via config_panel.toml
# -----------------------------------------------------------------------------
DATA_DIR_PATH = __Path('__DATA_DIR__') # /home/yunohost.app/$app
assert DATA_DIR_PATH.is_dir(), f'Directory not exists: {DATA_DIR_PATH}'
INSTALL_DIR_PATH = __Path('__INSTALL_DIR__') # /var/www/$app
assert INSTALL_DIR_PATH.is_dir(), f'Directory not exists: {INSTALL_DIR_PATH}'
LOG_FILE = __Path('__LOG_FILE__') # /var/log/$app/$app.log
assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}'
PATH_URL = '__PATH_URL__' # $YNH_APP_ARG_PATH
PATH_URL = PATH_URL.strip('/')
# -----------------------------------------------------------------------------
# Function that will be called to finalize a user profile:
YNH_SETUP_USER = 'setup_user.setup_project_user'
SECRET_KEY = __get_or_create_secret(DATA_DIR_PATH / 'secret.txt') # /home/yunohost.app/$app/secret.txt
# INSTALLED_APPS.append('<insert-your-app-here>')
# -----------------------------------------------------------------------------
At least you have to set these settings:
from django_yunohost_integration.base_settings import * # noqa
INSTALLED_APPS.append('django_yunohost_integration')
MIDDLEWARE.insert(
MIDDLEWARE.index('django.contrib.auth.middleware.AuthenticationMiddleware') + 1,
# login a user via HTTP_REMOTE_USER header from SSOwat:
'django_yunohost_integration.sso_auth.auth_middleware.SSOwatRemoteUserMiddleware',
)
# Keep ModelBackend around for per-user permissions and superuser
AUTHENTICATION_BACKENDS = (
'axes.backends.AxesBackend', # AxesBackend should be the first backend!
#
# Authenticate via SSO and nginx 'HTTP_REMOTE_USER' header:
'django_yunohost_integration.sso_auth.auth_backend.SSOwatUserBackend',
#
# Fallback to normal Django model backend:
'django.contrib.auth.backends.ModelBackend',
)
LOGIN_REDIRECT_URL = None
LOGIN_URL = '/yunohost/sso/'
LOGOUT_REDIRECT_URL = '/yunohost/sso/'
# /yunohost/sso/?action=logout
ROOT_URLCONF = 'urls' # .../conf/urls.py
We install psycopg2
(a PostgreSQL adapter for the Python) that needs some build prerequisites, e.g.:
~$ sudo apt install build-essential python3-dev libpq-dev
For quicker developing of django_yunohost_integration in the context of YunoHost app, it's possible to run the Django developer server with the settings and urls made for YunoHost installation.
e.g.:
~$ git clone https://github.com/YunoHost-Apps/django_yunohost_integration.git
~$ cd django_yunohost_integration/
~/django_yunohost_integration$ ./dev-cli.py
For quicker developing of django_yunohost_integration in the context of YunoHost app, it's possible to run the Django developer server with the settings and urls made for YunoHost installation.
e.g.:
~/django_yunohost_integration$ ./dev-cli.py local-test
test
and password test
is createdhttp://127.0.0.1:8000/app_path/
assert_project_version
and get_github_version_tag
SyslogHandler
to logging settingsextra_replacements:dict
to create_local_test()
setup_demo_user()
-> setup_project_user()
pytest_helper.run_pytest()
SECURE_PROXY_SSL_HEADER
to settingsFAQs
Glue code to package django projects as yunohost apps.
We found that django-yunohost-integration demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.