%global _empty_manifest_terminate_build 0 Name: python-tcell-agent Version: 1.10.0 Release: 1 Summary: tCell Python Agent License: Free-to-use, proprietary software. URL: https://www.rapid7.com/products/tcell/ Source0: https://mirrors.aliyun.com/pypi/web/packages/a7/92/88d5c143d23069ab6aa586299657b87369215a90f315721b20bc22fc9007/tcell_agent-1.10.0.tar.gz BuildArch: noarch %description # tCell Python Agent A tCell.io security agent that instruments your Python web applications. ## Installation Installing latest agent via pip: $ pip install tcell_agent Install a particular version: $ pip install tcell_agent==1.0.1 Install from source: $ pip install ~/Downloads/tcellagent_src Install from a compressed file: $ pip install ~/Downloads/pythonagent-tcell-master.zip ## Run application from source Switch to your project $ cd ~/projects/mydjangoapp/ Obtain a `tcell_agent.config` file from the tCell dashboard and place it at the root of your web app, for this example `~/projects/mydjango/`. **NOTE!** By default the agent looks for the `tcell_agent.config` in the current working directory as well as `$TCELL_AGENT_HOME/tcell_agent.config`. There are two ways you can load the tcell_agent: ### 1. Use the tcell_agent binary to run your app If you previously started your web app like this: $ python manage.py runserver 0.0.0.0:8000 you now start it like this: $ tcell_agent run python manage.py runserver 0.0.0.0:8000 ### 2. Load the tcell_agent via a wsgi.py file Assuming your `wsgi.py` (Django) file looks something like this: ```python import os from django.core.wsgi import get_wsgi_application from django_waitlist.settings import PROJECT_ROOT os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_waitlist.settings") application = get_wsgi_application() ``` modify it accordingly: ```python import os from django.core.wsgi import get_wsgi_application from django_waitlist.settings import PROJECT_ROOT # optional: change default settings via ENV # os.environ['TCELL_AGENT_CONFIG'] = '/var/www/html/tcell/tcell_agent.config' # os.environ['TCELL_AGENT_HOME'] = '/var/www/html/tcell' import tcell_agent tcell_agent.init() os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_waitlist.settings") application = get_wsgi_application() ``` ## Run application from service script Assuming your service script (`/etc/init.d/myapp.conf`) that looks something like this: ```sh script set -a source /etc/environment exec /path/to/bin/uwsgi --ini uwsgi.ini end script ``` load the tcell_agent by modifying it accordingly: ```sh script set -a source /etc/environment export TCELL_AGENT_CONFIG='/path/to/tcell-home/tcell_agent.config' export TCELL_AGENT_HOME='/path/to/tcell-home/tcell' exec /path/to/bin/tcell_agent /path/to/bin/uwsgi --ini uwsgi.ini end script ``` If you don't want to modify your service script, modifying `wsgi.py` to load the agent should also work. ## Common pitfalls * If you're using `tcell_agent` binary, ensure it exists in your path. * If you're using virtualenv make sure to load the environment before installing tcell_agent * When specifying `TCELL_AGENT_HOME` ensure the app's user has correct read/write permissions to that directory. %package -n python3-tcell-agent Summary: tCell Python Agent Provides: python-tcell-agent BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-tcell-agent # tCell Python Agent A tCell.io security agent that instruments your Python web applications. ## Installation Installing latest agent via pip: $ pip install tcell_agent Install a particular version: $ pip install tcell_agent==1.0.1 Install from source: $ pip install ~/Downloads/tcellagent_src Install from a compressed file: $ pip install ~/Downloads/pythonagent-tcell-master.zip ## Run application from source Switch to your project $ cd ~/projects/mydjangoapp/ Obtain a `tcell_agent.config` file from the tCell dashboard and place it at the root of your web app, for this example `~/projects/mydjango/`. **NOTE!** By default the agent looks for the `tcell_agent.config` in the current working directory as well as `$TCELL_AGENT_HOME/tcell_agent.config`. There are two ways you can load the tcell_agent: ### 1. Use the tcell_agent binary to run your app If you previously started your web app like this: $ python manage.py runserver 0.0.0.0:8000 you now start it like this: $ tcell_agent run python manage.py runserver 0.0.0.0:8000 ### 2. Load the tcell_agent via a wsgi.py file Assuming your `wsgi.py` (Django) file looks something like this: ```python import os from django.core.wsgi import get_wsgi_application from django_waitlist.settings import PROJECT_ROOT os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_waitlist.settings") application = get_wsgi_application() ``` modify it accordingly: ```python import os from django.core.wsgi import get_wsgi_application from django_waitlist.settings import PROJECT_ROOT # optional: change default settings via ENV # os.environ['TCELL_AGENT_CONFIG'] = '/var/www/html/tcell/tcell_agent.config' # os.environ['TCELL_AGENT_HOME'] = '/var/www/html/tcell' import tcell_agent tcell_agent.init() os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_waitlist.settings") application = get_wsgi_application() ``` ## Run application from service script Assuming your service script (`/etc/init.d/myapp.conf`) that looks something like this: ```sh script set -a source /etc/environment exec /path/to/bin/uwsgi --ini uwsgi.ini end script ``` load the tcell_agent by modifying it accordingly: ```sh script set -a source /etc/environment export TCELL_AGENT_CONFIG='/path/to/tcell-home/tcell_agent.config' export TCELL_AGENT_HOME='/path/to/tcell-home/tcell' exec /path/to/bin/tcell_agent /path/to/bin/uwsgi --ini uwsgi.ini end script ``` If you don't want to modify your service script, modifying `wsgi.py` to load the agent should also work. ## Common pitfalls * If you're using `tcell_agent` binary, ensure it exists in your path. * If you're using virtualenv make sure to load the environment before installing tcell_agent * When specifying `TCELL_AGENT_HOME` ensure the app's user has correct read/write permissions to that directory. %package help Summary: Development documents and examples for tcell-agent Provides: python3-tcell-agent-doc %description help # tCell Python Agent A tCell.io security agent that instruments your Python web applications. ## Installation Installing latest agent via pip: $ pip install tcell_agent Install a particular version: $ pip install tcell_agent==1.0.1 Install from source: $ pip install ~/Downloads/tcellagent_src Install from a compressed file: $ pip install ~/Downloads/pythonagent-tcell-master.zip ## Run application from source Switch to your project $ cd ~/projects/mydjangoapp/ Obtain a `tcell_agent.config` file from the tCell dashboard and place it at the root of your web app, for this example `~/projects/mydjango/`. **NOTE!** By default the agent looks for the `tcell_agent.config` in the current working directory as well as `$TCELL_AGENT_HOME/tcell_agent.config`. There are two ways you can load the tcell_agent: ### 1. Use the tcell_agent binary to run your app If you previously started your web app like this: $ python manage.py runserver 0.0.0.0:8000 you now start it like this: $ tcell_agent run python manage.py runserver 0.0.0.0:8000 ### 2. Load the tcell_agent via a wsgi.py file Assuming your `wsgi.py` (Django) file looks something like this: ```python import os from django.core.wsgi import get_wsgi_application from django_waitlist.settings import PROJECT_ROOT os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_waitlist.settings") application = get_wsgi_application() ``` modify it accordingly: ```python import os from django.core.wsgi import get_wsgi_application from django_waitlist.settings import PROJECT_ROOT # optional: change default settings via ENV # os.environ['TCELL_AGENT_CONFIG'] = '/var/www/html/tcell/tcell_agent.config' # os.environ['TCELL_AGENT_HOME'] = '/var/www/html/tcell' import tcell_agent tcell_agent.init() os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_waitlist.settings") application = get_wsgi_application() ``` ## Run application from service script Assuming your service script (`/etc/init.d/myapp.conf`) that looks something like this: ```sh script set -a source /etc/environment exec /path/to/bin/uwsgi --ini uwsgi.ini end script ``` load the tcell_agent by modifying it accordingly: ```sh script set -a source /etc/environment export TCELL_AGENT_CONFIG='/path/to/tcell-home/tcell_agent.config' export TCELL_AGENT_HOME='/path/to/tcell-home/tcell' exec /path/to/bin/tcell_agent /path/to/bin/uwsgi --ini uwsgi.ini end script ``` If you don't want to modify your service script, modifying `wsgi.py` to load the agent should also work. ## Common pitfalls * If you're using `tcell_agent` binary, ensure it exists in your path. * If you're using virtualenv make sure to load the environment before installing tcell_agent * When specifying `TCELL_AGENT_HOME` ensure the app's user has correct read/write permissions to that directory. %prep %autosetup -n tcell_agent-1.10.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-tcell-agent -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 1.10.0-1 - Package Spec generated