summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/openvpn_simple_smb
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/openvpn_simple_smb')
-rw-r--r--kpov_judge/tasks/openvpn_simple_smb/task.py38
1 files changed, 28 insertions, 10 deletions
diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py
index 4243454..1ff035b 100644
--- a/kpov_judge/tasks/openvpn_simple_smb/task.py
+++ b/kpov_judge/tasks/openvpn_simple_smb/task.py
@@ -13,10 +13,11 @@ Na VPNClient1 namestite OpenVPN in program za nadzor nad virtualnimi napravami
Na strežniku SimpleArbiterVPN že teče VPN strežnik in uporablja skrivnost,
ki jo najdete tudi na VPNClient1 v domačem imeniku uporabnika student.
Na VPNClient1 vzpostavite VPN tako, da napišete primerno datoteko z
-nastavitvami.
+nastavitvami. VPNClient1 na navideznem lokalnem omrežju nastavite naslov
+{IP_VPNClient1}
Nato poskrbite, da bo na VPNClient1 na navideznem omrežju prek NFS omogočen
-dostop do imenika /home/tester/{DIRNAME}.
+dostop do imenika /home/test/{DIRNAME}.
V ta imenik skopirajte datoteke, ki so prek SMB dostopne na SimpleArbiter.
""",
'en':u"""
@@ -24,7 +25,8 @@ Setup two virtual machines - SimpleArbiterVPN and a VPN client (VPNClient1).
Set the client's network up so that it has access to the internal network and
the internet.
On VPNClient1, install OpenVPN and a program for supervising virtual devices
-(which you will use to create a tap device).
+(which you will use to create a tap device). On the VPN, set the IP for
+VPNClient1 to {IP_VPNClient1}.
An OpenVPN server is already running on SimpleArbiterVPN. Use the secret
available on VPNClient1 in the home directory of user student to connect to
@@ -194,7 +196,7 @@ def task_check(results, params):
# zal si se nisem prišla na jasno s pingi
IP_SA = params['IP_SimpleArbiterVPN'].replace('.', '\.')
IP_C1 = params['IP_VPNClient1'].replace('.', '\.')
- rs = r"tap0 +Link encap:Ethernet +HWaddr [a-f0-9:]+ *\r\n +inet addr:{}".format(
+ rs = r"tap0: flags=.* mtu 1500\r\n +inet {}".format(
IP_SA)
# print rs, re.match(rs, results['SimpleArbiter_ifconfig'])
if re.search(rs,
@@ -202,17 +204,19 @@ def task_check(results, params):
score += 1
# print "ifconfig OK"
else:
+ hints.append("ifconfig on SimpleArbiter not OK")
pass
# print ('SA_ifconfig', results['SimpleArbiter_ifconfig'])
# results['SimpleArbiter_route'] = pexpect.run(
if re.search(
- "PING.*\r\n64 bytes from {}: icmp_req=[0-9]+ ttl=64 time=[0-9.]* ms".format(
+ "PING.*\r\n64 bytes from {}: icmp_seq=[0-9]+ ttl=64 time=[0-9.]* ms".format(
IP_C1),
results['SimpleArbiter_ping_C1']):
# print "Server ping OK"
score += 1
else:
+ hints.append("ping from server not OK")
pass
# print ("Server ping", results['SimpleArbiter_ping_C1'])
# ignore this
@@ -223,6 +227,7 @@ def task_check(results, params):
results['SimpleArbiter_traceroute']):
score += 1
else:
+ hints.append("traceroute not OK")
pass
# print ("fail!", rs, results['SimpleArbiter_traceroute'])
if results['VPNClient1_nfs_access_control_list'].find(
@@ -234,10 +239,12 @@ def task_check(results, params):
params['DIRNAME'])):
# print "mount OK"
score += 1
+ else:
+ hints.append("mount not OK")
# get r into the correct state
r = random.Random(params['secret_random_seed'])
s = "\n".join([
- "".join([r.choice("0123456789abcdef") for i in xrange(16)])
+ "".join([r.choice("0123456789abcdef") for i in xrange(32)])
for i in xrange(16)])
keyfile = kpov_random_helpers.fname_gen(r, extension=False)
# now check the filenames
@@ -247,31 +254,39 @@ def task_check(results, params):
foo = kpov_random_helpers.fortune(r, 4096)
pos = results['SimpleArbiter_ls'].find(fname + '.txt')
fnames_ok = fnames_ok and pos >= 0
+ #if pos < 0:
+ # hints.append("missing file:" + fname)
if fnames_ok:
score += 2
+ else:
+ hints.append("shared filenames not OK:")
# Ping the VPN server
if re.search(
- "PING.*\r\n64 bytes from {}: icmp_req=[0-9]+ ttl=64 time=[0-9.]* ms".format(
+ "PING.*\r\n64 bytes from {}: icmp_seq=[0-9]+ ttl=64 time=[0-9.]* ms".format(
IP_SA),
results['VPNClient1_ping_VPN_server']):
# print "ping OK"
score += 1
else:
+ hints.append("ping from client not OK")
pass
# print "Client ping", results['VPNClient1_ping_VPN_server']
- rs = r"tap0 +Link encap:Ethernet +HWaddr [a-f0-9:]+ *\r\n +inet addr:{}".format(
+ rs = r"tap0: flags=.* mtu 1500\r\n +inet {}".format(
IP_C1)
if re.search(rs,
results['VPNClient1_ifconfig']):
score += 1
# print "ifconfig OK"
else:
+ hints.append("ifconfig on VPNClient1 not OK")
pass
# print ('VPNClient1_ifconfig', results['VPNClient1_ifconfig'])
if results['VPNClient1_ps'].find('openvpn') > 0:
score += 1
+ else:
+ hints.append("openvpn not found running on VPNClient")
return score, hints
@@ -284,9 +299,12 @@ def prepare_disks(templates, task_params, global_params):
import random
r = random.Random(task_params['secret_random_seed'])
s = "\n".join([
- "".join([r.choice("0123456789abcdef") for i in xrange(16)])
+ "".join([r.choice("0123456789abcdef") for i in xrange(32)])
for i in xrange(16)])
- s = """-----BEGIN OpenVPN Static key V1-----
+ s = """#
+# 2048 bit OpenVPN static key
+#
+-----BEGIN OpenVPN Static key V1-----
{}
-----END OpenVPN Static key V1-----
""".format(s)