From 8081a5520a441b43a8a7a73f3a90c7aacfaa8e10 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 24 Feb 2019 21:05:27 +0100 Subject: Move everything one level up --- kpov_judge/tasks/set_motd/howtos/en/index.html | 44 ----------- kpov_judge/tasks/set_motd/howtos/images/first.png | Bin 3793 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img1.png | Bin 64082 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img10.png | Bin 27789 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img11.png | Bin 2090 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img12.png | Bin 4119 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img2.png | Bin 64618 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img3.png | Bin 63941 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img4.png | Bin 54840 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img5.png | Bin 12233 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img6.png | Bin 33093 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img7.png | Bin 32530 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img8.png | Bin 17532 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/img9.png | Bin 23007 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/second.png | Bin 25542 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/slika3.png | Bin 21635 -> 0 bytes kpov_judge/tasks/set_motd/howtos/images/slika4.png | Bin 17317 -> 0 bytes kpov_judge/tasks/set_motd/howtos/si/index.html | 46 ----------- kpov_judge/tasks/set_motd/task.py | 86 --------------------- 19 files changed, 176 deletions(-) delete mode 100644 kpov_judge/tasks/set_motd/howtos/en/index.html delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/first.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img1.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img10.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img11.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img12.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img2.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img3.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img4.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img5.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img6.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img7.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img8.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/img9.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/second.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/slika3.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/images/slika4.png delete mode 100644 kpov_judge/tasks/set_motd/howtos/si/index.html delete mode 100644 kpov_judge/tasks/set_motd/task.py (limited to 'kpov_judge/tasks/set_motd') diff --git a/kpov_judge/tasks/set_motd/howtos/en/index.html b/kpov_judge/tasks/set_motd/howtos/en/index.html deleted file mode 100644 index 2987cc5..0000000 --- a/kpov_judge/tasks/set_motd/howtos/en/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - set_motd - - - -

set_motd

-

Purpose of the exercise

-

How to create user? How to edit a file? How to connect to anoter computer using ssh? How to find out the computer IP address?

-

Brief description

-

Set up two virtual machines, set MOTD. Connect using ssh.

- -

How To

- -
    -
  1. Create two virtual machines, Student(student-console) and Test(SimpleArbiterDhcpGw)
    no img
  2. -
  3. Change the network settings to both virtual machines. SimpleArbiterDhcpGw: Adapter 1 set it to NAT for internet access, Adapter 2 to internal network for local network. - Student: Adapter1 set it to "internal-network" so it is in the same domestic network as SimpleArbiterDhcpGw.
    no img
    no img
    no img
  4. -
  5. Login on Student
    no img
  6. -
  7. On Student(student-console) create a new user (with "adduser username", as the task demands of you ( eg. marjankoral19 ), with a custom password.
    no img
  8. -
  9. In Student(student-console) open interfaces file ( nano /etc/network/interfaces ) and set the IP
    -

    How to use the nano text editor

    -

    - 1.) Open the nano editor with the command nano, which is followed by the path and name of the file. Example: nano /etc/myfile. If the file doesn't exist, the file will be created by the editor.
    - 2.) To move in the editor, we use the arrow keys, backspace is used for deleting.
    - 3.) To save a file press the combination of keys ctrl + O.
    - 4.) To exit the editor press the combination of keys ctrl + X. The editor will ask you, if you really want to exit, you can answer with y (yes ) or with n ( no ).
    - 5.) To cut a line press the combination of keys ctrl + K.
    - 6.) To paste a line press the combination of keys ctrl + U.
    - 7.) To search over a document press the combination of keys ctrl + W and then enter the search string. -

    no img
  10. -
  11. We can check which interface belongs to which adapter in Virtual-box with MAC address. Run ifconfig command and compare the HWaddr value with the value in the Virtual-box ( settings => network => adapter => Mac address )
    no imgno img
  12. -
  13. Then edit the /etc/motd (eg. with nano editor like this: "nano /etc/motd"), file with the specified string. (eg. "Not for Human consumption" )
    no img
  14. -
  15. For testing, login with the test user into Test(SimpleArbiterDhcpGw)
    no img
  16. -
  17. Then connect to the Student with ssh, using the user marjankoral19 - ssh marjankoral@ip.
    no img
  18. -
  19. If the login was successful, the Message of the day should apear.
  20. -
  21. To run Kpov_judge, login onto SimpleArbiterDhcpGw, find and run the file test_task.py ( with ./test_task.py as all other scripts )
    no img
  22. -
  23. A window appears as we can see on the image above, then press Enter, enter your username ( eg. dr6784@student.uni-lj.si ), password, task name (eg. 01-preparation-set_motd), enter the string we should get in motd, enter the username and password of a user on Student(student-console)(eg. marjankoral19), the IP of Student(student-console), and after a brief moment we should get the result. no img
  24. -
- - - - \ No newline at end of file diff --git a/kpov_judge/tasks/set_motd/howtos/images/first.png b/kpov_judge/tasks/set_motd/howtos/images/first.png deleted file mode 100644 index d3797d7..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/first.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img1.png b/kpov_judge/tasks/set_motd/howtos/images/img1.png deleted file mode 100644 index 2ed7899..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img1.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img10.png b/kpov_judge/tasks/set_motd/howtos/images/img10.png deleted file mode 100644 index dca77ef..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img10.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img11.png b/kpov_judge/tasks/set_motd/howtos/images/img11.png deleted file mode 100644 index f42e7b0..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img11.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img12.png b/kpov_judge/tasks/set_motd/howtos/images/img12.png deleted file mode 100644 index 73ffb65..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img12.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img2.png b/kpov_judge/tasks/set_motd/howtos/images/img2.png deleted file mode 100644 index 51688ac..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img2.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img3.png b/kpov_judge/tasks/set_motd/howtos/images/img3.png deleted file mode 100644 index 93a8acf..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img3.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img4.png b/kpov_judge/tasks/set_motd/howtos/images/img4.png deleted file mode 100644 index e5e21f9..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img4.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img5.png b/kpov_judge/tasks/set_motd/howtos/images/img5.png deleted file mode 100644 index a128781..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img5.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img6.png b/kpov_judge/tasks/set_motd/howtos/images/img6.png deleted file mode 100644 index b10bf9a..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img6.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img7.png b/kpov_judge/tasks/set_motd/howtos/images/img7.png deleted file mode 100644 index 40ce63d..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img7.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img8.png b/kpov_judge/tasks/set_motd/howtos/images/img8.png deleted file mode 100644 index b7bd3b8..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img8.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/img9.png b/kpov_judge/tasks/set_motd/howtos/images/img9.png deleted file mode 100644 index 20a2439..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/img9.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/second.png b/kpov_judge/tasks/set_motd/howtos/images/second.png deleted file mode 100644 index 61bea73..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/second.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/slika3.png b/kpov_judge/tasks/set_motd/howtos/images/slika3.png deleted file mode 100644 index 05ca178..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/slika3.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/images/slika4.png b/kpov_judge/tasks/set_motd/howtos/images/slika4.png deleted file mode 100644 index b99df06..0000000 Binary files a/kpov_judge/tasks/set_motd/howtos/images/slika4.png and /dev/null differ diff --git a/kpov_judge/tasks/set_motd/howtos/si/index.html b/kpov_judge/tasks/set_motd/howtos/si/index.html deleted file mode 100644 index 601b667..0000000 --- a/kpov_judge/tasks/set_motd/howtos/si/index.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - set_motd - - - -

set_motd

-

Namen vaje

-

Kako se ustvari uporabnik? Kako se popravi datoteka? Kako se s pomočjo ssh -povežemo na drug racunalnik? Kako ugotovimo IP naslov računalnika?

- -

Naloga na hitro

-

Postavi 2 navidezna računalnika, nastavi MOTD. Poveži se preko ssh.

- -

Podrobna navodila

- -
    -
  1. Ustvari dva navidezna računalnika, računalnik Student(student-console) ter računalnik Test(SimpleArbiterDhcpGw)
    ni slike
  2. -
  3. Spremeni omrežne nastavitve obema navideznima računalnikoma, SimpleArbiterDhcpGw: Adapter 1 na NAT za dostop do interneta, Adapter 2 na "internal network" za lokalno omrežje, - Student: Adapter1 na internal-network, da je v enakem omrežju kot SimpleArbiterDhcpGw.
    ni slike
    ni slike
    ni slike
  4. -
  5. Prijavi se na računalniku Student.
    ni slike
  6. -
  7. Na računalniku Student(student-console) ustvari novega uporabnika (z ukazom "adduser imeuporabnika"), kot to od tebe zahteva naloga (npr. marjankoral19), geslo določi sam.
    ni slike
  8. -
  9. Računalnik Student, odpri datoteko interfaces ( nano /etc/network/interfaces ), ter nastavi IP.
    ni slike
  10. -

    Kako se uporablja nano urejavalnika besedila:

    -

    - 1.) Urejvalnik Nano odpremo z ukazom nano, kateremu sledi ime datoteke. Primer: nano /etc/mojadatoteka. Če datoteka ne obstaja jo bo ustvaril urejevalnik.
    - 2.) Po urejevalniku se premikamo s smernimi puščicami, brišemo s tipko backspace.
    - 3.) Za shranjevanje dokumenta pritisnemo kombinacijo tipk ctrl + O
    - 4.) Za izhod iz urejevalnika pritisnemo kombinacijo tipk ctrl + X. Pri tem nas urejevalnik upraša, če želimo shraniti spremembe. Odgovorimo z y (yes, ja ) ali z n ( no, ne ).
    - 5.) Za izrez vrstice uporabimo kombinacijo tipk ctrl + K.
    - 6.) Za lepljenje vrstice se uporablja kombinacija tipk ctrl + U.
    - 7.) Za iskanje po besedilu uporabimo kombinacijo tipk ctrl + W, nakar vnesemo iskani niz in pritisnemo tipko enter. -


    -
  11. Kateri vmesnik (npr. eth0) spada pod kateri adapter (npr. Adapter1 ), lahko preverimo s strojnimi naslovi. Na računalniku zaženemo ukaz ifconfig, pogledamo HWaddr vrednost ter jo primerjamo z vrednostjo v Virtual-boxu (nastavitve => omrežja => adapter => MAC address
    ni slikeni slike
  12. -
  13. Nato spremeni datoteko /etc/motd (z urejevalnikom nano, primer uporabe: "nano /etc/motd"), ter zamenjaj niz z ustreznim nizom kot to od tebe zahteva naloga ( npr. "Not for Human consumption" )
    - ni slike
  14. -
  15. Za testiranje se s testnim uporabniškim imenom prijavi na prvem računalniku. (SimpleArbiterDhcpGw)
    ni slike
  16. -
  17. Nato se preko ssh poveži na računalnik Student z uporabniškim imenom marjankoral19 - ssh marjankoral19@ip.
    ni slike
  18. -
  19. Po uspešni prijavi se bi moralo izpisati motd sporočilo.
  20. -
  21. Kpov_judge poženemo tako da se prijavimo na računalniku SimpleArbiterDhcpGw, najdemo datoteko test_task.py ter jo poženemo ( z ./test_task.py kot se poganjajo vse skripte )
    ni slike
  22. -
  23. Pojavi se nam okno kot ga vidimo zgoraj, nato pa pritisnemo tipko Enter, vnesemo svoje uporabniško ime ( npr. dr6784@student.uni-lj.si ), geslo, ime naloge (npr. 01-preparation-set_motd), vnesemo niz ki bi se nam moral prikazati, vnesemo ime uporabnika na računalniku Student (npr. marjankoral19) ter njegovo geslo, ip računalnika študent, nato pa po kratkem premoru dobimo rezultat. ni slike
  24. -
- - - \ No newline at end of file diff --git a/kpov_judge/tasks/set_motd/task.py b/kpov_judge/tasks/set_motd/task.py deleted file mode 100644 index 89b78f6..0000000 --- a/kpov_judge/tasks/set_motd/task.py +++ /dev/null @@ -1,86 +0,0 @@ -instructions = { - 'si': '''\ -

-Ustvari dva navidezna računalnika - imenujmo ju arbiter in student. -Na računalniku student ustvarite uporabnika z uporabniškim imenom {{peer_user}}. IP navideznega računalnika student ter geslo za uporabnika {{peer_user}} nastavite sami. - -

-Poskrbite, da se bo v sporočilu, ki se ob prijavi izpiše na računalniku student, pojavil niz - -

{{niz}}
- -

-Temu sporočilu v angleščini rečemo message of the day oziroma MOTD. Ocenjevalni program pričakuje, da se bo ob koncu prijave pojavila ukazna vrstica oblike - -

username@hostname:~$ 
- -Pazite, da se bo takšna vrstica pojavila šele po nizu, ki ste ga dobili v teh navodilih. - ''', - 'en': '''\ -

-Create two virtual machines named arbiter and student. On student, create a user with the username {{peer_user}}. Set the IP of student and the password for {{peer_user}} yourself. - -

-Set the message of the day (MOTD) on student to - -

{{niz}}
- -

-This is the message which is displayed when you log in. The grading system expects that after login a prompt similar to - -

username@hostname:~$ 
- -

-appears. Make sure that this line shows up only after the string you got in these instructions. -''' -} - -computers = { - 'arbiter': { - 'disks': [{'name': 'dhcp-gw'}], - '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"} - }, - 'student': { - 'disks': [{ 'name': 'console'}], - 'flavor': 'm1.tiny', - 'network_interfaces': [{'network': 'net1'}], - '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': {'descriptions': {'si': 'IP računalnika', 'en':'IP'}, 'w': True, 'public': True, 'type': 'IP', 'generated': False}, - 'peer_user': {'descriptions': {'si': 'ime uporabnika', 'en':'Username'}, 'w': False, 'public': True, 'type': 'username', 'generated': True}, - 'peer_passwd': {'descriptions': {'si': 'geslo uporabnika', 'en': 'Password'}, 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False}, - 'niz': {'descriptions':{'si': 'niz, ki naj se v motd pokaže', 'en': 'The string which should be displayed in the MOTD'}, 'w': False, 'public': True, 'type': 'short_text', 'generated': True}, -} - -def task(peer_ip, peer_user, peer_passwd, niz): - "Check whether ssh works and return the MOTD." - return kpov_util.ssh_test(peer_ip, peer_user, peer_passwd) - -def gen_params(user_id, params_meta): - return kpov_util.default_gen(user_id, params_meta) - -def task_check(results, params): - niz = params['niz'] - score = 0 - hints = [] - if results['ssh'] is True: - score += 4 - if niz in results['motd']: - score += 6 - else: - hints += ['wrong motd:\n' + results['motd'] + '\n'] - else: - hints += ['ssh failed: ' + results['ssh']] - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['dhcp-gw'], global_params) -- cgit v1.2.1