summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r--kpov_judge/tasks/copy_rename_40_files/evaluation/task.py120
-rw-r--r--kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt1
-rw-r--r--kpov_judge/tasks/copy_rename_40_files/preparation/task.py106
-rw-r--r--kpov_judge/tasks/dhcp_dns/evaluation/task.py118
-rw-r--r--kpov_judge/tasks/dhcp_dns/lecture/ideja.txt1
-rw-r--r--kpov_judge/tasks/dhcp_dns/preparation/task.py112
-rw-r--r--kpov_judge/tasks/ieee802/evaluation/task.py116
-rw-r--r--kpov_judge/tasks/ieee802/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/ieee802/preparation/task.py117
-rw-r--r--kpov_judge/tasks/ldap/evaluation/task.py123
-rw-r--r--kpov_judge/tasks/ldap/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/ldap/preparation/task.py111
-rw-r--r--kpov_judge/tasks/nat/evaluation/task.py122
-rw-r--r--kpov_judge/tasks/nat/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/nat/preparation/task.py125
-rw-r--r--kpov_judge/tasks/network_boot/evaluation/task.py121
-rw-r--r--kpov_judge/tasks/network_boot/lecture/ideja.txt1
-rw-r--r--kpov_judge/tasks/network_boot/preparation/task.py90
-rw-r--r--kpov_judge/tasks/openvpn/evaluation/task.py122
-rw-r--r--kpov_judge/tasks/openvpn/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/openvpn/preparation/task.py121
-rw-r--r--kpov_judge/tasks/openwrt/evaluation/task.py120
-rw-r--r--kpov_judge/tasks/openwrt/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/openwrt/preparation/task.py122
-rw-r--r--kpov_judge/tasks/radius/evaluation/task.py126
-rw-r--r--kpov_judge/tasks/radius/lecture/ideja.txt1
-rw-r--r--kpov_judge/tasks/radius/preparation/task.py91
-rw-r--r--kpov_judge/tasks/rdate/evaluation/task.py121
-rw-r--r--kpov_judge/tasks/rdate/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zipbin0 -> 499 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu1.pngbin0 -> 979 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu15.pngbin0 -> 679 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu2.pngbin0 -> 826 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu3.pngbin0 -> 13656 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu4.pngbin0 -> 1564 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu5.pngbin0 -> 11278 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu6.pngbin0 -> 15244 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu7.pngbin0 -> 3842 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu8.pngbin0 -> 3420 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/bu9.pngbin0 -> 4245 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gifbin0 -> 686 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/s1.pngbin0 -> 700 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/s2.pngbin0 -> 3882 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/images/s3.pngbin0 -> 3569 bytes
-rw-r--r--kpov_judge/tasks/rdate/preparation/howtos/si/index.html57
-rw-r--r--kpov_judge/tasks/rdate/preparation/task.py107
-rw-r--r--kpov_judge/tasks/remote_ssh/evaluation/task.py51
-rw-r--r--kpov_judge/tasks/remote_ssh/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/remote_ssh/preparation/task.py4
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html9
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/evaluation/task.py100
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.pngbin0 -> 11706 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.pngbin0 -> 187608 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.pngbin0 -> 193147 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.pngbin0 -> 189272 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.pngbin0 -> 163954 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.pngbin0 -> 175600 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.pngbin0 -> 7062 bytes
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html73
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py121
-rw-r--r--kpov_judge/tasks/set_motd/evaluation/navodila.txt8
-rw-r--r--kpov_judge/tasks/set_motd/evaluation/task.py72
-rw-r--r--kpov_judge/tasks/set_motd/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/set_motd/preparation/task.py94
-rw-r--r--kpov_judge/tasks/set_motd_egotrip/evaluation/task.py120
-rw-r--r--kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt1
-rw-r--r--kpov_judge/tasks/set_motd_egotrip/preparation/task.py2
-rw-r--r--kpov_judge/tasks/snmp/evaluation/task.py124
-rw-r--r--kpov_judge/tasks/snmp/lecture/ideja.txt2
-rw-r--r--kpov_judge/tasks/snmp/preparation/task.py104
71 files changed, 3275 insertions, 0 deletions
diff --git a/kpov_judge/tasks/copy_rename_40_files/evaluation/task.py b/kpov_judge/tasks/copy_rename_40_files/evaluation/task.py
new file mode 100644
index 0000000..834cb2a
--- /dev/null
+++ b/kpov_judge/tasks/copy_rename_40_files/evaluation/task.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Ustvari dva navidezna računalnika. Za prvega uporabi sliko diska simpleArbiterDhcp. Na drugem računalniku
+ustvari uporabnika test z geslom test.
+Na sliki diska simpleArbiterDhcp najdeš imenik s 100 datotekami. Prekopiraj vse datoteke na drugi računalnik, v domači imenik uporabnika test.
+Spremeni vsebino datotek tako, da vse male črke spremeniš v velike. Poskrbi, da se bo s prvega računalnika (simpleArbiterDhcp) mogoče prek
+ssh prijaviti na drugi računalnik in prebrati predelane datoteke.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt b/kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt
new file mode 100644
index 0000000..1a29e34
--- /dev/null
+++ b/kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt
@@ -0,0 +1 @@
+Vprašanja/odgovori glede pristopnega kolokvija. Bashizmi. Morda window managerji.
diff --git a/kpov_judge/tasks/copy_rename_40_files/preparation/task.py b/kpov_judge/tasks/copy_rename_40_files/preparation/task.py
new file mode 100644
index 0000000..05bfd2c
--- /dev/null
+++ b/kpov_judge/tasks/copy_rename_40_files/preparation/task.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# TODO: finish this!
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Prijavi se na sistem.
+V domači mapi najdeš imenik Mapa z 20 datotekami.
+ - preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji
+ - Napiši čim krajši ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi
+ - Napiši ukaz, ki s pomočjo ukaza grep v datoteko "mama.txt" izpiše vse navade (ne skrite) datoteke v trenutnem imeniku, ki vsebujejo niz "mama", v datoteko "napake.txt" pa izpiše vse morebitne napake (npr. to, da so nekateri objekti v trenutnem imeniku dejansko imeniki ali napačne simbolične povezave)
+ - Napiši ukaz, ki bo 5s sledil vsebini /var/log/syslog. V primeru, da se v syslogu pojavi niz "zmeda", naj program izpiše "imam ga". Poleg tega naj program med sledenjem syslog-u odšteva od 5 do 1 (vsako sekundo naj se izpiše naslednja številka.
+ - Nastavi okoljsko spremenljivko TEST, da bo imela isto vrednost kot okoljska spremenljivka USER + število okoljskih spremenljivk, ki v imenu ali vrednosti ne vsebujejo besede TEST. Primer: polz37
+
+"""
+}
+
+computers = {
+ 'malishell': {
+ 'disks': [
+ { 'name': 'malishell',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/dhcp_dns/evaluation/task.py b/kpov_judge/tasks/dhcp_dns/evaluation/task.py
new file mode 100644
index 0000000..5e443ce
--- /dev/null
+++ b/kpov_judge/tasks/dhcp_dns/evaluation/task.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Ustvari tri navidezne računalnike. Za enega (SimpleArbiter) uporabi sliko diska simpleArbiter. Na drugega (DHCP_server) postavi strežnika
+DHCP in DNS. Poskrbi, da bo preostali računalnik (DHCP_client) dobil naslov, ki ga prebereš na SimpleArbiterju. Na SimpleArbiterju preberi
+še ime in IP nekega računalnika (HOSTNAME_X in IP_X). Poskrbi, da bo DNS strežnik za HOSTNAME_X vrnil naslov IP_X.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/dhcp_dns/lecture/ideja.txt b/kpov_judge/tasks/dhcp_dns/lecture/ideja.txt
new file mode 100644
index 0000000..89f3a3a
--- /dev/null
+++ b/kpov_judge/tasks/dhcp_dns/lecture/ideja.txt
@@ -0,0 +1 @@
+Nastavi strežnik dhcp tako, da bodo računalniki v različnih skupinah dobili različna imena zagonskih datotek. Nastavi syslinux tako, da se bo ob zagonu syslinux pokazala slika.
diff --git a/kpov_judge/tasks/dhcp_dns/preparation/task.py b/kpov_judge/tasks/dhcp_dns/preparation/task.py
new file mode 100644
index 0000000..c060db6
--- /dev/null
+++ b/kpov_judge/tasks/dhcp_dns/preparation/task.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# TODO: dokoncaj!
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi štiri navidezne računalnike - simpleArbiter, DHCP_server,
+BootableClientA ter BootableClientB. Na simpleArbiter preberi naslove IP_GW, IP_DHCP,
+IP_B ter najdi datoteko A.
+
+Na DHCP_server postavi DHCP strežnik s pomočjo ISC dhcp 3 na naslovu IP_DHCP.
+SimpleArbiter naj dobi IP_GW. DHCP_server naj ga uporabi kot gateway.
+Če se zaganja BootableClientB, naj se sistem zažene z live ISO in dobi svoj IP.
+Če se zaganja katerikoli drug, naj se sistem zažene v datoteko z imenom A.
+Tako BootableClientA kot BootableClientB naj bosta brez diskov.
+"""
+}
+
+computers = {
+ 'DHCPServer': {
+ 'disks': [
+ { 'name': 'DHCPServer',
+ },
+ { 'name': 'bootable_iso',
+ 'options':{'readonly': True},
+ 'parts': [],
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+ },
+ 'BootableClientA': {
+ 'disks': [
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+ },
+ 'BootableClientB': {
+ 'disks': [
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+ },
+ 'SimpleArbiter': {
+ 'disks': [
+ { 'name': 'simpleArbiterDhcp',
+ },
+ #{ '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 = {
+ 'IP_DHCP': {'opis': 'IP DHCP streznika', 'w': False, 'public': True, 'type':'IP', 'generated': True},
+ 'IP_GW': {'opis': 'IP SimpleArbiterja', 'w': False, 'public': True, 'type':'IP', 'generated': True},
+ 'MAC_BOOT': {'opis': 'MAC racunalnika, ki se zazene z ISO', 'w': True, 'public': True, 'type':'MAC', 'generated': False},
+ 'IP_BOOT': {'opis': 'IP racunalnika, ki se zazene z ISO', 'w': True, 'public': True, 'type':'IP', 'generated': False},
+ 'BOOT_FNAME': {'opis': 'Ime datoteke', 'w': False, 'public': True, 'type': 'filename', 'generated': True},
+}
+
+def task(IP_DHCP, IP_GW, MAC_BOOT, BOOT_FNAME):
+ # check the IP
+ # ping the DHCP server
+ # check whether the fname served by the dhcp server is correct
+ # connect to the service in the special ISO
+ # check the MAC of the server on IP_BOOT
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '10.75.0.0/10', 24)
+ params['IP_DHCP'], params['IP_GW'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['BOOT_FNAME'] = kpovRandomHelpers.filename_gen(r)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ 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
+
diff --git a/kpov_judge/tasks/ieee802/evaluation/task.py b/kpov_judge/tasks/ieee802/evaluation/task.py
new file mode 100644
index 0000000..a7a81d1
--- /dev/null
+++ b/kpov_judge/tasks/ieee802/evaluation/task.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Nastavi Radius strežnik. Postavi sistem za avtentikacijo s pomočjo IEEE 802.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/ieee802/lecture/ideja.txt b/kpov_judge/tasks/ieee802/lecture/ideja.txt
new file mode 100644
index 0000000..98380fc
--- /dev/null
+++ b/kpov_judge/tasks/ieee802/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Poveži se na omrežje IEEE 802 s pomočjo WPA supplicanta. Vzpostavi omrežje z avtentikacijo.
+
diff --git a/kpov_judge/tasks/ieee802/preparation/task.py b/kpov_judge/tasks/ieee802/preparation/task.py
new file mode 100644
index 0000000..29a02cd
--- /dev/null
+++ b/kpov_judge/tasks/ieee802/preparation/task.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# Poveži se na omrežje IEEE802.11 s pomočjo NetworkManagerja. Poglej ustvarjeno konfiguracijo za wpa supplicant.
+# http://oob.freeshell.org/nzwireless/intro.html
+instructions = {
+ 'si':u"""
+Poveži se na omrežje IEEE802 s pomočjo NetworkManagerja. Poglej ustvarjeno konfiguracijo za wpa supplicant.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/ldap/evaluation/task.py b/kpov_judge/tasks/ldap/evaluation/task.py
new file mode 100644
index 0000000..fee168a
--- /dev/null
+++ b/kpov_judge/tasks/ldap/evaluation/task.py
@@ -0,0 +1,123 @@
+#!/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 diskom simpleArbiterDhcp ter LDAPServer.
+Na LDAPServer namesti strežnik LDAP. Na SimpleArbiter preberi ime domene DOMENA,
+uporabniško ime BIND_DN ter geslo BIND_PASS. Poskrbi, da se bo lahko klient s simpleArbiterDhcp povezal na LDAP strežnik na LDAPServer.
+V primeru, da se klient poveže kot BIND_DN z geslom BIND_PASS, naj strežnik omogoči branje vseh podatkov za objekte v
+DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si. Nato na LDAP strežniku poišči datoteko /home/test/users.txt. Vsaka vrstica
+v datoteki vsebuje uporabniško ime, ime ter priimek, ločene s tabulatorji. V bazi LDAP
+pod DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si za vsako vrstico v users.txt ustvari svojega uporabnika.
+
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/ldap/lecture/ideja.txt b/kpov_judge/tasks/ldap/lecture/ideja.txt
new file mode 100644
index 0000000..e9647ce
--- /dev/null
+++ b/kpov_judge/tasks/ldap/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Postavi strežnik OpenLDAP. Ustvari shemo. Ustvari uporabnika. Uporabi LDAP kot backend za RADIUS.
+
diff --git a/kpov_judge/tasks/ldap/preparation/task.py b/kpov_judge/tasks/ldap/preparation/task.py
new file mode 100644
index 0000000..c123c92
--- /dev/null
+++ b/kpov_judge/tasks/ldap/preparation/task.py
@@ -0,0 +1,111 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# Poveži se na strežnik LDAP prek spletnega vmesnika. Ustvari uporabnika z danim imenom in geslom.
+# Napiši skripto, ki izpiše podatke o tem uporabniku z ldapsearch.
+#
+# TODO: finish this!
+instructions = {
+ 'si':u"""
+Ustvari dva navidezna računalnika - SimpleArbiter z diskom simpleArbiterDhcp ter LDAPServer.
+Na LDAPServer namesti strežnik LDAP. Na SimpleArbiter preberi ime domene DOMENA, uporabniško ime USER_A, geslo PASS_A,
+uporabniško ime BIND_DN ter geslo BIND_PASS. Poskrbi, da se bo lahko klient s simpleArbiterDhcp povezal na LDAP strežnik na LDAPServer.
+V primeru, da se klient poveže kot BIND_DN z geslom BIND_PASS, naj strežnik omogoči spreminjanje podatkov za objekt
+CN=USER_A,DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si ter ustvarjanje novih objektov v DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
+
+Na SimpleArbiter ustvari program, ki bo s pomočjo ldapsearch izpisala seznam lastnosti (otrok), ki jih ima poljuben objekt v domeni DOMENA.kpov.lusy.fri.uni-lj.si. Ime objekta (CN) naj program sprejme kot prvi argument.
+"""
+}
+
+computers = {
+ 'LDAPServer': {
+ 'disks': [
+ { 'name': 'LDAPServer',
+ },
+ #{ '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 = {
+ 'LDAP_USERNAME': {'opis': 'Uporabnisko ime v LDAP', 'w': False, 'public':True, 'type': 'username', 'generated': True},
+ 'LDAP_PASSWORD': {'opis': 'Geslo v LDAP', 'w': False, 'public':True, 'type': 'password', 'generated': True},
+ 'BIND_USERNAME': {'opis': 'Uporabnisko ime za dostop do LDAP', 'w': False, 'public':True, 'type': 'username', 'generated': True},
+ 'BIND_PASSWORD': {'opis': 'Geslo za dostop do LDAP', 'w': False, 'public':True, 'type': 'password', 'generated': True},
+}
+
+def task(LDAP_USERNAME, LDAP_PASSWORD, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/nat/evaluation/task.py b/kpov_judge/tasks/nat/evaluation/task.py
new file mode 100644
index 0000000..763dee4
--- /dev/null
+++ b/kpov_judge/tasks/nat/evaluation/task.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi dva računalnika - SimpleArbiter z diska simpleArbiter ter
+NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo
+povezan v Internet, z drugim pa na SimpleArbiter. Poskrbi, da bo
+NATServer služil kot DHCP strežnik ter privzeti prehod za SimpleArbiter.
+Na SimpleArbiter preberi vrednosti NET, PORT_OUTER in PORT_INNER. Poskrbi, da
+bo omrežje med SimpleArbiter in NATServer na področju NET. Nato poskrbi, da se
+bo promet z Interneta na vrata PORT_OUTER prepošiljal na SimpleArbiter na vrata PORT_INNER.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/nat/lecture/ideja.txt b/kpov_judge/tasks/nat/lecture/ideja.txt
new file mode 100644
index 0000000..852ee43
--- /dev/null
+++ b/kpov_judge/tasks/nat/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Nastavi računalnik tako, da bo vse pakete za določene naslove prepošiljal na drug računalnik.
+Vzpostavi NAT.
diff --git a/kpov_judge/tasks/nat/preparation/task.py b/kpov_judge/tasks/nat/preparation/task.py
new file mode 100644
index 0000000..6fb5700
--- /dev/null
+++ b/kpov_judge/tasks/nat/preparation/task.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# Poglej nek film na nekem določenem URL.
+# (?md5 vsota filma?)
+
+# Nastavi nek računalnik tako, da bo izvajal NAT.
+#TODO: finish this
+
+instructions = {
+ 'si':u"""
+Postavi dva navidezna računalnika - SimpleArbiter z diskom simpleArbiter
+ter NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo povezan
+na simpleArbiter, z drugim pa na Internet. Na simpleArbiter preberi naslov,
+na katerem si lahko ogledaš kratek filmček. Nastavi omrežje med NATServer in simpleArbiter
+tako, da bo na področju, ki ga vidiš v filmčku.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/network_boot/evaluation/task.py b/kpov_judge/tasks/network_boot/evaluation/task.py
new file mode 100644
index 0000000..8d1c308
--- /dev/null
+++ b/kpov_judge/tasks/network_boot/evaluation/task.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi tri navidezne računalnike - simpleArbiter, DHCP_server, DHCP_client.
+Na računalniku DHCP_server najdeš program A. DHCP_server nastavi tako, da se bo
+DHCP_client lahko zagnal prek mreže. Na datotečni sistem, s katerega
+se zaganja DHCP_client, spravi program A. Poskrbi, da se A požene ob zagonu DHCP_client.
+
+DHCP_client ne sme imeti priklopljenega nobenega trdega diska.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/network_boot/lecture/ideja.txt b/kpov_judge/tasks/network_boot/lecture/ideja.txt
new file mode 100644
index 0000000..a380311
--- /dev/null
+++ b/kpov_judge/tasks/network_boot/lecture/ideja.txt
@@ -0,0 +1 @@
+Zaženi računalnik. Spremeni initrd. Zaženi sistem prek NFS. Spremeni podatke v squashfs.
diff --git a/kpov_judge/tasks/network_boot/preparation/task.py b/kpov_judge/tasks/network_boot/preparation/task.py
new file mode 100644
index 0000000..8c54bf6
--- /dev/null
+++ b/kpov_judge/tasks/network_boot/preparation/task.py
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# TODO: dokoncaj!
+instructions = {
+ 'si':u"""
+Postavi dva navidezna računalnika (simpleArbiterDhcp in FileServer). Na SimpleArbiterDhcp poišči imenik
+Mapa ter preberi pot NFS_POT ter ime imenika v skupni rabi SAMBA_SHARE. Skopiraj datoteke iz imenika Mapa,
+na FileServer. Poskrbi, da bo imenik z datotekami dostopen prek NFS v imeniku NFS_POT in prek SMB na imeniku v skupni
+rabi SAMBA_SHARE. SimpleArbiterDhcp naj ima prek NFS pravico pisati po imeniku.
+"""
+}
+
+computers = {
+ 'FileServer': {
+ 'disks': [
+ { 'name': 'FileServer',
+ },
+ #{ '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 = {
+ 'SMB_NAME': {'opis': 'SMB ime streznika', 'w': False, 'public':True, 'type': 'hostname', 'generated': True},
+ 'SMB_SHARENAME': {'opis': 'Imenik v skupni rabi', 'w': False, 'public':True, 'type': 'filename', 'generated': True},
+ 'NFS_MOUNT': {'opis': 'Imenik, dostopen prek NFS', 'w': False, 'public': True, 'type': 'filename', 'generated': True},
+ 'SHARED_FILENAME': {'opis': 'Ime datoteke, ki je deljena', 'w': False, 'public': True, 'type': 'filename', 'generated': True},
+ 'SHARED_FILENAME_CONTENT': {'opis': 'Vsebina datoteke', 'w': False, 'public': True, 'type': 'filename', 'generated': True},
+}
+
+def task(SMB_NAME, NFS_MOUNT, SHARED_FILENAME, SHARED_FILENAME_CONTENT):
+ # mount the NFS mount
+ # mount the SMB mount
+ # read the filename content
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/openvpn/evaluation/task.py b/kpov_judge/tasks/openvpn/evaluation/task.py
new file mode 100644
index 0000000..679d136
--- /dev/null
+++ b/kpov_judge/tasks/openvpn/evaluation/task.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi 4 navidezne računalnike - SimpleArbiter z diska simpleArbiterDhcp, A, B ter C.
+Na računalnikih A, B in C ustvari uporabnika test z geslom test.
+Poskrbi, da bodo vsi štirje na istem navideznem fizičnem omrežju. Naslov omrežja (NET_PHYS) ter naslove
+(IP_A, IP_B, IP_C) preberi na SimpleArbiter. S pomočjo OpenVPN postavi navidezno omrežje med A in B na naslovih NET_VPN1.
+Nato s pomočjo OpenVPN postavi še navidezno omrežje med B in C na naslovih NET_VPN2.
+Poskrbi, da bo promet z A prek VPN prišel do C in obratno. Za avtentikacijo uporabi skupne skrivnosti, ki
+jih prebereš na SimpleArbiter - med A in B SECRET_AB ter med B in C SECRET_BC.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/openvpn/lecture/ideja.txt b/kpov_judge/tasks/openvpn/lecture/ideja.txt
new file mode 100644
index 0000000..3ae0c92
--- /dev/null
+++ b/kpov_judge/tasks/openvpn/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Namesti OpenVPN. Ustvari OpenVPN strežnik. Omogoči sosedu, da se nanj poveže.
+Ustvari javni in zasebni ključ. Omogoči več sosedom, da se povežejo na tvoj strežnik.
diff --git a/kpov_judge/tasks/openvpn/preparation/task.py b/kpov_judge/tasks/openvpn/preparation/task.py
new file mode 100644
index 0000000..2ca15fc
--- /dev/null
+++ b/kpov_judge/tasks/openvpn/preparation/task.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi dva navidezna računalnika - SimpleArbiter z diska SimpleArbiterVPN ter
+VPNClient. Na VPNClient nastavite OpenVPN klienta tako, da se bo povezal na SimpleArbiter.
+OpenVPN nastavite tako, da bosta strežnik in klient uporabila skupno skrivnost, ki jo
+preberete na SimpleArbiter. Nato poskrbite, da bo VPNClient na navideznem omrežju prek NFS omogočil
+dostop do imenika /home/test/IME_IMENIKA, pri čemer IME_IMENIKA preberite na SimpleArbiter.
+V ta imenik skopirajte datoteke, ki so prek SMB dostopne na SimpleArbiter.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/openwrt/evaluation/task.py b/kpov_judge/tasks/openwrt/evaluation/task.py
new file mode 100644
index 0000000..3326065
--- /dev/null
+++ b/kpov_judge/tasks/openwrt/evaluation/task.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi dva navidezna računalnika - simpleArbiter z diska SimpleArbiter ter
+OpenWRT z diska OpenWRT. Na disku OpenWRT je nameščena distribucija OpenWRT.
+Nastavi OpenWRT tako, da bo imel dva omrežna vmesnika - en naj bo povezan na Internet,
+drugo na omrežje, na katerem bo SimpleArbiter. Na SimpleArbiter preberi naslov omrežja
+med OpenWrt in SimpleArbiter ter njuna naslova.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/openwrt/lecture/ideja.txt b/kpov_judge/tasks/openwrt/lecture/ideja.txt
new file mode 100644
index 0000000..7e12372
--- /dev/null
+++ b/kpov_judge/tasks/openwrt/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Postavi OpenWRT na router. Usposobi predvajanje filmov na Raspberry PI.
+
diff --git a/kpov_judge/tasks/openwrt/preparation/task.py b/kpov_judge/tasks/openwrt/preparation/task.py
new file mode 100644
index 0000000..934dfe6
--- /dev/null
+++ b/kpov_judge/tasks/openwrt/preparation/task.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# Postavi nek film na Internet tako, da ga bodo lahko ostali videli.
+# TODO: finish this
+
+instructions = {
+ 'si':u"""
+Postavi navidezni računalnik SimpleArbiter z diska simpleArbiter.
+Na simpleArbiter preberi naslov filma ter ime toka TOK. Posnemi ali kako drugače ustvari
+film ter poskrbi, da bo film dostopen na Internetu prek RTP z imenom toka TOK. Računaj,
+da bodo film lahko videli tvoji sošolci. Kršenje avtorskih pravic je pri reševanju te naloge
+strogo prepovedano.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/radius/evaluation/task.py b/kpov_judge/tasks/radius/evaluation/task.py
new file mode 100644
index 0000000..5472d10
--- /dev/null
+++ b/kpov_judge/tasks/radius/evaluation/task.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi tri navidezne računalnike - SimpleArbiter z diska simpleArbiterDhcp,
+RadiusA ter RadiusB. Na simpleArbiterDhcp preberi imeni domen DOMENA_A ter DOMENA_B,
+uporabniški imeni USER_A in USER_B, gesli PASSWORD_A in PASSWORD_B ter skrivnosti
+SECRET_A in SECRET_B. Poskrbi, da se bo lahko radius klient s SimpleArbiter povezal
+na RadiusA s skrivnostjo SECRET_A ter na RadiusB s skrivnostjo SECRET_B. Poskrbi še,
+da bo v nastavitvah OpenRadius na RadiusA obstajal uporabnik USER_A z geslom PASSWORD_A ter
+na RadiusB uporabnik USER_B z geslom PASSWORD_B.
+
+Poskrbi, da bo strežnik RadiusA odgovarjal na zahtevke za avtentikacijo uporabnikov na domeni DOMENA_A,
+zahtevke za uporabnike na domeni DOMENA_B pa bo preposlal naprej na RadiusB. RadiusB naj odgovarja na
+zahtevke za uporabnike na domeni DOMENA_B, zahtevke za uporabnike na DOMENA_A pa naj preprosto zavrže.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/radius/lecture/ideja.txt b/kpov_judge/tasks/radius/lecture/ideja.txt
new file mode 100644
index 0000000..fd9d1a9
--- /dev/null
+++ b/kpov_judge/tasks/radius/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/preparation/task.py b/kpov_judge/tasks/radius/preparation/task.py
new file mode 100644
index 0000000..c160464
--- /dev/null
+++ b/kpov_judge/tasks/radius/preparation/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
+
diff --git a/kpov_judge/tasks/rdate/evaluation/task.py b/kpov_judge/tasks/rdate/evaluation/task.py
new file mode 100644
index 0000000..bd77c13
--- /dev/null
+++ b/kpov_judge/tasks/rdate/evaluation/task.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavi dva navidezna računalnika - SimpleArbiter z diska simpleArbiterDhcp ter
+RdateServer. Na RdateServer postavi strežnik, ki bo poslušal na vratih VRATA_X.
+Vsakič, ko se na vrata poveže klient, naj strežnik pošlje število sekund od DATUM_X.
+Število naj bo kodirano kot 64-bitno predznačeno število s tankim koncem.
+
+VRATA_X in DATUM_X preberi na SimpleArbiter.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/rdate/lecture/ideja.txt b/kpov_judge/tasks/rdate/lecture/ideja.txt
new file mode 100644
index 0000000..0fb111a
--- /dev/null
+++ b/kpov_judge/tasks/rdate/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Napiši svoj rdate klient. Nastavi računalnik, da bo uro sinhroniziral z NTP strežnika.
+
diff --git a/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip b/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip
new file mode 100644
index 0000000..9061692
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png
new file mode 100644
index 0000000..c6eeac8
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png
new file mode 100644
index 0000000..c2ac808
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png
new file mode 100644
index 0000000..85fcfa8
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png
new file mode 100644
index 0000000..831e764
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png
new file mode 100644
index 0000000..495351a
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png
new file mode 100644
index 0000000..103e0e6
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png
new file mode 100644
index 0000000..b032223
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png
new file mode 100644
index 0000000..bd50500
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png
new file mode 100644
index 0000000..98f7812
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png
new file mode 100644
index 0000000..9ed78ce
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif b/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif
new file mode 100644
index 0000000..02be389
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png
new file mode 100644
index 0000000..52b6ee5
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png
new file mode 100644
index 0000000..78a65ce
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png
new file mode 100644
index 0000000..c32eae1
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png
Binary files differ
diff --git a/kpov_judge/tasks/rdate/preparation/howtos/si/index.html b/kpov_judge/tasks/rdate/preparation/howtos/si/index.html
new file mode 100644
index 0000000..a22f5c2
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/howtos/si/index.html
@@ -0,0 +1,57 @@
+<html>
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1250">
+</head>
+
+<body><font face="Georgia, Times New Roman, Times, serif">
+<strong><h1>XX. predvaja:</h1></strong><br>
+<p><strong><h2>Naloga na hitro:</h2></strong><br>
+ Nastavi uro na streniku s pomojo rdate. Napii program, ki pretvori 24-bitna tevila z dvojikim komplementom v decimalno obliko.</p>
+<p><strong><h2>Navodila:</h2></strong><br>
+ 1. Iz imenika s slikami virtualnih raunalnikov povlecite sliki Student.vdi(klient) in SimpleArbiter.vdi(strenik).<br>
+ 2. Z VirtualBoxom (ali ostalim programom za virtualne raunalnike) ustvarite dva virtualna raunalnika in jim kot disk za shranjevanje podajte Student.vdi ter SimpleArbiter.vdi.<br>
+ 3. Zaenite oba navidezna raunalnika.<br>
+ 4. Na Student se prijavite z uporabnikom <strong>root</strong> in geslom <strong>kaboom</strong> na SimpleArbiter pa z uporabnikom <strong>tester</strong> in geslom <strong>SedemKrogovPekla</strong>.</p>
+<img src="slike/bu15.png"> <img src="slike/bu1.png">
+<p><h3><u><strong><em>Prvi del naloge: posodobi uro raunalnika s pomojo rdate.</em></strong></u></h3><br>
+ 1. Preverite in si zapiite IP naslov na SimpleArbiter. (ifconfig)<br><img src="slike/bu2.png"><br><img src="slike/bu3.png"><br>
+ 2. Z ukazom <strong>sudo apt-get install</strong> rdate namestimo program rdate.<br>
+ 3. Na Student z pomojo rdate posodobi uro raunalnika. <strong>rdate IP_SIMPLE_ARBITER</strong><br><img src="slike/bu4.png"><br>
+ Opozorilo: NI napaka, e se posodobljen as ne ujema s pravilnim asom. <br>
+ </p>
+<p><br>
+ <u><strong><em><h3>Drugi del naloge: napii program, ki pretvori binarni zapis 32-bitnega tevila v decimalnega.</h3></em></strong></u><br>
+ Nalogo lahko reite v Javi ali v Pythonu. Prav tako pa lahko kodo piete v poljubnem tekstovnem urejevalniku.</p>
+<p><br>
+ JAVA------<br>
+ 1. Z ukazom nano bintodec3.java ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano<br>
+ 2. Napiemo program za pretvarjanje 24-bitnega tevila z dvojikim komplementom v decimalno obliko<br>
+<img src="slike/bu6.png"><br><img src="slike/bu7.png"><br>
+ 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.<br>
+ 4. e je e nimamo, naloimo Javo <strong>sudo apt-get install openjdk-6-jdk</strong><br><img src="slike/predvaja_clip_image003.gif"><br>
+ 5. Prevedemo program <strong>javac bintodec3.java</strong><br>
+ 6. Lahko ga e zaenemo ter preizkusimo <strong>java bintodec3</strong>. Na standardni vhod vnaamo 24-bitno tevilo v estnajstiki obliki<br><img src="slike/bu9.png"><br></p>
+<p>PYTHON------<br>
+ 1. Z ukazom nano bintodec3.py ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano<br>
+ 2. Napiemo program za pretvarjanje 24-bitnega tevila z dvojikim komplementom v decimalno obliko<br>
+<img src="slike/bu5.png"><br>
+ 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.<br>
+ 4. Program zaenemo z ukazom <strong>python bintodec3.py</strong><br><img src="slike/bu8.png"><br></p><br><br>
+
+
+ <p>
+ <h3> Testiranje </h3>
+ 1. Lahko poenemo tester; z ukazom ./run_test.py<br>
+ <img src="slike/s1.png"><br>
+ 2. Kot "Upor. Ime" in "Geslo" napiite vae podatke uilnice. (npr.: "pz1234@student.uni-lj.si" in "geslo123")<br>
+ <img src="slike/s2.png"> <img src="slike/s3.png"> <br>
+ 3. Kot ime naloge vpiite XX.predvaja.<br>
+ 4. Ko vas program vpraa po poti programa vnesite vao pot do programa za pretvarjanje. (npr.: e imate program bintodec3.py v isti mapi kot program run_test.py, vnesete: ./bintodec3.py)<br>
+ 5. Povpraa tudi po IP naslovu SimpleArbiterja, vnesite.<br>
+ 6. e je lo vse po srei, program vrne OK vi pa ste opravili nalogo.</p>
+
+ </font>
+</body>
+
+</html>
diff --git a/kpov_judge/tasks/rdate/preparation/task.py b/kpov_judge/tasks/rdate/preparation/task.py
new file mode 100644
index 0000000..caf6298
--- /dev/null
+++ b/kpov_judge/tasks/rdate/preparation/task.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# TODO: finish this!
+
+instructions = {
+ 'si':u"""
+Postavi dva navidezna računalnika - SimpleArbiterDhcpRdate s slike diska simpleArbiterRdate ter rdateClient.
+Na rdateClient ustvarite uporabnika test z geslom test. Nastavite čas na rdateClient tako, da kot rdate strežnik
+uporabite SimpleArbiterDhcpRdate. Nato v domačem imeniku uporabnika test spravite program z imenom guliver, ki prebere 4 byte
+podatkov s standardnega vhoda in jih pretvori v predznačeno celo število, pri čemer naj uporablja zapis z debelim koncem (big endian).
+Število naj program izpiše na standardni izhod.
+"""
+}
+
+computers = {
+ 'rdateClient': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'SimpleArbiter': {
+ 'disks': [
+ { 'name': 'simpleArbiterDhcpRdate',
+ # 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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/remote_ssh/evaluation/task.py b/kpov_judge/tasks/remote_ssh/evaluation/task.py
new file mode 100644
index 0000000..0468b7d
--- /dev/null
+++ b/kpov_judge/tasks/remote_ssh/evaluation/task.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# bson.son.SON an
+# kpovRandomHelpers should be imported by add_assignment.py
+OrderedDict = SON
+
+instructions = {
+ 'si':u"""
+Ustvari dva navidezna računalnika. Za disk enega (imenujmo ga SimpleArbiter) uporabite
+sliko diska Test. Na drugega (imenujmo ga A) namesti poljubno Linux distribucijo. Na SimpleArbiter
+preberi uporabniško ime in geslo uporabnika, ki ga moraš ustvariti na A. Poskrbi, da se bo novoustvarjeni
+uporabnik s svojim geslom lahko na A prijavil z Interneta.
+"""
+}
+
+computers = {
+ 'SimpleArbiter': {
+ 'disks':[
+ { 'name': 'Test' }]
+ }
+}
+
+params_meta = {
+ 'peer_ip': {'opis': 'Naslov ssh strežnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False},
+ 'peer_user': {'opis': 'ime uporabnika', 'w': False, 'public': True, 'type': 'username', 'generated': True},
+ 'peer_passwd': {'opis': 'geslo uporabnika', 'w': False, 'public': True, 'type': 'password', 'generated': True},
+}
+
+def task(peer_ip, peer_user, peer_passwd):
+ return dict()
+
+def gen_params(user_id, params_meta):
+ return kpovRandomHelpers.default_gen(user_id, params_meta)
+
+def task_check(results, params):
+ import pxssh
+ import pexpect
+ results = dict()
+ s = pxssh.pxssh()
+ peer_ip, peer_user, peer_passwd = params['peer_ip'], params['peer_user'], params['peer_passwd']
+ try:
+ s.login(peer_ip, peer_user, peer_passwd)
+ s.logout()
+ except:
+ return 0
+ return 10
+
+def prepare_disks(templates, params):
+ pass
+ # print d1.ls('/')
diff --git a/kpov_judge/tasks/remote_ssh/lecture/ideja.txt b/kpov_judge/tasks/remote_ssh/lecture/ideja.txt
new file mode 100644
index 0000000..23f5dcc
--- /dev/null
+++ b/kpov_judge/tasks/remote_ssh/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Primer pristopnega kolokvija. Odgovori na vprašanja. Pogoste težave v Virtualbox.
+X11, desktopi, nastavitve.
diff --git a/kpov_judge/tasks/remote_ssh/preparation/task.py b/kpov_judge/tasks/remote_ssh/preparation/task.py
new file mode 100644
index 0000000..ea2b361
--- /dev/null
+++ b/kpov_judge/tasks/remote_ssh/preparation/task.py
@@ -0,0 +1,4 @@
+instructions = {
+ 'si':u"""
+Reši poizkusni pristopni kolokvij."""
+}
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html b/kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html
new file mode 100644
index 0000000..df4c68d
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html
@@ -0,0 +1,9 @@
+<p>Usposobite tri računalnike:
+<ul>
+<li>SimpleArbiter - testni računalnik</li>
+<li>Z_DHCP - računalnik, ki bo svoje nastavitve dobil prek DHCP</li>
+<li>BREZ_DHCP - računalnik, ki bo imel svoj IP nastavljen statično.</li>
+</ul>
+</p>
+<p>Prvi omrežni vmesnik računalnika SimpleArbiter naj bo povezan na Internet. Drugi naj bo povezan na neko lokalno omrežje, na katerega bosta priklopljena računalnika Z_DHCP ter BREZ_DHCP. Na računalniku Z_DHCP poskrbite, da bo ob pridobivanju naslova DHCP strežniku poslal tudi posebej nastavljeno ime računalnika (hostname), ki ne bo enako dejanskemu imenu računalnika (tistemu, ki ga izpiše ukaz hostname).</p>
+<p>Naslov BREZ_DHCP ter ime računalnika za Z_DHCP dobite ob zagonu run_test.py na računalniku SimpleArbiter. Uporabniško ime ter geslo na SimpleArbiter sta <pre>tester</pre> in <pre>SedemKrogovPekla</pre>.</p>
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/evaluation/task.py b/kpov_judge/tasks/set_ip_static_dhcp/evaluation/task.py
new file mode 100644
index 0000000..0fad134
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/evaluation/task.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# TODO: finish thi
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Ustvari tri navidezne računalnike. Za disk prvega uporabi sliko diska simpleArbiterDhcp.
+Za enega od ostalih dveh (Z_DHCP) poskrbi, da bo dobil IP prek DHCP, pri čemer
+naj kot hostname strežniku pošlje ime, ki ga dobiš na simpleArbiterDhcp.
+Za drugega poskrbi, da bo imel statično nastavljen IP.
+"""
+}
+
+computers = {
+ 'Z_DHCP': {
+ 'disks': [
+ { 'name': 'Z_DHCP',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'BREZ_DHCP': {
+ 'disks': [
+ { 'name': 'BREZ_DHCP',
+ },
+ #{ '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 = {
+ 'IP_DHCP': {'opis': 'Naslov za DHCP', 'w': False, 'public': False, 'type': 'IP', 'generated': True},
+ 'Hostname_DHCP': {'opis': 'Ime DHCP', 'w': False, 'public': True, 'type': 'hostname', 'generated': True},
+ 'IP_static': {'opis': 'Naslov BREZ_DHCP', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'IP_dhcp_static': {'opis': 'Dodeljen IP brez DHCP', 'w': False, 'public': False, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_DHCP, Hostname_DHCP, IP_static, MAC_static, IP_dhcp_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ # check hostname of DHCP
+ # check the hostname in the response of IP_DHCP
+ # check availability of IP_static
+ # check non-availability of IP_dhcp_static
+ return results
+
+def gen_params(user_id, params_meta):
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['IP_DHCP'], params['IP_static'], params['IP_dhcp_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 3)
+ params['Hostname_DHCP'] = kpovRandomHelpers.hostname_gen(r)
+ return params
+
+def task_check(results, params):
+ import re
+ score = -9
+ if results['bla']:
+ score += 3
+ return score
+
+def prepare_disks(templates, params):
+# d = templates['simpleArbiterDhcp']
+# create config for static_DHCP
+# set static_DHCP hostname
+ pass
+
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/lecture/ideja.txt b/kpov_judge/tasks/set_ip_static_dhcp/lecture/ideja.txt
new file mode 100644
index 0000000..92d984c
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Mrežne nastavitve pod Linuxom. Ukazi za delo z mrežo. tcpdump. NetworkManager.
+dbus.
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png
new file mode 100644
index 0000000..754c200
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png
new file mode 100644
index 0000000..866a51d
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png
new file mode 100644
index 0000000..d6ccf42
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png
new file mode 100644
index 0000000..10b5ec7
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png
new file mode 100644
index 0000000..0a87ae6
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png
new file mode 100644
index 0000000..e71474a
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png
new file mode 100644
index 0000000..d4bba87
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png
Binary files differ
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html
new file mode 100644
index 0000000..9b56a81
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html
@@ -0,0 +1,73 @@
+<p>
+<h2>Namen vaje</h2>
+Naučite se, kako se nastavljajo omrežni vmesniki v večini sodobnih Linux distribucij (NetworkManager).
+</p>
+<p>
+<h2>Naloga na hitro</h2>
+Nastavi statičen IP v NetworkManager-ju, nastavi statični IP in DNS strežnik v /etc/network/interfaces. Oba naslova računalnikov in DNS strežnikov dobite ob zagonu run_test.py.
+</p>
+<p>
+<h2>Navodila</p>
+<ol>
+<li>Iz imenika s slikami virtualnih računalnikov povlecite slike maliNetworkManager, maliBrezNetworkManager, SimpleArbiterDhcp</li>
+
+<li>Nastavite omrežja navideznih računalnikov tako, da bo<br/>1. omrežni vmesnik SimpleArbiterDhcp povezan na isto omrežje kot edini omrežni vmesnik maliNetworkManager in maliBrezNetworkManager,<br/>
+ 2. vmesnik SimpleArbiterDhcp bo povezan na NAT ali fizično omrežje, kjer prek DHCP dobi naslov in pot (prehod, gateway) do Interneta.</li>
+
+<li>Zaženite SimpleArbiterDhcp. Prijavite se kot uporabnik tester z geslom SedemKrogovPekla</li>
+<li>
+<img alt="slika-04" src="/sites/lusy.fri.uni-lj.si/files/public_files/courses/fri-courses/kpov/Vaje/03.predvaja/sshots/04_0.png" style="width: 800px; height: 600px;" /><br/>
+Z ukazom <pre>ping 193.2.1.66</pre> preverite, ali je SimpleArbiterDhcp na Internetu. Če je, boste približno vsako sekundo dobili odziv. Ping prekinete
+s kombinacijo tipk CTRL+C.<br/>
+ Če SimpleArbiterDhcp ne pride do Interneta, v VirtualBox zamenjajte nastavitve 1. in 2. omrežni vmesnik ter ponovno zaženite navidezni računalnik.
+</li>
+<li>Poženite run_test.py.</li>
+
+<li>Kot ime naloge vpišite 03.predvaja</li>
+
+<li>Preberite statični IP maliNetworkManager. Pustite SimpleArbiterDhcp da teče v ozadju, dokler niste nastavili maliNetworkManager</li>
+
+<li>Zaženite maliNetworkManager.</li>
+
+<li>
+Prijavite se v grafično okolje z uporabniškim imenom student, geslom vaje</li>
+<li><img alt="ikona network manager" src="/sites/lusy.fri.uni-lj.si/files/public_files/courses/fri-courses/kpov/Vaje/03.predvaja/sshots/10.png" style="width: 800px; height: 600px;" /><br/>
+Desno-kliknite na ikono za mrežne nastavitve</br>
+
+<li>
+<img alt="Menu NetworkManager" src="/sites/lusy.fri.uni-lj.si/files/public_files/courses/fri-courses/kpov/Vaje/03.predvaja/sshots/11.png" style="width: 800px; height: 600px;" /><br/>
+Izberite "Edit Connections"</li>
+
+<li>
+<img alt="Menu NetworkManager" src="/sites/lusy.fri.uni-lj.si/files/public_files/courses/fri-courses/kpov/Vaje/03.predvaja/sshots/12.png" style="width: 800px; height: 600px;" /><br/>
+Kliknite "Edit"</li>
+
+<li>
+<img alt="Menu NetworkManager" src="/sites/lusy.fri.uni-lj.si/files/public_files/courses/fri-courses/kpov/Vaje/03.predvaja/sshots/13.png" style="width: 800px; height: 600px;" /><br/>
+V zavihku "IPv4" spremenite "Method" na "Manual". Kliknite na "Add". Nastavite statični IP, ki ste ga prebrali na SimpleArbiterDhcp kot statični IP A.<br/>
+V DNS servers dodajte naslov Arnesovega DNS: 193.2.1.66
+</li>
+<li>Kliknite "Save"</li>
+
+<li>Preklopite na SimpleArbiterDhcp. Pritisnite "Enter" oz. "OK".</li>
+
+<li>Preberite IP maliBrezNetworkManager. Pritisnite "OK". Preberite naslov DNS strežnika.</li>
+
+<li> Preklopite na maliBrezNetworkManager. Preklopite na prvo konzolo s kombinacijo CTRL+ALT+F1. Prijavite se kot root z geslom kaboom.</li>
+
+<li> Odprite datoteko /etc/network/interfaces. Popravite nastavitve v skladu s podatki, ki ste jih dobili na SimpleArbiter. Vnos za omrežni vmesnik mora izgledati približno takole:<br/>
+<pre>
+allow-hotplug eth0
+iface eth0 inet static
+ 10.0.1.2
+ netmask 255.255.255.128
+ dns-nameservers 10.0.1.5
+</pre>
+</li>
+
+<li> Shranite nastavitve. Z ukazom reboot ponovno zaženite maliBrezNetworkManager. NetworkManager ob zagonu računalnika
+prebere, kateri omrežni vmesniki so nastavljeni v /etc/network/interfaces. Za te vmesnike potem ne skrbi več.</li>
+
+</li>Na SimpleArbiterDhcp pritisnite OK. Če je šlo vse po sreči, ste opravili tokratno nalogo.</li>
+</ol>
+</p>
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py b/kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py
new file mode 100644
index 0000000..1d79a61
--- /dev/null
+++ b/kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Ustvari tri navidezne računalnike. Za prvega
+uporabi sliko diska simpleArbiterDhcp, za drugega sliko diska
+maliNetworkManager, za tretjega sliko diska maliBrezNetworkManager.
+Računalnike imenujmo enako kot slike diska.
+Na maliBrezNetworkManager izklopi networkmanager. Na
+Izklopi NetworkManager. Na obeh ročno nastavi IP naslova ter naslova
+DNS strežnikov. Naslove dobiš na simpleArbiterDhcp.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+ return score
+
+def prepare_disks(templates, params):
+# d = templates['simpleArbiterDhcp']
+ pass
+
diff --git a/kpov_judge/tasks/set_motd/evaluation/navodila.txt b/kpov_judge/tasks/set_motd/evaluation/navodila.txt
new file mode 100644
index 0000000..755719f
--- /dev/null
+++ b/kpov_judge/tasks/set_motd/evaluation/navodila.txt
@@ -0,0 +1,8 @@
+Poskrbite, da se bo ob prijavi uporabnika (v Message Of The Day, MOTD) prek ssh izpisal nek niz.
+Računalnik nastavite tako, da bo dostopen s testnega računalnika (Test). Uporabniško ime na testnem računalniku je tester, geslo SedemKrogovPekla .
+
+Uporabniško ime in niz dobite kot parametre ob zagonu run_test.py. Pri nizu pazite, saj utegne biti dovolj dolg, da brez premikanja kurzorja ne bo takoj viden.
+
+IP navideznega računalnika ter geslo nastavite sami. Računalnik lahko namestite sami, lahko pa uporabite računalnik Student, na katerem imate uporabnika student z geslom vaje . Geslo uporabnika root je kaboom .
+
+Ocenjevalni program pričakuje, da se bo ob koncu prijave pojavila ukazna vrstica oblike uporabnisko_ime@ime_racunalnika:~$ . Pazite, da se bo takšna vrstica pojavila šele po nizu, ki ste ga dobili v navodilih.
diff --git a/kpov_judge/tasks/set_motd/evaluation/task.py b/kpov_judge/tasks/set_motd/evaluation/task.py
new file mode 100644
index 0000000..3338c80
--- /dev/null
+++ b/kpov_judge/tasks/set_motd/evaluation/task.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# bson.son.SON an
+# kpovRandomHelpers should be imported by add_assignment.py
+# OrderedDict = SON
+
+
+instructions = {
+ "si":u"""
+Ustvari dva navidezna računalnika - imenujmo ju Test in Student. Za računalnik Test uporabite
+sliko diska, poimenovano Test. Na računalniku Test dobite kratek niz. Poskrbite, da se bo ta
+kratki niz pojavil v sporočilu, ki se ob prijavi izpiše na računalniku Student. Temu sporočilu v
+angleščini rečemo "message of the day" - MOTD.
+"""
+}
+
+computers = {
+ 'Test': {
+ 'disks': [
+ { 'name': 'Test',
+ },
+ ],
+ 'flavor': 'm1.tiny',
+ 'network_interfaces': [{'network': 'net1'}],
+ 'config_drive': True,
+ 'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"}
+ },
+ 'Student': {
+ 'disks': [
+ { 'name': 'Student', }
+ ],
+ 'flavor': 'm1.tiny',
+ 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
+ 'config_drive': True,
+ 'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"}
+ }
+
+}
+
+networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
+
+params_meta = {
+ 'peer_ip': {'opis': 'IP računalnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False},
+ 'peer_user': {'opis': 'ime uporabnika', 'w': False, 'public': True, 'type': 'username', 'generated': True},
+ 'peer_passwd': {'opis': 'geslo uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False},
+ 'niz': {'w': False, 'public': True, 'type': 'short_text', 'generated': True},
+}
+
+def task(peer_ip, peer_user, peer_passwd, niz):
+ "Check whether ssh works"
+ import pxssh
+ import pexpect
+ results = dict()
+ s = pxssh.pxssh()
+ s.login (peer_ip, peer_user, peer_passwd, original_prompt=r'{0}@.*:\~\$'.format(peer_user),auto_prompt_reset=False)
+ results['motd'] = s.before # print everything before the prompt.
+ return results
+
+def gen_params(user_id, params_meta):
+ return kpovRandomHelpers.default_gen(user_id, params_meta)
+
+def task_check(results, params):
+ niz = params['niz']
+ score = 0
+ if (results['motd'].find(niz) > -1):
+ score += 10
+ return score
+
+def prepare_disks(templates, params):
+ # print d1.ls('/')
+ pass
diff --git a/kpov_judge/tasks/set_motd/lecture/ideja.txt b/kpov_judge/tasks/set_motd/lecture/ideja.txt
new file mode 100644
index 0000000..e05a775
--- /dev/null
+++ b/kpov_judge/tasks/set_motd/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Sistem dela pri vajah. Kako izgleda pristopni kolokvij. Kako se ocenjuje.
+Pogosti problemi pri VirtualBox. Dodajanje diskov. Problemi z mrežo.
diff --git a/kpov_judge/tasks/set_motd/preparation/task.py b/kpov_judge/tasks/set_motd/preparation/task.py
new file mode 100644
index 0000000..e634959
--- /dev/null
+++ b/kpov_judge/tasks/set_motd/preparation/task.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# bson.son.SON an
+# kpovRandomHelpers should be imported by add_assignment.py
+# OrderedDict = SON
+
+instructions = {
+ 'si':u"""
+Namesti VirtualBox. Ustvari dva navidezna računalnika. Pri enem od njiju (imenujmo ga TEST)
+kot disk uporabi datoteko Test_disk1. Na drugega (imenujmo ga A) namesti poljubno Linux distribucijo.
+Poskrbi, da bosta oba računalnika na istem omrežju. Na računalnik A namesti strežnik ssh.
+Z računalnika TEST se prek ssh poveži na A. Poskrbi, da bo TEST imel dostop tako do Interneta, kot
+tudi do računalnika A.
+"""
+}
+
+computers = {
+ 'A': {
+ 'disks': [
+ { 'name': 'A_disk1',
+ 'parts': [{'dev': 'a1', 'path': '/'}],
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'image': 'KPOV-bombica01',
+ 'flavor': 'm1.kpov',
+ 'network_interfaces': [{'network': 'net1'}],
+ 'config_drive': True,
+ 'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"}
+ },
+ 'TEST': {
+ 'disks': [
+ { 'name': 'Test_disk1',
+ # attempt automount
+ },
+ #{ 'name': 'CDROM',
+ # 'options': {'readonly': True},
+ # 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
+ #},
+ ],
+ 'image': 'KPOV-bombica01',
+ 'flavor': 'm1.kpov',
+ 'network_interfaces': [{'network': 'net1'},{'network':'test-net'}],
+ 'config_drive': False
+ },
+}
+
+networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
+
+params_meta = {
+ 'peer_ip': {'opis': 'Naslov ssh strežnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False},
+ 'peer_user': {'opis': 'ime uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False},
+ 'peer_passwd': {'opis': 'geslo uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False},
+ 'addon_disk_filename': {'w': False, 'public': False, 'generated': True}, # datoteka na dodatnem disku
+}
+
+def task(peer_ip, peer_user, peer_passwd):
+ "Check whether ssh works"
+ import pxssh
+ import pexpect
+ results = dict()
+ s = pxssh.pxssh()
+ s.login (peer_ip, peer_user, peer_passwd)
+ results['motd'] = s.before # print everything before the prompt.
+ s.sendline('ls /mnt')
+ s.prompt()
+ results['ls_remote'] = s.before
+ s.logout()
+ results['ls_local'] = pexpect.run('ls ~/')
+ return results
+
+def gen_params(user_id, params_meta):
+ return kpovRandomHelpers.default_gen(user_id, params_meta)
+
+def task_check(results, params):
+ fname = params['addon_disk_filename']
+ score = 0
+ if (results['ls_remote'].find(fname) > -1):
+ score += 5
+ if (results['ls_local'].find(fname) > -1):
+ score += 5
+ return score
+
+def prepare_disks(templates, params):
+ d1 = templates['A_disk1']
+ # print "touching", d1
+ d1.touch('/{0}.txt'.format(params['addon_disk_filename']))
+ # print "writing to", '/{0}.txt'.format(params['addon_disk_filename'])
+ d1.write('/{0}.txt'.format(params['addon_disk_filename']), 'Studentje na KPOV ste ZAKON!')
+ # print d1.ls('/')
diff --git a/kpov_judge/tasks/set_motd_egotrip/evaluation/task.py b/kpov_judge/tasks/set_motd_egotrip/evaluation/task.py
new file mode 100644
index 0000000..cd3d970
--- /dev/null
+++ b/kpov_judge/tasks/set_motd_egotrip/evaluation/task.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Na internet postavi računalnik, ki bo dostopen prek ssh in http.
+Poskrbi, da bo na računalniku ustvarjen uporabnik test z geslom test. Ob prijavi naj se
+uporabniku v MOTD izpiše (le) zgodbica ali pesmica, ki vam je všeč, dolžine vsaj 50 znakov.
+Ista zgodbica ali pesmica naj se na strežniku izpiše, če se na strežnik kdorkoli poveže prek
+http.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt b/kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt
new file mode 100644
index 0000000..91c85c2
--- /dev/null
+++ b/kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt
@@ -0,0 +1 @@
+Reši pristopni kolokvij z visoko oceno.
diff --git a/kpov_judge/tasks/set_motd_egotrip/preparation/task.py b/kpov_judge/tasks/set_motd_egotrip/preparation/task.py
new file mode 100644
index 0000000..272407c
--- /dev/null
+++ b/kpov_judge/tasks/set_motd_egotrip/preparation/task.py
@@ -0,0 +1,2 @@
+instructions = {'si': u"""
+Reši poizkusni pristopni kolokvij z visoko oceno.""" }
diff --git a/kpov_judge/tasks/snmp/evaluation/task.py b/kpov_judge/tasks/snmp/evaluation/task.py
new file mode 100644
index 0000000..e8fb908
--- /dev/null
+++ b/kpov_judge/tasks/snmp/evaluation/task.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+
+instructions = {
+ 'si':u"""
+Postavite tri računalnike - SimpleArbiterSNMP s sliko diska simpleArbiterSNMP, ServerSNMP s sliko
+diska serverSNMP ter SNMPClient.
+
+Na SNMPClient ustvarite uporabnika test z geslom test. V datoteko /home/test/alarmi zapišite
+vse IP in vse OID, s katerih po SNMP prihajajo alarmi. Za vsak alarm zapišite eno vrstico,
+v kateri bosta najprej IP, nato OID, ločena s presledkom.
+
+V datoteko /home/test/vmesniki vpišite imena vseh omrežnih vmesnikov, ki jih prek SNMP dobite na
+ServerSNMP.
+"""
+}
+
+computers = {
+ 'maliNetworkManager': {
+ 'disks': [
+ { 'name': 'maliNetworkManager',
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+
+ },
+ 'maliBrezNetworkManager': {
+ 'disks': [
+ { 'name': 'maliBrezNetworkManager',
+ },
+ #{ '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 = {
+ 'IP_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True},
+ 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+ 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True},
+}
+
+def task(IP_NM, DNS_NM, IP_static, DNS_static):
+ import pxssh
+ import pexpect
+ results = dict()
+ peer_user = 'student'
+ peer_passwd = 'vaje'
+ sA = pxssh.pxssh()
+ sB = pxssh.pxssh()
+ sA.login(IP_NM, peer_user, peer_passwd)
+ sB.login(IP_static, peer_user, peer_passwd)
+ # sA
+ # make sure NM is not handling eth0
+ results['NM_nmcli'] = sA.run('nmcli d')
+ results['NM_nslookup'] = sA.run('nslookup www.arnes.si')
+ # sB
+ # check whether NM is handling eth0
+ results['static_nmcli'] = sB.run('nmcli d')
+ results['static_nslookup'] = sB.run('nslookup www.arnes.si')
+ sA.logout()
+ sB.logout()
+ return results
+
+def gen_params(user_id, params_meta):
+ params = dict()
+ r = random.Random(user_id)
+ # IP_NM, DNS_NM, IP_static, DNS_static)
+ dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
+ net = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ params['DNS_NM'] = r.choice(dns_servers)
+ params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2)
+ params['DNS_static'] = r.choice(dns_servers)
+ 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
+
diff --git a/kpov_judge/tasks/snmp/lecture/ideja.txt b/kpov_judge/tasks/snmp/lecture/ideja.txt
new file mode 100644
index 0000000..0832279
--- /dev/null
+++ b/kpov_judge/tasks/snmp/lecture/ideja.txt
@@ -0,0 +1,2 @@
+Postavi SNMP strežnik. Preberi podatke z njega. Dodaj agenta za temp. procesorja. Namesti CACTI. Nastavi CACTI, da bo bral podatke s strežnika.
+
diff --git a/kpov_judge/tasks/snmp/preparation/task.py b/kpov_judge/tasks/snmp/preparation/task.py
new file mode 100644
index 0000000..7bd6069
--- /dev/null
+++ b/kpov_judge/tasks/snmp/preparation/task.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# kpovRandomHelpers should be imported by add_assignment.py
+# TODO: finish this.
+
+instructions = {
+ 'si':u"""
+Postavi tri navidezne računalnike - SimpleArbiter s sliko diska simpleArbiterDhcp,
+SNMPServer in SNMPClient. Napiši program upminutes, ki bo izpisal, kako dolgo je računalnik vklopljen v minutah.
+Postavi ga na SNMPClient v domači imenik uporabnika test z geslom test.
+
+Poskrbi, da bo SNMP strežnik prek SNMP pod NET-SNMP-EXTEND-MIB::nsExtendOutput2Table sporočal, kako dolgo je vklopljen v sekundah.
+
+Napiši skripto, poimenovano beri.sh, ki prek SNMP prebere vrednost s strežnika SNMPServer na OID 1.3.6.1.4.1.8072.1.3.2.4.1.4.
+Postavi jo na SNMP klienta, v domači imenik uporabnika test z geslom test.
+"""
+}
+
+
+computers = {
+ 'SNMPClient': {
+ 'disks': [
+ { 'name': 'SNMPClient',
+
+ },
+ #{ 'name': 'CDROM',
+ # 'options':{'readonly': True},
+ # 'parts': [],# no parts, no mounting.
+ #}
+ ],
+ 'network_interfaces': [{'network': 'net1'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+ },
+ 'SNMPServer': {
+ 'disks': [
+ { 'name': 'SNMPServer',
+ },
+ #{ '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 = {
+ 'SNMP_VALUE': {'opis': 'Vrednost, dostopna prek SNMP', 'w': False, 'public':True, 'type': 'number', 'generated': True},
+ 'SNMP_OID_ON_SERVER': {'opis': 'OID, na katerem je vrednost dostopna', 'w': False, 'public':True, 'type': 'OID', 'generated': True},
+ 'SNMP_OID_ON_CLIENT': {'opis': 'OID, ki naj ga klient bere', 'w': False, 'public':True, 'type': 'OID', 'generated': True},
+}
+
+def task(SNMP_VALUE, SNMP_OID_ON_SERVER, SNMP_OID_ON_CLIENT):
+ # run cpu temp script on client
+ # run SNMP read SNMP_OID_ON_CLIENT script on client
+ # read data on SNMP_OID_ON_CLIENT
+ # read data from SNMP server
+ 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
+