diff --git a/dev/apache-deploy-proxy.conf b/dev/apache-deploy-proxy.conf index 8a100db..4c41419 100644 --- a/dev/apache-deploy-proxy.conf +++ b/dev/apache-deploy-proxy.conf @@ -1,3 +1,4 @@ + ServerName oer.hps.vi4io.org @@ -15,8 +16,6 @@ Include /home/www/hps/dev/apache-generic.conf - Alias "/.well-known/acme-challenge/" "/var/www/certbot/.well-known/acme-challenge/" - Options SymLinksIfOwnerMatch AllowOverride None @@ -29,7 +28,14 @@ ServerAdmin admin@hps.vi4io.org ServerName oer.hps.vi4io.org - Redirect permanent / https://oer.hps.vi4io.org:8080/ + #Redirect permanent / https://oer.hps.vi4io.org:8081/ + ProxyPass "/" "https://localhost:8081/" + ProxyPassReverse "/" "https://localhost:8081/" + SSLProxyEngine on + SSLProxyVerify none + SSLProxyCheckPeerCN off + SSLProxyCheckPeerName off + SSLProxyCheckPeerExpire off Options SymLinksIfOwnerMatch @@ -45,4 +51,5 @@ SSLCertificateFile /etc/letsencrypt/live/oer.hps.vi4io.org/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/oer.hps.vi4io.org/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf + diff --git a/dev/run-container-server.sh b/dev/run-container-server.sh index 3d9d318..734a3ad 100755 --- a/dev/run-container-server.sh +++ b/dev/run-container-server.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run -p 8080:80 -h hps -d --rm --privileged -v /home/oer/icp/:/data/ -v /etc/letsencrypt/archive/oer.hps.vi4io.org/:/data/ssl kunkel/oer +docker run -p 8081:80 -h hps -d --rm --privileged -v /home/oer/icp/:/data/ -v /etc/letsencrypt/archive/oer.hps.vi4io.org/:/data/ssl kunkel/oer diff --git a/oer/exercise-formats/program/match-regex-parallel/controller.py b/oer/exercise-formats/program/match-regex-parallel/controller.py index ff59b44..1aa61a3 100644 --- a/oer/exercise-formats/program/match-regex-parallel/controller.py +++ b/oer/exercise-formats/program/match-regex-parallel/controller.py @@ -40,7 +40,7 @@ def execute(ctx): print(" ".join(allArgs), file=sys.stderr) p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path) - timeout = 1 + timeout = 3 poll_period = 0.1 p.poll() while p.returncode is None and timeout > 0: diff --git a/oer/exercise-formats/program/match-regex/controller.py b/oer/exercise-formats/program/match-regex/controller.py index cf4bfe1..fe0a47b 100755 --- a/oer/exercise-formats/program/match-regex/controller.py +++ b/oer/exercise-formats/program/match-regex/controller.py @@ -37,7 +37,7 @@ def execute(ctx): print(" ".join(allArgs), file=sys.stderr) p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path) - timeout = 1 + timeout = 3 poll_period = 0.1 p.poll() while p.returncode is None and timeout > 0: diff --git a/oer/exercise-formats/program/scriptgrade/controller.py b/oer/exercise-formats/program/scriptgrade/controller.py index cde43fe..7643267 100644 --- a/oer/exercise-formats/program/scriptgrade/controller.py +++ b/oer/exercise-formats/program/scriptgrade/controller.py @@ -32,7 +32,7 @@ def execute(ctx): # start subprocess in with work_path as cwd p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path) - timeout = 1 + timeout = 3 poll_period = 0.1 p.poll() while p.returncode is None and timeout > 0: diff --git a/src/frontend/templates/frontend/navbar.html b/src/frontend/templates/frontend/navbar.html index 53640e1..cb7e6cd 100644 --- a/src/frontend/templates/frontend/navbar.html +++ b/src/frontend/templates/frontend/navbar.html @@ -43,7 +43,8 @@
  • diff --git a/src/frontend/views.py b/src/frontend/views.py index 716ea7c..c632ce5 100644 --- a/src/frontend/views.py +++ b/src/frontend/views.py @@ -28,6 +28,10 @@ def index(request): courses_list = Course.objects.order_by('title') data = {'courses_list': courses_list} return render(request, 'frontend/index.html', data) + #context = RequestContext(request) + # Update the dictionary with csrf_token + #data.update(csrf(request)) + #return render_to_response("frontend/index.html", data, context) def attribution(request): diff --git a/src/main/settings.py b/src/main/settings.py index 4793a8f..d1e6927 100644 --- a/src/main/settings.py +++ b/src/main/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = ( # 3rd party #'rest_framework', 'cookielaw', + #'django_social_project', 'social.apps.django_app.default', # project @@ -52,16 +53,20 @@ INSTALLED_APPS = ( ) MIDDLEWARE = ( -# 'djangosecure.middleware.SecurityMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'django.middleware.security.SecurityMiddleware', ) +CSRF_TRUSTED_ORIGINS = ['oer.hps.vi4io.org'] +CSRF_COOKIE_DOMAIN = "oer.hps.vi4io.org" + + #SECURE_SSL_REDIRECT = True #SESSION_COOKIE_SECURE = True #CSRF_COOKIE_SECURE = True @@ -138,35 +143,35 @@ STATIC_ROOT = '/data/run/static/' AUTHENTICATION_BACKENDS = ( #'social.backends.open_id.OpenIdAuth', - 'social.backends.facebook.FacebookOAuth2', - 'social.backends.google.GoogleOAuth2', + #'social.backends.facebook.FacebookOAuth2', + #'social.backends.google.GoogleOAuth2', 'social.backends.github.GithubOAuth2', - 'social.backends.twitter.TwitterOAuth', - 'social.backends.reddit.RedditOAuth2', + #'social.backends.twitter.TwitterOAuth', + #'social.backends.reddit.RedditOAuth2', 'django.contrib.auth.backends.ModelBackend', ) # GitHub -SOCIAL_AUTH_GITHUB_KEY = '4c726275a445b55d37ca' -SOCIAL_AUTH_GITHUB_SECRET = '84aec8b37a1b4b6b843d4161a4240f312a964fe1' +SOCIAL_AUTH_GITHUB_KEY = '6187640bb1463a22ed04' +SOCIAL_AUTH_GITHUB_SECRET = '18986199a1ed32bc459e9c12df7f12489eccc63e' # Reddit -SOCIAL_AUTH_REDDIT_KEY = 'vAGMBJBPdnzLIw' -SOCIAL_AUTH_REDDIT_SECRET = 'riQyRWFrFZJKHLihG0_Y8cwO4cQ' -SOCIAL_AUTH_REDDIT_AUTH_EXTRA_ARGUMENTS = {'duration': 'permanent'} +#SOCIAL_AUTH_REDDIT_KEY = 'vAGMBJBPdnzLIw' +#SOCIAL_AUTH_REDDIT_SECRET = 'riQyRWFrFZJKHLihG0_Y8cwO4cQ' +#SOCIAL_AUTH_REDDIT_AUTH_EXTRA_ARGUMENTS = {'duration': 'permanent'} # Twitter -SOCIAL_AUTH_TWITTER_KEY = 'kzONnzGZ1CKUATgSPx6BeMSjD' -SOCIAL_AUTH_TWITTER_SECRET = 'oIsRdyUafNgXIWQ7pjWisfgAFTOiKX9gBDWARc3wcwiO1Ay2dN' +#SOCIAL_AUTH_TWITTER_KEY = 'kzONnzGZ1CKUATgSPx6BeMSjD' +#SOCIAL_AUTH_TWITTER_SECRET = 'oIsRdyUafNgXIWQ7pjWisfgAFTOiKX9gBDWARc3wcwiO1Ay2dN' # Google -SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '477896675547-pocqb7irgjttea34dc5efmtj8lqketaa.apps.googleusercontent.com' -SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'TbdZdorX_YNyLJ9_y8ldBwuV' +#SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '477896675547-pocqb7irgjttea34dc5efmtj8lqketaa.apps.googleusercontent.com' +#SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'TbdZdorX_YNyLJ9_y8ldBwuV' # Facebook -SOCIAL_AUTH_FACEBOOK_KEY = '1651995468422055' -SOCIAL_AUTH_FACEBOOK_SECRET = '79b7652a72397e6f4b05e097d735e0e5' -SOCIAL_AUTH_FACEBOOK_SCOPE = ['email'] +#SOCIAL_AUTH_FACEBOOK_KEY = '1651995468422055' +#SOCIAL_AUTH_FACEBOOK_SECRET = '79b7652a72397e6f4b05e097d735e0e5' +#SOCIAL_AUTH_FACEBOOK_SCOPE = ['email'] @@ -187,4 +192,9 @@ PIPELINE = ( ) -SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/' + +CSRF_COOKIE_DOMAIN = "oer.hps.vi4io.org" + +SOCIAL_AUTH_LOGIN_REDIRECT_URL = '' +#SOCIAL_AUTH_LOGIN_URL = '/' + diff --git a/src/main/urls.py b/src/main/urls.py index 4aa22e6..75037e7 100644 --- a/src/main/urls.py +++ b/src/main/urls.py @@ -18,8 +18,10 @@ from django.contrib import admin #import rest.views import courses.views -import django.contrib.auth.views import frontend.views +from django.contrib.auth import views as auth_views + + app_name="oer" @@ -45,13 +47,13 @@ urlpatterns = [ url(r'^api/rest/', include('rest.urls', namespace='rest')), # Admin (also course managment?) - #url(r'^admin/', include(admin.site.urls)), + url(r'^admin/', admin.site.urls), # allow social media users url('', include('social.apps.django_app.urls', namespace='social')), - url(r'^accounts/login/$', django.contrib.auth.views.login, {'template_name': 'admin/login.html'}), - url(r'^accounts/logout/$', django.contrib.auth.views.logout), + url(r'^accounts/login/$', auth_views.LoginView.as_view(template_name="admin/login.html"), name="login"), + url(r'^logout/$', auth_views.LogoutView, {'next_page': "/"}, name='logout'), ] diff --git a/src/templates/admin/base_site.html b/src/templates/admin/base_site.html index b1a9b8a..85b7c93 100644 --- a/src/templates/admin/base_site.html +++ b/src/templates/admin/base_site.html @@ -3,7 +3,7 @@ {% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} {% block branding %} -

    {{ site_header|default:_('WR Courseware Administration') }}

    +

    {{ site_header|default:_('HPS OER Administration') }}

    {% endblock %} {% block nav-global %}{% endblock %}