Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 611658 Details for
Bug 854176
Review Request: python-django-admin-honeypot - A fake Django admin login screen to notify admins of attempted unauthorized access
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Fix runtime requirements for rawhide
0002-change-setup.py-requires-to-fix.patch (text/plain), 13.29 KB, created by
Eduardo Echeverria
on 2012-09-11 05:07:10 UTC
(
hide
)
Description:
Fix runtime requirements for rawhide
Filename:
MIME Type:
Creator:
Eduardo Echeverria
Created:
2012-09-11 05:07:10 UTC
Size:
13.29 KB
patch
obsolete
>diff -uNr django-admin-honeypot-0.2.3-orig/setup.py django-admin-honeypot-0.2.3/setup.py >--- django-admin-honeypot-0.2.3-orig/setup.py 2012-09-10 20:09:36.701501865 -0430 >+++ django-admin-honeypot-0.2.3/setup.py 2012-09-10 20:31:48.071579022 -0430 >@@ -58,7 +58,7 @@ > tests_require=( > 'coverage', > 'django', >- 'pep8==1.3.1', >+ 'pep8==1.3.3', > ), > zip_safe=False, > ) >diff -uNr django-admin-honeypot-0.2.3-orig/tests/__init__.py django-admin-honeypot-0.2.3/tests/__init__.py >--- django-admin-honeypot-0.2.3-orig/tests/__init__.py 1969-12-31 20:00:00.000000000 -0400 >+++ django-admin-honeypot-0.2.3/tests/__init__.py 2012-09-10 20:13:01.074513715 -0430 >@@ -0,0 +1 @@ >+#initialize test >diff -uNr django-admin-honeypot-0.2.3-orig/tests/setuptest.py django-admin-honeypot-0.2.3/tests/setuptest.py >--- django-admin-honeypot-0.2.3-orig/tests/setuptest.py 1969-12-31 20:00:00.000000000 -0400 >+++ django-admin-honeypot-0.2.3/tests/setuptest.py 2012-09-10 20:10:47.714505978 -0430 >@@ -0,0 +1,169 @@ >+import pep8 >+import sys >+import unittest >+ >+from coverage import coverage, misc >+from distutils import log >+from StringIO import StringIO >+ >+ >+class SetupTestSuite(unittest.TestSuite): >+ """ >+ Test Suite configuring Django settings and using >+ DjangoTestSuiteRunner as test runner. >+ Also runs PEP8 and Coverage checks. >+ """ >+ def __init__(self, *args, **kwargs): >+ self.configure() >+ self.cov = coverage() >+ self.cov.start() >+ self.packages = self.resolve_packages() >+ >+ super(SetupTestSuite, self).__init__(tests=self.build_tests(), \ >+ *args, **kwargs) >+ >+ # Setup testrunner. >+ from django.test.simple import DjangoTestSuiteRunner >+ self.test_runner = DjangoTestSuiteRunner( >+ verbosity=1, >+ interactive=True, >+ failfast=False >+ ) >+ self.test_runner.setup_test_environment() >+ self.old_config = self.test_runner.setup_databases() >+ >+ def build_tests(self): >+ """ >+ Build tests for inclusion in suite from resolved packages. >+ """ >+ from django.core.exceptions import ImproperlyConfigured >+ from django.db.models import get_app >+ from django.test.simple import build_suite >+ >+ tests = [] >+ for package in self.packages: >+ try: >+ app_name = package.rsplit('.')[-1] >+ app = get_app(app_name, emptyOK=True) >+ tests.append(build_suite(app)) >+ except ImproperlyConfigured, e: >+ raise >+ log.info("Warning: %s" % e) >+ except ImportError, e: >+ raise >+ log.info("Warning: %s" % e) >+ return tests >+ >+ def configure(self): >+ """ >+ Configures Django settings. >+ """ >+ from django.conf import settings >+ from django.utils.importlib import import_module >+ try: >+ test_settings = import_module('tests.test_settings') >+ except ImportError, e: >+ log.info('ImportError: Unable to import test settings: %s' % e) >+ sys.exit(1) >+ >+ setting_attrs = {} >+ for attr in dir(test_settings): >+ if '__' not in attr: >+ setting_attrs[attr] = getattr(test_settings, attr) >+ >+ if not settings.configured: >+ settings.configure(**setting_attrs) >+ >+ def coverage_report(self): >+ """ >+ Outputs Coverage report to screen and coverage.xml. >+ """ >+ verbose = '--quiet' not in sys.argv >+ self.cov.stop() >+ if verbose: >+ log.info("\nCoverage Report:") >+ try: >+ include = ['%s*' % package for package in self.packages] >+ omit = ['*tests*'] >+ self.cov.report(include=include, omit=omit) >+ self.cov.xml_report(include=include, omit=omit) >+ except misc.CoverageException, e: >+ log.info("Coverage Exception: %s" % e) >+ >+ def resolve_packages(self): >+ from django.conf import settings >+ >+ packages = list() >+ targets = self.get_target_packages() >+ >+ for app in settings.INSTALLED_APPS: >+ for target in targets: >+ if app.startswith(target): >+ packages.append(app) >+ return packages >+ >+ def get_target_packages(self): >+ """ >+ Frame hack to determine packages contained in module for testing. >+ We ignore submodules (those containing '.') >+ """ >+ f = sys._getframe() >+ while f: >+ if 'self' in f.f_locals: >+ locals_self = f.f_locals['self'] >+ py_modules = getattr(locals_self, 'py_modules', None) >+ packages = getattr(locals_self, 'packages', None) >+ >+ top_packages = [] >+ if py_modules or packages: >+ if py_modules: >+ for module in py_modules: >+ if '.' not in module: >+ top_packages.append(module) >+ if packages: >+ for package in packages: >+ if '.' not in package: >+ top_packages.append(package) >+ >+ return list(set(top_packages)) >+ f = f.f_back >+ >+ def pep8_report(self): >+ """ >+ Outputs PEP8 report to screen and pep8.txt. >+ """ >+ verbose = '--quiet' not in sys.argv >+ if verbose: >+ # Hook into stdout. >+ old_stdout = sys.stdout >+ sys.stdout = mystdout = StringIO() >+ >+ # Run Pep8 checks. >+ pep8_style = pep8.StyleGuide(ignore=['E2', 'E3', 'E4', 'E501', 'W']) >+ pep8_style.check_files([pkg.replace('.', '/') for pkg in self.packages]) >+ >+ # Restore stdout. >+ sys.stdout = old_stdout >+ >+ # Save result to pep8.txt. >+ result = mystdout.getvalue() >+ output = open('pep8.txt', 'w') >+ output.write(result) >+ output.close() >+ >+ # Return Pep8 result >+ if result: >+ log.info("\nPEP8 Report:") >+ log.info(result) >+ >+ def run(self, *args, **kwargs): >+ """ >+ Run the test, teardown the environment and generate reports. >+ """ >+ result = super(SetupTestSuite, self).run(*args, **kwargs) >+ self.test_runner.teardown_databases(self.old_config) >+ self.test_runner.teardown_test_environment() >+ self.coverage_report() >+ self.pep8_report() >+ return result >+ >diff -uNr django-admin-honeypot-0.2.3-orig/tests/test_settings.py django-admin-honeypot-0.2.3/tests/test_settings.py >--- django-admin-honeypot-0.2.3-orig/tests/test_settings.py 1969-12-31 20:00:00.000000000 -0400 >+++ django-admin-honeypot-0.2.3/tests/test_settings.py 2012-09-10 20:10:47.714505978 -0430 >@@ -0,0 +1,156 @@ >+# Django settings for {{ project_name }} project. >+import os >+ >+PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) >+DEBUG = True >+TEMPLATE_DEBUG = DEBUG >+ >+ADMINS = ( >+ ('Admin User', 'admin@example.com') >+) >+ >+MANAGERS = ADMINS >+ >+DATABASES = { >+ 'default': { >+ 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. >+ 'NAME': ':memory:', # Or path to database file if using sqlite3. >+ 'USER': '', # Not used with sqlite3. >+ 'PASSWORD': '', # Not used with sqlite3. >+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. >+ 'PORT': '', # Set to empty string for default. Not used with sqlite3. >+ } >+} >+ >+# Local time zone for this installation. Choices can be found here: >+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name >+# although not all choices may be available on all operating systems. >+# On Unix systems, a value of None will cause Django to use the same >+# timezone as the operating system. >+# If running in a Windows environment this must be set to the same as your >+# system time zone. >+TIME_ZONE = 'America/Chicago' >+ >+# Language code for this installation. All choices can be found here: >+# http://www.i18nguy.com/unicode/language-identifiers.html >+LANGUAGE_CODE = 'en-us' >+ >+SITE_ID = 1 >+ >+# If you set this to False, Django will make some optimizations so as not >+# to load the internationalization machinery. >+USE_I18N = True >+ >+# If you set this to False, Django will not format dates, numbers and >+# calendars according to the current locale. >+USE_L10N = True >+ >+# If you set this to False, Django will not use timezone-aware datetimes. >+USE_TZ = True >+ >+# Absolute filesystem path to the directory that will hold user-uploaded files. >+# Example: "/home/media/media.lawrence.com/media/" >+MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') >+ >+# URL that handles the media served from MEDIA_ROOT. Make sure to use a >+# trailing slash. >+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" >+MEDIA_URL = '/media/' >+ >+# Absolute path to the directory static files should be collected to. >+# Don't put anything in this directory yourself; store your static files >+# in apps' "static/" subdirectories and in STATICFILES_DIRS. >+# Example: "/home/media/media.lawrence.com/static/" >+STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') >+ >+# URL prefix for static files. >+# Example: "http://media.lawrence.com/static/" >+STATIC_URL = '/static/' >+ >+# Additional locations of static files >+STATICFILES_DIRS = ( >+ # Put strings here, like "/home/html/static" or "C:/www/django/static". >+ # Always use forward slashes, even on Windows. >+ # Don't forget to use absolute paths, not relative paths. >+) >+ >+# List of finder classes that know how to find static files in >+# various locations. >+STATICFILES_FINDERS = ( >+ 'django.contrib.staticfiles.finders.FileSystemFinder', >+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder', >+# 'django.contrib.staticfiles.finders.DefaultStorageFinder', >+) >+ >+# Make this unique, and don't share it with anybody. >+SECRET_KEY = 'uv(aokeqwo$jj&$p7bhh6qf^*idhqowmb(uh9*_j&3h96rq@ai' >+ >+# List of callables that know how to import templates from various sources. >+TEMPLATE_LOADERS = ( >+ 'django.template.loaders.filesystem.Loader', >+ 'django.template.loaders.app_directories.Loader', >+# 'django.template.loaders.eggs.Loader', >+) >+ >+MIDDLEWARE_CLASSES = ( >+ 'django.middleware.common.CommonMiddleware', >+ 'django.contrib.sessions.middleware.SessionMiddleware', >+ 'django.middleware.csrf.CsrfViewMiddleware', >+ 'django.contrib.auth.middleware.AuthenticationMiddleware', >+ 'django.contrib.messages.middleware.MessageMiddleware', >+ # Uncomment the next line for simple clickjacking protection: >+ # 'django.middleware.clickjacking.XFrameOptionsMiddleware', >+) >+ >+ROOT_URLCONF = 'tests.urls' >+ >+TEMPLATE_DIRS = ( >+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". >+ # Always use forward slashes, even on Windows. >+ # Don't forget to use absolute paths, not relative paths. >+) >+ >+INSTALLED_APPS = ( >+ 'django.contrib.auth', >+ 'django.contrib.contenttypes', >+ 'django.contrib.sessions', >+ 'django.contrib.sites', >+ 'django.contrib.messages', >+ #'django.contrib.staticfiles', >+ 'admin_honeypot', >+ # Uncomment the next line to enable the admin: >+ 'django.contrib.admin', >+ # Uncomment the next line to enable admin documentation: >+ # 'django.contrib.admindocs', >+) >+ >+# A sample logging configuration. The only tangible logging >+# performed by this configuration is to send an email to >+# the site admins on every HTTP 500 error when DEBUG=False. >+# See http://docs.djangoproject.com/en/dev/topics/logging for >+# more details on how to customize your logging configuration. >+LOGGING = { >+ 'version': 1, >+ 'disable_existing_loggers': False, >+ 'filters': { >+ 'require_debug_false': { >+ '()': 'django.utils.log.RequireDebugFalse' >+ } >+ }, >+ 'handlers': { >+ 'mail_admins': { >+ 'level': 'ERROR', >+ 'filters': ['require_debug_false'], >+ 'class': 'django.utils.log.AdminEmailHandler' >+ } >+ }, >+ 'loggers': { >+ 'django.request': { >+ 'handlers': ['mail_admins'], >+ 'level': 'ERROR', >+ 'propagate': True, >+ }, >+ } >+} >+ >+ADMIN_HONEYPOT_EMAIL_ADMINS = True >diff -uNr django-admin-honeypot-0.2.3-orig/tests/urls.py django-admin-honeypot-0.2.3/tests/urls.py >--- django-admin-honeypot-0.2.3-orig/tests/urls.py 1969-12-31 20:00:00.000000000 -0400 >+++ django-admin-honeypot-0.2.3/tests/urls.py 2012-09-10 20:10:47.720505979 -0430 >@@ -0,0 +1,18 @@ >+from django.conf.urls.defaults import patterns, include, url >+ >+# Uncomment the next two lines to enable the admin: >+from django.contrib import admin >+admin.autodiscover() >+ >+urlpatterns = patterns('', >+ # Examples: >+ # url(r'^$', '{{ project_name }}.views.home', name='home'), >+ # url(r'^{{ project_name }}/', include('playground.foo.urls')), >+ >+ # Uncomment the admin/doc line below to enable admin documentation: >+ # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), >+ >+ # Uncomment the next line to enable the admin: >+ url(r'^admin/', include('admin_honeypot.urls')), >+ url(r'^secret/', include(admin.site.urls)), >+)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 854176
:
610638
| 611658