summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/radius_mysql_pam
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/radius_mysql_pam')
-rw-r--r--kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt1
-rw-r--r--kpov_judge/tasks/radius_mysql_pam/task.py91
2 files changed, 92 insertions, 0 deletions
diff --git a/kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt b/kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt
new file mode 100644
index 0000000..fd9d1a9
--- /dev/null
+++ b/kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt
@@ -0,0 +1 @@
+Nastavi apache tako, da se boš nanj prijavila s pomočjo avtentikacije pri sosedu.
diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py
new file mode 100644
index 0000000..c160464
--- /dev/null
+++ b/kpov_judge/tasks/radius_mysql_pam/task.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Ustvari dva navidezna računalnika - SimpleArbiter z diska simpleArbiterDhcp ter
+RadiusServer. Na RadiusServer namesti OpenRadius. Na SimpleArbiter preberi ime in priimek
+uporabnika ter ga dodaj v konfiguracijo OpenRadius na RadiusServer. Na SimpleArbiter
+preberi skrivnost ter poskrbi, da se bo s to skrivnostjo SimpleArbiter lahko povezal
+na RadiusServer.
+
+Nato na OpenRadius namesti še podatkovno bazo mysql. Na SimpleArbiter preberi še ime podatkovne baze,
+uporabniško ime na bazi ter geslo, s katerim se bo lahko klient s SimpleArbiter na to bazo lahko povezal.
+Ustvari podatkovno bazo. V bazi ustvari tabelo "users" s stolpcema username ter password.
+Na RadiusServer ustvari uporabnika test. Nastavi PAM tako, da se bo geslo uporabnika primerjalo z vnosom
+v tabeli v mysql, namesto da se uporabi datoteka /etc/passwd oziroma /etc/shadow.
+"""
+}
+
+computers = {
+ 'RadiusServer': {
+ 'disks': [
+ { 'name': 'RadiusServer',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'SimpleArbiter': {
+ 'disks': [
+ { 'name': 'simpleArbiterDhcp',
+ # attempt automount
+ },
+ #{ 'name': 'CDROM',
+ # 'options': {'readonly': True},
+ # 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
+ #},
+ ],
+ 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+ }
+}
+
+networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
+
+params_meta = {
+ 'RADIUS_SECRET':{'opis': 'Skrivnost RADIUS', 'w': False, 'public':True, 'type': 'passwd', 'generated': True},
+ 'RADIUS_USERNAME': {'opis': 'Username v RADIUS', 'w': True, 'public':True, 'type': 'username', 'generated': False},
+ 'RADIUS_PASSWORD': {'opis': 'Geslo v RADIUS', 'w': False, 'public':True, 'type': '', 'generated': True},
+ 'MYSQL_ADMIN_USER':{'opis': 'Username za dostop do MySQL', 'w': True, 'public':True, 'type': 'username', 'generated': False},
+ 'MYSQL_ADMIN_PASSWORD': {'opis': 'Geslo za dostop do MySQL', 'w': True, 'public':True, 'type': 'passwd', 'generated': True},
+ 'MYSQL_PAM_USERNAME': {'opis': 'Username v MySQL', 'w': True, 'public': True, 'type': 'IP', 'generated': False},
+ 'MYSQL_PAM_PASSWORD': {'opis': 'Geslo za uporabnika v MySQL', 'w': True, 'public': True, 'type': 'passwd', 'generated': False},
+}
+
+def task(RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, MYSQL_ADMIN_USER, MYSQL_ADMIN_PASSWORD, MYSQL_PAM_USERNAME, MYSQL_PAM_PASSWORD):
+ results = dict()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ return params
+
+def task_check(results, params):
+ import re
+ score = -9
+ if results['NM_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_NM'])) > -1:
+ score += 3
+ if results['static_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_static'])) > -1:
+ score += 3
+ if re.search(r'eth0 +802-.*connected', results['NM_nmcli']):
+ score += 2
+ if not re.search(r'eth0 +802-.*connected', results['static_nmcli']):
+ score += 2
+ score = 0
+ return score
+
+def prepare_disks(templates, params):
+# d = templates['simpleArbiterDhcp']
+ pass
+