diff options
author | ma0178@student.uni-lj.si <ma0178@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2015-01-07 08:22:49 +0000 |
---|---|---|
committer | ma0178@student.uni-lj.si <ma0178@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2015-01-07 08:22:49 +0000 |
commit | d4b5149065211ffee79a1604ad8a48f05f57d8d9 (patch) | |
tree | bb4c984f21e15389eeeafdcb0124a42700f22fbf /kpov_judge/tasks | |
parent | 62286aab57c3280a7c53abca1921a780ef0d69f5 (diff) |
Fixed some syntax errors in radius_mysql_pam.
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@157 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r-- | kpov_judge/tasks/radius_mysql_pam/task.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py index 8ac2dd7..95c6626 100644 --- a/kpov_judge/tasks/radius_mysql_pam/task.py +++ b/kpov_judge/tasks/radius_mysql_pam/task.py @@ -1,9 +1,8 @@ #!/usr/bin/env python
# -*- coding: utf-8 -*-
-.
# kpov_random_helpers should be imported by add_assignment.py
- instructions = {
+instructions = {
'si':u"""
Ustvari dva navidezna računalnika - SimpleArbiter z diska simpleArbiterDhcp ter
RadiusServer.SimpleArbeiterDhcp dobis na naslovu polz.si/media/uploads/kpov/virtualke.Na RadiusServer namesti OpenRadius. Dodatna navodila za instalacijo najdete na evbergen.home.xs4all.nl/openradius/doc-using-openradius.html.OpenRadius uporablja dve konfiguracijski datoteki. To sta /etc/openradius/configuration in /etc/openradius/behaviour.
@@ -17,7 +16,7 @@ uporabniško ime na bazi ter geslo, s katerim se bo lahko klient s SimpleArbiter Ustvari podatkovno bazo.Najprej namestimo mysql server. Nato se prijavimo v Mysql server z ukazom mysql -u root -p. Bazo ustvarimo z ukazom CREATE DATABASE <imePodatkovneBaze>. 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.
-"""
+""",
'en':u"""Create two virtual computers - SimpleArbiter (using the SimpleArbiterDhcp.vdi disk) and RadiusServer. You can get the disk image at polz.si/media/uploads/kpov/virtualke. Install OpenRadius on the RadiusServer VM. Installation instructions can be found at evbergen.home.xs4all.nl/openradius/doc-using-openradius.html. OpenRadius uses two configuration files /etc/openradius/configuration and /etc/openradius/behaviour. The first one defines sources and interfaces of the server, the second one defines how the server responds to requests. Add your username and password from the SimpleArbiter VM to the OpenRadius configuration. Make shure that SimpleArbiter is able to connect to RadiusServer using the shared secret.
Install the MySQL database on the RadiusServer VM. Log into the MySQL server using mysql -u root -p . Create the database using CREATE DATABASE <dbnamehere>. Add the columns username and password. Create the user test on RadiusServer and setup PAM so that the user password is checked against the MySQL database instead of the file /etc/passwd or /etc/shadow.
"""
@@ -71,18 +70,16 @@ params_meta = { def task(IP_RS, RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, MYSQL_ADMIN_USER, MYSQL_ADMIN_PASSWORD, MYSQL_PAM_USERNAME, MYSQL_PAM_PASSWORD):
import pxssh
- results = dict()
- peer_user = 'student'
+ results = dict()
+ peer_user = 'student'
peer_passwd = 'vaje'
- sR = pxssh.pxssh()
- sR.login(IP_RS, peer_user, peer_passwd)
-
- results['Test_RadiusServer'] = sR.run('radtest {0} {1} {3} 1812 {4}'.format(
- RADIUS_USERNAME, RADIUS_USERNAME,
- RADIUS_PASSWORD, IP_RS, RADIUS_SECRET'))
-
+ sR = pxssh.pxssh()
+ sR.login(IP_RS, peer_user, peer_passwd)
+ results['Test_RadiusServer'] = sR.run('radtest {0} {1} {3} 1812 {4}'.format(
+ RADIUS_USERNAME, RADIUS_USERNAME,
+ RADIUS_PASSWORD, IP_RS, RADIUS_SECRET))
return results
def gen_params(user_id, params_meta):
@@ -91,12 +88,12 @@ def gen_params(user_id, params_meta): secrets = ['skupna', 'secret', 'skrivnost', 'mystery', 'tajna', 'skupnaskrivnost', 'nekadruga', 'spetnekaskrivnost']
crke = list(string.ascii_lowercase)
for name, meta in param_meta.iteritems():
- params[name] = default_generators[meta.get('type', None](r)
+ params[name] = default_generators[meta.get('type', None)](r)
params['RADIUS_SECRET'] = r.choice(secrets)
password = SQLpassword = ""
for i in range(4):
- passowrd+=crke[randint(0,25)]
- SQLpassword+=crke[randint(0,25)]
+ passowrd+=crke[randint(0,25)]
+ SQLpassword+=crke[randint(0,25)]
params['RADIUS_PASSWORD'] = password
params['MYSQL_ADMIN_PASSWORD'] = SQLpassword
return params
|