diff options
Diffstat (limited to 'kpov_judge/tasks/openvpn_simple_smb')
-rw-r--r-- | kpov_judge/tasks/openvpn_simple_smb/task.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py index 2db4337..435b40f 100644 --- a/kpov_judge/tasks/openvpn_simple_smb/task.py +++ b/kpov_judge/tasks/openvpn_simple_smb/task.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# kpov_random_helpers should be imported by add_assignment.py +# kpov_util should be imported by add_assignment.py instructions = { 'si':""" @@ -181,9 +181,9 @@ def gen_params(user_id, params_meta): #(HASH bo naključno generiran niz iz user_id s katerim se bo preverjalo plagiatorstvo) import random r = random.Random(user_id) - net = kpov_random_helpers.IPv4_subnet_gen(r, '10.168.0.0/16', 24) - params['IP_VPNClient1'], params['IP_SimpleArbiterVPN'] = kpov_random_helpers.IPv4_addr_gen(r, net, 2) - params['DIRNAME'] = kpov_random_helpers.fname_gen(r, extension=False) + net = kpov_util.IPv4_subnet_gen(r, '10.168.0.0/16', 24) + params['IP_VPNClient1'], params['IP_SimpleArbiterVPN'] = kpov_util.IPv4_addr_gen(r, net, 2) + params['DIRNAME'] = kpov_util.fname_gen(r, extension=False) params['secret_random_seed']=str(r.random()) return params @@ -246,12 +246,12 @@ def task_check(results, params): s = "\n".join([ "".join([r.choice("0123456789abcdef") for i in range(32)]) for i in range(16)]) - keyfile = kpov_random_helpers.fname_gen(r, extension=False) + keyfile = kpov_util.fname_gen(r, extension=False) # now check the filenames fnames_ok = True for i in range(3): - fname = kpov_random_helpers.fname_gen(r, False) - foo = kpov_random_helpers.fortune(r, 4096) + fname = kpov_util.fname_gen(r, False) + foo = kpov_util.fortune(r, 4096) pos = results['SimpleArbiter_ls'].find(fname + '.txt') fnames_ok = fnames_ok and pos >= 0 #if pos < 0: @@ -308,7 +308,7 @@ def prepare_disks(templates, task_params, global_params): {} -----END OpenVPN Static key V1----- """.format(s) - keyfile = kpov_random_helpers.fname_gen(r, extension=False) + ".key" + keyfile = kpov_util.fname_gen(r, extension=False) + ".key" templates['simpleArbiterDhcpGWVPN'].write("/etc/openvpn/secret.key", s) netaddr_s = """auto tap0 iface tap0 inet static @@ -319,10 +319,10 @@ iface tap0 inet static """.format(task_params['IP_SimpleArbiterVPN']) templates['simpleArbiterDhcpGWVPN'].write_append("/etc/network/interfaces", netaddr_s) for i in range(3): - fname = kpov_random_helpers.fname_gen(r, False) + fname = kpov_util.fname_gen(r, False) templates['simpleArbiterDhcpGWVPN'].write( "/srv/smb/" + fname + '.txt', - kpov_random_helpers.fortune(r, 4096)) + kpov_util.fortune(r, 4096)) write_default_config(templates['simpleArbiterDhcpGWVPN'], global_params) templates['student-VPNClient1'].write("/home/student/" + keyfile, s) # uid, gid (student = ) |