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/README.txt | 122 - kpov_judge/add_task.py | 124 - kpov_judge/courses/fri_kpov/01/evaluation | 1 - kpov_judge/courses/fri_kpov/01/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/01/preparation | 1 - kpov_judge/courses/fri_kpov/02/evaluation | 1 - kpov_judge/courses/fri_kpov/02/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/02/preparation | 1 - kpov_judge/courses/fri_kpov/03/evaluation | 1 - kpov_judge/courses/fri_kpov/03/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/03/preparation | 1 - kpov_judge/courses/fri_kpov/04/evaluation | 1 - kpov_judge/courses/fri_kpov/04/lecture/idea.txt | 1 - kpov_judge/courses/fri_kpov/04/preparation | 1 - kpov_judge/courses/fri_kpov/05/evaluation | 1 - kpov_judge/courses/fri_kpov/05/lecture/idea.txt | 1 - kpov_judge/courses/fri_kpov/05/preparation | 1 - kpov_judge/courses/fri_kpov/06/evaluation | 1 - kpov_judge/courses/fri_kpov/06/lecture/idea.txt | 1 - kpov_judge/courses/fri_kpov/06/preparation | 1 - kpov_judge/courses/fri_kpov/07/evaluation | 1 - kpov_judge/courses/fri_kpov/07/lecture/idea.txt | 1 - kpov_judge/courses/fri_kpov/07/preparation | 1 - kpov_judge/courses/fri_kpov/08/evaluation | 1 - kpov_judge/courses/fri_kpov/08/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/08/preparation | 1 - kpov_judge/courses/fri_kpov/09/evaluation | 1 - kpov_judge/courses/fri_kpov/09/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/09/preparation | 1 - kpov_judge/courses/fri_kpov/10/evaluation | 1 - kpov_judge/courses/fri_kpov/10/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/10/preparation | 1 - kpov_judge/courses/fri_kpov/11/evaluation | 1 - kpov_judge/courses/fri_kpov/11/lecture/idea.txt | 1 - kpov_judge/courses/fri_kpov/11/preparation | 1 - kpov_judge/courses/fri_kpov/12/evaluation | 1 - kpov_judge/courses/fri_kpov/12/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/12/preparation | 1 - kpov_judge/courses/fri_kpov/13/evaluation | 1 - kpov_judge/courses/fri_kpov/13/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/13/preparation | 1 - kpov_judge/courses/fri_kpov/14/evaluation | 1 - kpov_judge/courses/fri_kpov/14/lecture/idea.txt | 2 - kpov_judge/courses/fri_kpov/14/preparation | 1 - kpov_judge/create_disk_images.py | 205 - kpov_judge/create_opstack.py | 112 - kpov_judge/doc/DEVELOPMENT-FAQ.txt | 93 - .../doc/presentation/beamercolorthemeULFRI.sty | 39 - kpov_judge/doc/presentation/beamerthemeULFRI.sty | 78 - .../doc/presentation/beamerthemeULFRIframes.sty | 74 - kpov_judge/doc/presentation/figs/VCL.png | Bin 30128 -> 0 bytes kpov_judge/doc/presentation/figs/baby.jpg | Bin 101205 -> 0 bytes .../presentation/figs/centralised-architecture.pdf | Bin 5339314 -> 0 bytes .../presentation/figs/centralised-architecture.png | Bin 96386 -> 0 bytes .../presentation/figs/centralised-architecture.svg | 18111 ------------------ kpov_judge/doc/presentation/figs/computer.svg | 566 - kpov_judge/doc/presentation/figs/fail.jpg | Bin 38377 -> 0 bytes .../doc/presentation/figs/kpov-architecture.pdf | Bin 4388584 -> 0 bytes .../doc/presentation/figs/kpov-architecture.png | Bin 95888 -> 0 bytes .../doc/presentation/figs/kpov-architecture.svg | 18991 ------------------- kpov_judge/doc/presentation/kpov_judge-slides.pdf | Bin 454569 -> 0 bytes kpov_judge/doc/presentation/kpov_judge-slides.tex | 277 - kpov_judge/doc/presentation/znakULFRIbeamer.png | Bin 51682 -> 0 bytes kpov_judge/finalize_opstack.py | 117 - kpov_judge/instructions_extractor.py | 39 - kpov_judge/kpov_util.py | 173 - kpov_judge/random_data/greek_gods.txt | 488 - kpov_judge/random_data/roman_gods.txt | 184 - kpov_judge/random_data/slavic_gods.txt | 72 - kpov_judge/random_data/slovenian_names.txt | 20 - kpov_judge/random_data/slovenian_surnames.txt | 10 - kpov_judge/rm_task.py | 26 - kpov_judge/scripts/make-arbiter.sh | 95 - kpov_judge/scripts/make-base.sh | 51 - kpov_judge/scripts/make-student.sh | 42 - kpov_judge/scripts/preseed.cfg | 91 - kpov_judge/settings-example.py | 11 - kpov_judge/tasks/basic_network_gcc/task.py | 279 - kpov_judge/tasks/copy_rename_100_files/task.py | 120 - .../howtos/en/index.html | 18 - .../howtos/si/index.html | 38 - .../solution/solution.py | 92 - .../solution/solution.sh | 40 - .../tasks/copy_rename_20_files_tail_env/task.py | 351 - kpov_judge/tasks/custom_rdate/CustomRDate.java | 21 - kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip | Bin 499 -> 0 bytes kpov_judge/tasks/custom_rdate/howtos/en/index.html | 65 - .../tasks/custom_rdate/howtos/images/bu1.png | Bin 979 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu15.png | Bin 679 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu2.png | Bin 826 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu3.png | Bin 13656 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu4.png | Bin 1564 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu5.png | Bin 11278 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu6.png | Bin 15244 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu7.png | Bin 3842 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu8.png | Bin 3420 -> 0 bytes .../tasks/custom_rdate/howtos/images/bu9.png | Bin 4245 -> 0 bytes .../howtos/images/predvaja_clip_image003.gif | Bin 686 -> 0 bytes kpov_judge/tasks/custom_rdate/howtos/images/s1.png | Bin 700 -> 0 bytes kpov_judge/tasks/custom_rdate/howtos/images/s2.png | Bin 3882 -> 0 bytes kpov_judge/tasks/custom_rdate/howtos/images/s3.png | Bin 3569 -> 0 bytes kpov_judge/tasks/custom_rdate/howtos/si/index.html | 67 - kpov_judge/tasks/custom_rdate/rDate.java | 34 - kpov_judge/tasks/custom_rdate/rDate.py | 18 - kpov_judge/tasks/custom_rdate/task.py | 146 - kpov_judge/tasks/dhcp_dns_predefined_ip/task.py | 116 - .../tasks/edit_find_grep_compile_convert/task.py | 313 - kpov_judge/tasks/entrance_exam/task.py | 2 - .../tasks/isc_dhcp_live_boot/howtos/en/index.html | 172 - .../isc_dhcp_live_boot/howtos/en/indexEN.html | 172 - .../isc_dhcp_live_boot/howtos/en/indexEN.html.save | 0 .../tasks/isc_dhcp_live_boot/howtos/images/01.png | Bin 651056 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/02.png | Bin 216256 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/03.png | Bin 174489 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/04.png | Bin 87256 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/05.png | Bin 67924 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/06.png | Bin 57607 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/07.png | Bin 77169 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/08.png | Bin 12705 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/09.png | Bin 196595 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/10.png | Bin 226002 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/11.png | Bin 75165 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/12.png | Bin 13295 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/13.png | Bin 152206 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/14.png | Bin 148800 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/15.png | Bin 15686 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/16.png | Bin 181602 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/17.png | Bin 95401 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/18.png | Bin 17634 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/19.png | Bin 101570 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/20.png | Bin 18593 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/21.png | Bin 116971 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/22.png | Bin 7869 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/23.png | Bin 208008 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/24.png | Bin 226191 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/25.png | Bin 97681 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/26.png | Bin 215513 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/27.png | Bin 216817 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/images/28.png | Bin 100288 -> 0 bytes .../tasks/isc_dhcp_live_boot/howtos/si/index.html | 147 - kpov_judge/tasks/isc_dhcp_live_boot/task.py | 222 - kpov_judge/tasks/ldap_import/task.py | 106 - kpov_judge/tasks/ldap_search/howtos/en/Pic1.jpg | Bin 182463 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic2.1.jpg | Bin 160469 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic2.2.jpg | Bin 154389 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic2.3.jpg | Bin 157859 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.1.jpg | Bin 64216 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.2.jpg | Bin 76701 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.3.jpg | Bin 65002 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.4.jpg | Bin 63397 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.5.jpg | Bin 73509 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.6.jpg | Bin 78701 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.7.jpg | Bin 57151 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic3.8.jpg | Bin 63569 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic4.jpg | Bin 111844 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic5.jpg | Bin 129138 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic6.jpg | Bin 146213 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic7.jpg | Bin 64296 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/Pic8.jpg | Bin 56538 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/en/index.html | 74 - kpov_judge/tasks/ldap_search/howtos/images/1.png | Bin 179319 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/images/2.png | Bin 71542 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic1.jpg | Bin 182463 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic2.1.jpg | Bin 160469 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic2.2.jpg | Bin 154389 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic2.3.jpg | Bin 157859 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.1.jpg | Bin 64216 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.2.jpg | Bin 76701 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.3.jpg | Bin 65002 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.4.jpg | Bin 63397 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.5.jpg | Bin 73509 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.6.jpg | Bin 78701 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.7.jpg | Bin 57151 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic3.8.jpg | Bin 63569 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic4.jpg | Bin 111844 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic5.jpg | Bin 129138 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic6.jpg | Bin 146213 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic7.jpg | Bin 64296 -> 0 bytes .../tasks/ldap_search/howtos/images/Pic8.jpg | Bin 56538 -> 0 bytes kpov_judge/tasks/ldap_search/howtos/si/index.html | 23 - kpov_judge/tasks/ldap_search/task.py | 210 - .../tasks/mock_entrance_exam/howtos/en/index.html | 0 .../howtos/images/SimpleArbiter-interface1.jpg | Bin 211527 -> 0 bytes .../howtos/images/SimpleArbiter-interface2.jpg | Bin 213524 -> 0 bytes .../howtos/images/SimpleArbiter.jpg | Bin 217218 -> 0 bytes .../howtos/images/student-entrance-interface1.jpg | Bin 193759 -> 0 bytes .../howtos/images/student-entrance-interface2.jpg | Bin 195110 -> 0 bytes .../howtos/images/student-entrance.jpg | Bin 217218 -> 0 bytes .../tasks/mock_entrance_exam/howtos/si/index.html | 82 - kpov_judge/tasks/mock_entrance_exam/task.py | 313 - kpov_judge/tasks/nat_port_forward/task.py | 172 - kpov_judge/tasks/nat_vlc/howtos/en/index.html | 72 - kpov_judge/tasks/nat_vlc/howtos/images/1.jpg | Bin 35092 -> 0 bytes kpov_judge/tasks/nat_vlc/howtos/images/2.jpg | Bin 40962 -> 0 bytes kpov_judge/tasks/nat_vlc/howtos/si/index.html | 80 - kpov_judge/tasks/nat_vlc/task.py | 126 - kpov_judge/tasks/nat_vlc/video.py | 37 - .../tasks/network_boot_custom_program/task.py | 119 - kpov_judge/tasks/openvpn_multiple_hops/task.py | 317 - .../tasks/openvpn_simple_smb/howtos/en/index.html | 98 - .../tasks/openvpn_simple_smb/howtos/si/index.html | 95 - kpov_judge/tasks/openvpn_simple_smb/task.py | 261 - kpov_judge/tasks/openwrt/task.py | 103 - kpov_judge/tasks/public_ip_ssh/task.py | 52 - kpov_judge/tasks/public_ssh_motd_http/task.py | 105 - kpov_judge/tasks/radius_multiple_realms/task.py | 110 - .../tasks/radius_mysql_pam/howtos/en/index.html | 34 - .../tasks/radius_mysql_pam/howtos/si/index.html | 40 - kpov_judge/tasks/radius_mysql_pam/task.py | 212 - kpov_judge/tasks/rdate_64bit/task.py | 104 - kpov_judge/tasks/rename_grep_network/task.py | 282 - kpov_judge/tasks/set_ip_dhcp_hostname/task.py | 100 - .../tasks/set_ip_static_dhcp/howtos/en/index.html | 73 - .../tasks/set_ip_static_dhcp/howtos/images/04.png | Bin 11706 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/images/09.png | Bin 187608 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/images/10.png | Bin 193147 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/images/11.png | Bin 189272 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/images/12.png | Bin 163954 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/images/13.png | Bin 175600 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/images/17.png | Bin 7062 -> 0 bytes .../tasks/set_ip_static_dhcp/howtos/si/index.html | 74 - kpov_judge/tasks/set_ip_static_dhcp/task.py | 127 - 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 - kpov_judge/tasks/smb_nfs/howtos/en/index.html | 341 - .../tasks/smb_nfs/howtos/images/parameters.png | Bin 8403 -> 0 bytes kpov_judge/tasks/smb_nfs/howtos/si/index.html | 71 - kpov_judge/tasks/smb_nfs/task.py | 138 - .../tasks/snmp_agent_uptime/howtos/en/index.html | 319 - .../tasks/snmp_agent_uptime/howtos/images/01.png | Bin 67779 -> 0 bytes .../tasks/snmp_agent_uptime/howtos/si/index.html | 308 - kpov_judge/tasks/snmp_agent_uptime/task.py | 224 - kpov_judge/tasks/snmp_alarms_interfaces/task.py | 107 - .../tasks/vlc_stream_rtp/howtos/en/index.html | 94 - .../tasks/vlc_stream_rtp/howtos/images/1.png | Bin 8681 -> 0 bytes .../vlc_stream_rtp/howtos/images/playlist.PNG | Bin 48064 -> 0 bytes .../vlc_stream_rtp/howtos/images/stream_finish.PNG | Bin 57437 -> 0 bytes .../vlc_stream_rtp/howtos/images/stream_menu.png | Bin 80030 -> 0 bytes .../vlc_stream_rtp/howtos/images/stream_open.PNG | Bin 62759 -> 0 bytes .../vlc_stream_rtp/howtos/images/stream_output.PNG | Bin 53770 -> 0 bytes .../howtos/images/stream_transcoding.PNG | Bin 88906 -> 0 bytes .../tasks/vlc_stream_rtp/howtos/si/index.html | 93 - kpov_judge/tasks/vlc_stream_rtp/task.py | 110 - kpov_judge/test_prepare_disks.py | 196 - kpov_judge/test_task.py | 246 - kpov_judge/util.py | 24 - kpov_judge/web/kpov.wsgi | 1 - kpov_judge/web/kpov_judge/babel.cfg | 3 - kpov_judge/web/kpov_judge/icons/computer.svg | 1877 -- kpov_judge/web/kpov_judge/icons/drive-harddisk.svg | 491 - kpov_judge/web/kpov_judge/icons/internet.svg | 3398 ---- kpov_judge/web/kpov_judge/kpov_draw_setup.py | 43 - kpov_judge/web/kpov_judge/kpov_judge.py | 289 - kpov_judge/web/kpov_judge/kpov_util.py | 1 - kpov_judge/web/kpov_judge/random_data | 1 - kpov_judge/web/kpov_judge/settings.py | 1 - .../web/kpov_judge/static/icons/computer.png | Bin 15600 -> 0 bytes .../web/kpov_judge/static/icons/computer.svg | 1877 -- .../web/kpov_judge/static/icons/drive-harddisk.png | Bin 1940 -> 0 bytes .../web/kpov_judge/static/icons/drive-harddisk.svg | 491 - .../web/kpov_judge/static/icons/internet.png | Bin 9438 -> 0 bytes .../web/kpov_judge/static/icons/internet.svg | 3398 ---- kpov_judge/web/kpov_judge/static/style.css | 72 - .../web/kpov_judge/templates/class_tasks.html | 16 - kpov_judge/web/kpov_judge/templates/index.html | 16 - kpov_judge/web/kpov_judge/templates/params.html | 24 - kpov_judge/web/kpov_judge/templates/results.html | 15 - kpov_judge/web/kpov_judge/templates/task.html | 12 - .../web/kpov_judge/templates/task_greeting.html | 141 - .../translations/en/LC_MESSAGES/messages.po | 144 - .../translations/sl/LC_MESSAGES/messages.po | 145 - 288 files changed, 61199 deletions(-) delete mode 100644 kpov_judge/README.txt delete mode 100755 kpov_judge/add_task.py delete mode 120000 kpov_judge/courses/fri_kpov/01/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/01/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/01/preparation delete mode 120000 kpov_judge/courses/fri_kpov/02/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/02/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/02/preparation delete mode 120000 kpov_judge/courses/fri_kpov/03/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/03/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/03/preparation delete mode 120000 kpov_judge/courses/fri_kpov/04/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/04/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/04/preparation delete mode 120000 kpov_judge/courses/fri_kpov/05/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/05/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/05/preparation delete mode 120000 kpov_judge/courses/fri_kpov/06/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/06/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/06/preparation delete mode 120000 kpov_judge/courses/fri_kpov/07/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/07/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/07/preparation delete mode 120000 kpov_judge/courses/fri_kpov/08/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/08/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/08/preparation delete mode 120000 kpov_judge/courses/fri_kpov/09/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/09/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/09/preparation delete mode 120000 kpov_judge/courses/fri_kpov/10/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/10/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/10/preparation delete mode 120000 kpov_judge/courses/fri_kpov/11/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/11/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/11/preparation delete mode 120000 kpov_judge/courses/fri_kpov/12/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/12/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/12/preparation delete mode 120000 kpov_judge/courses/fri_kpov/13/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/13/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/13/preparation delete mode 120000 kpov_judge/courses/fri_kpov/14/evaluation delete mode 100644 kpov_judge/courses/fri_kpov/14/lecture/idea.txt delete mode 120000 kpov_judge/courses/fri_kpov/14/preparation delete mode 100755 kpov_judge/create_disk_images.py delete mode 100644 kpov_judge/create_opstack.py delete mode 100644 kpov_judge/doc/DEVELOPMENT-FAQ.txt delete mode 100644 kpov_judge/doc/presentation/beamercolorthemeULFRI.sty delete mode 100644 kpov_judge/doc/presentation/beamerthemeULFRI.sty delete mode 100644 kpov_judge/doc/presentation/beamerthemeULFRIframes.sty delete mode 100644 kpov_judge/doc/presentation/figs/VCL.png delete mode 100644 kpov_judge/doc/presentation/figs/baby.jpg delete mode 100644 kpov_judge/doc/presentation/figs/centralised-architecture.pdf delete mode 100644 kpov_judge/doc/presentation/figs/centralised-architecture.png delete mode 100644 kpov_judge/doc/presentation/figs/centralised-architecture.svg delete mode 100644 kpov_judge/doc/presentation/figs/computer.svg delete mode 100644 kpov_judge/doc/presentation/figs/fail.jpg delete mode 100644 kpov_judge/doc/presentation/figs/kpov-architecture.pdf delete mode 100644 kpov_judge/doc/presentation/figs/kpov-architecture.png delete mode 100644 kpov_judge/doc/presentation/figs/kpov-architecture.svg delete mode 100644 kpov_judge/doc/presentation/kpov_judge-slides.pdf delete mode 100644 kpov_judge/doc/presentation/kpov_judge-slides.tex delete mode 100644 kpov_judge/doc/presentation/znakULFRIbeamer.png delete mode 100644 kpov_judge/finalize_opstack.py delete mode 100644 kpov_judge/instructions_extractor.py delete mode 100755 kpov_judge/kpov_util.py delete mode 100644 kpov_judge/random_data/greek_gods.txt delete mode 100644 kpov_judge/random_data/roman_gods.txt delete mode 100644 kpov_judge/random_data/slavic_gods.txt delete mode 100644 kpov_judge/random_data/slovenian_names.txt delete mode 100644 kpov_judge/random_data/slovenian_surnames.txt delete mode 100755 kpov_judge/rm_task.py delete mode 100755 kpov_judge/scripts/make-arbiter.sh delete mode 100755 kpov_judge/scripts/make-base.sh delete mode 100755 kpov_judge/scripts/make-student.sh delete mode 100644 kpov_judge/scripts/preseed.cfg delete mode 100644 kpov_judge/settings-example.py delete mode 100644 kpov_judge/tasks/basic_network_gcc/task.py delete mode 100644 kpov_judge/tasks/copy_rename_100_files/task.py delete mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/en/index.html delete mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/si/index.html delete mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.py delete mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.sh delete mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/task.py delete mode 100644 kpov_judge/tasks/custom_rdate/CustomRDate.java delete mode 100644 kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/en/index.html delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu1.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu15.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu2.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu3.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu4.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu5.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu6.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu7.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu8.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu9.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/predvaja_clip_image003.gif delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/s1.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/s2.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/s3.png delete mode 100644 kpov_judge/tasks/custom_rdate/howtos/si/index.html delete mode 100644 kpov_judge/tasks/custom_rdate/rDate.java delete mode 100644 kpov_judge/tasks/custom_rdate/rDate.py delete mode 100644 kpov_judge/tasks/custom_rdate/task.py delete mode 100644 kpov_judge/tasks/dhcp_dns_predefined_ip/task.py delete mode 100644 kpov_judge/tasks/edit_find_grep_compile_convert/task.py delete mode 100644 kpov_judge/tasks/entrance_exam/task.py delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/index.html delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html.save delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/01.png delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/02.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/03.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/04.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/05.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/06.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/07.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/08.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/09.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/10.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/11.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/12.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/13.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/14.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/15.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/16.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/17.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/18.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/19.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/20.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/21.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/22.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/23.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/24.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/25.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/26.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/27.png delete mode 100755 kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/28.png delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html delete mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/task.py delete mode 100644 kpov_judge/tasks/ldap_import/task.py delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic1.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic2.1.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic2.2.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic2.3.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.1.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.2.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.3.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.4.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.5.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.6.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.7.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic3.8.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic4.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic5.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic6.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic7.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/Pic8.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/en/index.html delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/1.png delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/2.png delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic1.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic2.1.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic2.2.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic2.3.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.1.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.2.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.3.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.4.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.5.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.6.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.7.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic3.8.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic4.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic5.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic6.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic7.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/images/Pic8.jpg delete mode 100644 kpov_judge/tasks/ldap_search/howtos/si/index.html delete mode 100644 kpov_judge/tasks/ldap_search/task.py delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/en/index.html delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface1.jpg delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface2.jpg delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter.jpg delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface1.jpg delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface2.jpg delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance.jpg delete mode 100644 kpov_judge/tasks/mock_entrance_exam/howtos/si/index.html delete mode 100644 kpov_judge/tasks/mock_entrance_exam/task.py delete mode 100644 kpov_judge/tasks/nat_port_forward/task.py delete mode 100644 kpov_judge/tasks/nat_vlc/howtos/en/index.html delete mode 100644 kpov_judge/tasks/nat_vlc/howtos/images/1.jpg delete mode 100644 kpov_judge/tasks/nat_vlc/howtos/images/2.jpg delete mode 100644 kpov_judge/tasks/nat_vlc/howtos/si/index.html delete mode 100644 kpov_judge/tasks/nat_vlc/task.py delete mode 100644 kpov_judge/tasks/nat_vlc/video.py delete mode 100644 kpov_judge/tasks/network_boot_custom_program/task.py delete mode 100644 kpov_judge/tasks/openvpn_multiple_hops/task.py delete mode 100644 kpov_judge/tasks/openvpn_simple_smb/howtos/en/index.html delete mode 100644 kpov_judge/tasks/openvpn_simple_smb/howtos/si/index.html delete mode 100644 kpov_judge/tasks/openvpn_simple_smb/task.py delete mode 100644 kpov_judge/tasks/openwrt/task.py delete mode 100644 kpov_judge/tasks/public_ip_ssh/task.py delete mode 100644 kpov_judge/tasks/public_ssh_motd_http/task.py delete mode 100644 kpov_judge/tasks/radius_multiple_realms/task.py delete mode 100644 kpov_judge/tasks/radius_mysql_pam/howtos/en/index.html delete mode 100644 kpov_judge/tasks/radius_mysql_pam/howtos/si/index.html delete mode 100644 kpov_judge/tasks/radius_mysql_pam/task.py delete mode 100644 kpov_judge/tasks/rdate_64bit/task.py delete mode 100644 kpov_judge/tasks/rename_grep_network/task.py delete mode 100644 kpov_judge/tasks/set_ip_dhcp_hostname/task.py delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/task.py 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 delete mode 100644 kpov_judge/tasks/smb_nfs/howtos/en/index.html delete mode 100644 kpov_judge/tasks/smb_nfs/howtos/images/parameters.png delete mode 100644 kpov_judge/tasks/smb_nfs/howtos/si/index.html delete mode 100644 kpov_judge/tasks/smb_nfs/task.py delete mode 100644 kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html delete mode 100644 kpov_judge/tasks/snmp_agent_uptime/howtos/images/01.png delete mode 100644 kpov_judge/tasks/snmp_agent_uptime/howtos/si/index.html delete mode 100644 kpov_judge/tasks/snmp_agent_uptime/task.py delete mode 100644 kpov_judge/tasks/snmp_alarms_interfaces/task.py delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/en/index.html delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/1.png delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/playlist.PNG delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_finish.PNG delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_menu.png delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_open.PNG delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_output.PNG delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_transcoding.PNG delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/howtos/si/index.html delete mode 100644 kpov_judge/tasks/vlc_stream_rtp/task.py delete mode 100755 kpov_judge/test_prepare_disks.py delete mode 100755 kpov_judge/test_task.py delete mode 100644 kpov_judge/util.py delete mode 100644 kpov_judge/web/kpov.wsgi delete mode 100644 kpov_judge/web/kpov_judge/babel.cfg delete mode 100644 kpov_judge/web/kpov_judge/icons/computer.svg delete mode 100644 kpov_judge/web/kpov_judge/icons/drive-harddisk.svg delete mode 100644 kpov_judge/web/kpov_judge/icons/internet.svg delete mode 100644 kpov_judge/web/kpov_judge/kpov_draw_setup.py delete mode 100755 kpov_judge/web/kpov_judge/kpov_judge.py delete mode 120000 kpov_judge/web/kpov_judge/kpov_util.py delete mode 120000 kpov_judge/web/kpov_judge/random_data delete mode 120000 kpov_judge/web/kpov_judge/settings.py delete mode 100644 kpov_judge/web/kpov_judge/static/icons/computer.png delete mode 100644 kpov_judge/web/kpov_judge/static/icons/computer.svg delete mode 100644 kpov_judge/web/kpov_judge/static/icons/drive-harddisk.png delete mode 100644 kpov_judge/web/kpov_judge/static/icons/drive-harddisk.svg delete mode 100644 kpov_judge/web/kpov_judge/static/icons/internet.png delete mode 100644 kpov_judge/web/kpov_judge/static/icons/internet.svg delete mode 100644 kpov_judge/web/kpov_judge/static/style.css delete mode 100644 kpov_judge/web/kpov_judge/templates/class_tasks.html delete mode 100644 kpov_judge/web/kpov_judge/templates/index.html delete mode 100644 kpov_judge/web/kpov_judge/templates/params.html delete mode 100644 kpov_judge/web/kpov_judge/templates/results.html delete mode 100644 kpov_judge/web/kpov_judge/templates/task.html delete mode 100644 kpov_judge/web/kpov_judge/templates/task_greeting.html delete mode 100644 kpov_judge/web/kpov_judge/translations/en/LC_MESSAGES/messages.po delete mode 100644 kpov_judge/web/kpov_judge/translations/sl/LC_MESSAGES/messages.po (limited to 'kpov_judge') diff --git a/kpov_judge/README.txt b/kpov_judge/README.txt deleted file mode 100644 index 1a9e772..0000000 --- a/kpov_judge/README.txt +++ /dev/null @@ -1,122 +0,0 @@ -What is kpov_judge - - kpov_judge is a system for the automated grading of assignments for - networking and system administration courses. - - Each assignment is represented by a task which a student should perform. - Tasks are customised for each student by setting a number of parameters - for each task. - - Typically, each task involves a number of interconnected computers, one - of which contains the kpov_judge testing program (test_task.py). After - solving the task, a student runs the test_task.py to check their solution. - The testing results are uploaded to a server for grading and feedback can - be provided immediately. - -Using kpov_judge as a student - - For each task, the student is supposed to set up some services or resources - on one or multiple computers. The services or resources are then checked to - see if the task has been performed successfully. The result of the test is - reported back to the student. - - The instructions for each task are included in the task itself. The - parameters for each task are either prepared for each student in advance or - generated the moment a student tries to check whether they have performed - the task successfully. - - The computers for each task are typically set up by downloading a set of - virtual disk images, creating a number of virtual machines using these - disks and connecting these virtual machines using virtual or physical - networks. After the computers are set up, a student can set up the services - required by the instructions. - - The checking is done by the program test_task.py. This program can run in - both an on-line mode where some of the testing is done by a remote server - or an off-line mode where all the testing is done locally. Since kpov_judge - is expected to be mostly used by schools, usually the on-line mode will be - used by students for handing in graded assignments and for immediate - feedback during practice. - -Using kpov_judge as a teacher - - TBD - -Preparing tasks - - Within the kpov_judge repository, tasks are stored under kpov_judge/tasks. - New tasks should be added as sub-directories of tasks. - - Each task is defined by a python file named task.py . The file task.py - contains: - - instructions - the task instructions in multiple languages, - - computers - a dictionary describing the computers used for this task, - - networks - a dictionary describing the network links for this task, - - params_meta - a dictionary with a description and other metadata for - each parameter for this task - - task(...) - a function for testing the student's solution of this task. - All the arguments for this function should be described in - params_meta and should be public. This function is run by - the student to test their task solution. The output of - task(...) should be relatively hard to fake - for example, - if the student had to set up the default route on one of - the computers, this function could return a string - containing the output of the 'netstat -r' command. The - idea is to make it harder for the student to fake the - correct output of task(...) than it would be to just - solve the task. - - task_check(results, params) - check the output of task(...). - The parameter results contains the return value of task(...). - The parameter params contains a dictionary of values for each - parameter used for this task - This function is used for grading the task and should return - a value between 0 and 10 with 0 representing the lowest and 10 - representing the highest number of points attainable for solving - the task. - - gen_params(user_id, params_meta) - prepare all the parameters for - this task. For most tasks, most of the parameters will be randomly - generated according to the metadata in params_meta. A number of - helper functions for generating the parameters are available in - kpov_util.py - - prepare_disks(templates, params) - prepare the disk images for this - task. For some tasks it might be neccessarry to create or edit - some files on the virtual disk images used by each student to set - up the computers needed for this task. The parameter templates - contains a dictionary of guestfs objects. Refer to the libguestfs - documentation for more information. - - Typically, a new task is created by the following steps: - - prepare a (virtual) testing computer - - checkout the kpov_judge repository on the testing computer - - create a copy of an existing task to use as reference - - change the instructions in task.py - - create the other computers and networks involved in this task - - change the dictionaries computers and networks in task.py - - change the params_meta to correspond to the new instructions. - - write a task(...) function which returns a simple string - - write a task_check function which simply prints out the parameter - results - - write a gen_params(user_id, params_meta) function - - run test_task -g to test gen_params and set the initial task parameters - - debug everything you have created so far by performing the task - and running test_task.py as many times as needed - - write the task_check and gen_params functions - - write the prepare_disks function - - commit the new task to the repository - - checkout the task on the web-based evaluation system - - upload the clean virtual disk images, add the task to the web-based - system - - log in as a student, download the images, solve task, run task_check - - debug the task if needed - - For each course taught using kpov_judge, a directory should be created - under kpov_judge/courses. Each course's directory can be arranged in any - way the lecturer sees fit. For fri_kpov, the directory contains one - sub-directory for each lesson. Each lesson consists of a task the student - should perform before attending class (preparation), the instructions - for that week's class (lecture) and a task the student will be graded on - after the class (evaluation). - - - - diff --git a/kpov_judge/add_task.py b/kpov_judge/add_task.py deleted file mode 100755 index 7bb2f3e..0000000 --- a/kpov_judge/add_task.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python3 - -import glob -import inspect -import os -import settings -import sys -import urllib - -import kpov_util -import pymongo -from bson import Binary - -def task_check(results, params): - data = { - 'results': json.dumps(results), - 'params': json.dumps({k: v for k, v in params.items() if k != 'token'}), - } - # should be an argument to task_check, but probably better not modify the signature… - if 'token' in params: - data['token'] = params['token'] - - response = urllib.request.urlopen( - '{task_url}/{task_name}/results.json'.format(task_url=task_url, task_name=task_name), - data=urllib.parse.urlencode(data).encode()) - response_dict = json.loads(response.read().decode()) - hints = response_dict.get('hints', []) - hints = ['status: ' + response_dict.get('status', '')] + hints - return response_dict.get('result', 'No result'), hints - -uploading_task_check_source = inspect.getsource(task_check) - -def gen_params(user_id, meta): - return dict() - -dummy_gen_params_source = inspect.getsource(gen_params) - - -if __name__ == '__main__': - if len(sys.argv) < 2: - print("Usage: {0} [task_name]".format(sys.argv[0])) - exit(1) - dirname = sys.argv[1] - fname = os.path.join(dirname, 'task.py') - try: - class_id, task_id = sys.argv[2].split('/') - except: - normpath = os.path.normpath(dirname) - class_id = os.path.split(os.path.dirname(normpath))[-1] - task_id = os.path.basename(normpath) - print((class_id, task_id)) - - db = pymongo.MongoClient(settings.DB_URI).get_default_database() - - source = open(fname).read() - d = {} - # defines task, task_check, gen_params, prepare_disks, computers, params_meta - exec(compile(source, fname, 'exec'), globals(), d) - - public_meta = {} - for k, v in d['params_meta'].items(): - if v.get('public', False): - public_meta[k] = v - task_source = "\n\n".join([ - inspect.getsource(d['task']), - uploading_task_check_source, - "params_meta = {}".format(public_meta), - dummy_gen_params_source]) - task_check_source = inspect.getsource(d['task_check']) - gen_params_source = inspect.getsource(d['gen_params']) - prepare_disks_source = inspect.getsource(d['prepare_disks']) - x = list(d['params_meta'].keys()) # check for existence - db.computers_meta.remove({'task_id': task_id, 'class_id': class_id}) - auto_networks = set([None]) - for k, v in d['computers'].items(): - for n in v.get('network_interfaces', []): - auto_networks.add(n.get('network', None)) - db.computers_meta.update({ - 'task_id': task_id, - 'class_id': class_id, - 'name': k - }, {'$set': v}, upsert=True) - auto_networks.remove(None) - db.networks.remove({'task_id': task_id, 'class_id': class_id}) - try: - net_list = d['networks'].items() - except: - net_list = [(k, {'public': False}) for k in auto_networks] - for k, v in net_list: - db.networks.update({'task_id': task_id, 'class_id': class_id, 'name': k}, {'$set': v}, upsert=True) - db.task_checkers.update({ - 'task_id': task_id, 'class_id': class_id - }, {'$set': {'source': task_check_source}}, upsert=True) - db.tasks.update({ - 'task_id': task_id, 'class_id': class_id - },{'$set': {'source': task_source}}, upsert=True) - db.prepare_disks.update({ - 'task_id': task_id, 'class_id': class_id - }, {'$set': {'source': prepare_disks_source}}, upsert=True) - db.gen_params.update({'task_id': task_id, 'class_id': class_id}, - {'$set': {'source': gen_params_source}}, upsert=True) - db.task_params_meta.update({'task_id': task_id, 'class_id': class_id}, - {'$set': {'params': d['params_meta']}}, upsert=True) - db.task_instructions.update({'task_id': task_id, 'class_id': class_id}, - {'$set': d['instructions']}, upsert=True) - for howto_dir in glob.glob(os.path.join(dirname, 'howtos/*')): - howto_lang = os.path.basename(os.path.normpath(howto_dir)) - if howto_lang not in {'images'}: - with open(os.path.join(howto_dir, 'index.html')) as f: - db.howtos.update({ - 'task_id': task_id, - 'class_id': class_id, - 'lang': howto_lang}, - {'$set': {'text': f.read()}}, upsert=True) - else: - for img in glob.glob(os.path.join(howto_dir, '*')): - fname = os.path.basename(img) - with open(img, 'rb') as f: - db.howto_images.update({ - 'task_id': task_id, - 'class_id': class_id, - 'fname': fname, - }, - {'$set': {'data': Binary(f.read())}}, upsert=True) diff --git a/kpov_judge/courses/fri_kpov/01/evaluation b/kpov_judge/courses/fri_kpov/01/evaluation deleted file mode 120000 index bc7800d..0000000 --- a/kpov_judge/courses/fri_kpov/01/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/set_motd \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/01/lecture/idea.txt b/kpov_judge/courses/fri_kpov/01/lecture/idea.txt deleted file mode 100644 index e05a775..0000000 --- a/kpov_judge/courses/fri_kpov/01/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -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/courses/fri_kpov/01/preparation b/kpov_judge/courses/fri_kpov/01/preparation deleted file mode 120000 index bc7800d..0000000 --- a/kpov_judge/courses/fri_kpov/01/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/set_motd \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/02/evaluation b/kpov_judge/courses/fri_kpov/02/evaluation deleted file mode 120000 index aa80e13..0000000 --- a/kpov_judge/courses/fri_kpov/02/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/public_ip_ssh \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/02/lecture/idea.txt b/kpov_judge/courses/fri_kpov/02/lecture/idea.txt deleted file mode 100644 index 23f5dcc..0000000 --- a/kpov_judge/courses/fri_kpov/02/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -Primer pristopnega kolokvija. Odgovori na vprašanja. Pogoste težave v Virtualbox. -X11, desktopi, nastavitve. diff --git a/kpov_judge/courses/fri_kpov/02/preparation b/kpov_judge/courses/fri_kpov/02/preparation deleted file mode 120000 index 92a2558..0000000 --- a/kpov_judge/courses/fri_kpov/02/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/mock_entrance_exam \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/03/evaluation b/kpov_judge/courses/fri_kpov/03/evaluation deleted file mode 120000 index 83669c5..0000000 --- a/kpov_judge/courses/fri_kpov/03/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/set_ip_dhcp_hostname \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/03/lecture/idea.txt b/kpov_judge/courses/fri_kpov/03/lecture/idea.txt deleted file mode 100644 index 92d984c..0000000 --- a/kpov_judge/courses/fri_kpov/03/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -Mrežne nastavitve pod Linuxom. Ukazi za delo z mrežo. tcpdump. NetworkManager. -dbus. diff --git a/kpov_judge/courses/fri_kpov/03/preparation b/kpov_judge/courses/fri_kpov/03/preparation deleted file mode 120000 index ecf9a02..0000000 --- a/kpov_judge/courses/fri_kpov/03/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/set_ip_static_dhcp \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/04/evaluation b/kpov_judge/courses/fri_kpov/04/evaluation deleted file mode 120000 index 8c03708..0000000 --- a/kpov_judge/courses/fri_kpov/04/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/copy_rename_100_files \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/04/lecture/idea.txt b/kpov_judge/courses/fri_kpov/04/lecture/idea.txt deleted file mode 100644 index 1a29e34..0000000 --- a/kpov_judge/courses/fri_kpov/04/lecture/idea.txt +++ /dev/null @@ -1 +0,0 @@ -Vprašanja/odgovori glede pristopnega kolokvija. Bashizmi. Morda window managerji. diff --git a/kpov_judge/courses/fri_kpov/04/preparation b/kpov_judge/courses/fri_kpov/04/preparation deleted file mode 120000 index bf8f78f..0000000 --- a/kpov_judge/courses/fri_kpov/04/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/copy_rename_20_files_tail_env \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/05/evaluation b/kpov_judge/courses/fri_kpov/05/evaluation deleted file mode 120000 index 71afeb3..0000000 --- a/kpov_judge/courses/fri_kpov/05/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/rename_grep_network \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/05/lecture/idea.txt b/kpov_judge/courses/fri_kpov/05/lecture/idea.txt deleted file mode 100644 index 91c85c2..0000000 --- a/kpov_judge/courses/fri_kpov/05/lecture/idea.txt +++ /dev/null @@ -1 +0,0 @@ -Reši pristopni kolokvij z visoko oceno. diff --git a/kpov_judge/courses/fri_kpov/05/preparation b/kpov_judge/courses/fri_kpov/05/preparation deleted file mode 120000 index 86fe4ae..0000000 --- a/kpov_judge/courses/fri_kpov/05/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/edit_find_grep_compile_convert \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/06/evaluation b/kpov_judge/courses/fri_kpov/06/evaluation deleted file mode 120000 index 13f05ef..0000000 --- a/kpov_judge/courses/fri_kpov/06/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/dhcp_dns_predefined_ip \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/06/lecture/idea.txt b/kpov_judge/courses/fri_kpov/06/lecture/idea.txt deleted file mode 100644 index 89f3a3a..0000000 --- a/kpov_judge/courses/fri_kpov/06/lecture/idea.txt +++ /dev/null @@ -1 +0,0 @@ -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/courses/fri_kpov/06/preparation b/kpov_judge/courses/fri_kpov/06/preparation deleted file mode 120000 index aaee75c..0000000 --- a/kpov_judge/courses/fri_kpov/06/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/isc_dhcp_live_boot \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/07/evaluation b/kpov_judge/courses/fri_kpov/07/evaluation deleted file mode 120000 index a033e6b..0000000 --- a/kpov_judge/courses/fri_kpov/07/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/network_boot_custom_program \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/07/lecture/idea.txt b/kpov_judge/courses/fri_kpov/07/lecture/idea.txt deleted file mode 100644 index a380311..0000000 --- a/kpov_judge/courses/fri_kpov/07/lecture/idea.txt +++ /dev/null @@ -1 +0,0 @@ -Zaženi računalnik. Spremeni initrd. Zaženi sistem prek NFS. Spremeni podatke v squashfs. diff --git a/kpov_judge/courses/fri_kpov/07/preparation b/kpov_judge/courses/fri_kpov/07/preparation deleted file mode 120000 index 338e3c4..0000000 --- a/kpov_judge/courses/fri_kpov/07/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/smb_nfs \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/08/evaluation b/kpov_judge/courses/fri_kpov/08/evaluation deleted file mode 120000 index 9f38dbd..0000000 --- a/kpov_judge/courses/fri_kpov/08/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/snmp_alarms_interfaces \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/08/lecture/idea.txt b/kpov_judge/courses/fri_kpov/08/lecture/idea.txt deleted file mode 100644 index 0832279..0000000 --- a/kpov_judge/courses/fri_kpov/08/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -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/courses/fri_kpov/08/preparation b/kpov_judge/courses/fri_kpov/08/preparation deleted file mode 120000 index 43d41d1..0000000 --- a/kpov_judge/courses/fri_kpov/08/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/snmp_agent_uptime \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/09/evaluation b/kpov_judge/courses/fri_kpov/09/evaluation deleted file mode 120000 index 4cf01e0..0000000 --- a/kpov_judge/courses/fri_kpov/09/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/rdate_64bit \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/09/lecture/idea.txt b/kpov_judge/courses/fri_kpov/09/lecture/idea.txt deleted file mode 100644 index 0fb111a..0000000 --- a/kpov_judge/courses/fri_kpov/09/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -Napiši svoj rdate klient. Nastavi računalnik, da bo uro sinhroniziral z NTP strežnika. - diff --git a/kpov_judge/courses/fri_kpov/09/preparation b/kpov_judge/courses/fri_kpov/09/preparation deleted file mode 120000 index 93958cb..0000000 --- a/kpov_judge/courses/fri_kpov/09/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/custom_rdate \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/10/evaluation b/kpov_judge/courses/fri_kpov/10/evaluation deleted file mode 120000 index 7dad5da..0000000 --- a/kpov_judge/courses/fri_kpov/10/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/openvpn_multiple_hops \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/10/lecture/idea.txt b/kpov_judge/courses/fri_kpov/10/lecture/idea.txt deleted file mode 100644 index 3ae0c92..0000000 --- a/kpov_judge/courses/fri_kpov/10/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -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/courses/fri_kpov/10/preparation b/kpov_judge/courses/fri_kpov/10/preparation deleted file mode 120000 index 88dd369..0000000 --- a/kpov_judge/courses/fri_kpov/10/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/openvpn_simple_smb \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/11/evaluation b/kpov_judge/courses/fri_kpov/11/evaluation deleted file mode 120000 index 632bdfe..0000000 --- a/kpov_judge/courses/fri_kpov/11/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/radius_multiple_realms \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/11/lecture/idea.txt b/kpov_judge/courses/fri_kpov/11/lecture/idea.txt deleted file mode 100644 index fd9d1a9..0000000 --- a/kpov_judge/courses/fri_kpov/11/lecture/idea.txt +++ /dev/null @@ -1 +0,0 @@ -Nastavi apache tako, da se boš nanj prijavila s pomočjo avtentikacije pri sosedu. diff --git a/kpov_judge/courses/fri_kpov/11/preparation b/kpov_judge/courses/fri_kpov/11/preparation deleted file mode 120000 index 193fb07..0000000 --- a/kpov_judge/courses/fri_kpov/11/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/radius_mysql_pam \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/12/evaluation b/kpov_judge/courses/fri_kpov/12/evaluation deleted file mode 120000 index 63a7017..0000000 --- a/kpov_judge/courses/fri_kpov/12/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/nat_port_forward \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/12/lecture/idea.txt b/kpov_judge/courses/fri_kpov/12/lecture/idea.txt deleted file mode 100644 index 852ee43..0000000 --- a/kpov_judge/courses/fri_kpov/12/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -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/courses/fri_kpov/12/preparation b/kpov_judge/courses/fri_kpov/12/preparation deleted file mode 120000 index 28b7694..0000000 --- a/kpov_judge/courses/fri_kpov/12/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/nat_vlc \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/13/evaluation b/kpov_judge/courses/fri_kpov/13/evaluation deleted file mode 120000 index 350e3c0..0000000 --- a/kpov_judge/courses/fri_kpov/13/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/openwrt \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/13/lecture/idea.txt b/kpov_judge/courses/fri_kpov/13/lecture/idea.txt deleted file mode 100644 index 7e12372..0000000 --- a/kpov_judge/courses/fri_kpov/13/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -Postavi OpenWRT na router. Usposobi predvajanje filmov na Raspberry PI. - diff --git a/kpov_judge/courses/fri_kpov/13/preparation b/kpov_judge/courses/fri_kpov/13/preparation deleted file mode 120000 index 3fa7bd2..0000000 --- a/kpov_judge/courses/fri_kpov/13/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/vlc_stream_rtp \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/14/evaluation b/kpov_judge/courses/fri_kpov/14/evaluation deleted file mode 120000 index e6e31f2..0000000 --- a/kpov_judge/courses/fri_kpov/14/evaluation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/ldap_import \ No newline at end of file diff --git a/kpov_judge/courses/fri_kpov/14/lecture/idea.txt b/kpov_judge/courses/fri_kpov/14/lecture/idea.txt deleted file mode 100644 index e9647ce..0000000 --- a/kpov_judge/courses/fri_kpov/14/lecture/idea.txt +++ /dev/null @@ -1,2 +0,0 @@ -Postavi strežnik OpenLDAP. Ustvari shemo. Ustvari uporabnika. Uporabi LDAP kot backend za RADIUS. - diff --git a/kpov_judge/courses/fri_kpov/14/preparation b/kpov_judge/courses/fri_kpov/14/preparation deleted file mode 120000 index 51c2854..0000000 --- a/kpov_judge/courses/fri_kpov/14/preparation +++ /dev/null @@ -1 +0,0 @@ -../../../tasks/ldap_search \ No newline at end of file diff --git a/kpov_judge/create_disk_images.py b/kpov_judge/create_disk_images.py deleted file mode 100755 index d4a7cfd..0000000 --- a/kpov_judge/create_disk_images.py +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/env python3 - -import hashlib -import collections -import fcntl -import glob -import inspect -import os -import re -import subprocess -import sys - -import guestfs -import pymongo - -import settings -import kpov_util -from util import write_default_config - -def get_prepare_disks(db, class_id, task_id): - prepare_disks_source = db.prepare_disks.find_one({'class_id': class_id, 'task_id': task_id})['source'] - d = {} - exec(compile(prepare_disks_source, 'prepare_disks.py', 'exec'), globals(), d) - return d['prepare_disks'] - -def create_snapshot(class_id, task_id, student_id, computer_name, disk_name, fmt='vmdk', overwrite=True): - # add a hash to filename to allow multiple students using the same directory - snap_hash = hashlib.sha1((student_id+class_id).encode()).hexdigest()[:3] - snap = '{}-{}-{}-{}.{}'.format( - task_id, snap_hash, computer_name, disk_name, fmt) - backing = [] - - template = disk_name + '.' + fmt - task_dir = os.path.join(student_id, class_id, task_id) - task_path = os.path.join(settings.STUDENT_DISK_PATH, task_dir) - - if not os.path.exists(os.path.join(task_path)) or overwrite: - if not os.path.exists(os.path.join(settings.DISK_TEMPLATE_PATH, template)): - raise Exception('template not found: {}'.format(template)) - - # ensure task dir exists - os.makedirs(task_path, exist_ok=True) - - if fmt in ('vdi', 'vmdk'): - # don’t use backing files, just copy the template - os.chdir(task_path) - if settings.STUDENT_DISK_COW: - subprocess.call(['cp', '--reflink=always', os.path.join(settings.DISK_TEMPLATE_PATH, template), snap]) - else: - subprocess.call(['cp', os.path.join(settings.DISK_TEMPLATE_PATH, template), snap]) - - elif fmt == 'qcow2': - # qemu-img create stores backing-file path as given, so link all - # backing images to task directory where target image will be - # generated - os.chdir(settings.DISK_TEMPLATE_PATH) # qemu-img info is saner when called from image directory - output = subprocess.check_output( - ['qemu-img', 'info', '--backing-chain', template], universal_newlines=True) - for image in [template] + [m.group(1) for m in re.finditer(r'backing file: (.*)', output)]: - backing += [image] - dest = os.path.join(task_path, image) - if not os.path.exists(dest): - os.symlink(os.path.join(settings.DISK_TEMPLATE_PATH, image), dest) - # would be great if someone finds a way to avoid the stuff above - - # make overlay image - os.chdir(task_path) - subprocess.call(['qemu-img', 'create', - '-f', fmt, - '-b', template, snap]) - - return task_dir, snap, backing - -def prepare_task_disks(class_id, task_id, student_id, fmt, computers): - disks = collections.defaultdict(dict) - templates = collections.defaultdict(dict) - for computer in computers: - lock_fp.write('creating computer ' + computer['name'] + '\n') - if not computer['disks']: - continue - - manual_disks = [] - try_automount = False - - g = guestfs.GuestFS() - for disk in computer['disks']: - lock_fp.write("register " + disk['name'] + '\n') - task_dir, snap, backing = create_snapshot(class_id, task_id, student_id, computer['name'], disk['name'], fmt=fmt) - snap_file = os.path.join(settings.STUDENT_DISK_PATH, task_dir, snap) - if 'options' in disk: - g.add_drive_opts(snap_file, **(disk['options'])) - else: - g.add_drive(snap_file) - if 'parts' in disk: - for p in disk['parts']: - lock_fp.write("part {}: {}\n".format( - settings.GUESTFS_DEV_PREFIX + p['dev'], p['path'])) - manual_disks.append( - (settings.GUESTFS_DEV_PREFIX + p['dev'], p['path'], p.get('options', None))) - else: - try_automount = True - - templates[disk['name']] = g - lock_fp.write(" templates[{}] = {}\n".format(disk['name'], disk)) - - # add disk or update existing record with new format - disks[computer['name']][disk['name']] = [snap] + backing - - g.launch() - mounted = set() - if try_automount: - roots = g.inspect_os() - for root in roots: - mps = g.inspect_get_mountpoints(root) - lock_fp.write('detected: ' + str(mps) + '\n') - for mountpoint, device in sorted(mps): - if mountpoint not in mounted: - try: - g.mount(device, mountpoint, ) - lock_fp.write( 'mounted ' + device + ' on ' + mountpoint + '\n') - except RuntimeError as msg: - lock_fp.write( "%s (ignored)\n" % msg) - mounted.add(mountpoint) - - for device, mountpoint, opts in manual_disks: - try: - if opts is not None: - g.mount_options(opts, device, mountpoint) - else: - g.mount(device, mountpoint) - lock_fp.write('manually mounted ' + device + " on " + mountpoint + '\n') - except RuntimeError as msg: - lock_fp.write( "%s (ignored)\n" % msg) - - lock_fp.write("preparing disks\n") - global_params = { - 'task_name': task_id, - 'class_id': class_id, - 'username': student_id - } - if 'TASK_URL' in vars(settings): - global_params['task_url'] = settings.TASK_URL + '/' + class_id + '/' - - task_params = db.task_params.find_one({'class_id': class_id, 'task_id': task_id, 'student_id': student_id})['params'] - prepare_disks = get_prepare_disks(db, class_id, task_id) - prepare_disks(templates, task_params, global_params) - - # pospravi za seboj. - lock_fp.write("unmounting\n") - for g in set(templates.values()): - g.umount_all() - g.close() - - return disks - -if __name__ == '__main__': - if len(sys.argv) != 1: - print("Usage: {0}") - print("Create the pending disk images") - - db = pymongo.MongoClient(settings.DB_URI).get_default_database() - - all_computers = collections.defaultdict(list) - for computer in db.student_computers.find({"disk_urls": {"$exists": False}}): - all_computers[(computer['class_id'], computer['task_id'], computer['student_id'])] += [computer] - - for (class_id, task_id, student_id), computers in all_computers.items(): - if db.student_computers.find_one({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}) is None: - continue - - lock_file = os.path.join(settings.STUDENT_LOCKFILE_PATH, - '{0}-{1}-{2}.lock'.format(student_id, class_id, task_id)) - with open(lock_file, 'w') as lock_fp: - try: - fcntl.lockf(lock_fp, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError: - continue - - all_disks = collections.defaultdict(dict) - for fmt in settings.STUDENT_DISK_FORMATS: - print("Creating {}/{} for {} [format={}]".format(class_id, task_id, student_id, fmt)) - try: - for computer, disks in prepare_task_disks(class_id, task_id, student_id, fmt, computers).items(): - for disk, urls in disks.items(): - d = all_disks[computer].setdefault(disk, {'formats': []}) - d['formats'] += [fmt] - d[fmt] = urls - except Exception as ex: - print(ex) - continue - - lock_fp.write("saving URLs\n") - for computer in computers: - comp_name = computer['name'] - disks = all_disks[comp_name] - lock_fp.write('urls: '+ str(disks) + '\n') - db.student_computers.update({ - 'disk_urls': {'$exists': False}, - 'student_id': student_id, - 'task_id': task_id, - 'class_id': class_id, - 'name': comp_name}, - {'$set': { 'disk_urls': disks }}) - - os.unlink(lock_file) diff --git a/kpov_judge/create_opstack.py b/kpov_judge/create_opstack.py deleted file mode 100644 index a7fa699..0000000 --- a/kpov_judge/create_opstack.py +++ /dev/null @@ -1,112 +0,0 @@ -import keystoneclient.v2_0.client as ksclient -import quantumclient.quantum.client as qclient -import novaclient.client as nclient -import settings -import pymongo -import sys -import os -import fcntl - -########################################################## - -def create_network(qc, network_name, tenant_name): - net = {'name': network_name, 'admin_state_up': True, 'tenant_id': getattr(kc.tenants.find(name=tenant_name), 'id')} - network = qc.create_network({'network': net}) - sub = {'name': network_name + "-subnet", 'cidr': '0.0.0.0/24', 'network_id': network['network']['id'], 'ip_version': 4, 'enable_dhcp': False, 'gateway_ip': None} - subnet = qc.create_subnet({'subnet': sub}) - return network - -def get_nova_client(tenant_name): - return nclient.Client("1.1", username=settings.OS_ADMIN_USER, api_key=settings.OS_ADMIN_PASS, auth_url=settings.OS_AUTH_URL, project_id=tenant_name) - -def get_quantum_client(tenant_name): - kcsub = ksclient.Client(auth_url=settings.OS_AUTH_URL, username=settings.OS_ADMIN_USER, password=settings.OS_ADMIN_PASS, tenant_name=tenant_name) - client = qclient.Client('2.0', endpoint_url=settings.OS_QUANTUM_URL, token=kcsub.auth_token) - client.format = 'json' - return client - - -########################################################## -def main(): - kc = ksclient.Client(endpoint=settings.OS_ADMIN_AUTH_URL, token=settings.OS_ADMIN_TOKEN) - admin_role = kc.roles.find(name='admin') - member_role = kc.roles.find(name='Member') - - db = pymongo.MongoClient(settings.DB_URI).get_default_database() - l = db.student_tasks.find({'create_openstack': True}) - projects = list() - for project in l: - task_id, student_id = project['task_id'], project['student_id'] - if (task_id, student_id) not in projects: - projects.append((task_id, student_id)) - #projects = [ ('01.predvaja','at9036@student.uni-lj.si'), ('01.predvaja', 'andrejtolic@fri1.uni-lj.si') ] - for task_id, student_id in projects: - l = db.student_tasks.find_one({'task_id': task_id, 'student_id': student_id, "create_openstack": True}) - if l is None: - continue - lock_file = os.path.join(settings.OS_LOCKFILE_PATH, '{0}-{1}.lock'.format(student_id, task_id)) - lock_fp = open(lock_file, 'w') - try: - fcntl.lockf(lock_fp, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError: - continue - # Ustvarimo projekt - project_name = "{0}-{1}".format(student_id, task_id) - project = kc.tenants.create(tenant_name=project_name) - lock_fp.write("Created project {0}.\n".format(project_name)) - # Dodamo admin uporabnika v projekt - kc.roles.add_user_role(kc.users.find(name='admin'), admin_role, project) - lock_fp.write("Added user admin to project {0}.\n".format(project_name)) - # Ustvarimo L2 omrezja - qc = get_quantum_client(tenant_name=project_name) - network_list = db.networks.find({'task_id': task_id}) - nets = {} - for n in network_list: - net = create_network(qc, network_name=n['name'], tenant_name=project_name) - lock_fp.write("Created network {0}.".format(n['name'])) - nets[n['name']] = {'net-id': net['network']['id']} - db.student_networks.update({'task_id': task_id, 'student_id': student_id, 'name': n['name']}, {'$set': {'network_id': net['network']['id'], 'public': n['public']}}, upsert=True) - #Ustvarimo instance - instance_list = db.computers_meta.find({'task_id': task_id}) - nc = get_nova_client(tenant_name=project_name) - first_instance_in_project = True - for inst in instance_list: - image = nc.images.find(name=inst['image']) - flavor = nc.flavors.find(name=inst['flavor']) - instance_nets = [nets[iface['network']] for iface in inst['network_interfaces']] - if inst['config_drive']: - if 'string' in inst['userdata'].keys(): - udata = inst['userdata']['string'] - elif 'file' in inst['userdata'].keys(): - try: - udata = open(inst['userdata']['file'], 'r') - except: - udata = None - lock_fp.write("Problem reading file {0} for config drive. Using None instead.".format(inst['userdata']['file'])) - else: - udata = None - if first_instance_in_project: - scheduler_hints = None - first_instance_in_project = False - else: - s = db.student_computers.find_one({'task_id': task_id, 'student_id': student_id, 'name': inst['name']}) - # Value corresponding to the 'same_host' key is a list (with just one element) - # of instances besides which to put the new instance. - scheduler_hints = {'same_host': [s['openstack_instance_id']] } - instance = nc.servers.create(name=project_name + "-" + inst['name'], image=image, flavor=flavor, nics=instance_nets, config_drive=inst['config_drive'], userdata=udata, scheduler_hints=scheduler_hints) - lock_fp.write("Created instance for computer {0}.".format(inst['name'])) - # Write openstack instance id to mongo. - db.student_computers.update({'task_id': task_id, 'student_id': student_id, 'name': inst['name']}, {'$set': {'openstack_instance_id': instance['id'], 'openstack_host': instance['OS-EXT-SRV-ATTR:host'], 'openstack_finalized': False}, upsert=True) - # instance['status'] lahko BUILD, ACTIVE ali SHUTOFF - # instance = nova.servers.get(instance['id']) - db.student_tasks.update({'task_id': task_id, 'student_id': student_id}, {'$set': {'create_openstack': False, 'openstack_created': True}}) - os.unlink(lock_file) - lock_fp.close() - - # TODO v loceni skripti. - # povezi test-net na brarbiters, po izklopu instanc guestfs nad diski in create_image. - # Dodamo studenta v projekt - kc.roles.add_user_role(kc.users.find(name=student_id), member_role, project) - -if __name__ == '__main__': - main() diff --git a/kpov_judge/doc/DEVELOPMENT-FAQ.txt b/kpov_judge/doc/DEVELOPMENT-FAQ.txt deleted file mode 100644 index 0c358cc..0000000 --- a/kpov_judge/doc/DEVELOPMENT-FAQ.txt +++ /dev/null @@ -1,93 +0,0 @@ -Question: - - I want to write a new task. Where do I start? - -Answer: - - You can start by looking at tasks/set_ip_static_dhcp. For instructions, see the file README.txt under Preparing tasks. After preparing the task, make sure to update the howtos. - -Question: - - How do I run gen_params? - -Answer: - - run test_task.py -g - -Question: - - What is the URL supposed to be? - -Answer: - - For testing on the simpleArbiter, you should probably set it to: - file:///home/tester/kpov-public/kpov_judge/tasks - The name should then be, for example, custom_rdate - -Vprašanje: - - Kaj, če ne znam postaviti vprašanja v angleščini? - Odgovor: - - Postavi vprašanje v slovenščini in asistent ga bo prevedel. - -Vprašanje (06-isc_live_boot): - - lahko prosim razložite bolj potrobno prvi del navodil (ne razumemo kaj naj bi bila ta datoteka A, ter kako so mišljeni ti IP-ji pri parametru IP_DHCP ter IP_GW). - -Question: - - What is the difference between simpleArbiter, simpleArbiterDhcp, simpleArbiter-base? - -Answer: - - The image simpleArbiter-base is a base image which should not be altered. simpleArbiter is derived from simpleArbiter-base - and is the minimal system that should be used for testing. simpleArbiterDhcp is the same as simpleArbiter, but includes a DHCP server. - simpleArbiterGW includes a DHCP server and is configured to act as a router using NAT. - -Question: - -Kaj je potrebno naredit pri nalogi write gen_params(), params_meta z parmams_meta tabelo? - -Answer: - Potrebno je spremeniti slovar params_meta tako, da pogleda katere parametre ste zgenerirali in kakšnega tipa so ti parametri. - -Question: - -Navodila za smb_nfs nalogo zahtevajo, da na virtualki SimpleArbiterDhcp poiscem mapo "Mapa", imenik "SAMBA_SHARE" ter "NFS_POT", vendar teh map na virtualki ni? - -Answer: - -Mapo Mapa kreirajte sami.Ta se bo enkrat ustvarila sama avtomaticno v prepare_disks. SAMBA_SHARE in NFS_POT bo ustvaril študent, ko bo reševal vašo nalogo. - -Question: - - How do I add a translation of the instructions? - -Answer: - - Add a key, value pair into the instructions dictionary. For example (orig): - instructions = {'en':'Do the locomotion'} - corrected: - instructions = {'en':'Do the locomotion', 'si':'Izvedi gibanje'} - -Question: - - How do I add a parameter to params_meta / what is the meaning of each field? - -Answer: - - params_meta is a simple dictionary. If, for example, the parameters are SOME_IP, SOME_MAC and SOME_FNAME and - if the student is supposed to be shown SOME_IP and SOME_MAC but is supposed to find SOME_FNAME by inspecting the - filesystem of their computer, params_meta might look like this: - -params_meta = { - 'SOME_IP': { - 'descriptions': {'en': 'THE IP of the server'}, # this will be shown in the dialog when test_task.py is run - 'w': False, # the student is not allowed to change the value of SOME_IP - 'public': True, # the student should be shown the value of SOME_IP if they run test_task.py - 'type':'IP', # this can be used to pick the right function to generate the random value - # Look at kpov_util.default_generators and kpov_util.IPv4_addr_gen - # for more info. - 'generated': True # this parameter should be generated by gen_params - }, - 'SOME_MAC': { - 'descriptions': {'en': 'The MAC of the server', 'si': u'MAC naslov strežnika'}, - 'w': True, # the student can change this value - 'public': True, # the student should see this parameter when they run test_task.py - 'type':'MAC', # if 'MAC' were a key in kpov_util.default_generators, the value - # in that dictionary should be a random function for generating MAC addresses. - # Also, in the future, the 'type' field could be used for validation. - 'generated': False # the student should enter this value his or herself. - }, - 'SOME_FNAME': { - 'descriptions': {'en': 'The name of the file to find'}, # this won't be shown anywhere - 'w': False, # the student is not allowed to change this - 'public': False, # the student will not be shown this parameter when they run test_task.py - 'type': 'filename', # this can be used by gen_params or kpov_util for generation - 'generated': True # the value should be generated in gen_params - }, -} - diff --git a/kpov_judge/doc/presentation/beamercolorthemeULFRI.sty b/kpov_judge/doc/presentation/beamercolorthemeULFRI.sty deleted file mode 100644 index a7bc26b..0000000 --- a/kpov_judge/doc/presentation/beamercolorthemeULFRI.sty +++ /dev/null @@ -1,39 +0,0 @@ -% Copyright 2012 by Pa3cio Bulic, UL FRI -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Public License. -% -% See the file doc/licenses/LICENSE for more details. - -% Just modified the Dolphin color theme. - -\ProvidesPackageRCS $Header: beamercolorthemeULFRI.sty,v 0.0.1 2012/10/08 22:31:55 patricio $ - - -\mode - -%% Nastavimo barvo primarnih elementov (npr. headline-a): -\setbeamercolor*{palette primary}{use=structure,fg=white,bg=structure.fg} -\setbeamercolor*{palette secondary}{use=structure,fg=black,bg=structure.fg} -\setbeamercolor*{palette tertiary}{use=structure,fg=black,bg=structure.fg} -\setbeamercolor*{palette quaternary}{fg=white,bg=black} - -%% Barva ozadja za sidebar -\setbeamercolor*{sidebar}{use=structure,bg=white,fg=black} - - -%% barva elementov v sidebar-u: -\setbeamercolor*{palette sidebar primary}{fg=black,bg=white} -\setbeamercolor*{palette sidebar secondary}{fg=black} -\setbeamercolor*{palette sidebar tertiary}{fg=black} -\setbeamercolor*{palette sidebar quaternary}{fg=black} - -\setbeamercolor*{titlelike}{use=structure,fg=structure.fg} - -\setbeamercolor*{separation line}{} -\setbeamercolor*{fine separation line}{} - -\mode - diff --git a/kpov_judge/doc/presentation/beamerthemeULFRI.sty b/kpov_judge/doc/presentation/beamerthemeULFRI.sty deleted file mode 100644 index 276c3c3..0000000 --- a/kpov_judge/doc/presentation/beamerthemeULFRI.sty +++ /dev/null @@ -1,78 +0,0 @@ -% Copyright 2012 by Pa3cio Bulic, UL FRI -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Public License. -% -% See the file doc/licenses/LICENSE for more details. - -\ProvidesPackageRCS $Header: beamerthemeULFRI.sty,v 0.0.1 2012/11/07 09:11:41 pa3cio $ - -\DeclareOptionBeamer{height}{\PassOptionsToPackage{height=#1}{beamerouterthemesidebar}} -\ProcessOptionsBeamer - -\DeclareOptionBeamer{compress}{\beamer@compresstrue} -\ProcessOptionsBeamer - -\mode -\usecolortheme[RGB={180,22,44}]{structure} -%\usecolortheme[RGB={204,45,48}]{structure} -%\usecolortheme[cmyk={0.0,0.81,0.81,0.16}]{structure} - - -% If you have a file called "university-logo-filename.xxx", where xxx -% is a graphic format that can be processed by latex or pdflatex, -% resp., then you can add a logo as follows: - -\pgfdeclareimage[height=20mm]{logo}{znakULFRIbeamer.png} -\logo{\pgfuseimage{logo}} -%\logo{\includegraphics[height=20mm]{znakULFRIbeamer.png}} - - -%\useoutertheme{infolines} -%\setbeamertemplate{items}[ball] -%\usefonttheme{serif} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% IZGLED BLOKOV (TEOREMI, DOKAZI, ....) -% 1. Ce zelite imeti bloke z zaobljenimi robovi, izberite: -% \setbeamertemplate{blocks}[rounded][shadow=false] -% 2. Ce zelite imeti bloke z zaobljenimi robovi in sencami, izberite: -% \setbeamertemplate{blocks}[rounded][shadow=true] -% 3. Ce zelite imeti navadne pravokotne bloke, izberite: -% \setbeamertemplate{blocks}[default] -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%\setbeamertemplate{blocks}[rounded][shadow=false] -%\setbeamertemplate{blocks}[rounded][shadow=true] -\setbeamertemplate{blocks}[default] -% -% -% -% -\setbeamertemplate{navigation symbols}{} -% - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% I Z B I R A T E M E Z U N A N J I H E L E M E N T O V : -% 1. Ce zelite prosojnice brez kazala poglavij, zakomentirajte spodnji dve vrstici -% 2. Ce zelite prosojnice s kazalom ob strani in logom v zgornjem levem kotu, izberite \useoutertheme[left,hideallsubsections]{sidebar} -% 3. Ce zelite prosojnice s kazalom v glavi, izberite \useoutertheme{split} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\useoutertheme[left,hideallsubsections]{sidebar} -%\useoutertheme{split} -%\useoutertheme[footline=authorinstitutetitle]{miniframes} -%\useoutertheme{shadow} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% B A R V N A P R E D L O G A I N F O N T I -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usecolortheme{ULFRI} -\usecolortheme{orchid} -\setbeamercolor*{frametitle}{parent=palette primary} -\setbeamerfont{block title}{size={}} - -\mode - diff --git a/kpov_judge/doc/presentation/beamerthemeULFRIframes.sty b/kpov_judge/doc/presentation/beamerthemeULFRIframes.sty deleted file mode 100644 index cd0e37a..0000000 --- a/kpov_judge/doc/presentation/beamerthemeULFRIframes.sty +++ /dev/null @@ -1,74 +0,0 @@ -% Copyright 2012 by Pa3cio Bulic, UL FRI -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Public License. -% -% See the file doc/licenses/LICENSE for more details. - -\ProvidesPackageRCS $Header: beamerthemeULFRIframes.sty,v 0.0.1 2012/11/07 09:11:41 pa3cio $ - -\DeclareOptionBeamer{height}{\PassOptionsToPackage{height=#1}{beamerouterthemesidebar}} -\ProcessOptionsBeamer - -\DeclareOptionBeamer{compress}{\beamer@compresstrue} -\ProcessOptionsBeamer - -\mode -\usecolortheme[RGB={180,22,44}]{structure} -%\usecolortheme[RGB={204,45,48}]{structure} -%\usecolortheme[cmyk={0.0,0.81,0.81,0.16}]{structure} - - -% If you have a file called "university-logo-filename.xxx", where xxx -% is a graphic format that can be processed by latex or pdflatex, -% resp., then you can add a logo as follows: - -%\pgfdeclareimage[height=20mm]{logo}{znakULFRIbeamer.png} -%\logo{\pgfuseimage{logo}} -%\logo{\includegraphics[height=20mm]{znakULFRIbeamer.png}} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% IZGLED BLOKOV (TEOREMI, DOKAZI, ....) -% 1. Ce zelite imeti bloke z zaobljenimi robovi, izberite: -% \setbeamertemplate{blocks}[rounded][shadow=false] -% 2. Ce zelite imeti bloke z zaobljenimi robovi in sencami, izberite: -% \setbeamertemplate{blocks}[rounded][shadow=true] -% 3. Ce zelite imeti navadne pravokotne bloke, izberite: -% \setbeamertemplate{blocks}[default] -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%\setbeamertemplate{blocks}[rounded][shadow=false] -%\setbeamertemplate{blocks}[rounded][shadow=true] -\setbeamertemplate{blocks}[default] -% -% -% -% -\setbeamertemplate{navigation symbols}{} -% - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% I Z B I R A T E M E Z U N A N J I H E L E M E N T O V : -% 1. Ce zelite prosojnice brez kazala poglavij, zakomentirajte spodnji dve vrstici -% 2. Ce zelite prosojnice s kazalom ob strani in logom v zgornjem levem kotu, izberite \useoutertheme[left,hideallsubsections]{sidebar} -% 3. Ce zelite prosojnice s kazalom v glavi, izberite \useoutertheme{split} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%\useoutertheme[left,hideallsubsections]{sidebar} -%\useoutertheme{split} -\useoutertheme[footline=authorinstitutetitle]{miniframes} -%\useoutertheme{shadow} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% B A R V N A P R E D L O G A I N F O N T I -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usecolortheme{ULFRI} -\usecolortheme{orchid} -\setbeamercolor*{frametitle}{parent=palette primary} -\setbeamerfont{block title}{size={}} - -\mode - diff --git a/kpov_judge/doc/presentation/figs/VCL.png b/kpov_judge/doc/presentation/figs/VCL.png deleted file mode 100644 index 01a3d3c..0000000 Binary files a/kpov_judge/doc/presentation/figs/VCL.png and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/baby.jpg b/kpov_judge/doc/presentation/figs/baby.jpg deleted file mode 100644 index aedb769..0000000 Binary files a/kpov_judge/doc/presentation/figs/baby.jpg and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/centralised-architecture.pdf b/kpov_judge/doc/presentation/figs/centralised-architecture.pdf deleted file mode 100644 index 17c9c6e..0000000 Binary files a/kpov_judge/doc/presentation/figs/centralised-architecture.pdf and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/centralised-architecture.png b/kpov_judge/doc/presentation/figs/centralised-architecture.png deleted file mode 100644 index a4830fc..0000000 Binary files a/kpov_judge/doc/presentation/figs/centralised-architecture.png and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/centralised-architecture.svg b/kpov_judge/doc/presentation/figs/centralised-architecture.svg deleted file mode 100644 index b91c593..0000000 --- a/kpov_judge/doc/presentation/figs/centralised-architecture.svg +++ /dev/null @@ -1,18111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - STUDENT 1 - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - STUDENT 2 - - - - TESTER - - diff --git a/kpov_judge/doc/presentation/figs/computer.svg b/kpov_judge/doc/presentation/figs/computer.svg deleted file mode 100644 index b20943c..0000000 --- a/kpov_judge/doc/presentation/figs/computer.svg +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kpov_judge/doc/presentation/figs/fail.jpg b/kpov_judge/doc/presentation/figs/fail.jpg deleted file mode 100644 index cf18aa0..0000000 Binary files a/kpov_judge/doc/presentation/figs/fail.jpg and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/kpov-architecture.pdf b/kpov_judge/doc/presentation/figs/kpov-architecture.pdf deleted file mode 100644 index 8efc2f6..0000000 Binary files a/kpov_judge/doc/presentation/figs/kpov-architecture.pdf and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/kpov-architecture.png b/kpov_judge/doc/presentation/figs/kpov-architecture.png deleted file mode 100644 index df20138..0000000 Binary files a/kpov_judge/doc/presentation/figs/kpov-architecture.png and /dev/null differ diff --git a/kpov_judge/doc/presentation/figs/kpov-architecture.svg b/kpov_judge/doc/presentation/figs/kpov-architecture.svg deleted file mode 100644 index 93e14aa..0000000 --- a/kpov_judge/doc/presentation/figs/kpov-architecture.svg +++ /dev/null @@ -1,18991 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - STUDENT 1 - - TESTER - - - - - - - - OXYGEN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARBITER - - INTERWEBZ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/doc/presentation/kpov_judge-slides.pdf b/kpov_judge/doc/presentation/kpov_judge-slides.pdf deleted file mode 100644 index c8eda87..0000000 Binary files a/kpov_judge/doc/presentation/kpov_judge-slides.pdf and /dev/null differ diff --git a/kpov_judge/doc/presentation/kpov_judge-slides.tex b/kpov_judge/doc/presentation/kpov_judge-slides.tex deleted file mode 100644 index c8a6acc..0000000 --- a/kpov_judge/doc/presentation/kpov_judge-slides.tex +++ /dev/null @@ -1,277 +0,0 @@ -% $Header: /Users/joseph/Documents/LaTeX/beamer/solutions/generic-talks/generic-ornate-15min-45min.en.tex,v 90e850259b8b 2007/01/28 20:48:30 tantau $ - -\documentclass{beamer} - -% This file is a solution template for: - -% - Giving a talk on some subject. -% - The talk is between 15min and 45min long. -% - Style is ornate. - -% Copyright 2004 by Till Tantau . -% -% In principle, this file can be redistributed and/or modified under -% the terms of the GNU Public License, version 2. -% -% However, this file is supposed to be a template to be modified -% for your own needs. For this reason, if you use this file as a -% template and not specifically distribute it as part of a another -% package/program, I grant the extra permission to freely copy and -% modify this file as you see fit and even to delete this copyright -% notice. - - -\mode -{ - \usetheme[height=9mm]{ULFRI} - % \usecolortheme{beaver} - % or ... - % \setbeamercovered{transparent} - % or whatever (possibly just delete it) -} - -% \usetheme[height=9mm]{ULFRI} - -\usepackage[english]{babel} -% or whatever - -\usepackage[utf8]{inputenc} -% or whatever -\usepackage{multirow} -\usepackage{times} -\usepackage[T1]{fontenc} -% Or whatever. Note that the encoding and the font should match. If T1 -% does not look nice, try deleting the line with the fontenc. - - -\title[Kpov Judge] % (optional, use only with long paper titles) -{Strah in trepet prihodnjih generacij pri KPOV} - -% \subtitle -% {A tale of RFIDs, finance and irritation} % (optional) - -% (optional, use only with lots of authors) -\author[LUSY] -{Ga\v{s}per Fele-\v{Z}or\v{z}} - -% - Use the \inst{?} command only if the authors have different -% affiliation. - -\institute[FRI]{ - Univerza v Ljubljani, Fakulteta za računalništvo in informatiko - {\small polz@fri.uni-lj.si} -} - -\date[FRI pedagoška delavnica] % (optional) -{} - -\subject{KPOV Judge} -% This is only inserted into the PDF information catalog. Can be left -% out. - - - -% If you have a file called "university-logo-filename.xxx", where xxx -% is a graphic format that can be processed by latex or pdflatex, -% resp., then you can add a logo as follows: - -% \pgfdeclareimage[height=0.5cm]{university-logo}{university-logo-filename} -% \logo{\pgfuseimage{university-logo}} - - - -% Delete this, if you do not want the table of contents to pop up at -% the beginning of each subsection: -%\AtBeginSubsection[] -%{ -% \begin{frame}{Outline} -% \tableofcontents[currentsection,currentsubsection] -% \end{frame} -%} - - -% If you wish to uncover everything in a step-wise fashion, uncomment -% the following command: - -%\beamerdefaultoverlayspecification{<+->} - -\begin{document} - -\begin{frame}{KPOV! Naravnost v obraz!} - \titlepage -\end{frame} - -\begin{frame}{Pregled} - \tableofcontents - % You might wish to add the option [pausesections] -\end{frame} - - -% Since this a solution template for a generic talk, very little can -% be said about how it should be structured. However, the talk length -% of between 15min and 45min and the theme suggest that you stick to -% the following rules: - -% - Exactly two or three sections (other than the summary). -% - At *most* three subsections per section. -% - Talk about 30s to 2min per frame. So there should be between about -% 15 and 30 frames, all told. -\section{Kaj je KPOV Judge} % ----------------------------------------------- - -\subsection{KPOV} - -\begin{frame}{KPOV} - \begin{itemize} - \item Računalniške komunikacije 2 - \item Predpogoj za Spletne Tehnologije - \item Postavi DHCP, TFTP, SNMP, RDATE, Video streaming... - \item 90 študentov 2. letnika VSŠ, en asistent - \end{itemize} -\end{frame} - -\begin{frame}{Pot na FRI je tlakovana z dobrimi nameni} - \begin{itemize} - \item Dva tedna za prvi prototip s podporo za OpenCloud - \item Devet mesecev za približno delujočih nekaj nalog z navodili - \end{itemize} -\end{frame} - -\begin{frame}{Čas izdelave} - \includegraphics<1>[width=\textwidth,height=0.8\textheight,keepaspectratio]{figs/baby.jpg} -\end{frame} - -\subsection{Uporabi že narejeno!} - -\begin{frame}{Open Virtual Computer Lab} - \includegraphics<1>[width=\textwidth,height=0.8\textheight,keepaspectratio]{figs/VCL.png} - \begin{itemize} - \item Postavi farmo strežnikov - \item Napiši skripte za testiranje - \end{itemize} -\end{frame} - -\subsection{BYOD MOOC} -\begin{frame}{Običajna arhitektura} - \includegraphics<1>[width=\textwidth,height=0.8\textheight,keepaspectratio]{figs/centralised-architecture.png} -\end{frame} - -\begin{frame}{Prihranimo na strojni opremi!} - \includegraphics<1>[width=\textwidth,height=0.8\textheight,keepaspectratio]{figs/kpov-architecture.png} -\end{frame} - -\section{Kako se ga uporablja?} -\begin{frame}{Asistent} - \begin{itemize} - \item Navodila - \item Seznam računalnikov / diskov, mrež - \item Seznam parametrov - \item Pripravljanje parametrov - \item Pripravljanje diskov - \item Preverjanje pri študentu - \item Preverjanje na strežniku - \end{itemize} -\end{frame} - -\begin{frame}{Študent} - \begin{itemize} - \item Povleci virtualke - \item Reši nalogo - \item Poženi testni program - \end{itemize} -\end{frame} - -\begin{frame}{DEMO} - \includegraphics<1>[width=\textwidth,height=0.8\textheight,keepaspectratio]{figs/fail.jpg} -\end{frame} - -\section{Uporabljene tehnologije} -\begin{frame}{Uporabljene tehnologije} - \begin{itemize} - \item Python, Flask - \item MongoDB - \item libguestfs - \item OpenStack (zadnjič deloval 2013) - \end{itemize} -\end{frame} - -\section{Rezultati uporabe} -\begin{frame}{Kako uporabiti študente} - \begin{itemize}[<+->] - \item Skupinsko delo (4 študentje / skupino) - \item Jasno razdeljene naloge - \item Če en ne opravi dela, padejo vsi - \item Vsak je v dveh skupinah, vsak ima backup - \item Brez točnih rokov - \item Brez dobre dokumentacije - \item Brez zadostnega obrtniškega znanja - \end{itemize} -\end{frame} - -\begin{frame}{Kako uporabiti študente} - \begin{itemize}[<+->] - \item V redu za howto, prevod - \item Slabi za programiranje - \end{itemize} -\end{frame} - - -\begin{frame}{Primer naloge} - \begin{itemize} - \item Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji - \item Napiši NAJKRAJŠI ukaz, ki premakne datoteke iz ADAHHD v KPOKNM - \item Poišči datoteke, ki vsebujejo "mama" - \item Izpiši zadnje vrstice, filtriraj syslog - \item Namesti paket "cowsay" in ga preizkusi :) - \item Povleci datoteko s CURL - \item Preštej vrstice v datoteki, rezultat spravi v okoljsko spremenljivko - \item Preštej število vrstic v datoteki - \end{itemize} -\end{frame} - -\begin{frame}{Poizkusni zajčki} - \begin{itemize}[<+->] - \item Dva študenta pri RF, druga stopnja Bolognske - \item En zaposleni, ne-asistent - \item Trije asistentje - \end{itemize} -\end{frame} - -\begin{frame}{Koliko časa} - \begin{itemize} - \item En študent - dve uri, rešil pol - \item Študentka - pet ur, rešila nič - \item Zaposleni - pogledal, se ni resno lotil - \item Dva asistenta - pogledala, po pol ure obupala - \item En asistent rešil v slabih 2 urah - \end{itemize} -\end{frame} - -\section{Rad bi pomagal} - -\begin{frame}{Dobri stari svn} - svn co https://lusy.fri.uni-lj.si/svn/kpov-public -\end{frame} - -\begin{frame}{Acknowledgements} - \begin{itemize} - \item Andrej Brodnik - \item Andrej Tolič - \item Študentje KPOV 2014/2015 - \end{itemize} -\end{frame} - -\begin{frame}{Vprašanja} -\end{frame} -%\begin{frame}{Map of Slovenia} - % - A title should summarize the slide in an understandable fashion - % for anyone how does not follow everything on the slide itself. -% \includegraphics<1>[width=\textwidth,height=0.8\textheight,keepaspectratio]{slovenia-map.png} -% \includegraphics<2>[width=\textwidth,height=0.8\textheight,keepaspectratio]{matkurja1.jpg} - -%\end{frame} - -\end{document} - - - - diff --git a/kpov_judge/doc/presentation/znakULFRIbeamer.png b/kpov_judge/doc/presentation/znakULFRIbeamer.png deleted file mode 100644 index be8d1b0..0000000 Binary files a/kpov_judge/doc/presentation/znakULFRIbeamer.png and /dev/null differ diff --git a/kpov_judge/finalize_opstack.py b/kpov_judge/finalize_opstack.py deleted file mode 100644 index 9f3d959..0000000 --- a/kpov_judge/finalize_opstack.py +++ /dev/null @@ -1,117 +0,0 @@ -import keystoneclient.v2_0.client as ksclient -import quantumclient.quantum.client as qclient -import novaclient.client as nclient -import settings -import pymongo -import sys -import os -import fcntl - -########################################################## -def create_project(project_name): - return kc.tenants.create(tenant_name=project_name) - -def get_project_by_name(project_name): - return kc.users.find(name=username) - -def get_user_by_name(username): - return kc.users.find(name=username) - -def create_network(network_name, tenant_name): - net = {'name': network_name, 'admin_state_up': True, 'tenant_id': getattr(kc.tenants.find(name=tenant_name), 'id')} - network = qc.create_network({'network': net}) - sub = {'name': network_name + "-subnet", 'cidr': '0.0.0.0/24', 'network_id': network['network']['id'], 'ip_version': 4, 'enable_dhcp': False, 'gateway_ip': None} - subnet = qc.create_subnet({'subnet': sub}) - return network - -def get_nova_client(tenant_name): - return nclient.Client("1.1", username=settings.OS_ADMIN_USER, api_key=settings.OS_ADMIN_PASS, auth_url=settings.OS_AUTH_URL, project_id=tenant_name) - -def get_quantum_client(tenant_name): - kcsub = ksclient.Client(auth_url=settings.OS_AUTH_URL, username=settings.OS_ADMIN_USER, password=settings.OS_ADMIN_PASS, tenant_name=tenant_name) - client = qclient.Client('2.0', endpoint_url=settings.OS_QUANTUM_URL, token=kcsub.auth_token) - client.format = 'json' - return client - -########################################################## - -kc = ksclient.Client(endpoint=settings.OS_ADMIN_AUTH_URL, token=settings.OS_ADMIN_TOKEN) -member_role = kc.roles.find(name='Member') - -db = pymongo.MongoClient(settings.DB_URI).get_default_database() - -l = db.student_tasks.find({'create_openstack': True}) -projects = list() -for project in l: - task_id, student_id = project['task_id'], project['student_id'] - if (task_id, student_id) not in projects: - projects.append((task_id, student_id)) -#projects = [ ('01.predvaja','at9036@student.uni-lj.si'), ('01.predvaja', 'andrejtolic@fri1.uni-lj.si') ] -for task_id, student_id in projects: - l = db.student_tasks.find_one({'task_id': task_id, 'student_id': student_id, "create_openstack": True}) - if l is None: - continue - lock_file = os.path.join(settings.OS_LOCKFILE_PATH, '{0}-{1}.lock'.format(student_id, task_id)) - lock_fp = open(lock_file, 'w') - try: - fcntl.lockf(lock_fp, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError: - continue - # Ustvarimo projekt - project_name = "{0}-{1}".format(student_id, task_id) - project = create_project(project_name=project_name) - lock_fp.write("Created project {0}.\n".format(project_name)) - # Dodamo admin uporabnika v projekt - kc.roles.add_user_role(get_user_by_name('admin'), admin_role, project) - lock_fp.write("Added user admin to project {0}.\n".format(project_name)) - # Ustvarimo L2 omrezja - qc = get_quantum_client(tenant_name=project_name) - network_list = db.networks.find({'task_id': task_id}) - nets = [] - for n in network_list: - net = create_network(network_name=n['name'], tenant_name=project_name) - lock_fp.write("Created network {0}.".format(n['name'])) - nets.append( (n['name'], {'net-id': net['network']['id']}) ) - db.student_networks.update({'task_id': task_id, 'student_id': student_id, 'name': n['name']}, {'$set': {'network_id': net['network']['id'], 'public': n['public']}}, upsert=True) - #Ustvarimo instance - instance_list = db.computers_meta.find({'task_id': task_id}) - nc = get_nova_client(tenant_name=project_name) - first_instance_in_project = True - for inst in instance_list: - image = nc.images.find(name=inst['image']) - flavor = nc.flavors.find(name=inst['flavor']) - instance_net_names = inst['networks'] - instance_nets = [net[1] for net in nets if net[0] in instance_net_names] - if inst['config_drive']: - if 'string' in inst['userdata'].keys(): - udata = inst['userdata']['string'] - elif 'file' in inst['userdata'].keys(): - try: - udata = open(inst['userdata']['file'], 'r') - except: - udata = None - lock_fp.write("Problem reading file {0} for config drive. Using None instead.".format(inst['userdata']['file'])) - else: - udata = None - if first_instance_in_project: - scheduler_hints = None - first_instance_in_project = False - else: - s = db.student_computers.find_one({'task_id': task_id, 'student_id': student_id, 'name': inst['name']}) - # Value corresponding to the 'same_host' key is a list (with just one element) - # of instances besides which to put the new instance. - scheduler_hints = {'same_host': [s['openstack_instance_id']] } - instance = nc.servers.create(name=project_name + "-" + inst['name'], image=image, flavor=flavor, nics=instance_nets, config_drive=inst['config_drive'], userdata=udata, scheduler_hints=scheduler_hints) - lock_fp.write("Created instance for computer {0}.".format(inst['name'])) - # Write openstack instance id to mongo. - db.student_computers.update({'task_id': task_id, 'student_id': student_id, 'name': inst['name']}, {'$set': {'openstack_instance_id': instance['id'], 'openstack_host': instance['OS-EXT-SRV-ATTR:host'], 'openstack_finalized': False}, upsert=True) - # instance['status'] lahko BUILD, ACTIVE ali SHUTOFF - # instance = nova.servers.get(instance['id']) - db.student_tasks.update({'task_id': task_id, 'student_id': student_id}, {'$set': {'create_openstack': False, 'openstack_created': True}}) - os.unlink(lock_file) - lock_fp.close() - -# TODO v loceni skripti. -# povezi test-net na brarbiters, po izklopu instanc guestfs nad diski in create_image. -# Dodamo studenta v projekt -kc.roles.add_user_role(get_user_by_name(student_id), member_role, project) diff --git a/kpov_judge/instructions_extractor.py b/kpov_judge/instructions_extractor.py deleted file mode 100644 index cc622f9..0000000 --- a/kpov_judge/instructions_extractor.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python3 - -import glob -import os -import sys - -def print_instructions(p, fname): - try: - print("---------------") - l = p.split(os.sep) - l1 = [] - for i in range(len(l)): - f = os.path.join(*l[:i+1]) - if os.path.islink(f): - s = "{0} ({1})".format(l[i], os.path.split(os.readlink(f))[1]) - else: - s = l[i] - l1.append(s) - print(p) - print(" - ".join(l1)) - with open(os.path.join(p, fname)) as f: - task_code = compile(f.read(), fname, 'exec') - d = {} - exec(task_code, globals(), d) - for lang, text in d['instructions'].items(): - print("Language: {0}".format(lang)) - print(text.encode('utf-8')) - print("") - except Exception as e: - print(e) - -if __name__ == '__main__': - l = glob.glob(sys.argv[1]) - l.sort() - for d in l: - for root, dirs, files in os.walk(d, followlinks=True): - for fname in files: - if fname == 'task.py': - print_instructions(root, fname) diff --git a/kpov_judge/kpov_util.py b/kpov_judge/kpov_util.py deleted file mode 100755 index ac7053f..0000000 --- a/kpov_judge/kpov_util.py +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env python3 - -import collections -import glob -import itertools -import math -import os -import random -import re -import socket -import string -import struct - -def ssh_test(host, user, password, commands=()): - import pexpect - from pexpect import pxssh - - results = collections.defaultdict(str) - try: - s = pxssh.pxssh(encoding='utf-8', timeout=10) - s.login(host, user, password, - original_prompt='~[#$] ', - auto_prompt_reset=False) - results['ssh'] = True - results['motd'] = s.before - s.set_unique_prompt() - for test, command in commands: - s.sendline(command) - s.prompt() - if test: - results[test] = s.before[len(command+'\r\n'):] - s.logout() - except pexpect.exceptions.EOF as e: - results['ssh'] = 'connection to {} as {}/{} failed (EOF)'.format(host, user, password) - except pexpect.exceptions.TIMEOUT as e: - results['ssh'] = 'connection to {} as {}/{} failed (timeout)'.format(host, user, password) - except Exception as e: - results['ssh'] = str(e) - return results - -def alnum_gen(r, l=1): - s = "" - for i in range(l): - s += r.choice(string.ascii_letters + string.digits) - return s - -def fortune(r, max_len): - all_fortunes = [] - for fortune_file in itertools.chain( - glob.iglob('/usr/share/fortune/*.u8'), - glob.iglob('/usr/share/games/fortunes/*.u8')): - f = open(fortune_file) - l = f.read().split('\n%\n')[:-1] - for i in l: - if len(i) < max_len: - all_fortunes.append(i) - stripped = re.sub(r'\s+', ' ', r.choice(all_fortunes)) - s = re.sub(r'[^\w?:;!./&%$=,]+', ' ', stripped) - return s.strip() - -def _net_to_int(s): - try: - net, subnet = s.split('/') - except ValueError: - subnet = '32' - try: - subnet_int = int(subnet) - except ValueError: - subnet_bytes = struct.unpack('>I', socket.inet_aton(subnet))[0] - max_bit = 1 << 31 - subnet_int = 0 - while (subnet_bytes & max_bit) > 0: - subnet_int += 1 - max_bit >>= 1 - return struct.unpack('>I', socket.inet_aton(net))[0], subnet_int - -def IPv4_subnet_gen(r, base_net, mask = 24): - base_addr, base_subnet = _net_to_int(base_net) - a = r.randint(1, 1 << mask - base_subnet) << (32 - mask) - if a >= 1<<32: - a = 0 - net_addr = base_addr | a - return socket.inet_ntoa(struct.pack('>I', net_addr)) + '/{0}'.format(mask) - -def IPv4_net_gen(r, min_hosts=254, local=True, multicast=False): - mask = 32 - int(math.ceil(math.log(min_hosts, 2))) - if local and not multicast: - net = r.choice([ - "192.168.0.0/16", - '10.0.0.0/8', - '172.16.0.0/12']) - if multicast: - if local: - net = "239.255.0.0/16" - else: - net = "224.0.0.0/4" - return IPv4_subnet_gen(r, net, mask) - -def IPv4_addr_gen(r, network, n_generated=1, reserve_top=1, reserve_bottom=1): - net, mask = _net_to_int(network) - hosts = [] - l = r.sample(list(range(reserve_bottom, - 2**(32 - mask)-reserve_top)), n_generated) - for i in l: - hosts.append(socket.inet_ntoa(struct.pack('>I', net | i))) - return hosts - -def MAC_gen(r): - s = "0123456789ABCDEF" - return ":".join([r.choice(s) + r.choice("26AE")] + \ - [r.choice(s) + r.choice(s) for i in range(5)]) - -common_file_extensions = ['jpg', 'png', 'txt', 'doc', 'cfg', 'pdf', 'odt', 'cpp', 'c', 'sh', 'java'] -def fname_gen(r, extension = True): - s = alnum_gen(r, 8) - if extension: - s += '.' + r.choice(common_file_extensions) - return s - -fdir = os.path.dirname(os.path.realpath(__file__)) -with open(os.path.join(fdir, 'random_data/greek_gods.txt')) as f: - greek_gods = [i.strip() for i in f.readlines()] -with open(os.path.join(fdir, 'random_data/roman_gods.txt')) as f: - roman_gods = [i.strip() for i in f.readlines()] -with open(os.path.join(fdir, 'random_data/slavic_gods.txt')) as f: - slavic_gods = [i.strip() for i in f.readlines()] - -gods = greek_gods + roman_gods + slavic_gods - -def hostname_gen(r): - return "{0}-{1:02}".format(r.choice(gods), r.randint(1, 99)) - -with open(os.path.join(fdir, 'random_data/slovenian_names.txt')) as f: - names = [i.strip() for i in f.readlines()] - -with open(os.path.join(fdir, 'random_data/slovenian_surnames.txt')) as f: - surnames = [i.strip() for i in f.readlines()] - -def username_gen(r): - return ("{}{}{}".format(r.choice(names), r.choice(surnames), r.randint(1, 99))).lower() - -def unknown_generator(r): - return '' - -default_generators = { - 'IP': lambda r: IPv4_addr_gen(r, IPv4_net_gen(r))[0], - 'localnet': lambda r: IPv4_net_gen(r, min_hosts = r.randint(16, 250), local=True, multicast=False), - 'filename': fname_gen, - 'dirname': lambda r: fname_gen(r, extension = False), - 'username': username_gen, - 'password': lambda r: alnum_gen(r, 8), - 'short_text': lambda r: fortune(r, 40), - 'uint': lambda r: r.randint(0, 2**32), - 'hostname': lambda r: hostname_gen(r), - None: lambda r: alnum_gen(r, 8), - '': unknown_generator, -} - - -def default_gen(userID, param_meta): - r = random.Random(userID) - params = dict() - for name, meta in param_meta.items(): - if meta.get('generated', False): - params[name] = default_generators.get( - meta.get('type', None), unknown_generator)(r) - return params - -if __name__ == '__main__': - r = random.Random() - for k, v in default_generators.items(): - print("---{}---".format(k)) - print(v(r)) diff --git a/kpov_judge/random_data/greek_gods.txt b/kpov_judge/random_data/greek_gods.txt deleted file mode 100644 index 33150aa..0000000 --- a/kpov_judge/random_data/greek_gods.txt +++ /dev/null @@ -1,488 +0,0 @@ -aceso -achelois -achelous -acheron -achlys -achos -acis -acmon -acratopotes -actaeus -adephagia -adikia -adonis -adrastea -adrasteia -aegaeon -aegle -aello -aeolus -aergia -aether -aetna -agdistis -aglaea -aglaope -agon -agrius -aiakos -aidos -aisa -aitnaios -akmon -akte -alala -alastor -alcyone -alcyoneus -alecto -alectrona -aletheia -alexiares -alke -alkon -aloadae -alpheus -amechania -amphiaraus -amphictyonis -amphitrite -anaideia -anatole -anemoi -angelia -angelos -ania -antaeus -anteros -antheia -anthousai -aoide -aparctias -apate -aphaea -apheleia -apheliotes -aphroditus -aphros -apollo -apollonis -aporia -arche -arete -arethusa -arges -argestes -argus -argyron -aristaeus -arke -arktos -artemis -asbetos -asbolus -asclepius -askalaphos -asopus -astraea -astraios -atabyrius -atropos -attis -auge -aura -aurai -auxesia -auxo -benthesikyme -beroe -bia -boreas -borysthenis -briareus -britomartis -brizo -brontes -bythos -cabeiri -caerus -caicias -calleis -calliope -calypso -carmanor -carme -celaeno -centaurs -cephisso -ceraon -cerberus -ceto -chalcon -chaos -chariclo -charites -charon -charybdis -cheimon -chione -chiron -chloris -chryson -chrysothemis -chrysus -circe -circios -cladeus -cleta -clio -clotho -clytie -cocytus -companions -comus -corus -corymbus -cottus -cronus -cyamites -cybele -cyclopes -cyllenus -cymopoleia -daemones -damnameneus -damneus -damon -daphne -deimos -deino -deipneus -delas -delphin -demeter -despoina -dexithea -dikaiosyne -dike -dionysus -dolos -dryades -dysis -dysnomia -dyssebeia -echo -eiar -eidothea -eidyia -eileithyia -eirene -eiresione -ekecheiria -electra -eleos -elete -elpis -empusa -enceladus -enyalius -enyo -eos -eosphorus -ephialtes -epiales -epimedes -epimeliades -epione -epiphron -erato -erebos -eris -eros -ersa -eucleia -eudaimonia -eulabeia -eunomia -eunostus -eupheme -euphrosyne -euporie -eupraxia -euronotus -eurotas -eurus -euryale -eurymedon -eurytion -eusebeia -euterpe -euthenia -euthymia -gaia -galene -gelos -geras -geryon -glaucus -gorgons -gorgyra -gyges -gymnastika -hamadryades -harmonia -harpocrates -hebe -hecate -hecaterus -hedone -hedylogos -hegemone -heimarmene -hekaerge -helios -hemera -hephaestus -hera -heracles -hermaphroditus -hermes -hesperis -hesperus -hestia -himerope -himeros -hippocampi -homados -homonoia -horkos -horme -hybris -hydros -hygieia -hymenaios -hypate -hypnos -iasios -iaso -ichnaea -idaios -ioke -iris -iynx -judges -kakia -kalokagathia -karkinos -karpo -kelmis -keuthonymos -koalemos -kokytos -korybantes -kratos -krotos -kydoimos -kyrbas -lachesis -ladon -lamia -lampades -lethe -leucosia -leucothea -ligeia -limos -lips -loxo -lupe -lycos -lysagora -lyssa -macaria -maenades -maia -makelo -mania -matton -medusa -megaera -megalesius -melete -meliae -melinoe -melpomene -menoetes -merope -mese -mesembria -methe -metope -minos -minthe -mneme -molpe -momus -mormo -moros -morpheus -mousika -muses -mylas -naiades -nemesis -nephelai -nereides -nereus -nerites -nessus -nete -nicothoe -nike -nikon -nomos -notus -nymphe -nyx -oceanides -oceanus -ocypete -oizys -okythoos -olympian -omodamos -onnes -oreades -orion -ormenos -orphne -orthosie -otos -oupis -paidia -palaemon -palaestra -palioxis -pan -panacea -pandaisia -pandia -pannychis -parthenope -pasithea -passalos -peisinoe -peitharchia -peitho -pemphredo -peneus -penia -penthus -pepromene -persephone -phaenna -phaenon -phaethon -phantasos -pheme -pherousa -philomelus -philophrosyne -philotes -phlegethon -phobetor -phobos -pholus -phorcys -phrike -phthonus -pistis -plutus -podarge -poine -polemos -polyhymnia -polymatheia -polyphemus -ponos -pontos -poros -porphyrion -poseidon -potamoi -pothos -praxidike -priapus -proioxis -prophasis -proteus -prymneus -psamathe -pthinoporon -ptocheia -pyroeis -pyrrhichos -raidne -rhadamanthys -rhapso -rhea -rivers -sabaktes -satyrs -scamander -scylla -selene -silenus -simon -skeiron -skelmis -skythes -smaragos -sophrosyne -soter -soteria -sponde -sterope -steropes -stheno -stilbon -styx -syntribos -talos -tartarus -taygete -techne -teles -telesphorus -telete -terpsichore -tethys -thalassa -thalia -thallo -thanatos -thaumas -thelchtereia -thelxinoe -thelxiope -theros -thetis -thoosa -thrasos -tisiphone -titan -titias -tityos -tonnes -triteia -triton -tritones -tyche -typhon -urania -uranus -younger -zagreus -zelos -zephyrus -zeus diff --git a/kpov_judge/random_data/roman_gods.txt b/kpov_judge/random_data/roman_gods.txt deleted file mode 100644 index dcf9cd7..0000000 --- a/kpov_judge/random_data/roman_gods.txt +++ /dev/null @@ -1,184 +0,0 @@ -abundantia -acis -aerecura -aequitas -aesculapius -aeternitas -aion -alernus -angerona -angitia -annona -antevorta -apollo -arimanius -aura -aurora -averruncus -bacchus -bellona -bubona -caca -cacus -caelus -camenae -cardea -carmenta -carmentes -carna -ceres -clementia -cloacina -concordia -consus -cupid -cura -cybele -decima -devera -diana -disciplina -egeria -empanda -epona -falacer -fama -fascinus -fauna -faunus -faustitas -februus -febris -fecunditas -felicitas -ferentina -feronia -fides -flora -fornax -fontus -fortuna -fufluns -fulgora -furrina -genius -gratiae -hercules -hermaphroditus -honos -hora -indiges -intercidona -inuus -inidia -janus -juno -jupiter -justitia -juturna -juventas -lares -laverna -latona -levana -letum -liber -libera -liberalitas -libertas -libitina -lua -lucifer -lucina -luna -lupercus -lympha -manes -mania -mantus -mars -meditrina -mefitis -mellona -mercury -minerva -mithras -molae -moneta -mors -morta -murcia -naenia -nascio -necessitas -nemesis -neptune -nerio -neverita -nixi -nona -nox -ops -orcus -palatua -pales -parcae -pax -penates -picumnus -picus -pietas -pilumnus -pluto -poena -pomona -porrima -portunes -postverta -priapus -proserpina -providentia -pudicitia -querquetulanae -quirinus -quiritis -robigo -roma -rumina -salacia -salus -sancus -saturn -securitas -silvanus -somnus -soranus -sors -spes -sterquilinus -suadela -summanus -tellumo -tempestas -terminus -tiberinus -tibertus -tranquillitas -trivia -ubertas -unxia -vacuna -vediovus -venilia -venti -venus -veritas -verminus -vertumnus -vesta -victoria -virbius -virtus -volturnus -voluptas -vulcan diff --git a/kpov_judge/random_data/slavic_gods.txt b/kpov_judge/random_data/slavic_gods.txt deleted file mode 100644 index bc9543c..0000000 --- a/kpov_judge/random_data/slavic_gods.txt +++ /dev/null @@ -1,72 +0,0 @@ - dazbog - kresnik - jarilo - zemlja - perun - svarun - svetovid - triglav - veles - zarja - ziva - zora - belobog - rusalka - berstuk - crnobog - devana - dodola - flins - hors - karewit - koliada - kupala - marzanna - mokos - porenut - porewit - porvata - radegast - rod - rugiewit - stribog - zirnitra - alkonost - cikavac - zarptica - gamayun - ispolin - kolobok - raróg - raskovnik - simargl - sirin - ved - zmaj - ala - jagababa - bannik - bauk - bes - blud - bukavac - crt - jerina - dola - domovoj - drekavac - dukljan - kikimora - koscej - ovinnik - polevik - psoglav - rusalka - samodiva - skrzak - sudice - topilec - vampir - vesna - vila - povodnimoz diff --git a/kpov_judge/random_data/slovenian_names.txt b/kpov_judge/random_data/slovenian_names.txt deleted file mode 100644 index 6004e4c..0000000 --- a/kpov_judge/random_data/slovenian_names.txt +++ /dev/null @@ -1,20 +0,0 @@ -Franc -Marija -Janez -Ana -Anton -Maja -Ivan -Irena -Rok -Mojca -Andrej -Mateja -Marko -Natalija -Nik -Ivana -Marjan -Nina -Peter -Barbara diff --git a/kpov_judge/random_data/slovenian_surnames.txt b/kpov_judge/random_data/slovenian_surnames.txt deleted file mode 100644 index f50e952..0000000 --- a/kpov_judge/random_data/slovenian_surnames.txt +++ /dev/null @@ -1,10 +0,0 @@ -Novak -Horvat -Zmeda -Krajnc -Brglez -Kolar -Ribnikar -Mlakar -Vidmar -Kos diff --git a/kpov_judge/rm_task.py b/kpov_judge/rm_task.py deleted file mode 100755 index 1752727..0000000 --- a/kpov_judge/rm_task.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 - -import settings -import sys - -import pymongo - -if __name__ == '__main__': - if len(sys.argv) < 2: - print("Usage: {0} [task_name]".format(sys.argv[0])) - exit(1) - task_id = sys.argv[1] - db = pymongo.MongoClient(settings.DB_URI).get_default_database() - db.computers_meta.remove({'task_id': task_id}) - db.networks.remove({'task_id': task_id}) - db.task_checkers.remove({'task_id': task_id}) - db.tasks.remove({'task_id': task_id}) - db.prepare_disks.remove({'task_id': task_id}) - db.student_computers.remove({'task_id': task_id}) - db.results.remove({'task_id': task_id}) - db.gen_params.remove({'task_id': task_id}) - db.task_params_meta.remove({'task_id': task_id}) - db.task_params.remove({'task_id': task_id}) - db.task_instructions.remove({'task_id': task_id}) - db.howtos.remove({'task_id': task_id}) - db.howto_images.remove({'task_id': task_id}) diff --git a/kpov_judge/scripts/make-arbiter.sh b/kpov_judge/scripts/make-arbiter.sh deleted file mode 100755 index b08944c..0000000 --- a/kpov_judge/scripts/make-arbiter.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh - -# Create the disk image for arbiter: a gateway with NAT, dnsmasq and -# sshd. The user account test / test is set up to run the test_task -# script for evaluating the given task. The account is also given sudo -# rights to reboot, poweroff, ifconfig, ip and mount. - -set -e - -if [ $# -lt 1 ]; then - echo "usage: ${0} base" - exit 1 -fi - -base="${1}" -name="arbiter" -format="qcow2" - -# WAN on first interface, LAN on second -file_interfaces=\ -'# see interfaces(5) -source /etc/network/interfaces.d/* - -# loopback interface -auto lo -iface lo inet loopback - -# first interface -allow-hotplug ens3 -iface ens3 inet dhcp -allow-hotplug enp0s3 -iface enp0s3 inet dhcp - -# second interface -allow-hotplug ens4 -iface ens4 inet static - address 10.94.94.1/24 -allow-hotplug enp0s8 -iface enp0s8 inet static - address 10.94.94.1/24 -' - -# NAT rules -file_nftables=\ -'table ip nat { - chain prerouting { - type nat hook prerouting priority 0; policy accept; - } - - chain postrouting { - type nat hook postrouting priority 100; policy accept; - oifname "ens3" masquerade - oifname "enp0s3" masquerade - } -} -' - -file_dnsmasq=\ -'interface=ens4 -interface=enp0s8 - -dhcp-range=10.94.94.16,10.94.94.250,12h -' - -file_sudoers=\ -'test ALL = /sbin/reboot -test ALL = /sbin/poweroff -test ALL = NOPASSWD: /bin/ip -test ALL = NOPASSWD: /bin/mount -test ALL = NOPASSWD: /sbin/ifconfig -' - -qemu-img create -f qcow2 -b "${base}" "${name}.${format}" - -virt-customize -a "${name}.${format}" \ - --hostname "${name}" \ - --update \ - --install fortune-mod,fortunes,fortunes-bofh-excuses,python3-pexpect,python3-paramiko,python3-snimpy,python3-yaml \ - --install dnsmasq \ - --install openssh-server \ - --run-command "apt clean" \ - --write /etc/network/interfaces:"${file_interfaces}" \ - --write /etc/nftables.conf:"${file_nftables}" \ - --write /etc/sysctl.d/gateway.conf:"net.ipv4.ip_forward = 1" \ - --run-command "systemctl enable nftables.service" \ - --write /etc/dnsmasq.d/kpov-gw:"${file_dnsmasq}" \ - --run-command "useradd -m -s /bin/bash -p '\$6\$VdV5y2gl\$YxpYuwcVZHSXiv0N4yzmF8PspBeIK8QLdGJZzYFuKRjkfc82DhaS5fQeuOt0q9APDPLeSMTzt8BtxI2Bwo/hH.' test" \ - --write /etc/sudoers.d/kpov-test:"${file_sudoers}" - -## make a sparse diff -#virt-sparsify "${name}.${format}" "${name}x.${format}" -#qemu-img create -f "${format}" -b "${name}x.${format}" "${name}-diff.${format}" -#qemu-img rebase -b "${base}" "${name}-diff.${format}" - -#rm -f "./${name}-install.${format}" diff --git a/kpov_judge/scripts/make-base.sh b/kpov_judge/scripts/make-base.sh deleted file mode 100755 index 970acac..0000000 --- a/kpov_judge/scripts/make-base.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# Create the base disk image: a minimal Debian install with a user -# account student / vaje. Root password is kaboom. Serial console is -# enabled for grub and boot messages are displayed. Some useful -# additional packages are installed, and the image is sparsified -# (requires at least 30 GB free space). - -set -e - -if [ $# -lt 1 ]; then - echo "usage: ${0} image-name" - exit 1 -fi - -name="${1}" -format=qcow2 - -outfile="${name}.${format}" -fatfile="${name}-fat.${format}" - -tmpdir="$(mktemp -d kpov-tmp.XXXXXX)" -trap 'rm -rf "${tmpdir}"' EXIT - -for f in linux initrd.gz; do - wget "https://d-i.debian.org/daily-images/i386/daily/netboot/debian-installer/i386/${f}" -O "${tmpdir}/${f}" -done - -qemu-img create -f "${format}" -o size=30G "${fatfile}" - -qemu-system-i386 \ - -enable-kvm \ - -nographic \ - -m 1G -smp 2 \ - -kernel "${tmpdir}/linux" -initrd "${tmpdir}/initrd.gz" \ - -append "console=ttyS0,115200n8 serial auto=true url=http://10.0.2.10:8080/preseed.cfg hostname=${name} domain=" \ - -net user,guestfwd=:10.0.2.10:8080-cmd:"/bin/busybox httpd -i" -net nic \ - -hda "${fatfile}" - -virt-customize -a "${fatfile}" \ - --update \ - --install virtualbox-guest-utils,virtualbox-guest-modules \ - --install nftables \ - --install git,nano,net-tools,rsync,sudo,tmux,vim \ - --run-command 'apt clean' \ - --edit /etc/default/grub:'s/^GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0"/' \ - --edit /etc/default/grub:'s/^GRUB_TERMINAL=.*$/GRUB_TERMINAL=\"console serial\"/' \ - --run-command update-grub - -virt-sparsify "${fatfile}" "${outfile}" -rm -f "${fatfile}" diff --git a/kpov_judge/scripts/make-student.sh b/kpov_judge/scripts/make-student.sh deleted file mode 100755 index f072b47..0000000 --- a/kpov_judge/scripts/make-student.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# Create the disk image for a basic terminal computer with sshd. -# Typical virtual‐machine network interfaces are configured for DHCP. - -set -e - -if [ $# -lt 1 ]; then - echo "usage: ${0} base" - exit 1 -fi - -base="${1}" -name="student" -format="qcow2" - -file_interfaces=\ -'# see interfaces(5) -source /etc/network/interfaces.d/* - -# loopback interface -auto lo -iface lo inet loopback - -# first interface -allow-hotplug ens3 -iface ens3 inet dhcp -allow-hotplug enp0s3 -iface enp0s3 inet dhcp -' - -qemu-img create -f qcow2 -b "${base}" "${name}.${format}" - -virt-customize -a "${name}.${format}" \ - --hostname "${name}" \ - --update \ - --install openssh-server \ - --write /etc/network/interfaces:"${file_interfaces}" - -#virt-sparsify "${name}.${format}" "${name}x.${format}" -#qemu-img create -f "${format}" -b "${name}x.${format}" "${name}-diff.${format}" -#qemu-img rebase -b "${base}" "${name}-diff.${format}" diff --git a/kpov_judge/scripts/preseed.cfg b/kpov_judge/scripts/preseed.cfg deleted file mode 100644 index 7bf3c7a..0000000 --- a/kpov_judge/scripts/preseed.cfg +++ /dev/null @@ -1,91 +0,0 @@ -d-i debian-installer/language string en -d-i debian-installer/country string SI -d-i debian-installer/locale string en_US.UTF-8 -d-i localechooser/supported-locales multiselect de_DE.UTF-8, es_ES.UTF-8, fr_FR.UTF-8, sl_SI.UTF-8 - -d-i keyboard-configuration/xkb-keymap select slovene -# d-i keyboard-configuration/toggle select No toggling - -d-i netcfg/choose_interface select auto - -# Any hostname and domain names assigned from dhcp take precedence over -# values set here. However, setting the values still prevents the questions -# from being shown, even if values come from dhcp. -d-i netcfg/get_hostname string unassigned-hostname -d-i netcfg/get_domain string unassigned-domain - -d-i netcfg/wireless_wep string - -# mirror settings -d-i mirror/country string manual -d-i mirror/http/hostname string ftp.si.debian.org -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - -d-i mirror/suite string buster - -# root password, either in clear text -d-i passwd/root-password password kaboom -d-i passwd/root-password-again password kaboom -# or encrypted using a crypt(3) hash. -#d-i passwd/root-password-crypted password [crypt(3) hash] - -d-i passwd/user-fullname string Študent KPOV -d-i passwd/username string student -# normal user's password, either in clear text -d-i passwd/user-password password vaje -d-i passwd/user-password-again password vaje -# or encrypted using a crypt(3) hash. -#d-i passwd/user-password-crypted password [crypt(3) hash] - -d-i passwd/user-default-groups string users audio cdrom video wheel - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Ljubljana -d-i clock-setup/ntp boolean true - -# Partitioning -# - regular: use the usual partition types for your architecture -# - lvm: use LVM to partition the disk -# - crypto: use LVM within an encrypted partition -d-i partman-auto/method string regular - -# - atomic: all files in one partition -# - home: separate /home partition -# - multi: separate /home, /var, and /tmp partitions -d-i partman-auto/choose_recipe select atomic - -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -# this makes partman automatically partition without confirmation. -d-i partman-md/confirm boolean true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish -d-i partman/confirm boolean true -d-i partman/confirm_nooverwrite boolean true - -# Base system installation -d-i base-installer/install-recommends boolean false -d-i apt-setup/contrib boolean true -d-i apt-setup/source boolean false - -tasksel tasksel/first multiselect standard -popularity-contest popularity-contest/participate boolean false - -# Individual additional packages to install -#d-i pkgsel/include string openssh-server build-essential nano python3 git tmux rsync vim - -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean true - -# Due notably to potential USB sticks, the location of the MBR can not be -# determined safely in general, so this needs to be specified: -#d-i grub-installer/bootdev string /dev/sda -# To install to the first device (assuming it is not a USB stick): -d-i grub-installer/bootdev string default - -d-i finish-install/reboot_in_progress note -d-i debian-installer/exit/poweroff boolean true \ No newline at end of file diff --git a/kpov_judge/settings-example.py b/kpov_judge/settings-example.py deleted file mode 100644 index 34e70c3..0000000 --- a/kpov_judge/settings-example.py +++ /dev/null @@ -1,11 +0,0 @@ -DEBUG=True - -DB_URI='mongodb://kpov:SomeSuperSecretPassword@kpov.fri.uni-lj.si:27017/kpov' -# SNAPSHOTS_ROOT='/home/andrejtolic/kpov/snapshots/' -DISK_TEMPLATE_PATH = '/home/kpov/disks/templates' -STUDENT_DISK_PATH='/home/kpov/disks/students' -STUDENT_DISK_FORMAT=['vdi', 'vmdk'] -STUDENT_DISK_COW=False # dokler Andrej ne popravi... -STUDENT_DISK_URL='https://my_html_server.com/kpov-disks/' -STUDENT_LOCKFILE_PATH='/home/kpov/disks/lockfiles' -GUESTFS_DEV_PREFIX = '/dev/vd' diff --git a/kpov_judge/tasks/basic_network_gcc/task.py b/kpov_judge/tasks/basic_network_gcc/task.py deleted file mode 100644 index b23c060..0000000 --- a/kpov_judge/tasks/basic_network_gcc/task.py +++ /dev/null @@ -1,279 +0,0 @@ -# TODO: -# - check if everything is filled in (computers, params, preparation) -# - improve scoring -# - test -# - switch to a real SSH/SFTP client to properly handle filenames - -instructions = { - 'si': '''\ -

-Postavite dva navidezna računalnika: SimpleArbiter in Student. Oba naj bosta povezana na internet. Poleg tega mora biti Student na naslovu {{student_IP} dostopen s SimpleArbiter. - -

-Računajte, da se na Student ob zagonu zažene program {{net_prog_name}, -ki vam spreminja nastavitve mrežne kartice. - -

-V domačem imeniku uporabnika student obstaja program {{P_c} v programskem jeziku C. Prevedite ga v program z imenom {{P_executable}. Izvorna koda je namenoma pokvarjena tako, da so vanjo vrinjeni nepotrebni znaki. -Pred prevajanjem jo morate popraviti. - -

-Napišite skripto ali program {{P_script} v domačem imeniku uporabnika student, ki - -

    -
  • požene {{P_executable} z argumentom {{arg_c} in mu na standardni vhod pripelje vrednost spremenljivke {{env_c}; -
  • vse, kar {{P_executable} izpiše na stderr, spravi v datoteko {{out_stderr_c}; -
  • vse vrstice, ki jih {{P_executable} izpiše na stdout in vsebujejo zaporedje znakov ma, zapiše v {{out_stdout_c}. -
- -

-Lastnik vseh ustvarjenih datotek mora biti uporabnik student. Gesla uporabnika student (vaje) ne smete spreminjati. -''', - 'en': ''' -''', -} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiter', - }, - ], - 'network_interfaces': [ - {'network': 'net1'}, - {'network': 'net2'}, - ], - 'flavor': 'm1.tiny', - 'config_drive': True, - }, - 'Student': { - 'disks': [ - {'name': 'student-entrance'} - ], - 'flavor': 'm1.tiny', - 'network_interfaces': [{'network': 'net1'}], - 'config_drive': True, - } -} - -networks = { - 'net1': { - 'public': True, - }, - 'net2': { - 'public': False, - }, -} - -params_meta = { - 'student_IP': { - 'descriptions': { 'si': 'IP naslov SimpleStudent', 'en': 'IP address of SimpleStudent', - }, 'w': False, 'public': True, 'type': 'IP', 'generated': True, - }, - 'net_prog_name': { - 'descriptions': { 'si': 'Ime programa, ki ponastalvlja naslov', 'en': 'The name of the program resetting the network' - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'P_c': { - 'descriptions': { 'si': 'Datoteka s programom v C', 'en': 'Filename of the program in C', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'P_executable': { 'descriptions': { 'si': 'Ime prevedenega programa v C', 'en': 'Filename of the compiled C program' - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'arg_c': { - 'descriptions': { 'si': 'Vrednost argumenta', 'en': 'Argument value', - }, 'w': False, 'public': True, 'type': 'short_text', 'generated': True, - }, - 'env_c': { - 'descriptions': { 'si': 'Ime okoljske spremenljivke', 'en': 'The name of the environment environment', - }, 'w': False, 'public': True, 'type': 'short_text', 'generated': True, - }, - 'out_stderr_c': { - 'descriptions': { 'si': 'Datoteka z napakami', 'en': 'File to store errors', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'P_script': { - 'descriptions': { 'si': 'Ime skripte', 'en': 'Filename of the script', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'out_stdout_c': { - 'descriptions': { 'si': 'Datoteka z izhodom', 'en': 'File to store the output', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'param_gen_seed': { - 'descriptions': { 'si': 'Nakljucno seme', 'en': 'Random seed', - }, 'w': False, 'public': True, 'type': None, 'generated': True, - }, - 'c_destroy_gen_seed': { - 'descriptions': { 'si': 'Nakljucno seme za kvarjenje kode v C', 'en': 'Random seed for destroying the C code', - }, 'w': False, 'public': False, 'type': None, 'generated': True, - } - -} - -def task(student_IP, net_prog_name, - P_c, P_executable, arg_c, env_c, out_stderr_c, out_stdout_c, P_script, - param_gen_seed): - import random - - r = random.Random(int(param_gen_seed)) - env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(11)]) - arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(13)]) - stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(17)]) - - return kpov_util.ssh_test(student_IP, 'student', 'vaje', ( - ('script_ls', 'ls -l {}'.format(P_script)), - ('executable_ls', 'ls -l {}'.format(P_executable)), - ('script_run', 'export {}={}; {}'.format(env_c, env_val, P_script)), - ('script_stdout', 'cat {}'.format(out_stdout_c)), - ('script_stderr', 'cat {}'.format(out_stderr_c)), - ('prog_stdout', 'echo "{}" | {} "{}" 2> /dev/null'.format(stdin_val, P_executable, arg_val)), - ('prog_stderr', 'echo "{}" | {} "{}" > /dev/null'.format(stdin_val, P_executable, arg_val)), - )) - -def gen_params(user_id, params_meta): - import random - r = random.Random(user_id+'evil cornholio') - params = kpov_util.default_gen(user_id, params_meta) - homedir = '/home/student/' - params['env_c'] = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ') for i in range(5)]) - params['P_c'] = "".join([r.choice('abcdefghijklmnoprst') for i in range(5)]) + ".c" - params['param_gen_seed'] = str(r.randint(0, 2**24)) - params['c_destroy_gen_seed'] = str(r.randint(0, 2**24)) - dest_net = kpov_util.IPv4_subnet_gen(r, '10.0.2.128/26', 26) - params['student_IP'] = kpov_util.IPv4_addr_gen(r, dest_net)[0] - for k in ['P_c', 'P_executable', 'out_stderr_c', 'P_script', 'out_stdout_c']: - params[k] = homedir + params[k] - return params - -def task_check(results, params): - import os - def test_out_gen(arg, var): - s_out = "" - s_err = "" - r = 0 - arg_len = len(arg) - env_len = len(var) - for i in range(100): - s_out += chr(32 + ((ord(arg[i % arg_len]) ^ ord(var[i % env_len])) % 64)) - r += ord(arg[i % arg_len]) + ord(var[i % env_len]) + i; - if (i % 17 == 0): - s_out += "RAUS\r\n"; - if (i % 29 == 0): - s_out += 'ma' - s_err += chr((r % 31) + ord('A')); - if (i % 23 == 0): - s_err += "PATACIS\r\n" - retval = r % 16 - s_err += '\r\n' - s_out += '\r\n' - return(s_out, s_err, retval) - score = 0 - hints = [] - r = random.Random(int(params['param_gen_seed'])) - env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(11)]) - arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(13)]) - stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(17)]) - expected_script_stdout, expected_script_stderr, rval = test_out_gen( - params['arg_c'], env_val - ) - if expected_script_stderr != results['script_stderr']: - hints += ['wrong script stderr'] - else: - score += 2 - split_stdout = expected_script_stdout.split('\r\n') - expected_script_stdout = "\r\n".join([ i for i in split_stdout if i.find('ma') >= 0]) - if expected_script_stdout != results['script_stdout'].strip(): - hints += ['wrong script stdout'] - else: - score += 2 - expected_prog_stdout, expected_prog_stderr, rval = test_out_gen( - arg_val, stdin_val - ) - if expected_prog_stderr != results['prog_stderr'][-len(expected_prog_stderr):]: - hints += ['wrong program stderr'] - else: - score += 2 - if expected_prog_stdout != results['prog_stdout'][-len(expected_prog_stdout):]: - hints += ['wrong program stdout'] - else: - score += 2 - if results['script_ls'].find('-r') < 0: - hints += ['script not found'] - else: - score += 1 - if results['executable_ls'].find('xr') < 0: - hints += ['C executable not found'] - else: - score += 1 - return score, hints - -def prepare_disks(templates, task_params, global_params): - c_source = '''#include -#include -#include -/* Odstranite vse odvecne velike crke Q, W ali X in program se bo prevedel. */ - -int main(int argc, char **argv){ - unsigned char *arg; - unsigned char var[255]; - int i, arg_len, env_len, r; - scanf("%s", var); - arg = argv[1]; - arg_len = strlen(argv[1]); - env_len = strlen(var); - r = 0; - for (i = 0; i<100; i++){ - printf("%c", 32 + (arg[i % arg_len] ^ var[i % env_len]) % 64); - r += (int)arg[i % arg_len] + (int)var[i % env_len] + i; - if (i % 17 == 0){ - printf("RAUS\\n"); - } - if (i % 29 == 0){ - printf("ma"); - } - fprintf(stderr, "%c", (r % 31) + 'A'); - if (i % 23 == 0){ - fprintf(stderr, "PATACIS\\n"); - } - } - printf("\\n"); - fprintf(stderr, "\\n"); - return r % 16; -} -''' - evil_shell_source = """#!/bin/bash -e -{ while true; do - ifconfig eth1 10.0.4.19 2> /dev/null; - ifconfig eth0 10.0.4.20 2> /dev/null; - ifconfig eth2 10.0.4.21 2> /dev/null; - sleep 10; -done; }& -""" - import random - d = templates['student-entrance'] - r = random.Random(task_params['c_destroy_gen_seed']) - destroyed_c_source = c_source[:110] - for c in c_source[110:]: - i = r.randint(0, 5) - if i == 1: - destroyed_c_source += 'QW' - if i == 2: - destroyed_c_source += 'XW' - if i == 3: - destroyed_c_source += 'QX' - destroyed_c_source += c - d.write(task_params['P_c'], destroyed_c_source) - d.chown(1000, 1000, task_params['P_c']) - sh_path = r.choice(['/usr/share/doc', '/var/lib', '/usr/local/share', '/etc/alternatives']) - sh_file = sh_path + '/' + task_params['net_prog_name'] - d.write(sh_file, evil_shell_source) - d.chmod(0o775, sh_file) - d.write("/etc/rc.local", """#!/bin/sh -e -export PATH=$PATH:{} -{} & - -exit 0 -""".format(sh_path, task_params['net_prog_name'])) diff --git a/kpov_judge/tasks/copy_rename_100_files/task.py b/kpov_judge/tasks/copy_rename_100_files/task.py deleted file mode 100644 index 9dcf69a..0000000 --- a/kpov_judge/tasks/copy_rename_100_files/task.py +++ /dev/null @@ -1,120 +0,0 @@ -# TODO: -# - check if everything is filled in (computers, params, preparation) -# - improve scoring -# - test -# - switch to a real SSH/SFTP client to properly handle filenames - -instructions = { - 'si':""" -

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.
-""", - 'en': ''' -
Create two virtual machines. For the first, use the `simpleArbiterDhcp' image.
-On the second machine, create a user `test' with the password `test'.
-The `simpleArbiterDhcp' disk image contains a folder with 100 files. Copy all
-of these files to the other computer into the home folder of theuser `test'.
-Modify the content of these files by converting all lowercase letters into
-uppercase. Make sure that the first machine (`simpleArbiterDhcp') can use ssh
-to access the second machine and read the processed files.
-''', -} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiterDhcp', - }, - ], - 'network_interfaces': [ - { - 'network': 'net1', - }, - ], - 'flavor': 'm1.tiny', - 'config_drive': False, - } -} - -networks = { - 'net1': { - 'public': True, - }, -} - -params_meta = { - 'folder': { - 'descriptions': { - 'si': 'Mapa, ki vsebuje 100 datotek', - 'en': 'A folder with 100 files', - }, - 'w': False, - 'public': True, - 'type': 'dirname', - 'generated': False, - }, - 'host': { - 'descriptions': { - 'si': 'Naslov racunalnika, na katerega kopiramo datoteke', - 'en': 'The address of the computer to which the files are copied', - }, - 'w': True, - 'public': True, - 'type': 'IP', - 'generated': False, - }, -} - -def task(host, folder): - return kpov_util.ssh_test(host, 'test', 'test', ( - ('files', 'ls -1'), # XXX: file may have newlines - ('contents', 'cat *'), # XXX: may include other files in $HOME - )) - -def gen_params(user_id, params_meta): - pass - -def task_check(results, params): - import os - - score = 0 - hints = [] - if results['ssh'] is not True: - hints += ['ssh failed: ' + results['ssh']] - - matched = 0 - files = os.listdir(params['folder']) - for fn in files: - if fn in results['files'].splitlines(): - matched += 1 - if matched > 0: - score = 1 - else: - hints += ["no files"] - if matched > len(files)/2: - score += 2 - else: - hints += ["less than half the files"] - if (matched == len(files)): - score += 3 - else: - hints += ["wrong number of files"] - rl = results['contents'].splitlines() - rl.sort() - tl = [] - for fn in files: - with open(os.path.join(params['folder'], fn)) as f: - tl += f.read().upper().splitlines() - tl.sort() - if rl == tl: - score += 4 - else: - hints += ["wrong files"] - return score, hints - -def prepare_disks(templates, task_params, global_params): - pass diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/en/index.html b/kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/en/index.html deleted file mode 100644 index b1008cc..0000000 --- a/kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/en/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - -

Purpose of this exercise

-

To learn how to use a few BASH commands.

-

Quick summary

-

You will use bash commands like: mv, grep, env etc.

-

Instructions

- -

    -
  1. Log into your system and in your home folder you will find a directory called Mapa containing 20 files.
  2. -
  3. Rename all files, by replacing all minus signs with underscores using the command: "rename 's/-/_/' *".
  4. -
  5. Remove all files from /home/user/mapa/mojimenik into /home/user/novi using command: "mkdir-p /home/user/novi && mv /home/user/mapa/mojimenik/* /home/user/novi"
  6. -
  7. Write all regular files containing a string "mama" into file "mama.txt", and all errors in file "napake.txt" by using: "find . -type f | grep mama 1> mama.txt 2> napake.txt".
  8. -
  9. Inspect /var/log/syslog for 5 seconds and in case a string"zmeda" appears in syslog, write "imam ga". Also while inspecting syslog, reduce the counter by every second using a command: "for i in 5 4 3 2 1; do echo $i; echo $(sed -n "$i p" /var/log/syslog | grep zmeda > /dev/null && echo "imam ga"); sleep 1; done".
  10. -
  11. Set a variable TEST to the same value as the variable USER + the number of environmen variables not containing string "TEST" in their names, by adding ~/.bashrc to the end of the file: "export TEST=$USER" + "$(env | grep -v TEST | wc -l)"
  12. -

- - diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/si/index.html b/kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/si/index.html deleted file mode 100644 index 1ce8b44..0000000 --- a/kpov_judge/tasks/copy_rename_20_files_tail_env/howtos/si/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - -

Namen vaje

-

Naučite se uporabe nekaj BASH ukazov.

-

Naloga na hitro

-

Uporabljali boste BASH ukaze kot so: mv, grep, env in druge.

-

Navodila

- -

    -
  1. Prijavite se v sistem. V domačem imeniku najdete imenik Mapa z 20 datotekami.
  2. -
  3. Preimenujete vse datoteke tako, da zamenjate minuse s podčrtaji z ukazom: "rename 's/-/_/' *".
  4. -
  5. Premaknite vse datoteke /home/user/mapa/mojimenik v /home/user/novi z ukazom: "mkdir-p /home/user/novi && mv /home/user/mapa/mojimenik/* /home/user/novi"
  6. -
  7. V datoteko "mama.txt" zapišite vse navadne datoteke v trenutnem imeniku, ki vsebujejo niz "mama", v datoteko "napake.txt" pa zapišite vse morebitne napake z ukazom: "find . -type f | grep mama 1> mama.txt 2> napake.txt".
  8. -
  9. Sledite vsebini /var/log/syslog za 5 sekund in v primeru, da se v syslogu pojavi niz "zmeda", izpišite "imam ga". Poleg tega med sledenjem syslog-u odštevajte od 5 do 1 z ukazom: "for i in 5 4 3 2 1; do echo $i; echo $(sed -n "$i p" /var/log/syslog | grep zmeda > /dev/null && echo "imam ga"); sleep 1; done".
  10. -
  11. Nastavite okoljsko spremenljivko TEST, da bo imela isto vrednost kot okoljska spremenljivka USER + število okoljskih spremenljivk, ki v imenu ali vrednosti ne vsebujejo besede TEST tako, da na koncu datoteke ~/.bashrc dodate: "export TEST=$USER" + "$(env | grep -v TEST | wc -l)"
  12. -

- - diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.py deleted file mode 100644 index f661c4d..0000000 --- a/kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.py +++ /dev/null @@ -1,92 +0,0 @@ -# preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji -def rename(): - import os - for filename in os.listdir('.'): - os.rename(filename, filename.replace('-', '_')) - -# Napiši čim krajši ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi -def mv_novi(): - import os - for filename in os.listdir("/home/user/mapa/mojimenik/"): - os.rename('/home/user/mapa/mojimenik/' + filename, '/home/user/novi/' + filename) - -# 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) -def mama(): - import os - import re - import mmap - mama = '' - wrong = '' - for filename in os.listdir('.'): - try: - f = open(filename, 'r+') - data = mmap.mmap(f.fileno(), 0) - if re.search('mama', data): - mama = mama + filename + "\n" - except ValueError: - wrong = wrong + filename + "\n" - open('mama.txt', 'w').write(mama) - open('napake.txt', 'w').write(wrong) - -# 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. -def checker(): - import time - import re - import mmap - t = time.time() * 1000 - n = t - - f = open('/var/log/syslog', 'r+') - data = mmap.mmap(f.fileno(), 0) - me = re.findall('zmeda', data) - - c = len(me) - for i in range(5, 0, -1): - print(i) - n += 1000 - while n > t: - f = open('/var/log/syslog', 'r+') - data = mmap.mmap(f.fileno(), 0) - me = re.findall('zmeda', data) - if len(me) > c: - c = len(me) - print('imam ga') - t = time.time() * 1000 - -# 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 -def env(): - import os - import re - c = 0 - for i in os.environ: - if not (re.search('TEST', i) or re.search('TEST', os.environ[i])): - c = c + 1 - os.environ['TEST'] = os.environ['USER'] + repr(c) - -# S pomočjo programa cURL shrani vsebino spletne strani www.google.com v datoteko z imenom website.txt -def googl(): - import urllib.request - open('website.txt', 'w').write(urllib.request.urlopen('http://www.google.com').read()) - -# Napiši ukaz, ki bo število pojavitev značke
v datoteki website.txt dodal na konec te iste datoteke brez, da bi se ukaz zapisal v zgodovino ukazov "bash history" -def div(): - import re - import mmap - f = open('website.txt', 'r+') - data = mmap.mmap(f.fileno(), 0) - me = re.findall('<[^/<>]*div[^>]*>', data) - open('website.txt', 'a+').write(repr(len(me))) - -# Napiši ukaz brez uporabe programa cron, kateri 5 minut po izvedbi izpiše vsebino imenika v katerem se trenutno nahajaš -def sleep(): - import time - import os - time.sleep(300) - print(os.listdir('.')) - -# Napiši najkrajši ukaz, ki s pomočjo Pythona zažene preprost (integriran) HTTP strežnik kateri streže datoteke iz imenika iz katerega je bil pognan na vratih 8000 -def server(): - import http.server - import socketserver - httpd = socketserver.TCPServer(("", 8000), http.server.SimpleHTTPRequestHandler) - httpd.serve_forever() diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.sh b/kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.sh deleted file mode 100644 index b8e2d13..0000000 --- a/kpov_judge/tasks/copy_rename_20_files_tail_env/solution/solution.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# preimenuj vse datoteke tako, da zamenja minuse s podrtaji -rename 'y/-/_/' * - -# Napii im kraji ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi -mv /home/user/mapa/mojimenik/* /home/user/novi/ - -# Napii ukaz, ki s pomojo ukaza grep v datoteko "mama.txt" izpie vse navade (ne skrite) datoteke v trenutnem imeniku, ki vsebujejo niz "mama", v datoteko "napake.txt" pa izpie vse morebitne napake (npr. to, da so nekateri objekti v trenutnem imeniku dejansko imeniki ali napane simboline povezave) -grep -l 'mama' * 1>mama.txt 2>napake.txt - -# Napii ukaz, ki bo 5s sledil vsebini /var/log/syslog. V primeru, da se v syslogu pojavi niz "zmeda", naj program izpie "imam ga". Poleg tega naj program med sledenjem syslog-u odteva od 5 do 1 (vsako sekundo naj se izpie naslednja tevilka. -COUNT=$(grep 'zmeda' /var/log/syslog | wc -l ); -END=$(date +%s%N | cut -b1-13); -for i in {5..1}; do - END=$(($END + 1000)); - echo "$i"; - while [ $(date +%s%N | cut -b1-13) -lt $END ]; do - COUN1=$(grep 'zmeda' /var/log/syslog | wc -l ); - if [ $COUN1 -gt $COUNT ]; then - echo "imam ga"; - COUNT=$COUN1; - fi - done -done - -# 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 -TEST="$USER$(printenv | grep -v TEST | wc -l)"; export TEST - -# S pomojo programa cURL shrani vsebino spletne strani www.google.com v datoteko z imenom website.txt -curl http://www.google.com > website.txt - -# Napii ukaz, ki bo tevilo pojavitev znake
v datoteki website.txt dodal na konec te iste datoteke brez, da bi se ukaz zapisal v zgodovino ukazov "bash history" -grep -o "<[^/<>]*div[^>]*>" website.txt | wc -l >> website.txt; history -d $((HISTCMD-1)) - -# Napii ukaz brez uporabe programa cron, kateri 5 minut po izvedbi izpie vsebino imenika v katerem se trenutno nahaja -$(sleep 300; ls) & - -# Napii najkraji ukaz, ki s pomojo Pythona zaene preprost (integriran) HTTP strenik kateri stree datoteke iz imenika iz katerega je bil pognan na vratih 8000 -python -m SimpleHTTPServer \ No newline at end of file diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py deleted file mode 100644 index ce51c9c..0000000 --- a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py +++ /dev/null @@ -1,351 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si': '''\ -

-Prijavi se na sistem kot uporabnik student z geslom vaje. - -

-V domači mapi najdeš imenik {{file_rename_dirname}} z 20 datotekami. Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji. - -

-Napiši najkrajši ukaz v bash, ki vse datoteke iz imenika {{mv_src_dir}} premakne v imenik {{mv_dst_dir}}. Ukaz spravi v /home/student/mv_ukaz. Pazite, da bodo ob testiranju v izvornem imeniku iste datoteke, kot so bile, ko je bila virtualka nova, ciljni imenik pa bo prazen. To pomeni, da boste verjetno morali po vsakem testiranju datoteke premakniti nazaj. Za krajšanje ukaza lahko izkoristite imeni imenikov. - -

-Napiši ukaz, ki s pomočjo ukaza grep v datoteko ~/mama.txt izpiše imena vseh navadnih (ne skritih) datotek 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). Ukaz spravite v datoteko /home/student/mama_ukaz. - -

-Napiši program (lahko v bash), ki bo pet sekund 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). Program naj bo v /home/student/syslog_ukaz.sh. - -

-Namesti paket cowsay in ga preizkusi. 😊 - -

-S pomočjo programa curl preštej število pojavitev niza images v spletni strani, ki jo dobiš na naslovu http://localhost/{{curl_fname}} na malishell in število zapiši v spremenljivko $images na simpleArbiterDhcpGW v lupini, kjer poganjaš task_check.py. - -

-V imeniku {{wc_dirname}} najdeš datoteko count.txt. Preštej število prehodov v novo vrstico v count.txt in rezultat zapiši v novo datoteko lines.txt v istem imeniku. -''', - 'en': '''\ -

-Log into the system as student using vaje as your password. - -

-In your home folder you will find a directory called {{file_rename_dirname}} containing 20 files. Rename all files in that directory replacing all dashes with underscores - -

-Find the shortest command for copying all the files located in {{mv_src_dir}} into the folder {{mv_dst_dir}}. Create a shell script /home/student/mv_ukaz containing this command. Before running test_task.py, make sure {{mv_src_dir}} contains the same files as when you downloaded your virtual disk. This probably means that you will have to move the files back from {{mv_dst_dir}} to {{mv_src_dir}} after each test. - -

-Come up with a command or sequence of commands in bash which will, using grep, write the names all normal (not hidden) files which contain the string mama and are located in the working directory (pwd) into the file ~/mama.txt while writing errors such as files in current directory being folders or symbolic links in the file called napake.txt. Write this command to /home/student/mama_ukaz. - -

-Write a program (which may be a shell script) that will track the contents of /var/log/syslog for five seconds. Every time an entry containing the string zmeda appears in the syslog, the script should output imam ga. In addition, the script should count down from 5 to 1 with a one-second interval. Store the script in /home/student/syslog_ukaz.sh. - -

-Install the package cowsay and test it. 😊 - -

-Using the curl command count the number of occurences of the string images on the web page accessible from malishell at http://localhost/{{curl_fname}}. On simpleArbiterDhcpGW within the shell where you are running test_task.py, set the environment variable $images to this number. - -

-In the directory {{wc_dirname}} there is a file called count.txt. Write the number of newlines in this file into the file lines.txt in the same directory. -''', -} - -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 - - }, - 'SimpleArbiterDhcpGW': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGW', - # attempt automount - }, - #{ 'name': 'CDROM', - # 'options': {'readonly': True}, - # 'parts': [{'dev': 'b1', 'path': '/cdrom'}], - #}, - ], - 'network_interfaces': [{'network': 'test-net'}, {'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = {'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'IP_malishell': {'descriptions': {'si': 'Naslov malishell'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'file_creator_random_seed': {'descriptions': {'si': 'random file creator seed'}, 'w': False, 'public':False, 'type': None, 'generated': True}, - 'file_rename_dirname': {'descriptions': {'si': 'imenik z datotekami, ki naj se jih preimenuje'}, 'w': False, 'public':True, 'type': 'dirname', 'generated': True}, - 'mv_src_dir': {'descriptions': {'si': 'imenik, iz katerega premakni datoteke'}, 'w': False, 'public':True, 'type': 'dirname', 'generated': True}, - 'mv_dst_dir': {'descriptions': {'si': 'imenik, v katerega premakni datoteke'}, 'w': False, 'public':True, 'type': 'dirname', 'generated': True}, - 'cowsay_string': {'descriptions': {'si': 'Kaj rece krava?'}, 'w': False, 'public':True, 'type': 'short', 'generated': True}, - 'syslog_n_zmeda': {'descriptions': {'si': 'st. zapisov zmeda v 5s'}, 'w': False, 'public':True, 'type': 'uint', 'generated': True}, - 'curl_fname': {'descriptions': {'si': 'ime datoteke, dostopne prek http'}, 'w': False, 'public':True, 'type': 'filename', 'generated': True}, - 'curl_n_images': {'descriptions': {'si': 'n pojavitev niza images'}, 'w': False, 'public':False, 'type': 'integer', 'generated': True}, - 'wc_dirname': {'descriptions': {'si': 'imenik, v katerem je datoteka count.txt'}, 'w': False, 'public':True, 'type': 'dirname', 'generated': True}, - 'wc_n_lines': {'descriptions': {'si': 'n vrstic v count.txt'}, 'w': False, 'public':False, 'type': 'integer', 'generated': True}, -} - -def task(IP_malishell, file_rename_dirname, mv_src_dir, mv_dst_dir, cowsay_string, curl_fname, wc_dirname): - import collections - import os - - # TOD: (polz) this has to be changed! Get a move on! - # - # sv: Z primozem lavricem sva skusala nekaj narediti - # Ker gen params ni narejen, sklepam da je "Mapa" na namizju, - # imena datotek pa so: 1,1-,2,2-,3,3-,4,5,6,7,8,9,.mama1,mama2,mama3,mama4,mama5,mojimenik,novi,oce1 - # v mojimenik se nahaja mojimenikfile - # mama2 vsebuje "mama" - #Stirje subt-aski dodani.By Mihec. - results = kpov_util.ssh_test(IP_malishell, 'student', 'vaje', ( - ('preimenuj', '/bin/ls -a1 {}'.format(file_rename_dirname)), - ('pre_mv_src', '/bin/ls -a1 {}'.format(mv_src_dir)), - ('pre_mv_dst', '/bin/ls -a1 {}'.format(mv_dst_dir)), - ('mv_ls_size', '/bin/ls -l ~/mv_ukaz'), - (None, '. ~/mv_ukaz'), - ('post_mv_src', '/bin/ls -a1 {}'.format(mv_src_dir)), - ('post_mv_dst', '/bin/ls -a1 {}'.format(mv_dst_dir)), - - # mama_ukaz - (None, 'cd /home/student/grep_test_dir'), - (None, '. ~/mama_ukaz'), - ('grep_napake', 'cat ~/napake.txt'), - ('grep_mama', 'cat ~/mama.txt'), - - # sledenje syslog - (None, 'date'), - ('syslog_start_time', '/usr/local/bin/syslog_spammer &'), - ('syslog_result', '/home/student/syslog_ukaz.sh'), - ('syslog_end_time', 'date'), - - ('cowsay', 'cowsay "{}"'.format(cowsay_string)), - ('wc_origfile', 'cat {}/count.txt'.format(wc_dirname)), - ('wc_lines', 'cat {}/lines.txt'.format(wc_dirname)), - )) - - try: - results['curl_env'] = os.environ['images'] - except: - results['curl_env'] = '' - - #results['curl'] = subprocess.check_output(["cat","/home/student/Desktop/website.txt"]) - #results['chkimages'] = subprocess.check_output(["curl www.24ur.com >> dlg.txt && cat dlg.txt | grep -c ","images"]) - #results['count'] = subprocess.check_output(["wc","/home/student/Desktop/count.txt"]) - #results['lines'] = subprocess.check_output(["cat","/home/student/Desktop/lines.txt"]) - #results['cowsay'] = subprocess.check_output(["dpkg --get-selections | grep","cowsay"]) - - return results - -def gen_params(user_id, params_meta): - import random - import subprocess - params = dict() - homedir = '/home/student/' - r = random.Random(user_id) - params['file_creator_random_seed'] = str(r.random()) - params['file_rename_dirname'] = homedir + kpov_util.default_generators['dirname'](r) - params['mv_src_dir'] = homedir + "".join([r.choice("abcdefgh") for i in range(6)]) - params['mv_dst_dir'] = homedir + "".join([r.choice("ijklmnop") for i in range(6)]) - params['syslog_n_zmeda'] = str(r.randint(5, 15)) - params['cowsay_string'] = kpov_util.default_generators['short_text'](r) - params['curl_fname'] = kpov_util.default_generators['filename'](r) - params['curl_n_images'] = str(r.randint(30,100)) - params['wc_dirname'] = homedir + "".join([r.choice("rstuvxz") for i in range(8)]) - params['wc_n_lines'] = str(r.randint(200, 600)) - #params['images'] = subprocess.check_output(["echo","$images"]) - return params - -def task_check(results, params): - import re - import random - score = 0 - hints = [] - r = random.Random(params['file_creator_random_seed']) - fnames = [] - for i in range(20): - fnames.append("".join([ r.choice("_abcdefghijk") for j in range(8)])) - #TO FINISH SCORING WE REQUIRE DICT KEYS AND FUNCTIONS gen_params AND task TO BE FINISHED - - # preimenuj 1 - task1_ok = True - for fname in fnames: - task1_ok = task1_ok and results['preimenuj'].find(fname) > 0 - if task1_ok: - score += 2 - else: - hints += ["wrong dash rename"] - - # premakni datoteke s cim krajsim ukazom - fnames = [] - try: - for i in range(40): - fnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) - task2_re = re.search( - r"-rw[x-][r-][w-][x-][r-][w-][x-] \d* student student (\d*) .*mv_ukaz", - results['mv_ls_size']) - mv_ls_size = int(task2_re.group(1)) - task2_ok = mv_ls_size <= 17 and mv_ls_size > 2 - except: - task2_ok = False - if task2_ok: - score += 1 - else: - hints += ["wrong mv_command size or owner"] - - # rename files - pre_src = set([i.strip() for i in results['pre_mv_src'].splitlines()[2:]]) - pre_dst = set([i.strip() for i in results['pre_mv_dst'].splitlines()[2:]]) - print(set(fnames)) - print(pre_src) - task2_ok = task2_ok and pre_src == set(fnames) - task2_ok = task2_ok and len(pre_dst) < 3 - post_src = set([i.strip() for i in results['post_mv_src'].splitlines()[2:]]) - post_dst = set([i.strip() for i in results['post_mv_dst'].splitlines()[2:]]) - task2_ok = task2_ok and post_dst == set(fnames) - task2_ok = task2_ok and len(post_src) < 3 - if task2_ok: - score += 1 - else: - hints += ["wrong rename files"] - - # mama_ukaz - task3_ok = True - mama_fnames = [] - for i in range(20): - mama_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) - papa_fnames = [] - for i in range(20): - papa_fnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) - dirnames = [] - for i in range(20): - dirnames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) - linknames = [] - for i in range(20): - linknames.append("".join([ r.choice("123456789abcdefghijk") for j in range(8)])) - for i in dirnames + linknames + papa_fnames: - if (i not in papa_fnames) and results['grep_napake'].find(i) < 0: - task3_ok = False - if results['grep_mama'].find(i) >= 0: - task3_ok = False - for i in papa_fnames: - if results['grep_napake'].find(i) >= 0: - task3_ok = False - if results['grep_mama'].find(i) >= 0: - task3_ok = False - for i in mama_fnames: - if results['grep_mama'].find(i) < 0: - task3_ok = False - if task3_ok: - score += 2 - else: - hints += ["mama cries"] - - # sledenje syslog - #print( results['syslog_start_time']) - #print( results['syslog_result']) - #print( results['syslog_end_time']) - # syslog count - # TODO: check syslog - task4_ok = True - if task4_ok: - score += 1 - else: - hints += ["wrong syslog count"] - - task5_ok = True - try: - assert int(results['curl_env'].strip()) == int(params['curl_n_images']) - except: - task5_ok = False - if task5_ok: - score += 2 - else: - hints += ["wrong image count"] - task6_ok = True - try: - assert int(results['wc_lines'].strip()) == int(params['wc_n_lines']) - except: - task6_ok = False - if task6_ok: - score += 1 - else: - hints += ["wrong line count"] - return score, hints - -def prepare_disks(templates, task_params, global_params): - import random - d = templates['malishell'] - r = random.Random(task_params['file_creator_random_seed']) - # rename - d.mkdir(task_params['file_rename_dirname']) - d.chown(1000, 1000, task_params['file_rename_dirname']) - for i in range(20): - fname = task_params['file_rename_dirname'] + '/' + "".join( - [r.choice("-abcdefghijk") for j in range(8)]) - d.touch(fname) - d.chown(1000, 1000, fname) - # mv ukaz - d.mkdir(task_params['mv_src_dir']) - d.chown(1000, 1000, task_params['mv_src_dir']) - for i in range(40): - fname = task_params['mv_src_dir'] + '/' +"".join( - [r.choice("123456789abcdefghijk") for j in range(8)]) - d.touch(fname) - d.chown(1000, 1000, fname) - d.mkdir(task_params['mv_dst_dir']) - d.chown(1000, 1000, task_params['mv_dst_dir']) - # grep mama - # mama fnames - d.mkdir('/home/student/grep_test_dir') - for i in range(20): - d.write("/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in range(8)]), - "mama") - # papa fnames - for i in range(20): - d.write("/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in range(8)]), - "papa") - # dirnames - for i in range(20): - d.mkdir("/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in range(8)])) - # linknames - for i in range(20): - d.ln_sf("mali zeleni", "/home/student/grep_test_dir/" + "".join( - [ r.choice("123456789abcdefghijk") for j in range(8)])) - # sledenje syslog - spammer_source = "#!/bin/sh\n" + int(task_params['syslog_n_zmeda']) * "logger zmeda\n" - d.write("/usr/local/bin/syslog_spammer", spammer_source) - d.chmod(0o775, "/usr/local/bin/syslog_spammer") - # curl - l1 = ['images'] * int(task_params['curl_n_images']) - l2 = ['imeges'] * r.randint(30, 100) - lx = l1 + l2 - r.shuffle(lx) - d.write("/var/www/html/{}".format(task_params['curl_fname']), ''.join(lx)) - # wc - lx = ['\n']*int(task_params['wc_n_lines']) - lx += ['a', 'b', 'c', 'repa', 'in', 'krompir', - 'raus', 'e', 'patacis'] * r.randint(50, 150) - r.shuffle(lx) - d.mkdir(task_params['wc_dirname']) - d.chown(1000, 1000, task_params['wc_dirname']) - d.write("{}".format(os.path.join(task_params['wc_dirname'], 'count.txt')), "".join(lx)) - - write_default_config(templates['simpleArbiterDhcpGW'], global_params) diff --git a/kpov_judge/tasks/custom_rdate/CustomRDate.java b/kpov_judge/tasks/custom_rdate/CustomRDate.java deleted file mode 100644 index 426dece..0000000 --- a/kpov_judge/tasks/custom_rdate/CustomRDate.java +++ /dev/null @@ -1,21 +0,0 @@ -import java.io.InputStream; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.util.Date; - -public class CustomRDate { - public static void main(String main[]) throws Exception{ - try { - Socket s = new Socket("ntp1.arnes.si", 37); - InputStream vhod = s.getInputStream(); - byte podatek[] = new byte[8]; - int dejanskoPrebranih = vhod.read(podatek, 4, 4); - ByteBuffer buf = ByteBuffer.wrap(podatek); - long stevilka = buf.getLong() - 2208988800L; - Date d = new Date(stevilka*1000); - System.out.println(d); - } catch(Exception e) { - System.out.println("Nedosegljiv streznik."); - } - } -} \ No newline at end of file diff --git a/kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip b/kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip deleted file mode 100644 index 9061692..0000000 Binary files a/kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/en/index.html b/kpov_judge/tasks/custom_rdate/howtos/en/index.html deleted file mode 100644 index 18ebfc1..0000000 --- a/kpov_judge/tasks/custom_rdate/howtos/en/index.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - -

Custom rdate

-

Short preview:

- Set time on server using rdate. Write a program that converts 32-bit numbers into a readable time format.

-

Instructions:

- 1. Downlaod Student.vdi (client) and SimpleArbiter.vdi (server) from the virtual machine images folder
- 2. Use VirtualBox (or similar) to create two virtual machines, select the virtual disk images from the previous step as hard drives
- 3. Run both virtual machines.
- 4. Login on client user: root pass: kaboom and server user: tester pass: tester

- - -

First part: update time using rdate.

-

- 1. Find and remember your server IP address. (ifconfig)


- 2. Install rdate with sudo apt-get install rdate
- 3. On Student client use rdate to update the machine time rdate SERVER_IP

- Note: It's NOT an error if the updated time does not match the correct time.
-

-

Second part: write a program that converts 32bit numbers into a readable time format.

-

- You can write a program in Java or Python using your favourite text editor. -

-

Java

-

- 1. We use nano guliver.java to create a new blank file
- 2. Write a program that converts 32bit numbers into a readable time format.
-

- 3. Press Ctrl+X, then Y and Enter to save the program
- 4. In case you don't have java installed use sudo apt-get install openjdk-6-jdk
-
- 5. To compile use javac bintodec3.java
- 6. Run the created program with java guliver and input the server IP or name...
-
-

-

Python

- 1. Use nano guliver.py to create a new empty python file.
- 2. Write a program that converts 32bit numbers into a readable time format.
-
- 3. Press Ctrl+X, then Y and Enter to save our program
- 4. Run the created program with python guliver.py

-

-

Testing

-

- 1. Use command ./run_test.py to run the tester
-
- 2. Your username and password are the same as on ucilnica (npr.: "pz1234@student.uni-lj.si" in "geslo123").
-
- 3. Name of the task should look like 09.predvaja.
- 4. When prompted for file path insert your program path (example: if bintodec3.py is in the same folder as program run_test.py run with ./bintodec3.py).
- 5. Then input your server IP address (SimpleArbiterRDate).
- 6. If all goes well the program should give you an OK that means you've completed your task successfully. -

- - diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu1.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu1.png deleted file mode 100644 index c6eeac8..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu1.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu15.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu15.png deleted file mode 100644 index c2ac808..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu15.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu2.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu2.png deleted file mode 100644 index 85fcfa8..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu2.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu3.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu3.png deleted file mode 100644 index 831e764..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu3.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu4.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu4.png deleted file mode 100644 index 495351a..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu4.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu5.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu5.png deleted file mode 100644 index 103e0e6..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu5.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu6.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu6.png deleted file mode 100644 index b032223..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu6.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu7.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu7.png deleted file mode 100644 index bd50500..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu7.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu8.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu8.png deleted file mode 100644 index 98f7812..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu8.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu9.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu9.png deleted file mode 100644 index 9ed78ce..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/bu9.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/predvaja_clip_image003.gif b/kpov_judge/tasks/custom_rdate/howtos/images/predvaja_clip_image003.gif deleted file mode 100644 index 02be389..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/predvaja_clip_image003.gif and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/s1.png b/kpov_judge/tasks/custom_rdate/howtos/images/s1.png deleted file mode 100644 index 52b6ee5..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/s1.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/s2.png b/kpov_judge/tasks/custom_rdate/howtos/images/s2.png deleted file mode 100644 index 78a65ce..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/s2.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/s3.png b/kpov_judge/tasks/custom_rdate/howtos/images/s3.png deleted file mode 100644 index c32eae1..0000000 Binary files a/kpov_judge/tasks/custom_rdate/howtos/images/s3.png and /dev/null differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/si/index.html b/kpov_judge/tasks/custom_rdate/howtos/si/index.html deleted file mode 100644 index e68221c..0000000 --- a/kpov_judge/tasks/custom_rdate/howtos/si/index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - -

Custom rdate

-

Naloga na hitro:

-

- Nastavi uro na strežniku s pomočjo rdate. Napiši program, ki pretvori 32-bitna števila v čas. -

-

Navodila:

-

- 1. Z imenika s slikami virtualnih računalnikov povlecite sliki Student.vdi(klient) in SimpleArbiterRDate.vdi(strežnik).
- 2. Z VirtualBoxom (ali podobnim) ustvarite dva virtualna računalnika in jim kot disk za shranjevanje podajte Student.vdi ter SimpleArbiterRDate.vdi.
- 3. Zaženite oba navidezna računalnika.
- 4. Na Student se prijavite z uporabnikom root in geslom kaboom - na SimpleArbiterRDate pa z uporabnikom tester in geslom tester. -

- -

Prvi del naloge: posodobi uro računalnika s pomočjo rdate.

-

- 1. Preverite in si zapišite IP naslov na SimpleArbiterRDate. (ifconfig)


- 2. Z ukazom sudo apt-get install rdate namestimo program rdate.
- 3. Na Student z pomočjo rdate posodobi uro računalnika. rdate IP_SIMPLE_ARBITER

- Opozorilo: NI napaka, če se posodobljen čas ne ujema s pravilnim časom.
-

-

Drugi del naloge: napiši program, ki pretvori binarni zapis 32-bitnega števila v časovni format.

-

- Nalogo lahko rešite v Javi ali v Pythonu. Prav tako pa lahko kodo pišete v poljubnem tekstovnem urejevalniku.

-

-

Java

-

- 1. Z ukazom nano guliver.java ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
- 2. Napišemo program za pretvarjanje 32-bitnega števila v čas
- 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
- 4. Če je še nimamo, naložimo Javo sudo apt-get install openjdk-6-jdk

- 5. Prevedemo program javac bintodec3.java
- 6. Lahko ga še zaženemo ter preizkusimo java guliver.Na standardni vhod vnasemo IP naslov ali ime strežnika NTP strežnikom, ki nam pošlje 32 bitno število in pretvori v čas

-

-

Python

-

- 1. Z ukazom nano guliver.py ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
- 2. Napišemo program za pretvarjanje 32-bitnega števila v čas
- 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
- 4. Program zaženemo z ukazom python guliver.py

-

- -

Testiranje

-

- 1. Lahko poženemo tester; z ukazom ./run_test.py
-
- 2. Kot "Upor. Ime" in "Geslo" napišite vaše podatke učilnice. (npr.: "pz1234@student.uni-lj.si" in "geslo123")
-
- 3. Kot ime naloge vpišite 09.predvaja.
- 4. Ko vas program vpraša po poti programa vnesite vašo pot do programa za pretvarjanje. (npr.: če imate program bintodec3.py v isti mapi kot program run_test.py, vnesete: ./bintodec3.py)
- 5. Povpraša tudi po IP naslovu SimpleArbiterjaRDate, vnesite.
- 6. Če je šlo vse po sreči, program vrne OK vi pa ste opravili nalogo. -

- - diff --git a/kpov_judge/tasks/custom_rdate/rDate.java b/kpov_judge/tasks/custom_rdate/rDate.java deleted file mode 100644 index 8c8bae7..0000000 --- a/kpov_judge/tasks/custom_rdate/rDate.java +++ /dev/null @@ -1,34 +0,0 @@ -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.net.Socket; -import java.net.SocketException; -import java.nio.ByteBuffer; -import java.uti.Date; -import java.util.Scanner; - -public class rDate{ - - public static void main(String[] args) throw IOException{ - Scanner sc=new Scanner(System.in); - String niz=sc.next(); - - try{ - Socket s=new Socket(niz,37); - OutputStreamWriter izhod=new OutputStreamWriter(s.getOutputStream()); - InputStream vhod=s.getInputStream(); - byte[] podatek=new byte[4]; - ByteBuffer buf=ByteBuffer.wrap(podatek); - int stevilka=buf.getInt(); - long dolga=stevilka - long maska=-1; - maska =~(maska <<32); - dolga = dolga & maska; - Date d=new Date(dolga *1000 - 2208988800000L); - System.out.print(d); - izhod.write(d.toString()); - }catch(SocketException e){ - System.out.println("Strežnik ne obstaja"); - } - } -} diff --git a/kpov_judge/tasks/custom_rdate/rDate.py b/kpov_judge/tasks/custom_rdate/rDate.py deleted file mode 100644 index 97885b0..0000000 --- a/kpov_judge/tasks/custom_rdate/rDate.py +++ /dev/null @@ -1,18 +0,0 @@ - -#!/usr/bin/env python -#-*- coding utf-8 -*- - -import socket -import struct -import time - -niz=input("Vnesi IP ali ime strežnika:") -s = socket.socket( - socket.AF_Inet, socket.SOCK_STREAm) -s.connect((niz,37)) -podatek = s.recv(4) -stevilka = struct.unpack("!I", podatek) -st= stevilka[0]-220898800 -date = time.localtime(st) -print((time.strftime('%Y-%m-%d %H:%M:%S'), date)) -s.send(date) diff --git a/kpov_judge/tasks/custom_rdate/task.py b/kpov_judge/tasks/custom_rdate/task.py deleted file mode 100644 index 4c5ff9f..0000000 --- a/kpov_judge/tasks/custom_rdate/task.py +++ /dev/null @@ -1,146 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -# TODO: finish this! -instructions = { - 'si': '''\ -

-Postavite dva navidezna računalnika: SimpleArbiterDhcpRdate in rdateClient. - -

-Nastavite čas na rdateClient tako, da kot rdate strežnik uporabite SimpleArbiterDhcpRdate. - -

-Na rdateClient ustvarite uporabnika test z geslom test. V domačem imeniku uporabnika test ustvarite program z imenom {{PROGRAM_FILENAME}}. Program naj prebere štiri bajte podatkov s standardnega vhoda in jih pretvori v predznačeno celo število, pri čemer naj uporablja zapis z debelim koncem (angl. big endian). Število naj program izpiše na standardni izhod v obliki niza. -''', - 'en': '''\ -

-Set up two virtual machines: SimpleArbiterDhcpRdate and rdateClient. - -

-Set the time on rdateClient using rdate with SimpleArbiterDhcpRdate as -the server. - -

-On rdateClient create a user with the username test and password test. Then, write a program called {{PROGRAM_FILENAME}} and put it in user test’s home directory. The program should read four bytes of data from standard input, convert them into a signed integer using big endian byte ordering and output the resulting integer (as a string) to standard output. -''', -} - -computers = { - 'rdateClient': { - 'disks': [ - { 'name': 'student-rdate', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGWRdate', - }, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -# Tu sem dolocil parametre -params_meta = { - 'RDATE_OFFSET':{'descriptions': {'si': 'Napaka v času pri rdate', 'en': 'Timekeeping error for rdate'}, 'w': False, 'public': False, 'type': 'integer', 'generated': True}, - 'PROGRAM_FILENAME':{'descriptions': {'si': 'Ime programa', 'en': 'program filename'}, 'w': False, 'public': True, 'type': 'integer', 'generated': True}, - 'IP_RDATECLIENT':{'descriptions': {'si': 'IP rdateClient', "en": "rdateClient's IP"}, 'w': True, 'public': True, 'type': 'IP', 'generated': False}, -} - -def task(IP_RDATECLIENT, PROGRAM_FILENAME): - import collections - import base64 - import random - import struct - import pexpect - - r = random.Random(PROGRAM_FILENAME) - results = collections.defaultdict(str) - tests = [] - for i in range(10): - data = struct.pack("!I", r.randint(0, 2**32)) - results['in_'+str(i)] = data_ascii = base64.encodestring(data) - tests += [('out_'+str(i), 'echo "{}" | base64 -d | ~/{}'.format(data_ascii.decode().strip(), PROGRAM_FILENAME))] - tests += [('date', 'date -u +"%s"')] - - results.update( - kpov_util.ssh_test(IP_RDATECLIENT, 'test', 'test', tests)) - results['ldate'] = pexpect.run('date -u +"%s"') - - return results - -#Dolocil sem tri parametre in sicer jih lahko vidite v prams_meta, -#zato prosim da jih upostevate v naslednih nalogah. - -def gen_params(user_id, params_meta): - import socket - import struct - import datetime - params = dict() - r = random.Random(user_id) - params['PROGRAM_FILENAME'] = kpov_util.fname_gen(r, False) - params['RDATE_OFFSET'] = str(r.randint(-2**24, 2**24)) - return params - -def task_check(results, params): - import random - import struct - import base64 - - r = random.Random(params['PROGRAM_FILENAME']) - score = 0.0 - hints = [] - for i in range(10): - data = base64.decodestring(results['in_' + str(i)]) - x = struct.pack("!I", r.randint(0, 2**32)) - if data != x: - hints += ["data: " + str((data,)) + " != " + str((x,))] - break - res = results['out_' + str(i)] - if str(struct.unpack("!i", data)[0]) == res.strip(): - score += 0.5 - else: - hints += ["wrong convert"] - - if abs(int(results['ldate']) + \ - int(params['RDATE_OFFSET']) - int(results['date'])) < 3: - score += 5 - else: - hints += ["wrong offset"] - return score, hints - -def prepare_disks(templates, task_params, global_params): - d = templates['simpleArbiterDhcpGWRdate'] - s1 = """service "time_tcp" {{ - enabled yes; - protocol tcp; - port "time"; - user "nobody"; - exec "/usr/local/bin/kpovrdate {RDATE_OFFSET}"; - server "/usr/sbin/tcpd"; - wait no; -}} -""".format(**task_params) - d.write('/etc/rlinetd.d/time', s1) - s2 = """#!/usr/bin/python - -import struct -import time -import sys - -offset = int(sys.argv[1]) -t = time.time() + offset # used to have + 2208988800 -sys.stdout.write(struct.pack("!I", int(t))) -""" - d.write('/usr/local/bin/kpovrdate', s2) - d.chmod(0o775, '/usr/local/bin/kpovrdate') - write_default_config(templates['simpleArbiterDhcpGWRdate'], global_params) diff --git a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py deleted file mode 100644 index 4822c2a..0000000 --- a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py +++ /dev/null @@ -1,116 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

Ustvari tri navidezne računalnike. Za enega (SimpleArbiter) uporabi sliko diska simpleArbiter. Na drugega (DHCP_server) postavi strežnika DHCP in DNS in poskrbi, da ta računalnik dobi IP naslov {IP_server}. Poskrbi, da bo preostali računalnik (DHCP_client) dobil naslov {IP_client}, ki mu ga določi DHCP strežnik. Poskrbi še,da DNS strežnik vrne za hostname {HOSTNAME_X} IP 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_server': {'descriptions': {'si': 'IP naslov DHCP streznika'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_client': {'descriptions': {'si': 'IP naslov DHCP klienta'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'MAC_client': {'descriptions': {'si': 'MAC naslov DHCP klienta'}, 'w': True, 'public': True, 'type': 'MAC', 'generated': False}, - 'HOSTNAME_X': {'descriptions': {'si': 'Hostname za DNS'}, 'w': False, 'public': True, 'type': 'short_text', 'generated': True}, - 'IP_X': {'descriptions': {'si': 'Naslov, ki ga vrne DNS'}, 'w': False, 'public': False, 'type': 'IP', 'generated': True}, -} - -def task(IP_server, IP_client, MAC_client, HOSTNAME_X): - tests = { - IP_server: ( - ('dhcp_proces', 'sudo ps -A')), - IP_client: ( - ('dhcp', 'sudo dhcping -s {} -h {} -c {}'.format(IP_server, MAC_client, IP_client)), - ('dns_hostname', 'nslookup {}'.format(HOSTNAME_X)), - ('client_IP', '/sbin/ifconfig')), - } - - results = collections.defaultdict(str) - for host, host_tests in tests.items(): - results.update(kpov_util.ssh_test(host, 'student', 'vaje', host_tests)) - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id+"bla") - net = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['IP_server'], params['IP_client'], params['IP_X'] = kpov_util.IPv4_addr_gen(r, net, 3) - params['HOSTNAME_X'] = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ') for i in range(5)]) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - if results['dhcp'].find("Got answer from: {}".format(params['IP_server'])) > -1: - score += 2 - else: - hints += ["dhcp server IP wrong"] - if results['dhcp_proces'].find("dhcpd") > -1: - score += 2 - else: - hints += ["dhcp wrong"] - if results['dns_hostname'].find("Address: {}".format(params['IP_X'])) >= 0: - score += 2 - else: - hints += ['dns hostname IP wrong'] - if results['dns_hostname'].find("Server:\t\t{}".format(params['IP_server'])) > -1: - score += 2 - else: - hints += ['dns server IP wrong'] - if results['client_IP'].find('inet {}'.format(params['IP_client'])) > -1: - score += 2 - else: - hints += ['client IP wrong'] - return score, hints - - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) - diff --git a/kpov_judge/tasks/edit_find_grep_compile_convert/task.py b/kpov_judge/tasks/edit_find_grep_compile_convert/task.py deleted file mode 100644 index deaac4f..0000000 --- a/kpov_judge/tasks/edit_find_grep_compile_convert/task.py +++ /dev/null @@ -1,313 +0,0 @@ -# TODO: -# - check if everything is filled in (computers, params, preparation) -# - improve scoring -# - test -# - switch to a real SSH/SFTP client to properly handle filenames - -instructions = { - 'si': '''\ -

-Ustvari dva navidezna računalnika: SimpleArbiter SmallStudent. - -

-Poskrbi, da bo SmallStudent s SimpleArbiter dostopen na naslovu {{testip}}. - -

-Na SmallStudent ustvari uporabnika {{testuser}} z geslom {{passwd}}. - -

-Na SmallStudent je nekje v domačem imeniku uporabnika bilbo skrita datoteka, ki vsebuje niz {{magicstr}}. Skopiraj jo v domači imenik uporabnika {{testuser}} in jo poimenuj {{dstfile}}. Poskrbi, da bo lastnik {{testuser}}, skupina pa naj bo enaka kot pri izvorni datoteki. Brati naj jo ima pravico samo lastnik, pisati lastnik in skupina, poganjati nihče. - -

-V {{dstfile}} zamenjaj vse vrstice oblike poXYZlz, kjer je XYZ poljubno zaporedje znakov, tako, da bo namesto XYZ niz kaka. - -

-Napiši program v poljubnem programskem jeziku, ki kot argument sprejme število B med 0 in 7. Program naj prebere znak s standardnega vhoda Če je B-ti bit v znaku nastavljen na 1, naj izpiše ta. Če je B-ti bit nastavljen na 0, naj program izpiše ti. Program poimenuj {{progname}} in ga spravi v domači imenik uporabnika {{testuser}}. -''', - 'en': '''\ -

-Create two virtual machines: SimpleArbiter and SmallStudent. - -

-Make sure that SmallStudent is accessible from SimpleArbiter on IP {{testip}}. - -

-Create a user {{testuser}} with the password {{passwd}} on SmallStudent. - -

-There is a file containing {{magicstr}} hidden somewhere in the home directory of user bilbo. Copy it into {{testuser}}’s home directory and name it {{dstfile}}. Change the owner to {{testuser}} and ensure the group is the same as for the original file. Make sure only the owner has the right to read it, only the owner and group members have the right to write to it and nobody has the right to execute it. - -

-In {{dstfile}}, replace all lines of the form poXYZlz where XYZ are arbitrary characters so that XYZ is replaced by kaka. - -

-Write a program in any programming language. The program should accept a single argument B, which is a number between 0 and 7. It should read a character from standard input and output ta if B-th bit in this character is set to 1, and ti. If B-th bit is set to 0. Name the program {{progname}} and place it in the home directory of {{testuser}}. -''', -} - -# instructions = {'si': 'Potrpite.', 'en': 'Have patience.'} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiterDhcpGW', - }, - ], - 'network_interfaces': [ - { - 'network': 'net1', - }, - { - 'network': 'net2', - }, - ], - 'flavor': 'm1.tiny', - 'config_drive': False, - }, - 'SmallStudent': { - 'disks': [ - { - 'name': 'student-entrance2', - }, - ], - 'network_interfaces': [ - { - 'network': 'net2', - }, - ], - 'flavor': 'm1.tiny', - 'config_drive': False, - } -} - -networks = { - 'net1': { - 'public': True, - }, - 'net2': { - 'public': False, - } -} - -params_meta = { - 'testip': { - 'descriptions': { - 'si': 'IP SmallStudent', - 'en': 'IP SmallStudent', - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True, - }, - 'testuser': { - 'descriptions': { - 'si': 'Uporabnik na SmallStudent', - 'en': 'Username on SmallStudent', - }, - 'w': False, - 'public': True, - 'type': 'username', - 'generated': True, - }, - 'passwd': { - 'descriptions': { - 'si': 'Geslo na SmallStudent', - 'en': 'Password on SmallStudent', - }, - 'w': False, - 'public': True, - 'type': None, - 'generated': True, - - }, - 'magicstr':{ - 'descriptions': { - 'si': 'Niz v iskani datoteki', - 'en': 'String in the file you need to find', - }, - 'w': False, - 'public': True, - 'type': None, - 'generated': True, - - }, - 'dstfile':{ - 'descriptions': { - 'si': 'Ciljno ime datoteke', - 'en': 'Destination filename', - }, - 'w': False, - 'public': True, - 'type': 'filename', - 'generated': True, - }, - 'progname':{ - 'descriptions': { - 'si': 'Ime programa', - 'en': 'Program filename', - }, - 'w': False, - 'public': True, - 'type': 'filename', - 'generated': True, - }, - 'pubseed':{ - 'descriptions': { - 'si': 'Nekaj nepredvidenega', - 'en': 'A random seed', - }, - 'w': False, - 'public': True, - 'type': None, - 'generated': True, - }, - 'rndseed':{ - 'descriptions': { - 'si': 'random seed za skrito datoteko', - 'en': 'random seed for hiding the file', - }, - 'w': False, - 'public': False, - 'type': None, - 'generated': True, - }, -} - -def task(testip, testuser, passwd, magicstr, dstfile, progname, pubseed): - import random - - r = random.Random(pubseed) - tests = [ - ('dst_ls', 'ls -l ~/{}'.format(dstfile)), - ('dst_file_contents', 'cat ~/{}'.format(dstfile)), - ('home_ls', 'ls ~/'.format(dstfile)), - ] - - N_TITA = 40 - for i in range(N_TITA): - b = r.randint(0, 7) - x = oct(r.randint(37, 127)).replace('o', '') - tests += [('tita-{:02}'.format(i), 'echo -e "\\{}" | ~/{} {}'.format(x, progname, b))] - - results = kpov_util.ssh_test(testip, testuser, passwd, tests) - results['tita_return'] = ''.join(results['tita-{:02}'.format(i)] for i in range(N_TITA)) - - return results - -def gen_params(user_id, params_meta): - import random - params = dict() - r = random.Random(user_id) - params['testip'] = kpov_util.IPv4_addr_gen(r, - network = '10.94.80.0/19', n_generated=1)[0] - params['testuser'] = kpov_util.default_generators['username'](r) - params['passwd'] = kpov_util.alnum_gen(r, 8) - params['magicstr'] = "".join([r.choice("qwerztlpoQWERTPOL") for i in range(10)]) - params['dstfile'] = kpov_util.default_generators['filename'](r) - params['progname'] = kpov_util.default_generators['filename'](r) - while params['dstfile'] == params['progname']: - params['progname'] = kpov_util.default_generators['filename'](r) - params['pubseed'] = kpov_util.alnum_gen(r, 8) - params['rndseed'] = kpov_util.alnum_gen(r, 8) - return params - - -def task_check(results, params): - import os - import re - N_TITA = 40 - hints = [] - score = 0 - r = random.Random(params['rndseed']) - - if results['ssh'] is not True: - hints += ['ssh failed: ' + results['ssh']] - return score, hints - - expected_contents = params['magicstr'] - for i in range(1000): - start = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - mid = "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) - end = r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) - if start[:2] == "po" and end == "lz": - start = "po" - mid = "kaka" - x = start + mid + end - expected_contents += x + "\r\n" - if results["dst_file_contents"] == expected_contents: - score += 3 - else: - for i, (a, b) in enumerate(zip(expected_contents, results['dst_file_contents'])): - if a != b: - break - hints += ['wrong file {} at position {}'.format(params['dstfile'], i)] - - expected_ls = "-rw--w---- 1 {testuser} bilbo .*{dstfile}.*\r\n".format(**params) - if re.match(expected_ls, results["dst_ls"]): - score += 3 - else: - hints += ["missing file or wrong user/permissions\n" + results["dst_ls"]] - if results["home_ls"].find(params['progname']) > -1: - score += 2 - else: - hints += ["missing program"] - - expected_tita = "" - r = random.Random(params['pubseed']) - for i in range(N_TITA): - b = r.randint(0, 7) - x_i = r.randint(37, 127) - if x_i & (1 << b): - expected_tita += "ta" - else: - expected_tita += "ti" - if results["tita_return"] == expected_tita: - score += 2 - else: - hints += ['program output incorrect:\nwanted:\t{}\ngot:\t{}'.format(expected_tita, results["tita_return"])] - return score, hints - - -def prepare_disks(templates, task_params, global_params): - import random - import os - - # first create the file contents to make it easyer to check. - hidden_contents = task_params['magicstr'] - r = random.Random(task_params['rndseed']) - for i in range(1000): - x = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - x += "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) - x += r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) - hidden_contents += x + "\n" - - # create hidden file - dir_list = ['Qlipper', 'Thunar', 'blender', 'autostart', 'kazam', 'mc', 'netsurf', 'pulse', 'qupzilla', 'radare2', 'teamviewer', 'texstudio', 'vlc'] - ending_list = ['rc', '.conf', ''] - start_list = ['net', 'dev', 'doc', 'lib', 'time', 'conf'] - r.shuffle(dir_list) - file_letters = ["mod", "co"] - - d = templates['student-entrance2'] - for potential_dir in dir_list: - try: - potential_dir = os.path.join('/home/bilbo/.config', potential_dir) - d.mkdir(potential_dir) - d.chown(1001, 1001, potential_dir) - except: - pass - for i in range(r.randint(2, 20)): - rndstr2 = r.choice(start_list) + \ - r.choice(file_letters) + r.choice(ending_list) - hidden_file_name = os.path.join(potential_dir, - rndstr2) - d.write(hidden_file_name, hidden_contents) - d.chown(1001, 1001, hidden_file_name) - file_letters = ["stamp", "", "dev", "re"] - hidden_contents = "".join([r.choice("asdfghjkyxcvbnm1234567890 \n") for j in range(10000)]) - file_letters = file_letters + ["mod", "co"] - # TODO create some additional files - - write_default_config(templates['simpleArbiterDhcpGW'], global_params) diff --git a/kpov_judge/tasks/entrance_exam/task.py b/kpov_judge/tasks/entrance_exam/task.py deleted file mode 100644 index bfefbd1..0000000 --- a/kpov_judge/tasks/entrance_exam/task.py +++ /dev/null @@ -1,2 +0,0 @@ -instructions = {'si': """ -Reši pristopni kolokvij z visoko oceno.""" } diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/index.html b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/index.html deleted file mode 100644 index 63d2463..0000000 --- a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/index.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - 06 - preparation (isc_dhcp_live_boot) - - - -

06 - preparation (isc_dhcp_live_boot)

-

Table of contents

- - - -

Purpose of this exercise

-

How to perform live boot using a DHCP server.

- - -

We need VirtualBox and the following 4 virtual -machines: -

-

- -

Schematics of our subnet

- slika-01 -

Our goal is to make BootableClient A get it's IP -through DHCP server and boot up using file -A, which is located on simpleArbiterGW,
If we run -BootableClient B machines, we would like it to retrieve it's IP -through DHCP server and boot from some live ISO which is also located on -SimpleArbiterGW. -

- -

Setting up simpleArbiterGW

-

Download simpleArbiterGW.vdi -and then run VirtualBox. After the file is downloaded, choose the New -option in VirtualBoxu and set simpleArbiterGW in the Name -field.
Memory size, should be set accordingly (1gb will suffice). Then choose "Use an existing virtual hard drive file" and select simpleArbiterGW.vdi clicking Create.

-
- slika-02 -

We start our virtual machines simpleArbiterGW using the -following login -credentials; username: "root", password: "kaboom".

- At the start, the computer on NAt get's it's IP(in our case 10.0.2.15).
(to check this useifconfig) We now use this address and eth0 interface to access the internet.

- slika-03 -

However, we would like this machine to have 2 -interfaces! One on NAT(we already have this one), and the other one on Internal Network,
throuh which we will communicate wiht the DHCP Server and other machines on our Internal Network.

- We add a new interface, by turning off the virtual machine, -select our machine in VirtualBox and select -računalnik, ter v VirtualBoxu Settings -> Network
- Adapter 1 is already set to NAT, we set Adapter -2 to -Internal Network

- slika-04 -

So, now we have two network interfaces!
In VirtuaBox -we can define multiple Internal Networks, however, for our needs two -will suffice. We save the settings and restart simpleArbiterGW.

- What we must do now, is to assign both interfaces IP addresses. We do this by setting theinterfacesfile - located at/etc/network.

- slika-05 -

Eth0 was already handled by and integrated DHCP, so eth0 had been assigned an IP).
- We have to set up the other network interface. If we don't know it's name, we find it out using ifconfig -a.

- slika-06 -

We can conclude the interface names is set to Eth1. - Now we would like to assign an IP naslov to Eth1.
- Ifconfig could be used, but rebooting the machine would reset the settings. Which is not ideal :)
- So configuring /etc/network/interfaces would be a better idea.

- Let's make up a random local network or a local area network or local area network address and assign it to eth1. -

- slika-07 -

We save the config file. Our machine still has no IP on eth1 so we use the ifup eth1 command

- slika-08
-

Now we use the ifconfig command, to see whether and ip is assigned to eth1 interface

- slika-09 -

We can see the IP is set. Now let's set up the DHCP -Server!

- -

Setting up DHCP Server

-

We download simpleArbiterDhcp.vdi and start VirtualBox. After the file had been dowloaded we select New in VirtualBoxu and unde rthe Name tag write DHCP Server.
We set the Memory size accordingly(1gb of memory should be sufficient). We also select "Use an existing virtual hard drive file" and select the simpleArbiterDhcp and press Create.

-
- slika-10 -

We run DHCP Server virtual machine and login using "root" ad username and "kaboom" as password.

-

At first, our machine has no assigned IP, since none was set! Let+s configure it in /etc/network/interfaces.
But which interface should we configure? Using ifconfig -a command, we see it's eth0interface.
- Again we select our IP address.

- slika-11 -

We save the configuration file. Our computer still has no IP address assigned to eth0, so using ifdown eth0 and then ifup eth0we provide one.

- slika-12 -

Now let us use ifconfig command, to check whether there is an IP assigned to interface eth0

- slika-13 -

We got it! We install DHCP server using apt-get install isc-dhcp-server

- slika-14 -

We see a bunch of errors. Why? Bacause, we have no internet access!
- We need to specify the Gateway for our inteface. Our Gateway will be set as IP of our simpleArbiter virtual machine.
We do this using theroute add default gw 192.168.251.1 eth0 command

- slika-15 -

Try pinging Google's DNS server at 8.8.8.8, to check if now have internet access.
- We do this using the ping 8.8.8.8 command.

- slika-16 -

Google's DNS server is responding. Great!
- However, we still cannot run apt-get install isc-dhcp-server
- Let's tempororly add another interface and set it to NAT, so we get internet access and install the DHCP server.

- We add a new interface by turning off the virtual computer, in VirtualBox we select our virtual machine and then select Settings -> Network
- Adapter 1 has already been set to Internal Network, we set Adapter 2 to NAT

- slika-17 -

We run DHCP Server and in file/etc/network/interfaces at the end of the line add iface eth1 inet dhcp, then save the file and run ifup eth1.
- Now we have access to the internet and can install our DHCP server with apt-get install isc-dhcp-server install command
- slika-18
-

Let's see what's in/var/log/syslog, which is a file where our system information is stored in.

- slika-19
-

Looks like we need to set up a DHCP server and specify where it should listen!
- DHCP settings are stored in /etc/dhcp/dhcpd.conf. Let's set it!
- First let's comment out option domain-name-servers to avoid having errors.

- slika-20
-

Then we configure DHCP server, so it would serve IPs a a certain subnet. We add the following lines:

- slika-21 -

(subnet) We set the subnet and the IP range, which the DHCP server should use, and which file it should serve.

Some PXEs are so unintelligent, that you should specify where they should get the files from and to do that you specify next-server
(IP from which it will be served from, in our case simpleArbiter), we also specify gateway, which, in our case is also simpleArbiter.

Since we would like, that in the case of BootableClient B another file to be served, we do it by defining a special host like this:
(host special) Under hardware ethernet we specifiy MAC address of our BootableClient B, we assign it a static ip and where the file live-ISO is located.

-

We save the settings and kill the process named dnsmasqusingkilall dnsmasq.

- slika-22 -

We restart our DHCP server, to apply the new settings. This is done using service isc-dhcp-server restart
command. DHCP server is now ready! We supply BootableClientA and BootableClientB and test them!

- - -

Setting up BootableClient A

-

We open VirtualBox and select New, for the -Name field we specify -BootableClient A and for the Hard drive we select Do not add a -virtual -hard drive (as we want diskless device),
and select Create. -We want the computer to be on Internal network so vse select our -Bootable Client -A and select
Settings->Network where we change Adapter -1 to Internal Network.

- slika-23 -

We also want our computer to boot through the network, so -underBoot Ordertab select Network.
- We save the setting by clicking OK

- slika-24 -

We run our BootableClient-a A and it get's it's -IP(which is great), using the DHCP server and the simpleArbiter serves -it exactly the file we specified. A.0

- slika-25 - - - -

Setting upBootableClient -B

-

We open virtual box and select New and under the Name tag write BootableClient B and under the Hard drivetab choose Do not add a virtual hard drive (since we want a diskless machine),
and then press the Create button, which will create a virtual machine. We want our machine to be connected to out Internal network so we select Bootable Client B and then select
Settings->Network and set the Adapter 1 to Internal Network.
- Under MAC Address we specify the same MAC address that is specified in the (dhcpd.conf -> host special) file, since we want our machine to be an exception
and will be served a special file namedlive-ISO

- slika-26 -

We want our machine to perform a netboot, so under the System

Boot Order tag specify only Network.
- We save the setting by clicking the OK button

- slika-27 -

We run our BootableClient-a A and it get's it's IP address using DHCP server and simpleArbiter serves it the file we selected called live-ISO

- slika-28 - - - - - diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html deleted file mode 100644 index c83ed57..0000000 --- a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - 06 - preparation (isc_dhcp_live_boot) - - - -

06 - preparation (isc_dhcp_live_boot)

-

Table of contents

- - - -

Purpose of this exercise

-

How to perform live boot using a DHCP server.

- - -

We need VirtualBox and the following 4 virtual -machines: -

-

- -

Schematics of our subnet

- slika-01 -

Our goal is to make BootableClient A get it's IP -through DHCP server and boot up using file -A, which is located on simpleArbiterGW,
If we run -BootableClient B machines, we would like it to retrieve it's IP -through DHCP server and boot from some live ISO which is also located on -SimpleArbiterGW. -

- -

Setting up simpleArbiterGW

-

Download simpleArbiterGW.vdi -and then run VirtualBox. After the file is downloaded, choose the New -option in VirtualBoxu and set simpleArbiterGW in the Name -field.
Memory size should be set accordingly (1gb will suffice). Then choose "Use an existing virtual hard drive file" and select simpleArbiterGW.vdi clicking Create.

-
- slika-02 -

We start our virtual machines simpleArbiterGW using the -following login -credentials; username: "root", password: "kaboom".

- At the start, the computer on NAt get's it's IP(in our case 10.0.2.15).
(to check this useifconfig) We now use this address and eth0 interface to access the internet.

- slika-03 -

However, we would like this machine to have 2 -interfaces! One on NAT(we already have this one), and the other one on Internal Network,
throuh which we will communicate wiht the DHCP Server and other machines on our Internal Network.

- We add a new interface, by turning off the virtual machine, -select our machine in VirtualBox and select -računalnik, ter v VirtualBoxu Settings -> Network
- Adapter 1 is already set to NAT, we set Adapter -2 to -Internal Network

- slika-04 -

So, now we have two network interfaces!
In VirtuaBox -we can define multiple Internal Networks, however, for our need's two -will suffice. We save the settings and restart simpleArbiterGW.

- What we must do now, is to assign both interfaces IP addresses. We do this by setting theinterfacesfile - located at/etc/network.

- slika-05 -

Eth0 was already handled by and integrated DHCP, so eth0 had been assigned an IP).
- We have to set up the other network interface. If we don't know it's name, we find it out using ifconfig -a.

- slika-06 -

We can conclude the interface names is set to Eth1. - Now we would like to assign an IP naslov to Eth1.
- Ifconfig could be used, but rebooting the machine would reset the settings. Which is not ideal :)
- So configuring /etc/network/interfaces would be a better idea.

- Let's make up a random local network or a local area network or local area network address and assign it to eth1. -

- slika-07 -

We save the config file. Our machine still has no IP on eth1 so we use the ifup eth1 command

- slika-08
-

Now we use the ifconfig command, to see whether and ip is assigned to eth1 interface

- slika-09 -

We can see the IP is set. Now let's set up the DHCP -Server!

- -

Setting up DHCP Server

-

We download simpleArbiterDhcp.vdi ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo DHCP Server.
Ustrezno nastavimo tudi Memory size (1gb pomnilnika nam bo zadostovalo). Spodaj izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterDhcp in pritisnimo Create.

-
- slika-10 -

We run DHCP Server virtual machine and login using "root" ad username and "kaboom" as password.

-

At first, our machine has no assigned IP, since none was set! Let+s configure it in /etc/network/interfaces.
But which interface should we configure? Using ifconfig -a command, we see it's eth0interface.
- Again we select our IP address.

- slika-11 -

We save the configuration file. Our computer still has no IP address assigned to eth0, so using ifdown eth0 and then ifup eth0we provide one.

- slika-12 -

Now let us use ifconfig command, to check whether there is an IP assigned to interface eth0

- slika-13 -

We got it! We install DHCP server using apt-get install isc-dhcp-server

- slika-14 -

We see a bunch of errors. Why? Bacause, we have no internet access!
- We need to specify the Gateway for our inteface. Our Gateway bo seveda IP našega simpleArbiter navideznega računalnika.
To naredimo s pomočjo ukaza route add default gw 192.168.251.1 eth0

- slika-15 -

Try pinging Google's DNS server at 8.8.8.8, to check if now have internet access.
- We do this using the ping 8.8.8.8 command.

- slika-16 -

Google's DNS server is responding. Great!
- However, we still cannot run apt-get install isc-dhcp-server
- Let's tempororly add another interface and set it to NAT, so we get internet access and install the DHCP server.

- We add a new interface by turning off the virtual computer, in VirtualBox we select our virtual machine and then select Settings -> Network
- Adapter 1 has already been set to Internal Network, we set Adapter 2 to NAT

- slika-17 -

We run DHCP Server and in file/etc/network/interfaces at the end of the line add iface eth1 inet dhcp, then save the file and run ifup eth1.
- Now we have access to the internet and can install our DHCP server with apt-get install isc-dhcp-server install command
- slika-18
-

Let's see what's in/var/log/syslog, which is a file where our system information is stored in.

- slika-19
-

Looks like we need to set up a DHCP server and specify where it should listen!
- DHCP settings are stored in /etc/dhcp/dhcpd.conf. Let's set it!
- First let's comment out option domain-name-servers to avoid having errors.

- slika-20
-

Then we configure DHCP server, so it would serve IPs a a certain subnet. We add the following lines:

- slika-21 -

(subnet) We set the subnet and the IP range, which the DHCP server should use, and which file it should serve.

Some PXEs are so unintelligent, that you should specify where they should get the files from and to do that you specify next-server
(IP from which it will be served from, in our case simpleArbiter), we also specify gateway, which, in our case is also simpleArbiter.

Ker bi radi, da v primeru zagona navideznega računalnika BootableClient B serviramo drugo datoteko, to naredimo tako da definiramo nek dodaten host na sledeč način:
(host special) Pod hardware ethernet zapišemo MAC naslov našega BootableClient B katerega bo imel, dodelimo mu nek statičen ip naslov ter povemo še iz kje se naj datoteka live-ISO zažene.

-

We save the settings and kill terthe process with ubijemo named dnsmasqusingkilall dnsmasq.

- slika-22 -

Sledi restart našega DHCP strežnika, da bo deloval z novimi nastavitvami, to naredimo z ukazom service isc-dhcp-server restart
DHCP server is now ready! We supply BootableClientA and BootableClientB and test them!

- - -

Postavitev BootableClient A

-

We open VirtualBox and select New, for the y -Name field we specify -BootableClient A and for the Hard drive we select Do not add a -virtual -hard drive (as we want diskless device),
and select Create. -We want the computer to be on Internal network so vse select our -Bootable Client -A and select
Settings->Network where we change Adapter -1 to Internal Network.

- slika-23 -

We also wan our computer to boot through network, so -underBoot Ordertab select Network.
- We save the setting by clicking OK

- slika-24 -

We run our BootableClient-a A and it get's it's -IP(which is great), using the DHCP server and the simpleArbiter serves -it exactly the file we specified. A.0

- slika-25 - - - -

Setting upBootableClient -B

-

Odpremo VirtualBox ter izberemo New in pod Name napišemo BootableClient B ter pod Hard drive izberemo Do not add a virtual hard drive (saj si želimo računalnik brez diska),
in pritisnemo na gump Create, da se nam ustvari navidezni računalnik. Želimo, da bo računalnik priklopljen na Internal network zato označimo naš Bootable Client B ter pritisnimo na
Settings->Network in prvi Adapter 1 spremenimo na Internal Network.
- Poleg tega nastavimo še pod MAC Address takšen MAC naslov, kot ga imamo v nastavitvah DHCP strežnika (dhcpd.conf -> host special), saj želimo da bo ta naš računalnik izjema
in bo ob zagonu dobil drugo datoteko kot ostali in sicer live-ISO

- slika-26 -

Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom System

tako, da pod Boot Order obkljukamo samo Network.
- Nastavitve shranimo z pritiskom na gumb OK

- slika-27 -

Poženemo našega BootableClient-a A in odličnoo, dobi ip naslov s pomočjo DHCP strežnika in simpleArbiter mu servira točno to datoteko katero si želimo live-ISO

- slika-28 - - - - - diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html.save b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/en/indexEN.html.save deleted file mode 100644 index e69de29..0000000 diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/01.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/01.png deleted file mode 100644 index 906135b..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/01.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/02.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/02.png deleted file mode 100644 index 545f630..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/02.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/03.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/03.png deleted file mode 100755 index 0b69590..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/03.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/04.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/04.png deleted file mode 100755 index ce4dc18..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/04.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/05.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/05.png deleted file mode 100755 index f343ec1..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/05.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/06.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/06.png deleted file mode 100755 index b4fe8e1..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/06.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/07.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/07.png deleted file mode 100755 index b6da6eb..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/07.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/08.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/08.png deleted file mode 100755 index 333fd7d..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/08.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/09.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/09.png deleted file mode 100755 index c7cb8b8..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/09.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/10.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/10.png deleted file mode 100755 index c7f9225..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/10.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/11.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/11.png deleted file mode 100755 index e1192e9..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/11.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/12.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/12.png deleted file mode 100755 index 295b3c7..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/12.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/13.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/13.png deleted file mode 100755 index 8d3badc..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/13.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/14.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/14.png deleted file mode 100755 index 3009f41..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/14.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/15.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/15.png deleted file mode 100755 index c4413e8..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/15.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/16.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/16.png deleted file mode 100755 index a4de5a8..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/16.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/17.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/17.png deleted file mode 100755 index 0ab5c0f..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/17.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/18.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/18.png deleted file mode 100755 index 4e1e17a..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/18.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/19.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/19.png deleted file mode 100755 index 570f644..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/19.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/20.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/20.png deleted file mode 100755 index ea67ce0..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/20.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/21.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/21.png deleted file mode 100755 index 428f92f..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/21.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/22.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/22.png deleted file mode 100755 index 7119fff..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/22.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/23.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/23.png deleted file mode 100755 index 68d0477..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/23.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/24.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/24.png deleted file mode 100755 index 4ab2dd2..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/24.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/25.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/25.png deleted file mode 100755 index 8823ac1..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/25.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/26.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/26.png deleted file mode 100755 index 09eb081..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/26.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/27.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/27.png deleted file mode 100755 index 9b867e1..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/27.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/28.png b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/28.png deleted file mode 100755 index 5844b8a..0000000 Binary files a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/28.png and /dev/null differ diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html deleted file mode 100644 index d83b934..0000000 --- a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/si/index.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - 06 - preparation (isc_dhcp_live_boot) - - - -

06 - preparation (isc_dhcp_live_boot)

-

Kazalo

- - - -

Namen vaje

-

Kako narediti live boot z DHCP strežnikom.

- - -

Potrebujemo program VirtualBox ter naslednje 4 navidezne računalnike: -

-

- -

Skica našega podomrežja

- slika-01 -

Naš cilj je, da računalnik BootableClient A preko DHCP strežnika pridobil IP naslov ter se zažene z datoteko A, ki se nahaja na simpleArbiterGW,
če pa zaženemo računalnik BootableClient B pa si želimo, da ta preko DHCP strežnika pridobi IP naslov ter se zažene z nekim live ISO, ki se prav tako nahaja na simpleArbiterGW. -

- -

Postavitev simpleArbiterGW

-

Prenesemo simpleArbiterGW.vdi ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo simpleArbiterGW.
Ustrezno nastavimo tudi Memory size (1gb pomnilnika nam bo zadostovalo). Spodaj izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterGW.vdi in pritisnimo Create.

-
- slika-02 -

Nato zaženemo virtualni računalnik simpleArbiterGW ter se z uporabniškim imenom "root" ter geslom "kaboom" vpišemo v naš sistem.

- Prvo računalnik od NAT-a, kateri je vgrajen v VirtualBox dobi nek naslov (v našem primeru 10.0.2.15).
(Da to preverimo uporabimo ukaz ifconfig) Preko tega IP naslova in vmesnika eth0 smo povezani v internet.

- slika-03 -

Mi pa si želimo 2 omrežna vmesnika na tem računalniku! Enega bi radi imeli na NAT (tega že imamo) drugega pa na Internal Network,
preko katerega bomo komunicirali z DHCP Strežnikom ter ostalimi računalniki, ki bodo v našem Internal Network-u.

- Nov omrežni vmesnik dodamo tako, da ugasnemo naš virtualni računalnik, ter v VirtualBoxu označimo naš virtualni računalnik in pritisnemo na Settings -> Network
- Adapter 1 imamo že nastavljeno na NAT, Adapter 2 pa nastavimo na Internal Network

- slika-04 -

Tako, zdaj imamo nastavljena 2 vmesnika!
V VirtualBoxu lahko definiramo več Internal Networkov (notranjih omrežij) a za naše potrebe bo to dovolj. Shranimo nastavitve ter ponovno poženimo naš simpleArbiterGW.

- Zdaj moramo oba omrežna vmesnika nastaviti tako, da bosta imela nek naslov. Uredimo datoteko interfaces v imeniku - /etc/network.

- slika-05 -

Za eth0 je poskrbel že DHCP strežnik, ki je vgrajen v VirtualBox (na eth0 je določil nek IP).
- Mi moramo nastaviti še drugi mrežni vmesnik. Kako se imenuje iz glave ne vemo zato s pomočjo ukaza ifconfig -a pogledamo.

- slika-06 -

Ugotovimo da je ime vmesnika eth1. - Zdaj bi rad na eth1 nastavil en IP naslov.
- Lahko bi nastavil z ifconfig, a ko rebootaš računalnik se nastavitve ne ohranijo. To nebi radi!
- Pojdimo raje skonfigurirat nastavitve v /etc/network/interfaces

- Izmislimo si eno naključno lokalno omrežje oz naslov lokalnega omrežja ter nastavimo eth1. -

- slika-07 -

Shranimo konfiguracijsko datoteko. Moj računalnik še nima IP-ja na eth1 zato uporabim ukaz ifup eth1

- slika-08
-

Sedaj uporabimo ukaz ifconfig, da vidimo če imamo slučajno ip na vmesniku eth1

- slika-09 -

Vidim, da ip imam. Super! Gremo postavit DHCP Server!

- -

Postavitev DHCP Server

-

Prenesemo simpleArbiterDhcp.vdi ter zaženemo VirtualBox. Ko je datoteka prenesena v VirtualBoxu izberemo New ter v polje Name vpišemo DHCP Server.
Ustrezno nastavimo tudi Memory size (1gb pomnilnika nam bo zadostovalo). Spodaj izberemo še "Use an existing virtual hard drive file" ter izberemo naš simpleArbiterDhcp in pritisnimo Create.
Ustrezno nastavimo tudi nastavitve mreže iz NAT na Internal Network

-
- slika-10 -

Nato zaženemo virtualni računalnik DHCP Server ter se z uporabniškim imenom "root" ter geslom "kaboom" vpišemo v naš sistem.

-

Sprva naš računalnik nima nobenega ip-ja saj mu ga nismo nastavili! Pojdimo skonfigurirat nastavitve v /etc/network/interfaces.
Ampak kateri vmesnik sploh konfiguriramo? Z ukazom ifconfig -a ugotovimo da je to eth0.
- Spet si izberemo nek svoj statičen ip naslov.

- slika-11 -

Shranimo konfiguracijsko datoteko. Moj računalnik še nima IP-ja na eth0 zato uporabim ukaz ifdown eth0 ter nato še ifup eth0

- slika-12 -

Sedaj uporabimo ukaz ifconfig, da vidimo če imamo slučajno ip na vmesniku eth0

- slika-13 -

Hura imamo! Namestimo naš DHCP strežnik z ukazom apt-get install isc-dhcp-server

- slika-14 -

Vidimo, da dobimo cel kup napak. Ampak zakaj? Zato, ker nimamo dostopa do interneta!
- Vmesniku eth0 moramo seveda povedati Gateway. Naš Gateway bo seveda IP našega simpleArbiter navideznega računalnika.
To naredimo s pomočjo ukaza route add default gw 192.168.251.1 eth0

- slika-15 -

Probajmo ping-ati Googlov DNS strežnik, da ugotovimo če imamo sedaj internet.
- To naredimo z ukazom ping 8.8.8.8.

- slika-16 -

Googlov DNS strežnik se odziva, super!
- Ampak apt-get install isc-dhcp-server še vedno ne moremo naložiti.
- Začasno dodajmo še en mrežni vmesnik ter ga nastavimo na NAT, nato bomo dobili dostop do interneta ter lahko namestimo naš DHCP strežnik.

- Nov omrežni vmesnik dodamo tako, da ugasnemo naš virtualni računalnik, ter v VirtualBoxu označimo naš virtualni računalnik in pritisnemo na Settings -> Network
- Adapter 1 imamo že nastavljeno na Internal Network, Adapter 2 pa nastavimo na NAT

- slika-17 -

Zaženemo naš DHCP Server in v /etc/network/interfaces začasno na koncu dodamo vrstico iface eth1 inet dhcp,datoteko shranimo ter poženemo ukaz ifup eth1.
- Sedaj imamo dostop do interneta in lahko namestimo naš DHCP strežnik z ukazom apt-get install isc-dhcp-server install
- slika-18
-

Poglejmo kaj je v /var/log/syslog, to je datoteka kamor se shranjujejo sporočila kaj se dogaja v našem sistemu

- slika-19
-

Očitno moramo nastaviti dhcp strežnik ter mu povedati tudi kam naj posluša!
- Za nastavitve DHCP strežnika imamo /etc/dhcp/dhcpd.conf. Nastavimo jo!
- Prvo zakomentiramo option domain-name-servers zaradi tega da nebo napak da jih ne najde.

- slika-20
-

Nato skonfiguriramo dhcp strežnik, da bo serviral ip-je na nekem podomrežju. Dodamo naslednje zapise:

- slika-21 -

(subnet) Nastavimo podomrežje ter območje naslovov od koder naj jih DHCP strežnik dodeli, katero datoteko naj servira,
poleg tega so eni PXE tako neumni, da če jim ti serviraš filename nevejo iz katerega serverja ga dobim, zato napišem še next-server
(ip od koder serviram, v našem primeru simpleArbiter), nastavim tudi gateway kateri je v našem primeru tudi simpleArbiter.

Ker bi radi, da v primeru zagona navideznega računalnika BootableClient B serviramo drugo datoteko, to naredimo tako da definiramo nek dodaten host na sledeč način:
(host special) Pod hardware ethernet zapišemo MAC naslov našega BootableClient B katerega bo imel, dodelimo mu nek statičen ip naslov ter povemo še iz kje se naj datoteka live-ISO zažene.

-

Spremembe shranimo, ter ubijemo proces z imenom dnsmasq z ukazom kilall dnsmasq.

- slika-22 -

Sledi restart našega DHCP strežnika, da bo deloval z novimi nastavitvami, to naredimo z ukazom service isc-dhcp-server restart
DHCP Strežnik je pripravljen! Pripravimo BootableClientA ter BootableClientB ter testirajmo!

- - -

Postavitev BootableClient A

-

Odpremo VirtualBox ter izberemo New in pod Name napišemo BootableClient A ter pod Hard drive izberemo Do not add a virtual hard drive (saj si želimo računalnik brez diska),
in pritisnemo na gump Create, da se nam ustvari navidezni računalnik. Želimo, da bo računalnik priklopljen na Internal network zato označimo naš Bootable Client A ter pritisnimo na
Settings->Network in prvi Adapter 1 spremenimo na Internal Network.

- slika-23 -

Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom System

tako, da pod Boot Order obkljukamo samo Network.
- Nastavitve shranimo z pritiskom na gumb OK

- slika-24 -

Poženemo našega BootableClient-a A in odličnoo, dobi ip naslov s pomočjo DHCP strežnika in simpleArbiter mu servira točno to datoteko katero si želimo A.0

- slika-25 - - - -

Postavitev BootableClient B

-

Odpremo VirtualBox ter izberemo New in pod Name napišemo BootableClient B ter pod Hard drive izberemo Do not add a virtual hard drive (saj si želimo računalnik brez diska),
in pritisnemo na gump Create, da se nam ustvari navidezni računalnik. Želimo, da bo računalnik priklopljen na Internal network zato označimo naš Bootable Client B ter pritisnimo na
Settings->Network in prvi Adapter 1 spremenimo na Internal Network.
- Poleg tega nastavimo še pod MAC Address takšen MAC naslov, kot ga imamo v nastavitvah DHCP strežnika (dhcpd.conf -> host special), saj želimo da bo ta naš računalnik izjema
in bo ob zagonu dobil drugo datoteko kot ostali in sicer live-ISO

- slika-26 -

Želimo še, da se računalnik boot-a preko mreže, zato to nastavimo pod zavihkom System

tako, da pod Boot Order obkljukamo samo Network.
- Nastavitve shranimo z pritiskom na gumb OK

- slika-27 -

Poženemo našega BootableClient-a A in odličnoo, dobi ip naslov s pomočjo DHCP strežnika in simpleArbiter mu servira točno to datoteko katero si želimo live-ISO

- slika-28 -

Postavitev TFTP strežnika in zagonskih datotek

- -

Na SimpleArbiter namestimo TFTP strežnik z ukazom apt-get install tftpd-hpa in spremenimo IP v "/etc/default/tftpd-hpa" pod TFTP_ADDRES na "192.168.251.1". -
Nato z ukazom apt-get install syslinux namestimo syslinux in skopiramo zagonsko datoteko iz "/usr/lib/syslinux/pxelinux.0" na "/srv/tftp/A.0.
Namestimo še NFS server z ukazom "apt-get install nfs-kernel-server" in v "/etc/exports" dodamo lokacijo mape, kjer se nahaja naša zagonska datoteka A.0, ter omogočimo branje ("/srv/tftp * (ro)"). -
V imeniku /srv/tftp ustvarimo mapo "pxelinux.cfg" in v njej ustvarimo datoteko z imenom default. Vanjo vpišemo : -
DEFAULT vesamenu.c32 -
PROMPT 0 -
MENU TITLE isc-dhcp-live -
LABEL iso -
menu label Run -
kernel vmlinuz -
APPEND boot=casper netboot=nfs nfsroot=192.168.251.1:/srv/tftp/boot/ initrd=initrd.gz

- - - diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/task.py b/kpov_judge/tasks/isc_dhcp_live_boot/task.py deleted file mode 100644 index c1adc47..0000000 --- a/kpov_judge/tasks/isc_dhcp_live_boot/task.py +++ /dev/null @@ -1,222 +0,0 @@ -# TODO: dokoncaj! -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si': '''\ -

-Postavi štiri navidezne računalnike: simpleArbiter, DHCP_server, BootableClientA in BootableClientB. - -

-Na DHCP_server postavi strežnik DHCP s pomočjo ISC dhcp 3 na naslovu {{IP_DHCP}}. SimpleArbiter naj dobi {{IP_GW}}. DHCP_server naj ga uporabi kot privzeti prehod (angl. gateway). - -

-Če se zaganja BootableClientB, naj se sistem zažene v datoteko z imenom {{BOOT_FNAME}}. Če se zaganja katerikoli drug, naj se sistem zažene z živega USB, ki ga predstavlja slika diska bootable_usb, ime datoteke z zagonskim nalagalnikom pa naj bo kakršno koli razen {{BOOT_FNAME}}. - -

-Živi USB priklopite na na DHCP_server in z njega poberite datoteke, potrebne za zagon. Datoteke z nastavitvami za PXELinux, ki jih najdete na živem USB, morajo biti dostopne na korenskem imeniku strežnika TFTP. - -

-Tako BootableClientA kot BootableClientB naj bosta brez diskov. -''', - 'en': '''\ -

-Set up four virtual machines: simpleArbiter, DHCP_server, BootableClientA and BootableClientB. - -

-On DHCP_server, set up a DHCP server using ISC dhcp 3. Set the IP address of this server to {{IP_DHCP}}. If SimpleArbiter requests an IP, have the DHCP server serve it {{IP_GW}}. DHCP_server should use SimpleArbiter as the gateway. - -

-If BootableClientB tries to boot over the network, have the DHCP server tell it to boot from the file {{BOOT_FNAME}}. If any other system tries to boot over the network, have it boot from a live USB drive represented by the disk image bootable_usb and have the bootloader filename be different from {{BOOT_FNAME}}. - -

-Connect the live USB to DHCP_server and copy the files neccessarry for it to boot. The PXELinux configuration files must be the same as the ones found on the live USB and must be accessible on the TFTP server root. - -

-Both BootableCLientA and BootableClientB should be diskless. -''', -} - -computers = { - 'DHCPServer': { - 'disks': [ - { 'name': 'student-DHCPServer', - }, - { 'name': 'bootable_usb', - 'options':{'readonly': False}, - 'parts': [ {'dev': 'sdb1', 'path':'/mnt'} ], - }, - ], - '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': 'simpleArbiterGW', - }, - ], - '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': {'descriptions': {'si': 'IP DHCP streznika'}, 'w': False, 'public': True, 'type':'IP', 'generated': True}, - 'IP_GW': {'descriptions': {'si': 'IP SimpleArbiterja'}, 'w': False, 'public': True, 'type':'IP', 'generated': True}, - 'MAC_BOOT': {'descriptions': {'si': 'MAC racunalnika, ki se zazene z ISO'}, 'w': True, 'public': True, 'type':'MAC', 'generated': False}, - # 'IP_BOOT': {'descriptions': {'si': 'IP racunalnika, ki se zazene z ISO'}, 'w': True, 'public': True, 'type':'IP', 'generated': False}, - 'TFTP_STRING': {'descriptions': {'si': 'vsebina'}, 'w': False, 'public': False, 'type':'short', 'generated': True}, - 'BOOT_FNAME': {'descriptions': {'si': 'Ime datoteke'}, 'w': False, 'public': True, 'type': 'filename', 'generated': True}, -} - -def task(IP_DHCP, IP_GW, MAC_BOOT, BOOT_FNAME): - # check the IP - # TODO (polz): Do not use tabs instead of spaces! - import pexpect - import re - import tftpy - import io - import time - results={} - # TODO (polz): Please use pexpect instead of os.system, it's much nicer. - # Also, test your functions. This function was obviously never run. - # - # check whether the fname served by the dhcp server is - # correct - # you should check the DHCP response from the server. - # You can use dhcpdump to get some packets, dhcping to create a - # DHCP Request. You may also use any other tool. - # If you choose to use dhcping, do not forget to set the hw address - # and ip arguments. You can simply feed it MAC_BOOT and IP_BOOT. - # dhcping -h MAC_BOOT -c IP_BOOT -V -r - # could work (but you should test it) - ip_str = pexpect.run('ip addr show') - eth_re_str = r"ether (([0-9a-f]{{2}}:){{5}}[0-9a-f]{{2}})(.*)\r\n(.*){}(.*)\s(\w*)\r\n" - ip_re = re.search(eth_re_str.format(IP_GW), ip_str) - mac_SA = ip_re.group(1) - eth_dev_SA = ip_re.group(6) - dhcpdump = pexpect.spawn("sudo dhcpdump -i {}".format(eth_dev_SA)) - time.sleep(2) - results['dhcping_other'] = pexpect.run('sudo dhcping -s {} -h {} -c {}'.format( - IP_DHCP, MAC_BOOT, IP_GW)) - dhcpdump.expect('---------------------------------------------------------------------------') - results['dhcpdump_other_req'] = dhcpdump.before - dhcpdump.expect('---------------------------------------------------------------------------') - results['dhcpdump_other_reply'] = dhcpdump.before - dhcpdump.expect('---------------------------------------------------------------------------') - results['dhcpdump_other_release'] = dhcpdump.before - results['dhcping_SA'] = pexpect.run('sudo dhcping -s {} -h {} -c {}'.format( - IP_DHCP, mac_SA, IP_GW)) - dhcpdump.expect('---------------------------------------------------------------------------') - results['dhcpdump_SA_req'] = dhcpdump.before - dhcpdump.expect('---------------------------------------------------------------------------') - results['dhcpdump_SA_reply'] = dhcpdump.before - dhcpdump.expect('---------------------------------------------------------------------------') - results['dhcpdump_SA_release'] = dhcpdump.before - dhcpdump.sendintr() - tftp_client = pexpect.spawn('tftp {}'.format(IP_DHCP)) - tftp_client.expect(r'tftp>') - tftp_client.sendline('get pxelinux.cfg/default /dev/stdout') - tftp_client.expect(r'tftp>') - results['tftp_string'] = tftp_client.before - # 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 = kpov_util.IPv4_subnet_gen(r, '10.64.0.0/10', 24) - params['IP_DHCP'], params['IP_GW'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['BOOT_FNAME'] = kpov_util.fname_gen(r) - params['TFTP_STRING'] = kpov_util.alnum_gen(r, 45) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - #TO FINISH SCORING WE REQUIRE DICT KEYS AND FUNCTIONS gen_params AND task TO BE FINISHED - #POINTS FOR EACH TASK MAY BE ADJUSTED IN THE FUTURE - if results['dhcping_other'].find(params['IP_DHCP']) >= 0: - score += 1 - else: - hints += ["DHCP wrong"] - if results['dhcping_SA'].find(params['IP_DHCP']) >= 0: - score += 1 - else: - hints += ["DHCP wrong"] - p = re.search(r"FNAME:(.*)\.\r", - results['dhcpdump_other_reply']) - if p is not None: - other_fname = p.group(1).strip() - else: - other_fname = '' - if other_fname == params['BOOT_FNAME']: - score += 3 - else: - hints += ["special fname wrong:" + other_fname] - p = re.search(r"FNAME:(.*)\.\r", - results['dhcpdump_SA_reply']) - if p is not None: - sa_fname = p.group(1).strip() - else: - sa_fname = '' - if sa_fname != params['BOOT_FNAME']: - score += 3 - else: - hints += ["fname wrong:" + sa_fname] - try: - special_tftp = "# " + params['TFTP_STRING'] - tftp_end = results['tftp_string'].split('\r\r\n')[-1] - assert tftp_end[:len(special_tftp)] == special_tftp - score += 2 - except: - hints += ["tftp wrong"] - return score, hints - -def prepare_disks(templates, task_params, global_params): - d = templates['student-DHCPServer'] - s = """# {}""".format(task_params['TFTP_STRING']) - d = templates['bootable_usb'] - d.write_append('/mnt/syslinux.cfg', s) - d = templates['simpleArbiterGW'] - s = """auto lo -iface lo inet loopback - -auto ens3 -iface ens3 inet dhcp - -auto enp0s3 -iface enp0s3 inet dhcp - -auto ens4 -iface ens4 inet static - address {IP_GW} - netmask 255.192.0.0 - -auto enp0s8 -iface enp0s8 inet static - address {IP_GW} - netmask 255.192.0.0 -""".format(IP_GW = task_params['IP_GW']) - d.write("/etc/network/interfaces", s) - write_default_config(templates['simpleArbiterGW'], global_params) diff --git a/kpov_judge/tasks/ldap_import/task.py b/kpov_judge/tasks/ldap_import/task.py deleted file mode 100644 index f8fdd60..0000000 --- a/kpov_judge/tasks/ldap_import/task.py +++ /dev/null @@ -1,106 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

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', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcp', - }, - ], - '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': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) - diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic1.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic1.jpg deleted file mode 100644 index fecb706..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic2.1.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic2.1.jpg deleted file mode 100644 index 085f1cc..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic2.1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic2.2.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic2.2.jpg deleted file mode 100644 index cb9975c..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic2.2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic2.3.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic2.3.jpg deleted file mode 100644 index 1069e1a..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic2.3.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.1.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.1.jpg deleted file mode 100644 index 0c00ddd..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.2.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.2.jpg deleted file mode 100644 index d488e43..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.3.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.3.jpg deleted file mode 100644 index 2ea916c..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.3.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.4.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.4.jpg deleted file mode 100644 index 24db305..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.4.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.5.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.5.jpg deleted file mode 100644 index d2ff304..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.5.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.6.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.6.jpg deleted file mode 100644 index 0ab07d0..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.6.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.7.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.7.jpg deleted file mode 100644 index 44ca494..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.7.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.8.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic3.8.jpg deleted file mode 100644 index 855353b..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic3.8.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic4.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic4.jpg deleted file mode 100644 index 4aab71d..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic4.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic5.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic5.jpg deleted file mode 100644 index 07a60de..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic5.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic6.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic6.jpg deleted file mode 100644 index 48c6606..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic6.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic7.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic7.jpg deleted file mode 100644 index 58b8bdf..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic7.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/Pic8.jpg b/kpov_judge/tasks/ldap_search/howtos/en/Pic8.jpg deleted file mode 100644 index c9d053e..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/en/Pic8.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/en/index.html b/kpov_judge/tasks/ldap_search/howtos/en/index.html deleted file mode 100644 index 31bb1e9..0000000 --- a/kpov_judge/tasks/ldap_search/howtos/en/index.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - ldap_search - - - - -

ldap_search

-

Purpose of the exercise

-

How to setup a LDAP Server, to add entries to a LDAP Server, and to change users' rights to be able to add entries and change the attributes of entries.

- -

How To

- -
    -
  1. Create two virtual machines, SimpleArbiterDhcpGWLDAP(simpleArbiterDhcpGWLDAP.vdi) and LDAPServer(student-LDAPServer.vdi). -
    No img
  2. -
    -
  3. Change the network settings to both virtual machines. SimpleArbiterDhcpGWLDAP: Adapter 1 is set to "NAT" for internet access and - adapter 2 to "internal network" for local network. LDAPServer: Adapter 1 set to "internal network" sot that it is in the same internal network as SimpleArbiterDhcpGWLDAP. -
    No img -
    No img -
    No img
  4. -
    -
  5. In SimpleArbiterDhcpGWLDAP log in as user "tester", in LDAPServer log in as user "root", run the command "apt-get update" to update the list of packages and - open up another terminal by pressing "ALT+F2" and log in as user "student".
  6. -
    -
  7. In LDAPServer run the command "apt-get install slapd ldap-utils" to install these packages which are the LDAP server and tools to access and manage the LDAP server. -
    During the LDAP server installation you'll have to provide the password for the user "admin", the administrator of the server and confirm the password chosen.
  8. -
    -
  9. Configure the LDAP server by choosing the appropriate domain name and other configuration parameters. Execute the commmand "dpkg-reconfigure slapd". -
    No img -
    No img -
    No img -
    No img -
    No img -
    No img -
    No img -
    No img -
    a) If you will configure the "slapd" again don't forget to remove the old database "rm -rf /var/backups/unknown-2.4.44+dfsg-2.ldapdb".
  10. -
    -
  11. Now that the LDAP server is configured for use, try to open a third console and log in as user "student" and execute the command "ldapsearch -D cn=admin,dc=ceres-20,dc=kpov, - dc=lusy,dc=fri,dc=uni-lj,dc=si -W -b dc=ceres-20,dc=kpov,dc=lusy,dc=fri,dc=uni-lj,dc=si", which will show the entries in the server. -
    Because you will be using a lot the domain name to access the LDAP server you can set the environment variable "D", which will allow for quicker typing of commands. -
    "export D=dc=ceres-20,dc=kpov,dc=lusy,dc=fri,dc=uni-lj,dc=si" -
    "ldapsearch -D cn=admin,$D -wvaje -b $D"
  12. -
    -
  13. Create the file(LDIF format) "users.ldif" which will contain the objects(users) that we want to add to the LDAP server database. -
    No img -
    Execute the following command to add users to the LDAP server: -
    "ldapadd -D cn=admin,$D -wvaje -f users.ldif" -
    Add password to the users added to the LDAP server: -
    "ldappasswd -D cn=admin,$D -wvaje -sj2531e cn=ninavidmar,ou=users,$D" -
    "ldappasswd -D cn=admin,$D -wvaje -scTyRM0 cn=natalijaribnikar39,ou=users,$D" -
    Execute command "ldapsearch -D cn=natalijaribnikar39,ou=users,$D -wcTyRM0 -b $D" to bind to the LDAP server with the newly added user "natalijaribnikar39" and to see the entries currently in the LDAP server. -
    No img
  14. -
    -
  15. In order to change the users' rights settings, which allows a user to add entries to the directory and change values of attributes of entries in the directory you need to create an additional file acl.ldif: -
    To see which backend database is used and other settings related to the users' rights execute command "ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config" as root user in the system, which does not need the user authentication to the LDAP server. -
    No img -
    The settings in the acl.ldif file: -
    No img -
    Now to change users' rights run the command "ldapmodify -Y EXTERNAL -H ldapi:/// -f acl.ldif" as user "root" in the system.
  16. -
    -
  17. The user "natalijaribnikar39" has the right to add or change objects in the LDAP server. -
    Now try to bind to the LDAP server using "natalijaribnikar39" user's credentials and add a new user to the server directory. -
    "ldapadd -D cn=natalijaribnikar39,ou=users,$D -wcTyRM0 -f newuser.ldif"
  18. -
    -
  19. Now to test your result go to the SimpleArbiterDhcpGWLDAP virtual machine and run "./test_task.py" to run the test and see your score. -
    No img
  20. - -
- - diff --git a/kpov_judge/tasks/ldap_search/howtos/images/1.png b/kpov_judge/tasks/ldap_search/howtos/images/1.png deleted file mode 100644 index f4edca8..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/1.png and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/2.png b/kpov_judge/tasks/ldap_search/howtos/images/2.png deleted file mode 100644 index 4d4ebb5..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/2.png and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic1.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic1.jpg deleted file mode 100644 index fecb706..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic2.1.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic2.1.jpg deleted file mode 100644 index 085f1cc..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic2.1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic2.2.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic2.2.jpg deleted file mode 100644 index cb9975c..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic2.2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic2.3.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic2.3.jpg deleted file mode 100644 index 1069e1a..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic2.3.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.1.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.1.jpg deleted file mode 100644 index 0c00ddd..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.2.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.2.jpg deleted file mode 100644 index d488e43..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.3.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.3.jpg deleted file mode 100644 index 2ea916c..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.3.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.4.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.4.jpg deleted file mode 100644 index 24db305..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.4.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.5.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.5.jpg deleted file mode 100644 index d2ff304..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.5.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.6.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.6.jpg deleted file mode 100644 index 0ab07d0..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.6.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.7.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.7.jpg deleted file mode 100644 index 44ca494..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.7.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.8.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic3.8.jpg deleted file mode 100644 index 855353b..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic3.8.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic4.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic4.jpg deleted file mode 100644 index 4aab71d..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic4.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic5.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic5.jpg deleted file mode 100644 index 07a60de..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic5.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic6.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic6.jpg deleted file mode 100644 index 48c6606..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic6.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic7.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic7.jpg deleted file mode 100644 index 58b8bdf..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic7.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/images/Pic8.jpg b/kpov_judge/tasks/ldap_search/howtos/images/Pic8.jpg deleted file mode 100644 index c9d053e..0000000 Binary files a/kpov_judge/tasks/ldap_search/howtos/images/Pic8.jpg and /dev/null differ diff --git a/kpov_judge/tasks/ldap_search/howtos/si/index.html b/kpov_judge/tasks/ldap_search/howtos/si/index.html deleted file mode 100644 index 7370099..0000000 --- a/kpov_judge/tasks/ldap_search/howtos/si/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -

Naloga: ldap search

-

-

Povzetek naloge

-Ustvari 2 virtualna sistema SimpleArbiterDhcp ter LDAPServer ter se s SimpleArbiterDhcp povezi na LDAP server na drugem virtualnem sistemu. Ustvari uporabnika. -

-

-

Navodila

- 1. Prenesite disk SimpleArbiterDhcp preko imenika s diski virtualnih naprav. - 2. V Virtualbox ustvarite nov racunalnik SimpleArbiterDhcp in uporabite prenešen disk.(Slika 1) - 3. Prav tako naredi drugi virtualni sistem poimenovan LDAPServer. - 4. Na oba sistema se prijavi kot uporabnik "root" z geslom "kaboom". - 5. Na sistemi LDAPServer namesti LDAP z ukazom 'apt-get install ldap-utils.(Slika 2) - 6. Po prenosu vkljucite LDAP server. - 7. S sistema SimpleArbiterDhcp se povezi na LDAP streznik na sistemu LDAPServer. - 8. Ustvari uporabnika na LDAP serverju. -

- - diff --git a/kpov_judge/tasks/ldap_search/task.py b/kpov_judge/tasks/ldap_search/task.py deleted file mode 100644 index 29117db..0000000 --- a/kpov_judge/tasks/ldap_search/task.py +++ /dev/null @@ -1,210 +0,0 @@ -# kpov_util 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': '''\ -

-Ustvari dva navidezna računalnika: SimpleArbiter in LDAPServer. - -

-Na LDAPServer namesti strežnik LDAP. Strežnik naj skrbi za domeno - -

DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-V imeniku ustvari uporabnika - -

CN={{LDAP_USERNAME}},ou=users,DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-z geslom {{LDAP_PASSWORD}} in uporabnika - -

CN={{BIND_USERNAME}},ou=users,DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-z geslom {{BIND_PASSWORD}}. - -

-Poskrbi, da se bo lahko klient s SimpleArbiter povezal na LDAP strežnik na LDAPServer. -V primeru, da se klient poveže kot {{BIND_USERNAME}} z geslom {{BIND_PASSWORD}}, -naj strežnik omogoči spreminjanje podatkov za objekt - -

CN={{LDAP_USERNAME}},ou=users,DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-ter ustvarjanje novih objektov v - -

DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
-
-CN = Common Name
-O = Organization
-OU = Organizational Unit
-DC = Domain Component
-
-''', - 'en': '''\ -

-Create two virtual machines: SimpleArbiter and LDAPServer. - -

-Set up an LDAP server on LDAPServer. Make it responsible for - -

DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-Create a user - -

CN={{LDAP_USERNAME}},ou=users,DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-with the password {{LDAP_PASSWORD}}, and a user - -

CN={{BIND_USERNAME}},ou=users,DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-with the password {{LDAP_PASSWORD}} . - -

-Make sure that a client from SimpleArbiter can connect to the LDAP server on LDAPServer. If the client identifies themself as {{BIND_USERNAME}} with the password {{BIND_PASSWORD}}, allow it to change data for the object - -

CN={{LDAP_USERNAME}},ou=users,DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
- -

-and to create objects in - -

DC={{DOMAIN}},DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si
-
-CN = Common Name
-O = Organization
-OU = Organizational Unit
-DC = Domain Component
-
-''', -} - -computers = { - 'LDAPServer': { - 'disks': [ - { 'name': 'student-LDAPServer', - }, - #{ 'name': 'CDROM', - # 'options':{'readonly': True}, - # 'parts': [],# no parts, no mounting. - #} - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGWLDAP', - # 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_IP': {'descriptions': {'si': 'IP strežnika', 'en': 'Server IP'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'DOMAIN': {'descriptions': {'si': 'Domena (poddomena kpov.lusy.fri.uni-lj.si)', 'en': 'Domain (subdomain of kpov.lusy.fri.uni-lj.si)'}, 'w': False, 'public':True, 'type': 'username', 'generated': True}, - 'LDAP_USERNAME': {'descriptions': {'si': 'Uporabniško ime v LDAP', 'en': 'Username in LDAP'}, 'w': False, 'public':True, 'type': 'username', 'generated': True}, - 'LDAP_PASSWORD': {'descriptions': {'si': 'Geslo v LDAP', 'en': 'LDAP password'}, 'w': False, 'public':True, 'type': 'password', 'generated': True}, - 'BIND_USERNAME': {'descriptions': {'si': 'Uporabniško ime za dostop do LDAP (bind)', 'en': 'Bind username in LDAP'}, 'w': False, 'public':True, 'type': 'username', 'generated': True}, - 'BIND_PASSWORD': {'descriptions': {'si': 'Geslo za dostop do LDAP (bind)', 'en': 'Bind password in LDAP'}, 'w': False, 'public':True, 'type': 'password', 'generated': True}, -} - -def task(LDAP_IP, DOMAIN, LDAP_USERNAME, LDAP_PASSWORD, BIND_USERNAME, BIND_PASSWORD): - from pexpect import pxssh - import pexpect - results = dict() - FULLDOMAIN = "dc={DOMAIN},dc=kpov,dc=lusy,dc=fri,dc=uni-lj,dc=si".format( - **locals()) - BIND_DN = "cn={BIND_USERNAME},ou=Users,{FULLDOMAIN}".format(**locals()) - s = "ldapsearch -D {BIND_DN} -b {FULLDOMAIN} -w {BIND_PASSWORD}\ - -h {LDAP_IP}".format( - **locals()) - results['ldapsearch_before'] = pexpect.run(s) - s = "ldapmodify -D {BIND_DN} -w {BIND_PASSWORD} -h {LDAP_IP}".format( - **locals()) - modify = pexpect.spawn(s) - FORTUNE = kpov_util.hostname_gen(random.Random(str(LDAP_USERNAME))) - results['fortune'] = FORTUNE - s1 = """ -dn: cn={LDAP_USERNAME},ou=Users,{FULLDOMAIN} -changetype: modify -replace: description -description: {FORTUNE} -""".format(**locals()) - modify.write(s1) - modify.sendeof() - modify.expect(pexpect.EOF) - results['modify'] = modify.before - s = "ldapsearch -D {BIND_DN} -b {FULLDOMAIN} -w {BIND_PASSWORD}\ - -h {LDAP_IP}".format(**locals()) - results['ldapsearch_after'] = pexpect.run(s) - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - params['DOMAIN'] = kpov_util.hostname_gen(r) - params['LDAP_USERNAME'] = kpov_util.username_gen(r) - params['LDAP_PASSWORD'] = kpov_util.alnum_gen(r, 6) - params['BIND_USERNAME'] = kpov_util.username_gen(r) - params['BIND_PASSWORD'] = kpov_util.alnum_gen(r, 6) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - s = """.*dn: dc={DOMAIN},dc=kpov,dc=lusy,dc=fri,dc=uni-lj,dc=si\r[^#]* -objectClass: top\r -objectClass: dcObject\r -objectClass: organization\r -.*""".format(**params) -#dc: {DOMAIN}\r - if re.match(s, results['ldapsearch_before'], re.DOTALL): - score += 2 - else: - hints += ["domain missing in ldapsearch result"] - s = ".*cn: {}.*".format(re.escape(params['LDAP_USERNAME'])) - if re.search(s, results['ldapsearch_before']): - score += 2 - else: - hints += ["LDAP_USERNAME missing in: " + s + str(results['ldapsearch_before'])] - fortune = kpov_util.hostname_gen(random.Random(str(params['LDAP_USERNAME']))) - s = ".*cn: {0}.*description: {1}.*".format( - re.escape(params['LDAP_USERNAME']), re.escape(fortune)) - if re.match(s, results['ldapsearch_after'], re.DOTALL): - score += 2 - else: - hints += ["description missing after update:" + fortune + "\n" + s + str(results['modify']) + str(results['ldapsearch_after'])] - if results['ldapsearch_before'][:100] == results['ldapsearch_after'][:100]: - score += 2 - else: - hints += ["ldapsearch before equals after. This should not happen."] - s = '.*\r\nmodifying entry "cn={LDAP_USERNAME},ou=Users,dc={DOMAIN},dc=kpov,dc=lusy,dc=fri,dc=uni-lj,dc=si".*'.format( - **params) - if re.match(s, results['modify'], re.DOTALL): - score += 2 - else: - hints += ['Modify error' + s + str(results['modify'])] - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcpGWLDAP'], global_params) diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/en/index.html b/kpov_judge/tasks/mock_entrance_exam/howtos/en/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface1.jpg b/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface1.jpg deleted file mode 100644 index 8953de7..0000000 Binary files a/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface2.jpg b/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface2.jpg deleted file mode 100644 index 4eeb5e0..0000000 Binary files a/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter-interface2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter.jpg b/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter.jpg deleted file mode 100644 index 4df497e..0000000 Binary files a/kpov_judge/tasks/mock_entrance_exam/howtos/images/SimpleArbiter.jpg and /dev/null differ diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface1.jpg b/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface1.jpg deleted file mode 100644 index 3174913..0000000 Binary files a/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface2.jpg b/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface2.jpg deleted file mode 100644 index 5679dae..0000000 Binary files a/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance-interface2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance.jpg b/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance.jpg deleted file mode 100644 index 4df497e..0000000 Binary files a/kpov_judge/tasks/mock_entrance_exam/howtos/images/student-entrance.jpg and /dev/null differ diff --git a/kpov_judge/tasks/mock_entrance_exam/howtos/si/index.html b/kpov_judge/tasks/mock_entrance_exam/howtos/si/index.html deleted file mode 100644 index f10bcf1..0000000 --- a/kpov_judge/tasks/mock_entrance_exam/howtos/si/index.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Preparation_mock_entrance_exam_HowTo - - -

MOCK ENTRANCE EXAM - HOWTO

- -

1) POSTAVITEV VIRTUALK

- -Najprej prenesi obe sliki za virtualki iz sistema kpov-judge, 2. naloga. Če se sliki ne naložita takoj, malo počakaj in osveži stran. -Ustvari novo virtualko imenovano "Student", tip je načeloma "Linux" ter verzija "Ubuntu (64-bit)" - lahko pa je tudi karkoli drugega. Določi ustrezno količino pomnilnika, ki bo na voljo napravi, izberi možnost rabe obstoječe slike navidezne naprave ter izberi prenešeno datoteko "student-entrance.vdi". Klikni ustvari.
ni slike
-Prejšnji postopek ponovi še za "SimpleArbiter", "Linux", "Ubuntu (64-bit)", "simplearbiter.vdi".
ni slike
- -

2) OMREŽNE NASTAVITVE VIRTUALK

- -V navodilih naloge lahko vidimo, da morata biti obe virtualki povezani v internet ter povezani med seboj prek nekega notranjega omrežja. -Na "SimpleArbiter" nastavimo pod Settings->Network->Adapter 1; Enable network adapter "check", Attached to: NAT. ->Adapter 2; Enable network adapter "check", Atached to: Internal Network.
ni slike ni slike
-Na "Student" je postopek nastavitve enak kot na "SimpleArbiter".
ni slike ni slike
- -OPOMBA: Pozoren je treba biti, da sta oba vmesnika, ki sta povezana na notranje omrežje (Internal Nerwork) povezana preko istega omrežja, npr. "intnet". - -

3) ZAGON VIRTUALK IN POSOTPEK NALOGE

- -SA - SimpleArbiter -STUD - Student - -Najprej zaženemo obe vritualki, to storimo s klikom na gumb start. -Na SA se prijavimo z uporabniškim imenom "tester" ter geslom "tester" - -

3.1) POSKRBIMO ZA MREŽO

- -

3.1.1) SPREMEMGA GESLA ZA ROOT

- -Z uporabo ukaza /sbin/ifconfig preverimo, ali so vmesniki pravilno nastavljeni. Kaj kmalu ugotovimo, da je na SA aktiven samo en vmesnik. Za nastavljanje omesnikov moramo najprej postati "root", torej uporabnik, ki ima pooblastila za urejanje sistemskih nastavitev. -Najprej ponovno zaženemo virtualko: "sudo reboot", potrdimo z geslom "tester". -V GRUB meniju (zagonski meni) nato pritisnemo tipko "e", ki omogoča spreminjanje ukazov pred zagonom. Vrstico "53d ro" spremenimo v "53d rw init=/bin/bash". Pritisnemo "F10" in sprožimo zagon naprave. -Sedaj lahko kot super uporabnik zamenjaš geslo za root, to storiš z ukazom "passwd", sistem te nato vpraša za novo geslo, po vnosu pa še za potrditev gesla. Geslo je uspešno spremenjeno, spremembe pa je potrebno še shraniti na disk, to storiš z ukazom "mount -o remount,ro /", izvedi še ukaz "sync", da se podatki res zapišejo na disk. Sedaj lahko virtualko ponovno zaženeš kar iz Machine->Reset. - -

3.1.2) NASTAVIMO OMREŽNE VMESNIKE

- -V virtualko SA se sedaj prijavimo kot uporabnik "root" ter s spremenjenim geslom "karsinastavil". -Sedaj spremenimo nastavitve omrežnih vmesnikov tako, da bodo naslovi ustrezali tistim v navodilih. Izvedemo ukaz "ifconfig enp0s8 10.0.2.129 netmask 255.255.255.128 up" -Preklopimo na virtualko STUD (uporabnik "root", geslo "kaboom") ter izvedemo podoben ukaz "ifconfig enp0s8 10.0.2.X netmassk 255.255.255.128", kjer je X podatek iz navodil naloge. -Notranje omrežje testiramo tako, da pošljemo ping iz SA do STUD z ukazom "ping NASLOV", kjer je NASLOV omrežni naslov na STUD, ki je povezan na notranje omrežje (nastavitev iz prejšnjega koraka). -SUPER, omrežje deluje, gremo naprej. Če ne deluje, preveri pravilnost naslovov na SA in STUD, bodi pozoren na dolžino maske ter na morebitne zatipke. - -

3.2) "ZLONAMERNI" PROGRAM

- -V navodilih naloge je podano ime programa, ki naj bi ob svojem zagonu pokvaril nastavitve omrežnih vmesnikov na STUD. Z ukazom "ps xa | grep IMEPROGRAMA" preverimo, če se program izvaja. V izpisu ugotovimo, da se najvrjetneje ne izvaja, zato lahko zadevo ignoriramo. Če bi se program izvajal, bi bilo potrebno ukrepati ter ga na nek način izbrisati oz. mu onemogočiti spreminjanje omrežnih vmesnikov (najlažje bi bilo uporabiti ukaz "kill", ki kot argument prejme PID (prvi stolpec prejšnjega izpisa) ter konča izvajanje tega procesa). Več o ukazu "kill" si preberi na spletu! - -

3.3) PREVAJANJE PROGRAMA

- -Najprej si odpremo novo konzolo na STUD "alt+F2" ter se prijavimo kot "student" z geslom "vaje". -Z ukazom "ls" preverimo vsebino domačega direktorija uporabnika student. Izpisati bi se morala datoteka, ki jo imamo podano v navodilih. To datoteko moramo najprej odpreti z ukazom "vim IMEDATOTEKE". Datoteko moramo sedaj popraviti tako, da odstranimo odvečne črke, to storimo tako, da izvedemo ukaz ":%s/[QXW]*//g", sedaj izvedemo še ":syn on" in si obarvamo kodo. Izhod iz urejevalnika ":wq". -Ta program sedaj z ukazom "gcc IMEPREVEDENEGAPROGRAMA IMEDATOTEKE" prevedemo v nov program, kjer je IMEPREVEDENEGAPROGRAMA izhodni program, katerega ime je prav tako podano v navodilih, IMEDATOTEKE pa ime pravkar popravljene datoteke. - -

3.4) SKRIPTA

- -Sedaj bomo napisali nov program/skripto, uporabimo urejevalnik nano; "nano IMESKRIPTE", kjer je IMESKRIPTE podano v navodilih naloge. -V skripto zapišemo sledeče;
-
-----BREZ TE VRSTICE-------
-
-#!/bin/bash
-
-echo -n $SPREMENLJIVKA | /home/student/IMEPREVEDENEGAPROGRAMA "argument" 2> /home/student/IMEDATOTEKE_STDERR | grep "ma" > /home/student/IMEDATOTEKE_STDOUT
-
-----BREZ TE VRSTICE-------
-
-Datoteko shranimo "ctrl+x" ter potrdimo z "y" in enter. -Datoteko sedaj spremenimo v program "chmod +x IMESKRIPTE" - -

4) TESTIRANJE NALOGE

- -Preklopimo nazaj na SA ter odpremo novo konzolo "alt+F2", vpišemo se kot uporabnik "tester" z geslom "tester" in poženemo program "./test_task.py" -Izpolnimo vsa polja; URL "https://kpov.fri.uni-lj.si/kpov_judge/tasks", vpišemo svoje uporabniško ime in geslo (za dostop do KPOV-JUDGE preko učilnice) npr. "jn1234@student.uni-lj.si geslozaucilnico", ime naloge "02-preparation-mock_entrance_exam". Sedaj se pojavijo še vaši vhodni in izhodni podatki za nalogo, preverite, če so pravilni; datoteka z izhodom, IP naslov SA, ime spremenljivke, ime "zlonamernega" programa, datoteka z napakami ter neko naljučno seme itd. -Če program vrne 10 OK je naloga uspešno opravljena, sicer pa vrne število doseženih točk ter napako. -
- - diff --git a/kpov_judge/tasks/mock_entrance_exam/task.py b/kpov_judge/tasks/mock_entrance_exam/task.py deleted file mode 100644 index ad51c2a..0000000 --- a/kpov_judge/tasks/mock_entrance_exam/task.py +++ /dev/null @@ -1,313 +0,0 @@ -# TODO: -# - check if everything is filled in (computers, params, preparation) -# - improve scoring -# - test -# - switch to a real SSH/SFTP client to properly handle filenames - -instructions = { - 'si': '''\ -

-Postavite dva navidezna računalnika - SimpleArbiter in Student. Oba naj bosta povezana na internet. Poleg tega mora biti Student na naslovu {{student_IP}} dostopen s SimpleArbiter. - -

-Računajte, da se na Student ob zagonu zažene program {{net_prog_name}}, ki vam spreminja nastavitve mrežne kartice. - -

-V domačem imeniku uporabnika student obstaja program {{P_c}} v programskem jeziku C. -Prevedite ga v program z imenom {{P_executable}}. Izvorna koda je namenoma pokvarjena tako, da so vanjo vrinjeni nepotrebni znaki. Pred prevajanjem jo morate popraviti. - -

-Napišite skripto ali program {{P_script}} v domačem imeniku uporabnika student, ki: - -

    -
  • požene {{P_executable}} z argumentom "{{arg_c}}" in mu na standardni vhod pripelje vrednost spremenljivke {{env_c}}; -
  • vse, kar {{P_executable}} izpiše na stderr, spravi v datoteko {{out_stderr_c}}; in -
  • vse vrstice, ki jih {{P_executable}} izpiše na stdout in vsebujejo zaporedje znakov ma, zapiše v {{out_stdout_c}}. -
- -

-Lastnik vseh ustvarjenih datotek mora biti uporabnik student. Gesla uporabnika student (vaje) ne smete spreminjati. -''', - 'en': '''\ -

-Set up two virtual machines - SimpleArbiter and Student. Both should be connected to the internet. Student should also be accessible from SimpleArbiter at the address {{student_IP}}. - -

-Keep in mind that a program called {{net_prog_name}} starts on Student on each boot. This program may change your network settings. - -

-There is a program called {{P_c}} in student’s home directory. Compile it into a program called {{P_executable}}. The source code is intentionally broken so that unneccessarry characters are inserted into the file. You have to fix the file before compiling. - -

-Also, write a script or program called {{P_script}} in student’s home directory. The script should: - -

    -
  • run {{P_executable}} with the argument {{arg_c}} and pipe the value of the environment variable {{env_c}} into {{P_executable}}’s standard input; -
  • redirect stderr of {{P_executable}} into a file called {{out_stderr_c}}; and -
  • save each line which {{P_executable}} outputs and which contains the character sequence ma into {{out_stdout_c}}. -
- -

-The owner of all created files should be student. You are not allowed to change student’s password (vaje). -''', -} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiter', - }, - ], - 'network_interfaces': [ - {'network': 'net1'}, - {'network': 'net2'}, - ], - 'flavor': 'm1.tiny', - 'config_drive': True, - }, - 'Student': { - 'disks': [ - {'name': 'student-entrance'} - ], - 'flavor': 'm1.tiny', - 'network_interfaces': [{'network': 'net1'}, {'network': 'net3'}], - 'config_drive': True, - } -} - -networks = { - 'net1': { - 'public': False, - }, - 'net2': { - 'public': True, - }, - 'net3': { - 'public': True, - } -} - -params_meta = { - 'student_IP': { - 'descriptions': { 'si': 'IP naslov SimpleStudent', 'en': 'IP address of SimpleStudent', - }, 'w': False, 'public': True, 'type': 'IP', 'generated': True, - }, - 'net_prog_name': { - 'descriptions': { 'si': 'Ime programa, ki ponastalvlja naslov', 'en': 'The name of the program resetting the network' - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'P_c': { - 'descriptions': { 'si': 'Datoteka s programom v C', 'en': 'Filename of the program in C', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'P_executable': { 'descriptions': { 'si': 'Ime prevedenega programa v C', 'en': 'Filename of the compiled C program' - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'arg_c': { - 'descriptions': { 'si': 'Vrednost argumenta', 'en': 'Argument value', - }, 'w': False, 'public': True, 'type': 'short_text', 'generated': True, - }, - 'env_c': { - 'descriptions': { 'si': 'Ime okoljske spremenljivke', 'en': 'The name of the environment environment', - }, 'w': False, 'public': True, 'type': 'short_text', 'generated': True, - }, - 'out_stderr_c': { - 'descriptions': { 'si': 'Datoteka z napakami', 'en': 'File to store errors', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'P_script': { - 'descriptions': { 'si': 'Ime skripte', 'en': 'Filename of the script', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'out_stdout_c': { - 'descriptions': { 'si': 'Datoteka z izhodom', 'en': 'File to store the output', - }, 'w': False, 'public': True, 'type': 'filename', 'generated': True, - }, - 'param_gen_seed': { - 'descriptions': { 'si': 'Nakljucno seme', 'en': 'Random seed', - }, 'w': False, 'public': True, 'type': None, 'generated': True, - }, - 'c_destroy_gen_seed': { - 'descriptions': { 'si': 'Nakljucno seme za kvarjenje kode v C', 'en': 'Random seed for destroying the C code', - }, 'w': False, 'public': False, 'type': None, 'generated': True, - } - -} - -def task(student_IP, net_prog_name, - P_c, P_executable, arg_c, env_c, out_stderr_c, out_stdout_c, P_script, - param_gen_seed): - import random - - r = random.Random(int(param_gen_seed)) - env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(11)]) - arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(13)]) - stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(17)]) - - return kpov_util.ssh_test(student_IP, 'student', 'vaje', ( - ('script_ls', 'ls -l {}'.format(P_script)), - ('executable_ls', 'ls -l {}'.format(P_executable)), - ('script_run', 'export {}={}; {}'.format(env_c, env_val, P_script)), - ('script_stderr', 'cat {}'.format(out_stderr_c)), - ('script_stdout', 'cat {}'.format(out_stdout_c)), - ('prog_stdout', 'echo "{}" | {} "{}" 2> /dev/null'.format(stdin_val, P_executable, arg_val)), - ('prog_stderr', 'echo "{}" | {} "{}" > /dev/null'.format(stdin_val, P_executable, arg_val)), - )) - -def gen_params(user_id, params_meta): - import random - r = random.Random(user_id+'evil cornholio') - params = kpov_util.default_gen(user_id, params_meta) - homedir = '/home/student/' - params['env_c'] = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ') for i in range(5)]) - params['P_c'] = "".join([r.choice('abcdefghijklmnoprst') for i in range(5)]) + ".c" - params['param_gen_seed'] = str(r.randint(0, 2**24)) - params['c_destroy_gen_seed'] = str(r.randint(0, 2**24)) - dest_net = kpov_util.IPv4_subnet_gen(r, '10.0.2.128/26', 26) - params['student_IP'] = kpov_util.IPv4_addr_gen(r, dest_net)[0] - for k in ['P_c', 'P_executable', 'out_stderr_c', 'P_script', 'out_stdout_c']: - params[k] = homedir + params[k] - return params - -def task_check(results, params): - import os - def test_out_gen(arg, var): - s_out = "" - s_err = "" - r = 0 - arg_len = len(arg) - env_len = len(var) - for i in range(100): - s_out += chr(32 + ((ord(arg[i % arg_len]) ^ ord(var[i % env_len])) % 64)) - r += ord(arg[i % arg_len]) + ord(var[i % env_len]) + i; - if (i % 17 == 0): - s_out += "RAUS\r\n"; - if (i % 29 == 0): - s_out += 'ma' - s_err += chr((r % 31) + ord('A')); - if (i % 23 == 0): - s_err += "PATACIS\r\n" - retval = r % 16 - s_err += '\r\n' - s_out += '\r\n' - return(s_out, s_err, retval) - score = 0 - hints = [] - if results['ssh'] is not True: - hints += ['ssh failed: ' + results['ssh']] - r = random.Random(int(params['param_gen_seed'])) - env_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(11)]) - arg_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(13)]) - stdin_val = "".join([r.choice('ABCDEFGHIJKLMNPRSTUVZ012345') for i in range(17)]) - expected_script_stdout, expected_script_stderr, rval = test_out_gen( - params['arg_c'], env_val - ) - expected_script_stderr = 'cat {}\r\n'.format(params['out_stderr_c']) + expected_script_stderr - # hints += [expected_script_stderr, results['script_run'], results['script_stderr'], params['arg_c'], env_val] - if expected_script_stderr != results['script_stderr']: - hints += ['wrong script stderr'] - else: - score += 2 - split_stdout = expected_script_stdout.split('\r\n') - expected_script_stdout = "\r\n".join([ i for i in split_stdout if i.find('ma') >= 0]) - expected_script_stdout = 'cat {}\r\n'.format(params['out_stdout_c']) + expected_script_stdout + "\r\n" - if expected_script_stdout != results['script_stdout']: - hints += ['wrong script stdout'] - else: - score += 2 - expected_prog_stdout, expected_prog_stderr, rval = test_out_gen( - arg_val, stdin_val - ) - if expected_prog_stderr != results['prog_stderr'][-len(expected_prog_stderr):]: - hints += ['wrong program stderr'] - else: - score += 2 - if expected_prog_stdout != results['prog_stdout'][-len(expected_prog_stdout):]: - hints += ['wrong program stdout'] - else: - score += 2 - if results['script_ls'].find('-r') < 0: - hints += ['script not found'] - else: - score += 1 - if results['executable_ls'].find('xr') < 0: - hints += ['C executable not found'] - else: - score += 1 - return score, hints - -def prepare_disks(templates, task_params, global_params): - c_source = '''#include -#include -#include -/* Odstranite vse odvecne velike crke Q, W ali X in program se bo prevedel. */ - -int main(int argc, char **argv){ - unsigned char *arg; - unsigned char var[255]; - int i, arg_len, env_len, r; - scanf("%s", var); - arg = argv[1]; - arg_len = strlen(argv[1]); - env_len = strlen(var); - r = 0; - for (i = 0; i<100; i++){ - printf("%c", 32 + (arg[i % arg_len] ^ var[i % env_len]) % 64); - r += (int)arg[i % arg_len] + (int)var[i % env_len] + i; - if (i % 17 == 0){ - printf("RAUS\\n"); - } - if (i % 29 == 0){ - printf("ma"); - } - fprintf(stderr, "%c", (r % 31) + 'A'); - if (i % 23 == 0){ - fprintf(stderr, "PATACIS\\n"); - } - } - printf("\\n"); - fprintf(stderr, "\\n"); - return r % 16; -} -''' - evil_shell_source = """#!/bin/bash -e - -while true; do - /sbin/ifconfig eth1 10.0.4.19 2> /dev/null; - /sbin/ifconfig eth0 10.0.4.20 2> /dev/null; - /sbin/ifconfig eth2 10.0.4.21 2> /dev/null; - /sbin/ifconfig en0p3 10.0.4.19 2> /dev/null; - /sbin/ifconfig en0p8 10.0.4.20 2> /dev/null; - /sbin/ifconfig enp0s3 10.0.4.21 2> /dev/null; - /sbin/ifconfig enp0s8 10.0.4.21 2> /dev/null; - sleep 10; -done; -""" - import random - d = templates['student-entrance'] - r = random.Random(task_params['c_destroy_gen_seed']) - destroyed_c_source = c_source[:110] - for c in c_source[110:]: - i = r.randint(0, 5) - if i == 1: - destroyed_c_source += 'QW' - if i == 2: - destroyed_c_source += 'XW' - if i == 3: - destroyed_c_source += 'QX' - destroyed_c_source += c - d.write(task_params['P_c'], destroyed_c_source) - d.chown(1000, 1000, task_params['P_c']) - sh_path = r.choice(['/usr/share/doc', '/var/lib', '/usr/local/share', '/etc/alternatives']) - sh_file = sh_path + '/' + task_params['net_prog_name'] - d.write(sh_file, evil_shell_source) - d.chmod(0o775, sh_file) - d.write("/etc/rc.local", """#!/bin/sh -e -export PATH=$PATH:{} -nohup {} & - -exit 0 -""".format(sh_path, task_params['net_prog_name'])) - - write_default_config(templates['simpleArbiter'], global_params) diff --git a/kpov_judge/tasks/nat_port_forward/task.py b/kpov_judge/tasks/nat_port_forward/task.py deleted file mode 100644 index 80d2e47..0000000 --- a/kpov_judge/tasks/nat_port_forward/task.py +++ /dev/null @@ -1,172 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

Postavi tri računalnike - SimpleArbiter z diska simpleArbiter, TestClient z diska testClient in NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo
-povezan na omrežje, od koder bo imel dostop do Interneta, z drugim pa na SimpleArbiter. TestClient naj bo povezan na isto omrežje z dostopom do Interneta kot NATServer.
-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 ter vpiši IP_TEST_CLIENT. Poskrbi, da
-bo omrežje med SimpleArbiter in NATServer na področju NET. Nato poskrbi, da se
-bo TCP promet z omrežja z dostopom do Interneta na vrata PORT_OUTER prepošiljal na SimpleArbiter na vrata PORT_INNER.
""" -} - -computers = { - 'TestClient': { - 'disks': [ - { 'name': 'maliNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'NATServer': { - 'disks': [ - { 'name': 'student-NATServer', - }, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiter', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'IP_TEST_CLIENT': {'descriptions': {'si': 'Naslov TestClient'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'IP_NAT': {'descriptions': {'si': 'Naslov NATServer, dostopen s TestClient'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'PORT_OUTER': {'descriptions': {'si': 'Zunanja vrata'}, 'w': False, 'public':True, 'type': 'port', 'generated': True}, - 'PORT_INNER': {'descriptions': {'si': 'Notranja vrata'}, 'w': False, 'public': True, 'type': 'port', 'generated': True}, - 'NET': {'descriptions': {'si': 'Področje naslovov med SimpleArbiter in TestClient'}, 'w': False, 'public': True, 'type': 'NET', 'generated': True}, -} - -def task(IP_TEST_CLIENT, IP_NAT, PORT_OUTER, PORT_INNER, NET): - import random - import time - import pexpect - from pexpect import pxssh - - results = dict() - tcpdump = pexpect.spawn('sudo /usr/sbin/tcpdump src host {} and dst port {}'.format(IP_TEST_CLIENT, PORT_INNER), encoding='utf-8') - sshconn = pxssh.pxssh(encoding='utf-8') - sshconn.login(IP_TEST_CLIENT, 'student', 'vaje') - r = random.Random() - k = r.randint(10, 15) - results['pre_nc'] = str(k) - results['nc_pre'] = "" - for i in range(k): - sshconn.sendline("nc {} {}".format(IP_NAT, PORT_OUTER)) - sshconn.sendline() - sshconn.sendintr() - sshconn.prompt() - results['nc_pre'] += sshconn.before - nc = pexpect.spawn('nc -l -p {}'.format(PORT_INNER), encoding='utf-8') - sshconn.sendline() - sshconn.prompt() - sshconn.sendline("nc {} {}".format(IP_NAT, PORT_OUTER)) - results['post_nc'] = "".join([r.choice("abcd\n") for i in range(100)]) - sshconn.sendline(results['post_nc']) - time.sleep(1) - sshconn.sendintr() - nc.expect(pexpect.EOF) - results['nc_ret'] = nc.before - results['route'] = pexpect.run('ip route list 0/0', encoding='utf-8') - results['traceroute'] = pexpect.run('traceroute {}'.format(IP_TEST_CLIENT), encoding='utf-8') - # wait for traceroute - time.sleep(10) - tcpdump.sendintr() - tcpdump.expect(pexpect.EOF) - results['tcpdump'] = tcpdump.before - sshconn.prompt() - results['nc_post'] = sshconn.before - sshconn.close() - # nc.expect(pexpect.EOF) - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - params['PORT_INNER'] = str(r.randint(6000, 10000)) - params['PORT_OUTER'] = str(r.randint(10001, 15000)) - params['NET'] = kpov_util.IPv4_subnet_gen(r, "10.36.0.0/14", 24) - return params - -def task_check(results, params): - import re - import pickle - score = 0 - hints = [] - local_net = params['NET'][:params['NET'].rfind('.')] - s = "default via ({}\\.[0-9]+)".format(re.escape(local_net)) - res = re.search(s, results['route']) - if res: - ip_nat_internal = res.groups(1)[0] - score += 1 - else: - ip_nat_internal = 'abrakadabra' - # print (s, results['route'],) - s = "traceroute to {ip_test} \\({ip_test}\\), 30 hops max, 60 byte packets\ -\r\n 1 {ip_nat} \\({ip_nat}\\) [0-9.]+ ms [0-9.]+ ms [0-9.]+ ms\ -.*{ip_test} \\({ip_test}\\)".format( - ip_nat = re.escape(ip_nat_internal), - ip_test = re.escape(params['IP_TEST_CLIENT']) - ) - if re.search(s, results['traceroute'], re.DOTALL): - score += 1 - else: - hints += [s + str(results['traceroute'])] - if len(results['post_nc']) == 100: - score += 1 - else: - hints += [str(results['post_nc']) + str(len(results['post_nc']))] - if results['nc_ret'] == (results['post_nc'] + '\n').replace('\n', '\r\n'): - score += 1 - else: - hints += ['wrong nc'] - s = "Connection refused" - res = re.findall(s, results['nc_pre']) - if len(res) >= 2: - score += 3 - else: - hints += [s + str(results['nc_pre'])] - s = "\r\n" - if re.search(s, results['nc_post']): - score += 1 - else: - hints += [s + str(results['nc_post'])] - rejected_count = int(results['pre_nc']) - accepted_count = results['nc_ret'].count('\r\n') - s = ".*verbose output suppressed.*listening on.*dropped by kernel.*" - if re.match(s, results['tcpdump'], re.DOTALL): - score += 1 - else: - hints += [s + str(results['tcpdump'])] - res = re.findall("length .*\r\n", results['tcpdump']) - total_len = 0 - n_empty = 0 - for i in res: - k = int(i[len("length "):].strip()) - total_len += k - if k == 0: - n_empty += 1 - # print total_len, rejected_count, n_empty - if total_len == 101 and rejected_count <= n_empty: - score += 1 - else: - hints += [s + str(results['tcpdump'])] - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiter'], global_params) diff --git a/kpov_judge/tasks/nat_vlc/howtos/en/index.html b/kpov_judge/tasks/nat_vlc/howtos/en/index.html deleted file mode 100644 index 6048647..0000000 --- a/kpov_judge/tasks/nat_vlc/howtos/en/index.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - -

NAT VLC:

-

Explanation:


- Set up a computer so that it forwards all packets meant for a certain address, to another computer.

-

Instructions:

-

1. Create two VMs. SimpleArbiter using the disk simpleArbiter and NATServer.

- You can get the disks at polz.si/media/uploads/kpov/virtualke. As for the NATServer VM, you can use any disk you want like base-student-desktop-2014. -
-

2. NATServer should have two network interfaces, one should connect to the simpleArbiter VM and the other to the internet.

- Adapter 1 should be NAT and adapter 2 should be Internal Network.
- Simple Arbiter must be connected to the Internal Network. -
- slika-1 -

3.On NATServer use ifconfig or /etc/network/interfaces to configure the network interfaces you created in virtualbox.

- - -vim /etc/network/interfaces
- -Set it up like this:
- auto eth1
- iface eth1 inet static
- NETMASK 255.255.0.0 # Specify based on your requirement
- IPADDR 192.168.2.1 # Gateway of the LAN
- NETWORK 192.168.0.0 # Optional
- ADDRESS 192.168.0.0
- -ifdown eth1
- -ifup eth1 -
-slika-2 -

4. Configure SimpleArbiter so that it uses NATServer as the default gateway.

- -

5. Set up DNS (etc/resolv.conf) on NATServer.

- vim /etc/resolv.conf - nameserver 203.145.184.13 # Primary DNS Server provided by the ISP
- nameserver 202.56.250.5 # Secondary DNS Server provided by the ISP
- Than we set up the host:
- vim /etc/hosts
- Replace the first line with:
- 127.0.0.1 nat localhost.localdomain localhost
- -

6. Enable IP forwarding on NATServerju (should be run as root).

- echo 1 > /proc/sys/net/ipv4/ip_forward - -

7. Set up NAT on NATServer using iptables.

- - apt-get install iptables
- iptables -F
- ptables -t nat -F
- iptables -t mangle -F
- iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- iptables -A FORWARD -i eth1 -j ACCEPT

- - service iptables restart - -

8. Use vlc on simpleArbiter to watch the video over your network.


- - -

8. Additional resources


--https://www.howtoforge.com/nat_iptables
--http://www.bctes.com/nat-linux-iptables.html
- - - - - - - - diff --git a/kpov_judge/tasks/nat_vlc/howtos/images/1.jpg b/kpov_judge/tasks/nat_vlc/howtos/images/1.jpg deleted file mode 100644 index adee258..0000000 Binary files a/kpov_judge/tasks/nat_vlc/howtos/images/1.jpg and /dev/null differ diff --git a/kpov_judge/tasks/nat_vlc/howtos/images/2.jpg b/kpov_judge/tasks/nat_vlc/howtos/images/2.jpg deleted file mode 100644 index f7868df..0000000 Binary files a/kpov_judge/tasks/nat_vlc/howtos/images/2.jpg and /dev/null differ diff --git a/kpov_judge/tasks/nat_vlc/howtos/si/index.html b/kpov_judge/tasks/nat_vlc/howtos/si/index.html deleted file mode 100644 index 779cd54..0000000 --- a/kpov_judge/tasks/nat_vlc/howtos/si/index.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - -

NAT VLC:

-

Naloga na hitro:


- Nastavi računalnik tako, da bo vse pakete za določene naslove prepošiljal na drug računalnik, vzpostavi NAT.

-

Navodila:

-

1. Postavi dva navidezna računalnika. SimpleArbiter z diskom simpleArbiter ter NATServer.

- Virtualke dobiš na (polz.si/media/uploads/kpov/virtualke). Za NATServer lahko uporabiš base-student-desktop-2014. -
-

2. Postavi NAT server tako, da ima dva omrežna vmesnika. Z enim naj bo povezan na simpleArbiter, z drugim pa na internet.

- (settings-Network) Adapter 1 nastavimo na NAT (omrežje), adapter 2 pa na InternalNetwork (lokalno).
- Simple Arbiter nastavimo na InternalNetwork(lokalno). -
- slika-1 -

3.Na NATServer z ukazom ifconfig in z datoteko /etc/network/interfaces skonfiguriraj omrežne vmesnike
- tako, da bo en povezan v WAN (internet) in en vmesnik na LAN (simpleArbiter).

- - -vim /etc/network/interfaces
- -dopišemo:
- auto eth1
- iface eth1 inet static
- NETMASK 255.255.0.0 # Specify based on your requirement
- IPADDR 192.168.2.1 # Gateway of the LAN
- NETWORK 192.168.0.0 # Optional
- ADDRESS 192.168.0.0
- -ifdown eth1
- -ifup eth1 -
-slika-2 -

4. SimpleArbiter skofiguriraj tako, da bo privzeti prehod uporabljal NATServer.

- Nastavi gateway, da ima IP od NATServerja.
- route add -net IP netmask MASK default gw IP dev eth0
- -

5. Nastavi DNS (etc/resolv.conf) na NATServerju.

- vim /etc/resolv.conf - nameserver 203.145.184.13 # Primary DNS Server provided by the ISP
- nameserver 202.56.250.5 # Secondary DNS Server provided by the ISP
- Nato nastavimo še host:
- vim /etc/hosts
- Prvo vrstico zamenjamo z:
- 127.0.0.1 nat localhost.localdomain localhost
- -

6. Omogoči posredovanje IP naslovov na NATServerju.

- echo 1 > /proc/sys/net/ipv4/ip_forward - -

7. Nastavi NAT z uporabo paketa iptables na NATServerju.

- - apt-get install iptables
- iptables -F
- ptables -t nat -F
- iptables -t mangle -F
- iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- iptables -A FORWARD -i eth1 -j ACCEPT

- - service iptables restart - -

8. Na simpleArbiter z vlc preberi naslov, na katerem si lahko ogledaš kratek filmček.

- - apt-get install vlc-nox
- Nastavitev naslova:
- Open Media > OpenNetwork ....
- - - -

8. Dodatni viri


--https://www.howtoforge.com/nat_iptables
--http://www.bctes.com/nat-linux-iptables.html
- - - - - - - - diff --git a/kpov_judge/tasks/nat_vlc/task.py b/kpov_judge/tasks/nat_vlc/task.py deleted file mode 100644 index 5224495..0000000 --- a/kpov_judge/tasks/nat_vlc/task.py +++ /dev/null @@ -1,126 +0,0 @@ -# kpov_util 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': '''\ -

-Postavi dva navidezna računalnika: SimpleArbiter in NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo povezan na lokalno omrežje, na katerem naj bo tudi simpleArbiter, z drugim pa na Internet. - -

-Na NATServer skonfiguriraj omrežne vmesnike tako, da bo imel dostop do Interneta in da bo imel na lokalnem omrežju {{IP_NAT}}. Na NATServer ustvarite še uporabnika {{IP_NAT_user}}. - -

-Poskrbi, da bo SimpleArbiter prek DHCP dobil naslov {{IP_simple}}. Poskrbi, da bo NATServer deloval kot prehod za SimpleArbiter in izvajal NAT. -''', - 'en': '''\ -

-Set up two virtual machines: SimpleArbiter and -NATServer. NATServer should have two network -adapters. Connect the first adapter to SimpleArbiter and the -second adapter to the Internet. - -

-Configure the network in NATServer so that one interface is connected to the Internet while the other is connected to SimpleArbiter and has the address {{IP_NAT}}. Create a user called {{IP_NAT_user}} on NATServer. - -

-Configure a DHCP server on NATServer so that SimpleArbiter gets the IP {{IP_simple}}. Also, set up NAT on NATServer and set it as the gateway for SimpleArbiter. -''', -} - -computers = { - 'NATServer': { - 'disks': [ - { 'name': 'student-NATServer', - }, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiter', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - }, -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -#ne potrebujemo dnsjev in ip za malibreznewtork manager? -params_meta = { - 'IP_simple': {'descriptions': {'si': 'Naslov SimpleArbiter', 'en': 'SimpleArbiter address'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_NAT': {'descriptions': {'si': 'Naslov NATServer', 'en': 'NATServer address'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True }, - 'IP_NAT_user': {'descriptions': {'si': 'Username na NATServer', 'en': 'Username on NATServer'}, 'w': False, 'public' : True, 'type' : 'username', 'generated' : True}, - 'IP_NAT_passwd': {'descriptions': {'si': 'Password na NATServer', 'en': 'Password on NATServer'}, 'w': True,'public' : True, 'type' : 'passwd', 'generated' : False}, -} - -def task(IP_simple, IP_NAT, IP_NAT_user, IP_NAT_passwd): - import pexpect - - results = kpov_util.ssh_test(IP_NAT, IP_NAT_user, IP_NAT_passwd, ( - ('IP_NAT_ip_forward', 'cat /proc/sys/net/ipv4/ip_forward'), - )) - - # Check if If IP_simple is connected to NAT - results['IP_simple_ping_to_NAT'] = pexpect.run('ping -c 5 {}'.format(IP_NAT), encoding='utf-8') - # Check routing table on IP_simple - results['IP_simple_routing_table'] = pexpect.run('route -n', encoding='utf-8', env={'PATH': '/bin:/sbin'}) - # Tracert Check if IP_simple is connected to internet - results['IP_simple_to_internet'] = pexpect.run('traceroute 8.8.8.8', encoding='utf-8') - - 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 = kpov_util.IPv4_net_gen(r, 253, True, False) - # params['DNS_NM'] = r.choice(dns_servers) - params['IP_NAT'], params['IP_simple'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['IP_NAT_user'] = kpov_util.default_generators['username'](r) - # params['IP_NM'] - # params['IP_simple'] = kpov_util.IPv4_addr_gen(r, net, 1) - # params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - if re.search( - "PING.*\r\n64 bytes from {}: icmp_seq=[0-9]+ ttl=64 time=[0-9.]* ms".format( - params['IP_NAT']), results['IP_simple_ping_to_NAT']): - score += 3 - else: - hints.append("Ping to NAT incorrect") - if results['IP_NAT_ip_forward'].strip() == "1": - score += 2 - else: - hints.append("ip_forward not set on NAT?") - rs = r"1 +{0} +\({0}\)".format(params['IP_NAT']) - if re.search(rs, - results['IP_simple_to_internet']): - score += 3 - else: - hints.append("traceroute not OK") - gateway=r'0\.0\.0\.0 +{} +0\.0\.0\.0 +UG'.format(params['IP_NAT'].replace('.', '\.')) - if re.search(gateway,results['IP_simple_routing_table']) and \ - re.search("Kernel IP routing table\r\nDestination", results['IP_simple_routing_table']): - score += 2 - else: - hints.append("route not OK") - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiter'], global_params) - diff --git a/kpov_judge/tasks/nat_vlc/video.py b/kpov_judge/tasks/nat_vlc/video.py deleted file mode 100644 index 3c21c82..0000000 --- a/kpov_judge/tasks/nat_vlc/video.py +++ /dev/null @@ -1,37 +0,0 @@ -import string, random, os -#You need to find PIL library on the internet. Just GOOGLE it!!! Other imports are standard. -from PIL import Image, ImageDraw, ImageFont - -#Method for generating random string -def randomString(): - return ''.join(random.choice(string.lowercase) for i in range(30)) - - -image = Image.new("RGBA", (600,150), (255,255,255)) -draw = ImageDraw.Draw(image) - -#Font option is optional. If you don't want to use it figure out how to increase font size, because default is veeeeery small. - -font = ImageFont.truetype("georgia.ttf", 36) -txt = randomString() - -draw.text((20,50), txt, (20,100,0), font) -img_resized = image.resize((600,80), Image.ANTIALIAS) -img_resized.save("out.png") - -#Creates .mp4 video from image out.png. Video is 1 second long. -bashCommand = "avconv -r 1/5 -i out.png -b:v 1000k video.mp4" -os.system(bashCommand) - -# Converts .mp4 video to .avi format. Still 1 second long. ( 2x ) -bashCommand = "avconv -i video.mp4 -c:a copy video.avi" -os.system(bashCommand) - -bashCommand = "avconv -i video.mp4 -c:a copy video1.avi" -os.system(bashCommand) - -# This loop will increas videos length by adding more picesec of the original video. -last = int(input("Set video length in seconds: ")) -bashCommand = "avconv -i concat:video.avi\|video1.avi -c copy video.avi" -for i in range(0, last-2): - os.system(bashCommand) diff --git a/kpov_judge/tasks/network_boot_custom_program/task.py b/kpov_judge/tasks/network_boot_custom_program/task.py deleted file mode 100644 index e3fbad2..0000000 --- a/kpov_judge/tasks/network_boot_custom_program/task.py +++ /dev/null @@ -1,119 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

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': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): -# d = templates['simpleArbiterDhcp'] - write_default_config(templates['simpleArbiterDhcp'], global_params) - diff --git a/kpov_judge/tasks/openvpn_multiple_hops/task.py b/kpov_judge/tasks/openvpn_multiple_hops/task.py deleted file mode 100644 index 44ad8c4..0000000 --- a/kpov_judge/tasks/openvpn_multiple_hops/task.py +++ /dev/null @@ -1,317 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -
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 = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiterDhcp', - } - ], - 'network_interfaces': [ - { - 'network': 'nat' - }, - { - 'network': 'net1' - } - ], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'VPNClient1': { - 'disks': [ - { - 'name': 'student-VPNClient1', - } - ], - 'network_interfaces': [ - { - 'network': 'net1' - }, - { - 'network': 'vpnAB' - } - ], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'VPNClient2': { - 'disks': [ - { - 'name': 'student-VPNClient2', - } - ], - 'network_interfaces': [ - { - 'network': 'net1' - }, - { - 'network': 'vpnAB' - }, - { - 'network': 'vpnBC' - } - ], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'VPNClient3': { - 'disks': [ - { - 'name': 'student-VPNClient3', - } - ], - 'network_interfaces': [ - { - 'network': 'net1' - }, - { - 'network': 'vpnBC' - } - ], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { - 'nat': { - 'public': True - }, - - 'net1': { - 'public': True - }, - # Used for VPN - 'vpnAB': { - 'public': False - }, - - 'vpnBC': { - 'public': False - } -} -#Tukaj sem generiral osem parametrov, prosil bi če se upoštevali pri Tasku. -params_meta = { - 'IP_VPNClient1': {'descriptions':{'si':'IP klienta A na VPN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_LANClient1': {'descriptions':{'si':'IP klienta A na LAN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': False}, - 'IP1_VPNClient2': {'descriptions':{'si':'1. IP klienta B na VPN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': True}, - 'IP2_VPNClient2': {'descriptions':{'si':'2. IP klienta B na VPN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_LANClient2': {'descriptions':{'si':'IP klienta B na LAN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': False}, - 'IP_VPNClient3': {'descriptions':{'si':'IP klienta C na VPN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_LANClient3': {'descriptions':{'si':'IP klienta C na LAN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': False}, - 'IP_SimpleArbiterLAN': {'descriptions':{'si':'IP za SimpleArbiter na LAN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': False} -} - - -def task(IP_SimpleArbiterLAN, IP_VPNClient1, IP_LANClient1, IP1_VPNClient2, IP2_VPNClient2, IP_LANClient2, IP_VPNClient3, IP_LANClient3): - tests = { - ('VPNClient1', IP_LANClient1): [ - ('VPNClient1_ping_C2', 'ping -c 3 {}'.format(IP1_VPNClient2)), - ('VPNClient1_ping_C3', 'ping -c 3 {}'.format(IP_VPNClient3)), - ('VPNClient1_traceroute_C3', 'traceroute {}'.format(IP_VPNClient3)), - ], - ('VPNClient2', IP_LANClient2): [ - ('VPNClient2_ping_C1', 'ping -c 3 {}'.format(IP_VPNClient1)), - ('VPNClient2_ping_C3', 'ping -c 3 {}'.format(IP_VPNClient3)), - ], - ('VPNClient3', IP_LANClient3): [ - ('VPNClient3_ping_C1', 'ping -c 3 {}'.format(IP_VPNClient1)), - ('VPNClient3_ping_C2', 'ping -c 3 {}'.format(IP2_VPNClient2)), - ('VPNClient3_traceroute_C1', 'traceroute {}'.format(IP_VPNClient1)), - ], - } - - for (name, host), host_tests in tests.items(): - host_tests += [ - (name+'_ifconfig', '/sbin/ifconfig -a'), - (name+'_route', '/sbin/route -n'), - ] - - results = collections.defaultdict(str) - for (name, host), host_tests in tests.items(): - results.update(kpov_util.ssh_test(host, 'test', 'test', host_tests)) - return results - -def gen_params(user_id, params_meta): - params = dict() - import random - r = random.Random(user_id) - net = kpov_util.IPv4_subnet_gen(r, '10.70.0.0/16', 24) - params['IP_VPNClient1'], params['IP1_VPNClient2'] = kpov_util.IPv4_addr_gen(r, net, 2) - net = kpov_util.IPv4_subnet_gen(r, '10.50.0.0/16', 24) - params['IP_VPNClient3'], params['IP2_VPNClient2'] = kpov_util.IPv4_addr_gen(r, net, 2) - return params - -def task_check(results, params): - - import re - score = 0 - hints = [] - - IP_C1 = params['IP_VPNClient1'].replace('.', '\.') - IP1_C2 = params['IP1_VPNClient2'].replace('.', '\.') - IP2_C2 = params['IP2_VPNClient2'].replace('.', '\.') - IP_C3 = params['IP_VPNClient3'].replace('.', '\.') - - # testi za ifconfig - # C1 - rs = r"tun0.*\n.*inet.*{}".format(IP_C1) - if re.search(rs, - results['VPNClient1_ifconfig']): - score += 1 - else: - hints.append("ifconfig on VPNClient1 is not OK") - pass - # C2 - rs = r"tun.*\n.*inet.*{}".format(IP1_C2) - if re.search(rs, results['VPNClient2_ifconfig']): - rs = r"tun.*\n.*inet.*{}".format(IP2_C2) - if re.search(rs, results['VPNClient2_ifconfig']): - score += 1 - else: - hints.append("ifconfig on VPNClient2 is not OK") - pass - else: - hints.append("ifconfig on VPNClient2 is not OK") - pass - # C3 - rs = r"tun0.*\n.*inet.*{}".format(IP_C3) - if re.search(rs, results['VPNClient3_ifconfig']): - score += 1 - else: - hints.append("ifconfig on VPNClient3 is not OK") - pass - # testi za route - # C1 - rs = r"{}.*tun0".format(IP1_C2) - if IP_C3[:-1].endswith('.'): - ASD = IP_C3[:-1]+"0" - elif IP_C3[:-2].endswith('.'): - ASD = IP_C3[:-2]+"0" - else: - ASD = IP_C3[:-3]+"0" - if re.search(rs, results['VPNClient1_route']): - rs = r"{} {}.*tun0".format(ASD, IP1_C2) - if re.search(rs, results['VPNClient1_route']): - score += 1 - else: - hints.append("route on VPNClient1 is not OK") - else: - hints.append("route on VPNClient1 is not OK") - pass - # C2 - rs = r"{}.*tun".format(IP_C1) - if re.search(rs, results['VPNClient2_route']): - rs = r"{}.*tun".format(IP_C3) - if re.search(rs, results['VPNClient2_route']): - score += 1 - else: - hints.append("route on VPNClient2 is not OK") - else: - hints.append("route on VPNClient2 is not OK") - pass - # C3 - rs = r"{}.*tun0".format(IP2_C2) - if IP_C1[:-1].endswith('.'): - ASD = IP_C1[:-1]+"0" - elif IP_C1[:-2].endswith('.'): - ASD = IP_C1[:-2]+"0" - else: - ASD = IP_C1[:-3]+"0" - if re.search(rs, results['VPNClient3_route']): - rs = r"{} {}.*tun0".format(ASD, IP2_C2) - if re.search(rs, results['VPNClient3_route']): - score += 1 - else: - hints.append("route on VPNClient3 is not OK") - else: - hints.append("route on VPNClient3 is not OK") - pass - # testi za ping - # C1 - rs = r"64 bytes from {}: icmp_seq=[0-9]+ ttl=[0-9]+ time=\d+\.\d+ ms".format(IP1_C2) - if re.search(rs, results['VPNClient1_ping_C2']): - score += 0.5 - else: - hints.append("ping from VPNClient1 to VPNClient2 is not OK") - pass - rs = r"64 bytes from {}: icmp_seq=[0-9]+ ttl=[0-9]+ time=\d+\.\d+ ms".format(IP_C3) - if re.search(rs, results['VPNClient1_ping_C3']): - score += 0.5 - else: - hints.append("ping from VPNClient1 to VPNClient3 is not OK") - pass - # C2 - rs = r"64 bytes from {}: icmp_seq=[0-9]+ ttl=[0-9]+ time=\d+\.\d+ ms".format(IP_C1) - if re.search(rs, results['VPNClient2_ping_C1']): - score += 0.5 - else: - hints.append("ping from VPNClient2 to VPNClient1 is not OK") - pass - rs = r"64 bytes from {}: icmp_seq=[0-9]+ ttl=[0-9]+ time=\d+\.\d+ ms".format(IP_C3) - if re.search(rs, results['VPNClient2_ping_C3']): - score += 0.5 - else: - hints.append("ping from VPNClient2 to VPNClient3 is not OK") - pass - # C3 - rs = r"64 bytes from {}: icmp_seq=[0-9]+ ttl=[0-9]+ time=\d+\.\d+ ms".format(IP_C1) - if re.search(rs, results['VPNClient3_ping_C1']): - score += 0.5 - else: - hints.append("ping from VPNClient3 to VPNClient1 is not OK") - pass - rs = r"64 bytes from {}: icmp_seq=1 ttl=[0-9]+ time=\d+\.\d+ ms".format(IP2_C2) - if re.search(rs, results['VPNClient3_ping_C2']): - score += 0.5 - else: - hints.append("ping from VPNClient3 to VPNClient2 is not OK") - pass - #score = int(score) - - # testi za tracetoute - # C1 - rs = r"1 {}".format(IP1_C2) - if re.search(rs, results['VPNClient1_traceroute_C3']): - rs = r"2 {}".format(IP_C3) - if re.search(rs, results['VPNClient1_traceroute_C3']): - score += 1 - else: - hints.append("traceroute from VPNClient1 to VPNClient3 is not OK") - pass - else: - hints.append("traceroute from VPNClient1 to VPNClient3 is not OK") - pass - # C3 - rs = r"1 {}".format(IP2_C2) - if re.search(rs, results['VPNClient3_traceroute_C1']): - rs = r"2 {}".format(IP_C1) - if re.search(rs, results['VPNClient3_traceroute_C1']): - score += 1 - else: - hints.append("traceroute from VPNClient1 to VPNClient3 is not OK") - pass - else: - hints.append("traceroute from VPNClient1 to VPNClient3 is not OK") - pass - if score > 10 : - score -= 1 - score = int(score) - return score, hints - - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) diff --git a/kpov_judge/tasks/openvpn_simple_smb/howtos/en/index.html b/kpov_judge/tasks/openvpn_simple_smb/howtos/en/index.html deleted file mode 100644 index aba834e..0000000 --- a/kpov_judge/tasks/openvpn_simple_smb/howtos/en/index.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -

OpenVPN and SMB task:

-

Quick task:


- Connect to VPN with OpenVPN. Enable access to files through NFS and copy them through SMB.

-

Instructions:


- 1. From Directory with images of virtual computers drag twice the picture SimpleArbiterVPN and VPNClient.
- 2. With VirtualBox (or other programs for virtual computers) create two virtual computers and give them VPNCLient.vdi and SimpleArbiterVPN.vdi as disk for storage.
- 3. On both set two network interface(NAT and Internal) and run them.
- 4. On both VM login with username root and password kaboom .

-

First part: Set up OpenVPN on SimpleArbiterVPN and VPNClient.

-

Settings on the server:

- 1. Download packages uml-utilities -> to adjust the virtual network interfaces and packet (openvpn). example: sudo apt-get install openvpn
- 2. The new virtual network interface create with tunctl and specify IP with sudo ifconfig tap0 10.P.Q.R netmask 255.255.255.0
- 3. Then generirate common key (you will share that key with client) with the command: openvpn --genkey --secret vpnkljuc.key
- 4. On server set the configuration file tap0.conf, which should contain (split by lines) "dev tap0","proto tcp-server", "secret vpnkljuc.key"
- 5. Run openvpn with openvpn --config /some_directory/somewhere/tap0.conf
-

Settings on the client:

-1., 2. steps are the same as the settings on the server
-3. Create configuration file tap0.conf, which should contain (split by lines) "remote IP_OF_YOUR_VPN_SERVR", "dev tap0", "proto tcp-client", "secret vpnkljuc.key"
-4. On OpenVPN server connect to openvpn --config /some_directory/somewhere/tap0.conf
-

- -

Second part: Access to imenika /home/test/IME_IMENIKA over NFS

-

Client settings:

- 1. Using "sudo apt-get install nfs-kernel-server" we install nfs service
- 2. Create a directory /home/test/IME_IMENIKA
- 3. To /etc/exports add line /home/test/bla IP_client - 4. Use sudo exportfs -a to save - 5. Restart service using "sudo service nfs-kernel-server start" -

Client settings:

- 1. Instal client for nfs with command "sudo apt-get install nfs-common"
- 2. Create mounting directory "sudo mkdir -p /mnt/nfs/home/test" and mount servers file "sudo mount IP_SERVER:/home/test"
- 3. For automatic mounting we add previous commands to /etc/fstab
- -

How-to za uporabo kpov-judge za OpenVPN

- -
- -
-

-howto: task_check(results, params): - Metoda dobi, kot prvi argument rezultat metode task(...), kot drugi pa - rezultat funkcije gen_params(). - - Vrne stevilo pridobljenih tock. - - -howto: task(...): - Metoda prejme naslednje argumente: - - IP naslov VPN streznika - - DNS naslov VPN streznika - - IP naslov klienta 1 - - DNS naslov klienta 1 - - IP naslov klienta 2 - - DNS naslov klienta 2 - - Vrne slovar rezultatov: - - results['SimpleArbiter_is_VPN_set_up'] - pove ali je VPN streznik nastavljen - - results['SimpleArbiter_is_VPN_running'] - pove ali je VPN streznik zagnan - - results['SimpleArbiter_ping_C1'] - ping rezultati (streznik -> klient1) - - results['SimpleArbiter_ping_C2'] - ping rezultati (streznik -> klient2) - - results['SimpleArbiter_nmap_results'] - pove ali sta oba klienta povezana na pravi VPN streznik - - results['SimpleArbiter_dir_vpn_contents'] - kljuc, ce se ta nahaja v ustreznem imeniku - - results['SimpleArbiter_nfs_access_control_list'] - preveri ce NFS dovoljuje dostop do /home/test/IME_UPORABNIKA - - results['VPNClient1_ping_VPN_server'] - ping rezultati (klient 1 -> strežnik) - - results['VPNClient2_ping_VPN_server'] - ping rezultati (klient 2 -> strežnik) - -

- - - - - - diff --git a/kpov_judge/tasks/openvpn_simple_smb/howtos/si/index.html b/kpov_judge/tasks/openvpn_simple_smb/howtos/si/index.html deleted file mode 100644 index 67e1c4e..0000000 --- a/kpov_judge/tasks/openvpn_simple_smb/howtos/si/index.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -

OpenVPN in SMB vaja:

-

Naloga na hitro:


- Vzpostavi VPN povezavo z pomočjo OpenVPN. Omogoči dostop do datotek prek NFS in skopiraj datoteke prek SMB.

-

Navodila:


- 1. Iz imenika s slikami virtualnih računalnikov dvakrat povlecite sliki SimpleArbiterVPN ter VPNClient.
- 2. Z VirtualBoxom (ali ostalim programom za virtualne računalnike) ustvarite dva virtualna računalnika in jim kot disk za shranjevanje podajte VPNCLient.vdi ter SimpleArbiterVPN.vdi.
- 3. Na obeh nastavite dva omrežna vmesnika (NAT in Internal) in jih zaženite.
- 4. Na oba VM-a se prijavite z uporabnikom root in geslom kaboom .

-

Prvi del naloge: Nastavi OpenVPN na SimpleArbiterVPN in VPNClient.

-

Nastavitve na strežniku:

- 1. Prenesite pakete uml-utilities -> za nastavljanje navideznih omrežnih vmesnikov in paket (openvpn). Npr: sudo apt-get install openvpn
- 2. Nov navidezni omrežni vmesnik kreirate z tunctl in mu podate IP z sudo ifconfig tap0 10.P.Q.R netmask 255.255.255.0
- 3. Nato generirate skupen ključ(ta ključ boste delili z klientom) z ukazom: openvpn --genkey --secret vpnkljuc.key
- 4. Na strežniku še nastavite konfiguracijsko datoteko tap0.conf, ki naj vsebuje (ločeno po vrsticah) "dev tap0","proto tcp-server", "secret vpnkljuc.key"
- 5. Zaženete openvpn z openvpn --config /some_directory/somewhere/tap0.conf
-

Nastavitve na klientu:

-1., 2. koraka sta ista kot pri nastavitvah na strežniku
-3. Kreirajte konfiguracijsko datoteko tap0.conf, ki naj vsebuje (ločeno po vrsticah) "remote IP_VAŠEGA_VPN_SERVERJA", "dev tap0", "proto tcp-client", "secret vpnkljuc.key"
-4. Na OpenVPN strežnik se povežete z openvpn --config /some_directory/somewhere/tap0.conf
-

-

Drugi del naloge: Dostop prek NFS do imenika /home/test/IME_IMENIKA

-

Nastavitve na strežniku:

- 1. Z ukazom "sudo apt-get install nfs-kernel-server" namestimo nfs program
- 2. Uredimo mapo exports "sudo nano /etc/exports" in kreiramo direktorij /home/test/IME_IMENIKA
- 3. V datoteko exports dodamo /home/test/bla IP_klienta - 4. Share shranimo z sudo exportfs -a - 5. NFS strežnik štartamo z "sudo service nfs-kernel-server start" -

Nastavitve na klientu:

- 1. Z ukazom "sudo apt-get install nfs-common" namestimo programček nfs-common, da lahko kasneje pripnemo share
- 2. Na klientu moramo urediti še mount tega direktorija: "sudo mkdir -p /mnt/nfs/home/test" in "sudo mount IP_SERVERJA:/home/test"
- 3. Za avtomatski mount ob ponovnem zagonu, dodamo prejšnje ukaze v datoteko /etc/fstab
- -

How-to za uporabo kpov-judge za OpenVPN

- -
- -
-

-howto: task_check(results, params): - Metoda dobi, kot prvi argument rezultat metode task(...), kot drugi pa - rezultat funkcije gen_params(). - - Vrne stevilo pridobljenih tock. - - -howto: task(...): - Metoda prejme naslednje argumente: - - IP naslov VPN streznika - - DNS naslov VPN streznika - - IP naslov klienta 1 - - DNS naslov klienta 1 - - IP naslov klienta 2 - - DNS naslov klienta 2 - - Vrne slovar rezultatov: - - results['SimpleArbiter_is_VPN_set_up'] - pove ali je VPN streznik nastavljen - - results['SimpleArbiter_is_VPN_running'] - pove ali je VPN streznik zagnan - - results['SimpleArbiter_ping_C1'] - ping rezultati (streznik -> klient1) - - results['SimpleArbiter_ping_C2'] - ping rezultati (streznik -> klient2) - - results['SimpleArbiter_nmap_results'] - pove ali sta oba klienta povezana na pravi VPN streznik - - results['SimpleArbiter_dir_vpn_contents'] - kljuc, ce se ta nahaja v ustreznem imeniku - - results['SimpleArbiter_nfs_access_control_list'] - preveri ce NFS dovoljuje dostop do /home/test/IME_UPORABNIKA - - results['VPNClient1_ping_VPN_server'] - ping rezultati (klient 1 -> strežnik) - - results['VPNClient2_ping_VPN_server'] - ping rezultati (klient 2 -> strežnik) - -

- - - - diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py deleted file mode 100644 index 5d7c22f..0000000 --- a/kpov_judge/tasks/openvpn_simple_smb/task.py +++ /dev/null @@ -1,261 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si': '''\ -

-Postavi dva navidezna računalnika: SimpleArbiter in VPNClient1. Poskrbite, da bosta povezana med seboj in v internet. Na VPNClient1 namestite OpenVPN in program za nadzor nad virtualnimi napravami (s katerim kreirate napravo tap). - -

-Na strežniku SimpleArbiter že teče 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. Računalniku 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/test/{{DIRNAME}}. V ta imenik skopirajte datoteke, ki so prek SMB dostopne na SimpleArbiter. -''', - 'en': '''\ -

-Setup two virtual machines: SimpleArbiter and 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). On the VPN, set the IP for -VPNClient1 to {{IP_VPNClient1}}. - -

-An OpenVPN server is already running on SimpleArbiter. Use the secret -available on VPNClient1 in the home directory of user student to connect to the VPN server on SimpleArbiter. To do that, you will have to write your -own OpenVPN configuration file. - -

-After you have set up the VPN, make the directory /home/test/{{DIRNAME}} on VPNClient1 available over NFS from SimpleArbiter over -your VPN. Copy files that are available from SimpleArbiter over SMB to /home/test/{{DIRNAME}}. -''' -} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiterDhcpGWVPN', - }, - ], - 'network_interfaces': [ - { - 'network': 'test-net' - }, - { - 'network': 'net1' - } - ], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'VPNClient1': { - 'disks': [ - { 'name': 'student-VPNClient1', - }, - ], - 'network_interfaces': [ - { - 'network': 'net1' - } - ], - 'flavor': 'm1.tiny', - 'config_drive': False - }, -} - -networks = { - 'test-net': { - 'public': True - }, - # Used for the VPN tunnel - 'net1': { - 'public': False - } -} - -#Tukaj sem generiral tri parametre, prosil bi če se upoštevajo pri Tasku. -params_meta = { - 'IP_SimpleArbiterVPN': {'descriptions':{'si':'IP za SimpleArbiter na VPN'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_VPNClient1': {'descriptions':{'si':'IP klienta na VPN'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_LANClient1': {'descriptions':{'si':'IP klienta na LAN'}, 'w': True, 'public': True, 'type': 'IP', 'generated': False}, - 'DIRNAME': {'descriptions':{'si':'Imenik, dostopen prek NFS'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'secret_random_seed': {'descriptions':{'si':'Seme za skrivnost'}, 'w': False, 'public': False, 'type': None, 'generated': True}, -} - -def task(IP_SimpleArbiterVPN, IP_VPNClient1, IP_LANClient1, DIRNAME): - import collections - from pexpect import pxssh # Used to set up an SSH connection to a remote machine - import pexpect # Allows the script to spawn a child application and control it as if a human were typing commands - - # The necessary things we need to check if the task was performed correctly - results = collections.defaultdict(str) - - # VPNClient1 - sC1 = pxssh.pxssh(encoding='utf-8') - sC1.login(IP_LANClient1, 'student', 'vaje') - - # sA - results['SimpleArbiter_ifconfig'] = pexpect.run( - 'ifconfig -a', encoding='utf-8', env={'PATH': '/bin:/sbin'}) - results['SimpleArbiter_route'] = pexpect.run( - 'route -n', encoding='utf-8', env={'PATH': '/bin:/sbin'}) - - # Pings each of the clients - # 10.8.0.6 and 10.8.0.10 are the first two default addresses distributed by OpenVPN - # Will output everything ping outputs (set to ping 3 times) - results['SimpleArbiter_ping_C1'] = pexpect.run( - 'ping -c 3 {}'.format(IP_VPNClient1), encoding='utf-8') - results['SimpleArbiter_traceroute'] = pexpect.run( - 'traceroute {}'.format(IP_VPNClient1), encoding='utf-8') - sC1.sendline('cat /etc/exports') - sC1.prompt() - output = sC1.before - results['VPNClient1_nfs_access_control_list'] = output - results['SimpleArbiter_mount'] = pexpect.run( - 'sudo mount {}:/home/test/{} /mnt'.format(IP_VPNClient1, DIRNAME), encoding='utf-8') - results['SimpleArbiter_mount_result'] = pexpect.run( - 'sudo mount', encoding='utf-8') - results['SimpleArbiter_ls'] = pexpect.run( - 'ls /mnt', encoding='utf-8') - pexpect.run( - 'sudo umount /mnt', encoding='utf-8') - - # Ping the VPN server - sC1.sendline('ping -c 3 {0}'.format( IP_SimpleArbiterVPN )) - sC1.prompt() - results['VPNClient1_ping_VPN_server'] = sC1.before - - sC1.sendline('/sbin/ifconfig -a') - sC1.prompt() - results['VPNClient1_ifconfig'] = sC1.before - - sC1.sendline('ps xa') - sC1.prompt() - results['VPNClient1_ps'] = sC1.before - sC1.logout() - - return results - -def gen_params(user_id, params_meta): - params = dict() - #Tukaj sem generiral te tri parametre (ime skupne skrivnosti je heidi ) - #(ime imenika kjer naj bo shranjena skupna skrivnost naj bo openvpn) - #(HASH bo naključno generiran niz iz user_id s katerim se bo preverjalo plagiatorstvo) - import random - r = random.Random(user_id) - 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 - - -def task_check(results, params): - import re - score = 0 - hints = [] - - IP_SA = params['IP_SimpleArbiterVPN'].replace('.', '\.') - IP_C1 = params['IP_VPNClient1'].replace('.', '\.') - rs = r"tap0: flags=.* mtu 1500\r\n +inet {}".format(IP_SA) - if re.search(rs, - results['SimpleArbiter_ifconfig']): - score += 1 - else: - hints.append("ifconfig on SimpleArbiter not OK") - - if re.search( - "PING.*\r\n64 bytes from {}: icmp_seq=[0-9]+ ttl=64 time=[0-9.]* ms".format(IP_C1), - results['SimpleArbiter_ping_C1']): - score += 1 - else: - hints.append("ping from server not OK") - rs = "1 +{0} \({0}\)".format(IP_C1) - if re.search(rs, results['SimpleArbiter_traceroute']): - score += 1 - else: - hints.append("traceroute not OK") - if results['VPNClient1_nfs_access_control_list'].find( - '/home/test/' + params['DIRNAME'] + ' ') >= 0: - score += 1 - if results['SimpleArbiter_mount_result'].find( - '{}:/home/test/{} on /mnt type nfs'.format( - params['IP_VPNClient1'], params['DIRNAME'])): - 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 range(32)]) - for i in range(16)]) - keyfile = kpov_util.fname_gen(r, extension=False) - - # now check the filenames - fnames_ok = True - for i in range(3): - 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 fnames_ok: - score += 2 - else: - hints.append("shared filenames not OK:") - - # Ping the VPN server - if re.search( - "PING.*\r\n64 bytes from {}: icmp_seq=[0-9]+ ttl=64 time=[0-9.]* ms".format(IP_SA), - results['VPNClient1_ping_VPN_server']): - score += 1 - else: - hints.append("ping from client not OK") - - rs = r"tap0: flags=.* mtu 1500\r\n +inet {}".format(IP_C1) - if re.search(rs, results['VPNClient1_ifconfig']): - score += 1 - else: - hints.append("ifconfig on VPNClient1 not OK") - - if results['VPNClient1_ps'].find('openvpn') > 0: - score += 1 - else: - hints.append("openvpn not found running on VPNClient") - return score, hints - -def prepare_disks(templates, task_params, global_params): - #guestmount -a d -m /dev/VG/LV -m /dev/sda1:/boot --ro /mnt - #asistent je pocasnela :) - import random - r = random.Random(task_params['secret_random_seed']) - s = "\n".join([ - "".join([r.choice("0123456789abcdef") for i in range(32)]) - for i in range(16)]) - s = """# -# 2048 bit OpenVPN static key -# ------BEGIN OpenVPN Static key V1----- -{} ------END OpenVPN Static key V1----- -""".format(s) - 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 - openvpn server - pre-up tunctl -t tap0 - address {} - netmask 255.255.255.0 -""".format(task_params['IP_SimpleArbiterVPN']) - templates['simpleArbiterDhcpGWVPN'].write_append("/etc/network/interfaces", netaddr_s) - for i in range(3): - fname = kpov_util.fname_gen(r, False) - templates['simpleArbiterDhcpGWVPN'].write( - "/srv/smb/" + fname + '.txt', - kpov_util.fortune(r, 4096)) - write_default_config(templates['simpleArbiterDhcpGWVPN'], global_params) - templates['student-VPNClient1'].write("/home/student/" + keyfile, s) - # uid, gid (student = ) - templates['student-VPNClient1'].chown(1000, 1000, "/home/student/" + keyfile) - - write_default_config(templates['simpleArbiterDhcpGWVPN'], global_params) diff --git a/kpov_judge/tasks/openwrt/task.py b/kpov_judge/tasks/openwrt/task.py deleted file mode 100644 index 8872989..0000000 --- a/kpov_judge/tasks/openwrt/task.py +++ /dev/null @@ -1,103 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

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', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcp', - }, - ], - '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': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) diff --git a/kpov_judge/tasks/public_ip_ssh/task.py b/kpov_judge/tasks/public_ip_ssh/task.py deleted file mode 100644 index 8dcb858..0000000 --- a/kpov_judge/tasks/public_ip_ssh/task.py +++ /dev/null @@ -1,52 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -
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': 'simpleArbiter' }], - 'network_interfaces':[{'network':'net1'}], - }, - 'A': { - 'disks':[], - 'network_interfaces':[{'network':'net2'}], - } - -} - -networks = { 'net1': {'public': True}, 'net2': {'public': True} } - -params_meta = { - 'peer_ip': {'descriptions': {'si': 'Naslov ssh strežnika'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'peer_user': {'descriptions': {'si': 'ime uporabnika'}, 'w': False, 'public': True, 'type': 'username', 'generated': True}, - 'peer_passwd': {'descriptions': {'si': '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 kpov_util.default_gen(user_id, params_meta) - -def task_check(results, params): - from pexpect import pxssh - ip, user, passwd = params['peer_ip'], params['peer_user'], params['peer_passwd'] - results = {} - try: - s = pxssh.pxssh(encoding='utf-8') - s.login(ip, user, passwd) - s.logout() - return 10, [] - except Exception as ex: - return 0, [str(ex)] - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiter'], global_params) diff --git a/kpov_judge/tasks/public_ssh_motd_http/task.py b/kpov_judge/tasks/public_ssh_motd_http/task.py deleted file mode 100644 index bd48d77..0000000 --- a/kpov_judge/tasks/public_ssh_motd_http/task.py +++ /dev/null @@ -1,105 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -
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', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcp', - }, - ], - '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': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): -# d = templates['simpleArbiterDhcp'] - write_default_config(templates['simpleArbiterDhcp'], global_params) - diff --git a/kpov_judge/tasks/radius_multiple_realms/task.py b/kpov_judge/tasks/radius_multiple_realms/task.py deleted file mode 100644 index 0067f46..0000000 --- a/kpov_judge/tasks/radius_multiple_realms/task.py +++ /dev/null @@ -1,110 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -
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', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcp', - }, - ], - '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': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) - diff --git a/kpov_judge/tasks/radius_mysql_pam/howtos/en/index.html b/kpov_judge/tasks/radius_mysql_pam/howtos/en/index.html deleted file mode 100644 index ac53a1f..0000000 --- a/kpov_judge/tasks/radius_mysql_pam/howtos/en/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - -

Radius mysql:

-

Quick how to:


- Setup the OpenRadius server and add users. Use MySql as the database.

-

Instructions:

-
    -
  1. Create two virtual machines - SimpleArbiter (use the simpleArbiterDhcp.vdi disk) and RadiusServer. Discs for virtual machines are located on polz.si/media/uploads/kpov/virtualke.
  2. -
  3. Create another two virtual machines using the disks VPNCLient.vdi and SimpleArbiterVPN.vdi.
  4. -
  5. Setup both VMs so that they use two network adapters - NAT and Internal network.
  6. -
  7. Login with the username student and password student on both VMs.
  8. -
- -

Part one: Setup OpenRadius.

-
    -
  1. Install OpenRadius on the RadiusServer VM (configuration files are: /etc/openradius/configuration and /etc/openradius/behaviour)
  2. -
  3. Add a user and assign him a shared secret. This should be configured in the /etc/openradius/configuration file. (More info: http://sites.e-advies.nl/openradius/doc-using-openradius.html )
  4. -
  5. Create a connection from SimpleArbiter to RadiusServer using the secret you configured.
  6. -
-

Part two: Install and setup a MySQL database on RadiusServer

-
    -
  1. OpenRadius can use the module RadSQL to store users in database.
  2. -
  3. Setup a MySQL server: sudo apt-get install mysql-server.
  4. -
  5. Connect to the MySQL server: mysql -u root -p.
  6. -
  7. Create a database: CREATE DATABASE . Create a table users with columns username and password.
  8. -
- - - diff --git a/kpov_judge/tasks/radius_mysql_pam/howtos/si/index.html b/kpov_judge/tasks/radius_mysql_pam/howtos/si/index.html deleted file mode 100644 index 612cce9..0000000 --- a/kpov_judge/tasks/radius_mysql_pam/howtos/si/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -

Radius mysql:

-

Naloga na hitro:


- Postaviti je treba RADIUS strežnik in podatkovno bazo.
- Za RADIUS strežnik uporabite FreeRADIUS, za podatkovno bazo pa MySQL. -

-

Navodila:


- 1. Ustvarite dva navidezna računalnika z imenom SimpleArbiter in RadiusServer.
- Za SimpleArbiter uporabite simpleArbiterDhcp, za RadiusServer pa lahko uporabite poljubno virtualko.
- ( virtualke dobiš na polz.si/media/uploads/kpov/virtualke)
- 2. Z VirtualBoxom (ali ostalim programom za virtualne računalnike) ustvarite dva virtualna računalnika in jim kot disk za shranjevanje podajte simpleArbiterDhcp.vdi ter base-student-console-2014.vdi.
- 3. Na obeh nastavite dva omrežna vmesnika (NAT in Internal) in jih zaženite.
- 4. Na oba VM-a se prijavite z uporabnikom student in geslom vaje .

-

Prvi del naloge: Postavi OpenRadius.

- 1. Namesti FreeRadius na virtualki RadiusServer z ukazom "sudo apt-get install freeradius".
- ( pomembni sta dve konfiguracijski datoteki /etc/openradius/configuration in /etc/openradius/behaviour
- 2. Dodaj uporabnika in mu dodaj skupno skrivnost v /etc/openradius/configuration datoteko (več o dodajanju lahko izveš na: "http://sites.e-advies.nl/openradius/doc-using-openradius.html"
- 3. Nato se z to skrivnostjo povežete iz SimpleArbiter na RadiusServer
- - Namestimo freeradius z ukazom apt-get install freeradius-mysql - V datoteku /etc/freeradius/client.conf spremenimo skrivnost (secret) - Nato pa v datoteki /etc/freeradius/users dodamo uporabnika - - -

Drugi del naloge: Namestitev in vzpostavitev baze MySQL na RadiusServer

- 1. Pri OpenRadius-u imamo modul RadSQL, s katerim lahko vzpostavimo hranjenje uporabnikov v bazi
- 2. Namestimo MySQL server z ukazom "sudo apt-get install mysql-server"
- 3. VNato se prijavimo v Mysql server z ukazom mysql -u root -p
- 4. Bazo ustvarimo z ukazom primer: - CREATE DATABASE kwhbRgJY; - GRANT ALL ON kwhbRgJY.* To MajaNovak80@localhost IDENTIFIED BY "y06gmo2Z"; - - - diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py deleted file mode 100644 index 5051bb4..0000000 --- a/kpov_judge/tasks/radius_mysql_pam/task.py +++ /dev/null @@ -1,212 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si': '''\ -

-Ustvari dva navidezna računalnika: SimpleArbiter in RadiusServer. Na RadiusServer namesti FreeRadius ter MySQL. - -

-Ustvari podatkovno bazo MySQL z imenom {{MYSQL_DB_NAME}}. Ustvari uporabnika za MySQL z imenom {{MYSQL_ADMIN_USER}} in geslom {{MYSQL_ADMIN_PASSWORD}}, ki naj ima poln dostop do te baze. Prijava za tega uporabnika mora biti omogočena tudi s SimpleArbiter. - -

-Nastavi FreeRadius tako, da bo podatke o uporabnikih in geslih pobiral iz baze MySQL z imenom {{MYSQL_DB_NAME}}. Podatkovna shema (imena tabel) naj ostane -privzeta. - -

-Dostop do strežnika Radius na RadiusServer s SimpleArbiter naj bo mogoč ob uporabi skrivnosti {{RADIUS_SECRET}}. - -

-V bazi ustvari vnos, ki bo omogočil, da se na RadiusServer s pomočjo protokola Radius avtenticira uporabnik {{RADIUS_USERNAME}} z geslom {{RADIUS_PASSWORD}}. - -

-Nastavi PAM za prijavo (login) tako, da bo dovolj, če se uporabnik na SSH predstavi z uporabniškim imenom in geslom, ki sta veljavna na FreeRadius, ne glede na /etc/shadow oziroma /etc/password. -''', - 'en': '''\ -

-Create two virtual machines: SimpleArbiter and RadiusServer. On RadiusServer, install FreeRadius and MySQL. - -

-Create a MySQL database named {{MYSQL_DB_NAME}}. Create a mysql user with the username {{MYSQL_ADMIN_USER}} and password {{MYSQL_ADMIN_PASSWORD}}. Make sure this user can access the database from SimpleArbiter and has administrative rights over the {{MYSQL_DB_NAME}} database. - -

-Set up FreeRadius so that the data about users and passwords is stored in the MySQL database. Keep the default schema (table names). - -

-Make the Radius server on RadiusServer accessible from SimpleArbiter using {{RADIUS_SECRET}} as the secret. - -

-Create an entry in the database which will enable a user with the username {{RADIUS_USERNAME}} to authenticate themself against the Radius server using the password {{RADIUS_PASSWORD}}. - -

-Set up PAM to enable login over SSH using a username and password which are -valida on the FreeRadius server, regardless of the entries in /etc/shadow -and/or /etc/password. -''', -} - -#KABOOM - -computers = { - 'RadiusServer': { - 'disks': [ - { 'name': 'student-RadiusServer', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGW', - }, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'IP_RS': {'descriptions': {'si': 'Naslov RadiusServer', 'en': 'RadiusServer IP address'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'RADIUS_SECRET':{'descriptions': {'si': 'Skrivnost RADIUS', 'en': 'RADIUS secret'}, 'w': False, 'public':True, 'type': 'password', 'generated': True}, - 'RADIUS_USERNAME': {'descriptions': {'si': 'Uporabniško ime', 'en': 'Username'}, 'w': True, 'public':True, 'type': 'username', 'generated': False}, - 'RADIUS_PASSWORD': {'descriptions': {'si': 'Geslo uporabnika', 'en': 'Password'}, 'w': False, 'public':True, 'type': None, 'generated': True}, - 'MYSQL_DB_NAME': {'descriptions': {'si': 'Ime baze v mysql', 'en': 'Database name'}, 'w': False, 'public':True, 'type': None, 'generated': True}, - 'MYSQL_ADMIN_USER':{'descriptions': {'si': 'Uporabniško ime za dostop do MySQL', 'en': 'MySQL username'}, 'w': False, 'public':True, 'type': 'username', 'generated': True}, - 'MYSQL_ADMIN_PASSWORD': {'descriptions': {'si': 'Geslo za dostop do MySQL', 'en': 'MySQL password'}, 'w': True, 'public':True, 'type': 'password', 'generated': True}, - 'MYSQL_SEED':{'descriptions': {'si': 'seed', 'en': 'seed'}, 'w': False, 'public':True, 'type': None, 'generated': True}, -} - -def task(IP_RS, RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, - MYSQL_DB_NAME, MYSQL_ADMIN_USER, MYSQL_ADMIN_PASSWORD, MYSQL_SEED): - import collections - import random - import pexpect - - r = random.Random(MYSQL_SEED) - MYSQL_TEST_USER = kpov_util.username_gen(r) - MYSQL_TEST_PASSWORD = kpov_util.alnum_gen(r, 7) - RADIUS_NEW_PASSWORD = kpov_util.alnum_gen(r, 7) - - results = collections.defaultdict(str) - - # Testiranje radius strežnika - results['Test_RadiusServer'] = pexpect.run('radtest {0} {1} {2} 1812 {3}'.format( - RADIUS_USERNAME, RADIUS_PASSWORD, IP_RS, RADIUS_SECRET)) - - # Testiranje podatkovne base mysql - mysql = pexpect.spawn('mysql -u {MYSQL_ADMIN_USER} -p{MYSQL_ADMIN_PASSWORD} -h {IP_RS}'.format(**locals())) - mysql.expect("mysql>") - results['mysql_login'] = mysql.before - mysql.sendline('USE {MYSQL_DB_NAME}'.format(**locals())) - mysql.expect("mysql>") - results['database_connect'] = mysql.before - mysql.sendline('SELECT UserName, Value FROM radcheck;') - mysql.expect("mysql>") - results['select_from_users'] = mysql.before - mysql.sendline("INSERT INTO radcheck (UserName, Attribute, Value, Op) VALUES ('{MYSQL_TEST_USER}', 'Cleartext-Password', '{MYSQL_TEST_PASSWORD}', ':=');".format(**locals())) - mysql.expect("mysql>") - - results['radtest_OK'] = pexpect.run('radtest {0} {1} {2} 1812 {3}'.format( - MYSQL_TEST_USER, MYSQL_TEST_PASSWORD, IP_RS, RADIUS_SECRET)) - results['radtest_NOK'] = pexpect.run('radtest {0} {1} {2} 1812 {3}'.format( - MYSQL_TEST_USER, "Flügzeug", IP_RS, RADIUS_SECRET)) - results['radtest_NOK'] = pexpect.run('radtest {0} {1} {2} 1812 {3}'.format( - MYSQL_TEST_USER, "Flügzeug", IP_RS, RADIUS_SECRET)) - - mysql.sendline("UPDATE radcheck SET value='{RADIUS_NEW_PASSWORD}' where UserName='{RADIUS_USERNAME}' and Attribute='Cleartext-Password';".format(**locals())) - - results.update(kpov_util.ssh_test(IP_RS, RADIUS_USERNAME, RADIUS_NEW_PASSWORD)) - - mysql.sendline("UPDATE radcheck SET value='{RADIUS_PASSWORD}' where UserName='{RADIUS_USERNAME}' and Attribute='Cleartext-Password';".format(**locals())) - mysql.expect('mysql>') - mysql.sendline("DELETE FROM radcheck where UserName='{MYSQL_TEST_USER}' and Attribute='Cleartext-Password';".format(**locals())) - mysql.expect('mysql>') - mysql.sendline('\q'); - # TODO Testiranje PAM s testnim uporabnikom - - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - params['RADIUS_SECRET'] = kpov_util.alnum_gen(r, 8) - params['RADIUS_PASSWORD'] = kpov_util.alnum_gen(r, 8) - params['RADIUS_USERNAME'] = kpov_util.username_gen(r) - params['MYSQL_ADMIN_USER'] = kpov_util.alnum_gen(r, 6) - params['MYSQL_ADMIN_PASSWORD'] = kpov_util.alnum_gen(r, 6) - params['MYSQL_DB_NAME'] = kpov_util.alnum_gen(r, 4) - params['MYSQL_SEED'] = str(r.random()) - return params - -def task_check(results, params): - import re - import pickle - score = 0 - hints = [] - r = random.Random(params['MYSQL_SEED']) - MYSQL_TEST_USER = kpov_util.username_gen(r) - MYSQL_TEST_PASSWORD = kpov_util.alnum_gen(r, 7) - RADIUS_NEW_PASSWORD = kpov_util.alnum_gen(r, 7) - s = r"Sent Access-Request Id [0-9]+ from ([0-9]|\.)+:[0-9]+ to {IP_RS}:1812 length [0-9]+\r\n\tUser-Name = \"{RADIUS_USERNAME}\"\r\n\tUser-Password = \"{RADIUS_PASSWORD}\".*Access-Accept Id [0-9]+ from {IP_RS}".format(**params) - #with open('test.pickle', 'w') as f: - # pickle.dump({'pattern': s, 'res': results['Test_RadiusServer']}, f) - if re.search(s, results['Test_RadiusServer'], flags=re.DOTALL): - # print "Test OK" - score += 2 - else: - hints.append('radtest connect output incorrect:' + results['Test_RadiusServer']) - print((results['Test_RadiusServer'], s)) - # Testiranje podatkovne base mysql - s = "Welcome to the MySQL monitor.*Type 'help;' or '\\\\h' for help\\. Type '\\\\c' to clear the current input statement\\.\r\n" - if re.search(s, results['mysql_login'], flags=re.DOTALL): - # print "mysql_login OK" - score += 1 - else: - hints.append("mysql connection string incorrect") - print((results['mysql_login'], s)) - s = " USE {MYSQL_DB_NAME}\r\nReading table information.*Database changed\r\n".format(**params) - if re.search(s, results['database_connect'], flags=re.DOTALL): - # print "database_connect OK" - score += 1 - else: - hints.append('mysql table information string incorrect') - print((results['database_connect'],)) - s = " SELECT UserName, Value FROM radcheck;\r\n.*{RADIUS_USERNAME} *| *{RADIUS_PASSWORD}".format(**params) - if re.search(s, results['select_from_users'], flags=re.DOTALL): - # print "select_from_users OK" - score += 2 - else: - hints.append('mysql user entry in table check failed') - print((results['select_from_users'], )) - - s = r"Sent Access-Request Id [0-9]+ from ([0-9]|\.)+:[0-9]+ to {0}:1812 length [0-9]+\r\n\tUser-Name = \"{1}\"\r\n\tUser-Password = \"{2}\".*Access-Accept Id [0-9]+ from {0}".format(params['IP_RS'], MYSQL_TEST_USER, MYSQL_TEST_PASSWORD) - if re.search(s, results['radtest_OK'], flags=re.DOTALL): - # print "radtest_OK OK" - score += 2 - else: - hints.append('radtest output incorrect:' + results['radtest_OK']) - print((s, results['radtest_OK'])) - - s = r"Sent Access-Request Id [0-9]+ from ([0-9]|\.)+:[0-9]+ to {0}:1812 length [0-9]+\r\n\tUser-Name = \"{1}\"\r\n\tUser-Password = \"Flügzeug\".*Access-Reject Id [0-9]+ from {0}".format(params['IP_RS'], MYSQL_TEST_USER) - if re.search(s, results['radtest_NOK'], flags=re.DOTALL): - # print "radtest_NOK OK" - score += 1 - else: - hints.append('radtest negative output incorrect: ' + results['radtest_NOK']) - print((results['radtest_NOK'], s)) - s = "{RADIUS_USERNAME}@.*:".format(**params) - if re.search(s, results['motd'], flags=re.DOTALL): - # print "login_test OK" - score += 1 - else: - hints.append('login test failed') - print((results['login_test'],s)) - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcpGW'], global_params) diff --git a/kpov_judge/tasks/rdate_64bit/task.py b/kpov_judge/tasks/rdate_64bit/task.py deleted file mode 100644 index 9f90014..0000000 --- a/kpov_judge/tasks/rdate_64bit/task.py +++ /dev/null @@ -1,104 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

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', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcp', - }, - ], - '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': {'descriptions':{'si':'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions':{'si':'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions':{'si':'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions':{'si':'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) diff --git a/kpov_judge/tasks/rename_grep_network/task.py b/kpov_judge/tasks/rename_grep_network/task.py deleted file mode 100644 index 4d81313..0000000 --- a/kpov_judge/tasks/rename_grep_network/task.py +++ /dev/null @@ -1,282 +0,0 @@ -# TODO: -# - check if everything is filled in (computers, params, preparation) -# - improve scoring -# - test -# - switch to a real SSH/SFTP client to properly handle filenames - -instructions = { - 'si': """ -
Ustvari dva navidezna računalnika s slikama diskov 
-- SimpleArbiterExam s sliko diska simpleArbiterDhcp in
-SmallStudent s slikama diska student-entrance3
-in smallstudent-personal.
-
-Drugi razdelek na sliki smallstudent-personal priklopi na imenik {mntdir}
-
-Na SimpleArbiterExam se lahko prijaviš z uporabniškim imenom tester in geslom test.
-Na SmallStudentExam se lahko prijaviš kot root z geslom kaboom.
-
-Poskrbi, da bo SmallStudent s SimpleArbiter dostopen na naslovu {testip}.
-
-Na SmallStudent ustvari uporabnika {testuser} z geslom {passwd}.
-
-Na smallstudent-personal je nekje skrita
-datoteka, ki vsebuje niz {magicstr}.
-Skopiraj jo v domači imenik {testuser} in preimenuj tako, da vse znake 'O' v imenu zamenjaš z 'I'.
-Pazi, da nobena druga datoteka v domačem imeniku v svojem imenu ne bo vsebovala "I".
-
-Poskrbi, da bo lastnik {testuser}, skupina pa naj ostane nespremenjena.
-Brati naj jo ima pravico samo lastnik, pisati lastnik in skupina, poganjati nihče.
-""", - 'en': ''' -''', -} - -instructions = {'si': 'Potrpite.', 'en': 'Have patience.'} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { - 'name': 'simpleArbiterEntrance', - }, - ], - 'network_interfaces': [ - { - 'network': 'net1', - }, - { - 'network': 'net2', - }, - ], - 'flavor': 'm1.tiny', - 'config_drive': False, - }, - 'SmallStudent': { - 'disks': [ - { - 'name': 'student-entrance4', - # 'parts': [{'dev': 'sda1', 'path': '/'}], - }, - { - 'name': 'smallstudent-personal', - 'parts': [{'dev': 'sdb1', 'path': '/media'}, {'dev': 'sdb2', 'path': '/mnt'}] - } - ], - 'network_interfaces': [ - { - 'network': 'net2', - }, - ], - 'flavor': 'm1.tiny', - 'config_drive': False, - } -} - -networks = { - 'net1': { - 'public': True, - }, - 'net2': { - 'public': False, - } -} - -params_meta = { - 'testip': { - 'descriptions': { - 'si': 'IP SmallStudent', - 'en': 'IP SmallStudent', - }, - 'w': False, - 'public': True, - 'type': 'IP', - 'generated': True, - }, - 'testuser': { - 'descriptions': { - 'si': 'Uporabnik na SmallStudent', - 'en': 'Username on SmallStudent', - }, - 'w': False, - 'public': True, - 'type': 'username', - 'generated': True, - }, - 'passwd': { - 'descriptions': { - 'si': 'Geslo na SmallStudent', - 'en': 'Password on SmallStudent', - }, - 'w': False, - 'public': True, - 'type': None, - 'generated': True, - - }, - 'mntdir': { - 'descriptions': { - 'si': 'imenik za priklop diska', - 'en': 'mountpoint', - }, - 'w': False, - 'public': True, - 'type': 'dirname', - 'generated': True, - }, - 'magicstr' : { - 'descriptions': { - 'si': 'Niz v iskani datoteki', - 'en': 'String in the file you need to find', - }, - 'w': False, - 'public': True, - 'type': None, - 'generated': True, - - }, - 'rndseed': { - 'descriptions': { - 'si': 'random seed za skrito datoteko', - 'en': 'random seed for hiding the file', - }, - 'w': False, - 'public': False, - 'type': None, - 'generated': True, - }, -} - -def task(testip, testuser, passwd, mntdir, magicstr): - return kpov_util.ssh_test(testip, testuser, passwd, ( - ('home_ls', 'ls ~/'), - ('dst_file_contents', 'cat ~/*I*.txt'), - ('dst_ls', 'ls -l ~/*I*.txt'), - ('mnt', 'mount'), - )) - -def gen_params(user_id, params_meta): - import random - params = dict() - r = random.Random(user_id) - params['testip'] = kpov_util.IPv4_addr_gen(r, - network = '10.94.80.0/19', n_generated=1)[0] - params['testuser'] = kpov_util.default_generators['username'](r) - params['passwd'] = kpov_util.alnum_gen(r, 8) - params['magicstr'] = "".join([r.choice("qwerztlpoQWERTPOL") for i in range(10)]) - params['mntdir'] = "/" + kpov_util.default_generators['filename'](r) - params['rndseed'] = kpov_util.alnum_gen(r, 8) - return params - - -def task_check(results, params): - import os - import re - hints = [] - score = 0 - if results['ssh'] is not True: - hints += ['ssh failed: ' + results['ssh']] - hidden_contents = params['magicstr'] - r = random.Random(params['rndseed']) - dstfile = "".join([r.choice("qQoOp") for i in range(64)]) + "I.txt" - dstfile = dstfile.replace('O', 'I') - for i in range(1000): - start = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - mid = "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) - end = r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) - #if start[:2] == "po" and end == "lz": - # start = "po" - # mid = "kaka" - x = start + mid + end - hidden_contents += x + "\r\n" - expected_contents = hidden_contents - #expected_contents = re.sub(r"^po.*lz\r$", - # r"pokakalz\r", - # hidden_contents, - # re.MULTILINE) - if results["dst_file_contents"] == expected_contents: - score += 3 - else: - diff_pos = (0, "") - for i, c in enumerate(results["dst_file_contents"]): - if len(expected_contents) < i or c != expected_contents[i]: - start = max(0, i-10) - end = min(len(expected_contents), len(results["dst_file_contents"]), i+20) - diff_pos = (i, results["dst_file_contents"][start:end]) - break - hints += ["wrong file contents\n" + str(diff_pos[1])] - params['dstfile'] = dstfile - expected_dst_ls = "-rw--w---- 1 {testuser} bilbo .*{dstfile}".format(**params) - if re.match(expected_dst_ls, results["dst_ls"]): - score += 2 - else: - hints += ["missing file or wrong user/permissions\n" + results["dst_ls"] + "\n" + expected_dst_ls] - if results["home_ls"].find(params['dstfile']) > -1: - score += 2 - expected_mnts = [ - "/dev/sdb2 on {mntdir} type ext4".format(**params), - "sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)", - "proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)", - "udev on /dev type devtmpfs (rw,nosuid,relatime", - "/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)",] - if all([results["mnt"].find(expected_mnt) > -1 for expected_mnt in expected_mnts]): - score += 3 - else: - hints += ["missing or wrong mount\n"] - return score, hints - - -def prepare_disks(templates, task_params, global_params): - import random - import os - - # first create the file contents to make it easyer to check. - hidden_contents = task_params['magicstr'] - r = random.Random(task_params['rndseed']) - dstfile = "".join([r.choice("qQoOp") for i in range(64)]) + "I.txt" - for i in range(1000): - x = "".join([r.choice(["po", "p0", "no", "ko", "fo", "qo"]) for i in range(20)]) - x += "".join([r.choice("uiasdfghjkyxcvbnm1234567890ASDFGHJKYZXCVBNM") for i in range(60)]) - x += r.choice(["lz", "1z", "Iz", "iz", "l2", "I2", "12"]) - hidden_contents += x + "\n" - - # create hidden file - dir_list = ['Qlipper', 'Thunar', 'blender', 'autostart', 'kazam', 'mc', 'netsurf', 'pulse', 'qupzilla', 'radare2', 'teamviewer', 'texstudio', 'vlc'] - ending_list = ['rc', '.conf', '', '.txt'] - start_list = ['net', 'dev', 'doc', 'lib', 'time', 'conf'] - for i in range(20): - start_list.append("".join([r.choice("qQoOp") for i in range(64)]) + "O") - r.shuffle(dir_list) - file_letters = ["mod", "co"] - - d = templates['smallstudent-personal'] - d.mkdir('/mnt/.hideme') - d.mkdir('/media/.hideme') - for potential_dir in dir_list: - try: - potential_dir1 = os.path.join('/mnt/.hideme', potential_dir) - potential_dir2 = os.path.join('/media/.hideme', potential_dir) - d.mkdir(potential_dir1) - d.chown(1001, 1001, potential_dir1) - d.mkdir(potential_dir2) - d.chown(1001, 1001, potential_dir2) - except: - pass - rndstr2 = dstfile - for i in range(r.randint(2, 20)): - hidden_file_name1 = os.path.join(potential_dir1, - rndstr2) - hidden_file_name2 = os.path.join(potential_dir2, - rndstr2) - d.write(hidden_file_name1, hidden_contents) - d.chown(1001, 1001, hidden_file_name1) - file_letters = ["stamp", "", "dev", "re"] - hidden_contents = "".join([r.choice("asdfghjkyxcvbnm1234567890 \n") for j in range(10000)]) - d.write(hidden_file_name2, hidden_contents) - d.chown(1001, 1001, hidden_file_name2) - rndstr2 = r.choice(start_list) + \ - r.choice(file_letters) + r.choice(ending_list) - file_letters = file_letters + ["mod", "co"] - # TODO create some additional files - - # write_default_config(templates['simpleArbiterDhcpGW'], global_params) diff --git a/kpov_judge/tasks/set_ip_dhcp_hostname/task.py b/kpov_judge/tasks/set_ip_dhcp_hostname/task.py deleted file mode 100644 index 1007424..0000000 --- a/kpov_judge/tasks/set_ip_dhcp_hostname/task.py +++ /dev/null @@ -1,100 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -
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 (BREZ_DHCP) poskrbi, da bo imel statično nastavljen IP.
-
-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).
-
-Naslov BREZ_DHCP ter ime računalnika za Z_DHCP dobite ob zagonu run_test.py na računalniku SimpleArbiter.
-""" -} - -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': {'descriptions': {'si': 'Naslov za DHCP'}, 'w': False, 'public': False, 'type': 'IP', 'generated': True}, - 'Hostname_DHCP': {'descriptions': {'si': 'Ime DHCP'}, 'w': False, 'public': True, 'type': 'hostname', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov BREZ_DHCP'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'IP_dhcp_static': {'descriptions': {'si': '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): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['IP_DHCP'], params['IP_static'], params['IP_dhcp_static'] = kpov_util.IPv4_addr_gen(r, net, 3) - params['Hostname_DHCP'] = kpov_util.hostname_gen(r) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - if results['bla']: - score += 3 - return score, hints - -def prepare_disks(templates, task_params, global_params): -# d = templates['simpleArbiterDhcp'] -# create config for static_DHCP -# set static_DHCP hostname - write_default_config(templates['simpleArbiterDhcp'], global_params) diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html b/kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html deleted file mode 100644 index 74dfeea..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/en/index.html +++ /dev/null @@ -1,73 +0,0 @@ -

-

Purpose of the assignment

-Learn how to setup network interfaces in most modern Linux distributions (NetworkManager). -

-

-

Quick instructions

-Set a static IP in NetworkManager, set a static IP and DNS server in /etc/network/interfaces. You'll get both IP's when you execute script run_test.py. -

-

-

Instructions

-
    -
  1. From the directory with images of virtual computers, download the following:
    maliNetworkManager, maliBrezNetworkManager, SimpleArbiterDhcp.
  2. - -
  3. Set the network for virtual computers, so that SimpleArbiterDhcp's 1. nework interface is connected to the same network, as the only network interface for maliNetworkManager and maliBrezNetworkManager,
    - SimpleArbiterDhcp's 2. network interface will be connected to a NAT or a physical network, where the address and route (gateway) to the internet is obtained via DHCP.
  4. - -
  5. Start SimpleArbiterDhcp. Sign in as user "tester" with password "SedemKrogovPekla".
  6. -
  7. -slika-04
    -Use command
    ping 193.2.1.66
    to check if SimpleArbiterDhcp is connected to internet. If you get ping reply, you're connected to the internet. Cancel the ping with combination CTRL+C.
    - If SimpleArbiterDhcp doesn't have internet access, change the network settings in Virtual box for 1. and 2. network interface, then restart the virtual computer. - -
  8. -
  9. Run the script run_test.py.
  10. - -
  11. Enter "03.predvaja" as assignment name.
  12. - -
  13. Read the maliNetworkManager's static IP . Leave SimpleArbiterDhcp running in the background until you have setup the maliNetworkManager.
  14. - -
  15. Start maliNetworkManager.
  16. - -
  17. -Sign in the GUI(graphical user interface) using username "student" and password "vaje".
  18. -
  19. ikona network manager
    -Right click on the icon for network settings.
    - -
  20. -Menu NetworkManager
    -Choose "Edit Connections"
  21. - -
  22. -Menu NetworkManager
    -Click "Edit"
  23. - -
  24. -Menu NetworkManager
    -In tab "IPv4" change the "Method" to "Manual". Click "Add". Set the SimpleArbiterDhcp's static IP as static IP A.
    -Add Arnes DNS: 193.2.1.66 to DNS servers. -
  25. -
  26. Click "Save"
  27. - -
  28. Switch to SimpleArbiterDhcp. Click "Enter" or "OK".
  29. - -
  30. Read maliBrezNetworkManager's IP . Click "OK". Read the DNS server's address .
  31. - -
  32. Switch to maliBrezNetworkManager. Switch to first console using combination CTRL+ALT+F1. Sign in as root (su) with password "kaboom".
  33. - -
  34. Open the file /etc/network/interfaces. Edit the settings according to the information you got on SimpleArbiter. Entry for network interface should look something like this:
    -
    -allow-hotplug eth0
    -iface eth0 inet static
    -    10.0.1.2
    -    netmask 255.255.255.128
    -    dns-nameservers 10.0.1.5
    -
    -
  35. - -
  36. Save the settings. Use the command
    reboot
    to restart maliBrezNetworkManager. On boot the NetworkManager reads which network interfaces are configured in /etc/network/interfaces. After that NetworkManager doesn't manage these interfaces anymore.
  37. - - -Press OK on SimpleArbiterDhcp. If all went ok, you have completed this assignment. -
-

diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png deleted file mode 100644 index 754c200..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png deleted file mode 100644 index 866a51d..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png deleted file mode 100644 index d6ccf42..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png deleted file mode 100644 index 10b5ec7..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png deleted file mode 100644 index 0a87ae6..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png deleted file mode 100644 index e71474a..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png deleted file mode 100644 index d4bba87..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html b/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html deleted file mode 100644 index 6236245..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html +++ /dev/null @@ -1,74 +0,0 @@ -

-

Namen vaje

-Naučite se, kako se nastavljajo omrežni vmesniki v večini sodobnih Linux distribucij (NetworkManager). -

-

-

Naloga na hitro

-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. -

-

-

Navodila

-
    -
  1. Z imenika s slikami virtualnih računalnikov povlecite slike maliNetworkManager, maliBrezNetworkManager, SimpleArbiterGW
  2. - -
  3. Nastavite omrežja navideznih računalnikov tako, da bo
    1. omrežni vmesnik SimpleArbiterGW povezan na isto omrežje kot edini omrežni vmesnik maliNetworkManager in maliBrezNetworkManager,
    - 2. vmesnik SimpleArbiterGW bo povezan na NAT ali fizično omrežje, kjer prek DHCP dobi naslov in pot (prehod, gateway) do Interneta.
  4. - -
  5. Zaženite SimpleArbiterGW. Prijavite se kot uporabnik tester z geslom SedemKrogovPekla
  6. -
  7. -slika-04
    -Z ukazom
    ping 8.8.8.8 
    preverite, ali je SimpleArbiterGW na Internetu. Če je, boste približno vsako sekundo dobili odziv. Ping prekinete -s kombinacijo tipk CTRL+C.
    - Če SimpleArbiterGW ne pride do Interneta, v VirtualBox zamenjajte nastavitve 1. in 2. omrežni vmesnik ter ponovno zaženite navidezni računalnik. -
  8. -
  9. Poženite run_test.py.
  10. - -
  11. Kot ime naloge vpišite preparation
  12. - -
  13. Preberite statični IP maliNetworkManager. Pustite SimpleArbiterGW da teče v ozadju, dokler niste nastavili maliNetworkManager
  14. - -
  15. Zaženite maliNetworkManager.
  16. - -
  17. -Prijavite se v grafično okolje z uporabniškim imenom student, geslom vaje
  18. -
  19. ikona network manager
    -Desno-kliknite na ikono za mrežne nastavitve.
    - -
  20. -Menu NetworkManager
    -Izberite "Edit Connections".
  21. - -
  22. -Menu NetworkManager
    -Kliknite "Edit"
  23. - -
  24. -Menu NetworkManager
    -V zavihku "IPv4" spremenite "Method" na "Manual". Kliknite na "Add". Nastavite statični IP, ki ste ga prebrali na SimpleArbiterGW kot statični I.
    -V DNS servers dodajte naslov DNSja, ki van ha poda run_test.py. Kot gateway dodaj IP SimpleArbiterGW. -
  25. -
  26. Kliknite "Save".
  27. - -
  28. Preklopite na SimpleArbiterGW. Pritisnite "Enter" oz. "OK".
  29. - -
  30. Preberite IP maliBrezNetworkManager. Pritisnite "OK". Preberite naslov DNS strežnika.
  31. - -
  32. Preklopite na maliBrezNetworkManager. Preklopite na prvo konzolo s kombinacijo CTRL+ALT+F1. Prijavite se kot root z geslom kaboom.
  33. - -
  34. 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:
    -
    -allow-hotplug eth0
    -iface eth0 inet static
    -    address "Podan IP"
    -    netmask 255.255.255.0
    -    dns-nameservers "Podan DNS"
    -    getway "IP SimpleArbiterGW"
    -
    -
  35. - -
  36. Shranite nastavitve. Z ukazoma "ifdown eth0", in ifup eth0" posodobite NetworkManager ki prebere -kateri omrežni vmesniki so nastavljeni v /etc/network/interfaces. Za te vmesnike potem ne skrbi več.
  37. - -Na SimpleArbiterGW pritisnite OK. Če je šlo vse po sreči, ste opravili tokratno nalogo. -
-

diff --git a/kpov_judge/tasks/set_ip_static_dhcp/task.py b/kpov_judge/tasks/set_ip_static_dhcp/task.py deleted file mode 100644 index 0d11f43..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/task.py +++ /dev/null @@ -1,127 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si': '''\ -

-Ustvari tri navidezne računalnike. Za prvega uporabi sliko diska simpleArbiterDhcpGW, za drugega sliko diska -maliNetworkManager, za tretjega sliko diska maliBrezNetworkManager. Računalnike imenujmo enako kot slike diska. - -

-Na maliBrezNetworkManager poskrbi, da NetworkManager ne bo več skrbel za omrežni vmesnik, temveč bosta delovala ukaza ifup in ifdown. - -

-Na maliNetworkManager nastavi naslov IP {{IP_NM}} ter DNS {{DNS_NM}}. - -

-Na maliBrezNetworkManager nastavi naslov IP {{IP_static}} ter DNS {{DNS_static}}. -''', - 'en': '''\ -

-Create three virtual machines. Use simpleArbiterDhcpGW as the disk image for the first, maliNetworkManager as the disk image for the second, and maliBrezNetworkManager for the third. The virtual machine names can match the disks. - -

-Make sure that on maliBrezNetworkManager ifup and ifdown can be used to configure the network and that NetworkManager, while still installed, will not manage the network interface. The IP should be {{IP_static}} and the computer should use the server {{DNS_static}} for DNS. - -

-On maliNetworkManager, set the IP address to {{IP_NM}} and use {{DNS_NM}} for DNS. -''', -} - -computers = { - 'maliNetworkManager': { - 'disks': [ - { 'name': 'maliNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGW', - }, - ], - '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': {'descriptions': {'si': 'Naslov maliNetworkManager', 'en': 'IP address for maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager', 'en': 'DNS for maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager', 'en': 'IP address for maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager', 'en':'DNS for maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - import collections - - tests = ( - ('nmcli', 'nmcli -c no d'), - ('nslookup', 'nslookup www.arnes.si'), - ) - - results = collections.defaultdict(str) - for name, host in [('nm', IP_NM), ('static', IP_static)]: - host_results = kpov_util.ssh_test(host, 'student', 'vaje', tests) - for key, value in host_results.items(): - results[key+'-'+name] = value - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - 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 = kpov_util.IPv4_subnet_gen(r, '10.94.96.0/19', 25) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - if results['ssh-nm'] is True: - score += 1 - else: - hints += ['mali ssh failed: ' + results['ssh-nm']] - if results['ssh-static'] is True: - score += 1 - else: - hints += ['malibrez ssh failed: ' + results['ssh-static']] - if params['DNS_NM'] in results['nslookup-nm']: - score += 2 - else: - hints += ['NM nslookup incorrect'] - if params['DNS_static'] in results['nslookup-static']: - score += 2 - else: - hints += ['static nslookup incorrect'] - if re.search(r'e(th0|np0s3|ns3) +ethernet +connected', results['nmcli-nm']): - score += 2 - else: - hints += ['nmcli incorrect'] - if re.search(r'e(th0|np0s3|ns3) +ethernet +unmanaged', results['nmcli-static']): - score += 2 - else: - hints += ['nmcli on malibrez incorrect'] - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcpGW'], global_params) 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) diff --git a/kpov_judge/tasks/smb_nfs/howtos/en/index.html b/kpov_judge/tasks/smb_nfs/howtos/en/index.html deleted file mode 100644 index fe056b4..0000000 --- a/kpov_judge/tasks/smb_nfs/howtos/en/index.html +++ /dev/null @@ -1,341 +0,0 @@ - - - -smb_nfs - - - -

- smb_nfs -

-

- VirtualBox | Server | Client | NFS | Samba | DHCP -

-

- Quick guide -

-

- Set up two virtual computers - SimpleArbiterDhcp and FileServer. -

-

- Make sure that the directory /srv/nfs/ERLbbBrT on FileServer is accessible - over NFS and over SMB under the sharename urania-03. - Set the SMB server name to zarptica-32. -

-

- SimpleArbiterDhcp should have write access to /srv/nfs/ERLbbBrT over NFS. -

- -

- Instructions -

-
    -
  • -

    - Download these VM images: -

    -
      -
    • - student-fileserver.vdi -
    • -
    • - simpleArbiterDhcpGW.vdi -
    • -
      -
    -
  • - -
  • -

    - VirtualBox Settings: -

    -
      -
    • - Enable PAE/NX for both VMs: Settings⇒System⇒Processor -
    • -
    • - For FileServer -
        -
      • - Adapter 1 - NAT -
      • -
      • - Adapter 2 - Internal Network -
      • -
      -
    • -
    • - For SimpleArbiterDhcp -
        -
      • - Adapter 1 - Internal Network -
      • -
      -
    • -
    -
  • -
    - -
  • -

    - Server FileServer -

    -
      - -
    1. - Set up a DHCP server -
        -
      1. - - apt-get update - -
      2. -
      3. - - apt-get install isc-dhcp-server - -
      4. -
      5. - The server will not start (error - - Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!) - , configure 3 files: -
          -
        • - In /etc/network/interfaces set static IP for eth1 on which the DHCP server will be running, - e.g.: -

          - auto eth1
          - iface eth1 inet static
          - address 192.168.1.10
          - netmask 255.255.255.0
          - network 192.168.1.0
          - broadcast 192.168.1.255
          -

          -
        • -
        • - In /etc/default/isc-dhcp-server: -

          - INTERFACES="eth1" -

          -
        • -
        • - In /etc/dhcp/dhcpd.conf configure the subnet properties, - e.g.: -

          - authoritative;
          - default-lease-time 600;
          - max-lease-time 7200;
          -
          - subnet 192.168.1.0 netmask 255.255.255.0 {
          - range 192.168.1.100 192.168.1.200;
          - option routers 192.168.1.10;
          - option domain-name-servers 193.2.1.66, 8.8.4.4;
          -
          - host SimpleArbiter {
          - hardware ethernet 08:00:27:A2:FB:B4;
          - fixed-address 192.168.1.180;
          - }
          - }
          -

          -
        • -
        -
      6. -
      -
    2. - -
    3. - Set up a NFS server -
        -
      1. - apt-get install nfs-kernel-server -
      2. -
      3. - Determine the rules in /etc/exports, e.g.: -

        - #privileges for SimpleArbiterDhcp
        - /srv/nfs/ERLbbBrT 192.168.1.180(rw,sync,insecure)
        - /srv/nfs/ERLbbBrT 192.168.1.0/24(ro,sync,insecure)
        -

        -
      4. -
      5. - Change the owner of the directory and files in it: - - chown student /srv/nfs/ERLbbBrT - - and similarly for all the files in shared directory. The owner should not be root. -
      6. -
      7. - Run command - exportfs -rv - to export file systems -

        After that run - - services nfs-kernel-server restart - -

        -
      8. -
        -
      -
    4. - -
    5. - Set up SMB server -
        -
      1. - - apt-get install samba - -
      2. -
      3. - Create directory urania-03 and set owner and privileges: -

        - mkdir /home/student/urania-03
        - chown -R root:users /home/urania-03/
        - chmod -R ug+rwx,o+rx+w /home/urania-03
        -

        -
      4. -
      5. - Edit configurations in /etc/samba/smb.conf, add at the bottom of document, e.g.: -

        - [global]
        - workgroup = users
        - server string = zarptica-32
        - dns proxy = no
        - log file = /var/log/samba/log.%m
        - max log size = 1000
        - syslog = 0
        - panic action = /usr/share/samba/panic-action %d
        - security = user
        - encrypt passwords = yes
        - passdb backend = tdbsam
        - obey pam restrictions = yes
        - unix password sync = yes
        - passwd program = /usr/bin/passwd %u
        - passwd chat = *Enter\snew\s*\spassword:* %n\n
        *Retype\snew\s*\spassword:* %n\n
        *password\supdated\ssuccessfully* .
        - pam password change = yes
        - map to guest = bad user
        - usershare allow guests = yes
        -
        - [homes]
        - comment = Home Directories
        - browseable = no
        - read only = yes
        - create mask = 0700
        - directory mask = 0700
        - valid users = %S
        -
        - [printers]
        - comment = ALl Printers
        - browseable = no
        - path = /var/spool/samba
        - printable = yes
        - guest ok = no
        - read only = yes
        - create mask = 0700
        -
        - [print$]
        - comment = Printer Drivers
        - path = /var/lib/samba/printers
        - browseable = yes
        - read only = yes
        - guest ok = no
        -
        - [urania-03]
        - comment = All Users
        - path = /home/urania-03
        - users = @users
        - force group = users - create mask = 0660
        - directory mask = 0771
        - writable = yes
        -

        -
      6. -
      7. - Restart Samba: - - service samba restart - -
      8. -
      9. -

        - Test the syntax of smb.conf file with command - - testparam - -

        -
      10. -
      11. - Add users: -

        - In order to define passwords for Samba users they have to exist on a local system, too. -

        - Use command - - useradd USERNAME --shell /bin/false - - to create user with a disabled account and without home directory, e.g: -

        - useradd tester --shell /bin/false -

        -

        -

        - Define Samba password for your user: -

        - smbpasswd -a tester -

        -

        - Add the user to your group. -

        - Open /etc/group file and add group and users: - - users:x:1002:tester - -

        -

        -
      12. Restart Samba. -
      13. - -
      -
    6. -
    -
  • -
    - -
  • -

    - Client SimpleArbiterDhcp -

    -
      -
    • Create directories for your mounts, e.g.: -

      - mkdir mnt
      - mkdir mnt/smb
      - mkdir mnt/nfs
      -

      -
    • -
    • - NFS: Run command -

      - sudo mount 192.168.1.10:/srv/nfs/ERLbbBrT /mnt/nfs -

      -
    • -
    • - SMB: Run command -

      - sudo mount -t cifs //192.168.1.10/urania-03 /mnt/smb -o username=tester,password=test,workgroup=users
      -

      -
    • -

      - You should be able to access shared folders now. -

      -
    -
  • -
- - \ No newline at end of file diff --git a/kpov_judge/tasks/smb_nfs/howtos/images/parameters.png b/kpov_judge/tasks/smb_nfs/howtos/images/parameters.png deleted file mode 100644 index 7d3db83..0000000 Binary files a/kpov_judge/tasks/smb_nfs/howtos/images/parameters.png and /dev/null differ diff --git a/kpov_judge/tasks/smb_nfs/howtos/si/index.html b/kpov_judge/tasks/smb_nfs/howtos/si/index.html deleted file mode 100644 index 80d910d..0000000 --- a/kpov_judge/tasks/smb_nfs/howtos/si/index.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - SMB NFS How To - - - - - -

KPOV Judge 7 (SMB NFS)

-

V tej vaji postavimo na linux-u strežnik za nudenje datotek prek mreže in strežnik za SMB, s katerim lahko na Windows sistemih postavimo datoteko v skupno rabo. Pazi da bo simpleArbiterDhcpGW imel NFS pravico pisanja po imeniku!

-

Virtualni računalniki

-
    -
  • simpleArbiterDhcpGW
  • -
  • student-fileserver
  • -
-

simpleArbiterDhcpGW

-

Naj ima 2 omrežna vmesnika, prvi naj bo preko NAT povezan na svetovni splet, drugi vmesnik pa naj vsebuje interno povezavo znotraj virtualnih sistemov na tvojem računalniku “intnet”.

-

student-fileserver

-

Naj ima 1 omrežni vmesnik, povezan na interno omrežje “intnet”.

-

Parametri

-
- Parametri -

Parametri za reševanje naloge

-
-

Tokrat imamo tri parametre. “Imenovani” dir, smb-share, smb-server.

-

Oziroma iz slike so to:

-
    -
  • dir = TeNVU74X
  • -
  • smb-share = aurora-85
  • -
  • smb-server = melete-04
  • -
-

Postopek

-

Ko zaženemo simpleArbiterDhcpGW in student-fileserver se najprej prijavimo v oba sistema. Nato pa na student-fileserver poženemo

-
apt-get update && apt-get install nfs-kernel-server samba
-

Nastavitve NFS

-

V datoteki /etc/exports dodamo sledečo vrtstico: /srv/nfs/[dir] [IP simpleArbiterDhcpGW](rw).

Datoteko shranimo in znova poženemo NFS strežnik.

-
service nfs-kernel-server restart
-

Ustvarimo imenik, ki smo ga malce prej navedli v nastavitvah NFS. In nato omogočimo vsem pisanje po tem imeniku.

-
-
-mkdir /srv/nfs/[dir]
-chmod oug+w /srv/nfs/[dir]
-
-
-

Nastavitve SMB

-

Vse nastavitvene datoteke SMB se nahajajo v imeniku: /etc/samba. Zanima pa nas datoteka smb.conf.

-
# Datoteka smb.conf
-    [global]
-
-    workgroup = WORKGROUP
-    netbios name = [smb-server] # Nadomestek DNS, ki si ga je izmislil Microsoft
-
-    # Malce nižje pod vrstico =========== Share Definitions =========== dodamo svoje nastavitve
-
-    [[smb-share]] # Primer iz slike: [aurora-85]
-    path = /srv/nfs/[dir]
-    read only = no
-    guest ok = yes
-    browseable = yes
-

Ko popravimo to datoteko restartamo SMB in NetBios s spodnjima ukazoma.

-
service smbd restart
-service nmbd restart
-

Testiranje

-

Sedaj samo še testiranje :) Za to pa na simpleArbiterDhcpGW poženi testno skripto.

-
./test_task.py
- - - - diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py deleted file mode 100644 index 6d1e51d..0000000 --- a/kpov_judge/tasks/smb_nfs/task.py +++ /dev/null @@ -1,138 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -# TODO: dokoncaj! -instructions = { - 'si': '''\ -

-Postavi dva navidezna računalnika: simpleArbiterDhcp in FileServer. - -

-Poskrbi, da bo imenik {{NFS_MOUNT}} na FileServer dostopen prek NFS in prek SMB kot imenik v skupni rabi {{SMB_SHARENAME}}. Ime strežnika SMB nastavite na {{FILESERVER_NAME}}. - -

-SimpleArbiterDhcp naj ima prek NFS pravico pisati po imeniku. -''', - 'en': '''\ -

-Set up two virtual computers: simpleArbiterDhcp and FileServer. - -

-Make sure that the directory {{NFS_MOUNT}} on FileServer is accessible over NFS and over SMB under the sharename {{SMB_SHARENAME}}. Set the SMB server name to {{FILESERVER_NAME}}. - -

-SimpleArbiterDhcp should have write access to {{NFS_MOUNT}} over NFS. -''', -} - -computers = { - 'FileServer': { - 'disks': [ - { 'name': 'student-fileserver', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGW', - }, - ], - 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'FILESERVER_IP': {'descriptions': {'si': 'IP streznika'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'FILESERVER_NAME': {'descriptions': {'si': 'Ime streznika'}, 'w': False, 'public':True, 'type': 'hostname', 'generated': True}, - 'SMB_SHARENAME': {'descriptions': {'si': 'Ime imenika v skupni rabi prek SMB', 'en': 'SMB sharename'}, 'w': False, 'public':True, 'type': 'filename', 'generated': True}, - 'NFS_MOUNT': {'descriptions': {'si': 'Imenik, dostopen prek NFS'}, 'w': False, 'public': True, 'type': 'filename', 'generated': True}, - 'SHARED_FILENAME': {'descriptions': {'si': 'Iskana datoteka'}, 'w': False, 'public': True, 'type': 'filename', 'generated': True}, - 'SHARED_CONTENT': {'descriptions': {'si': 'Vsebina iskane datoteke'}, 'w': False, 'public': False, 'type': 'short', 'generated': True}, - 'SHARED_FILE_SEED': {'descriptions': {'si': 'Dodatni podatek za testiranje'}, 'w': False, 'public': True, 'type': 'filename', 'generated': True}, -} - -def task(FILESERVER_IP, FILESERVER_NAME, NFS_MOUNT, SMB_SHARENAME, SHARED_FILE_SEED): - import pexpect - import random - # TODO: (polz) Try using pexpect instead of subprocess, it's much nicer. - # Tabela vseh mountov. - # Samo mounti na streznik. - results = dict() - results['mount'] = pexpect.run('mount') - results['try_mount_nfs'] = pexpect.run('sudo mount -t nfs {}:/{} /mnt/nfs'.format( - FILESERVER_IP, NFS_MOUNT)) - results['try_mount_smb'] = pexpect.run( - 'sudo mount -t cifs //{}/{} /mnt/smb -o ip={},guest'.format( - FILESERVER_NAME, SMB_SHARENAME, FILESERVER_IP)) - results['mount_after'] = pexpect.run('mount') - results['ls_smbmount'] = pexpect.run('ls /mnt/smb') - results['ls_nfs'] = pexpect.run('ls /mnt/nfs') - r = random.Random(SHARED_FILE_SEED) - testfile = kpov_util.fname_gen(r) - teststring = kpov_util.alnum_gen(r, 200) - with open('/mnt/nfs/{}'.format(testfile),'w') as f: - f.write(teststring) - results['filestr'] = pexpect.run( - 'cat /mnt/smb/{}'.format(testfile)) - results['filels'] = pexpect.run( - 'ls /mnt/smb/'.format(testfile)) - pexpect.run('rm /mnt/nfs/{}'.format(testfile)) - results['filels_later'] = pexpect.run('ls /mnt/smb') - pexpect.run("sudo umount /mnt/nfs") - pexpect.run("sudo umount /mnt/smb") - return results - -def gen_params(user_id, params_meta): - d = kpov_util.default_gen(user_id, params_meta) - r = random.Random(user_id) - d['FILESERVER_NAME'] = kpov_util.hostname_gen(r) - d['SMB_SHARENAME'] = kpov_util.hostname_gen(r) - d['NFS_MOUNT'] = "/srv/nfs/" + kpov_util.fname_gen(r, False) - d['SHARED_FILENAME'] = kpov_util.fname_gen(r) - d['SHARED_CONTENT'] = kpov_util.fortune(r, 4096) - d['SHARED_FILE_SEED'] = kpov_util.alnum_gen(r, 42) - return d - -def task_check(results, params): - score = 0 - hints = [] - r = random.Random(params['SHARED_FILE_SEED']) - testfile = kpov_util.fname_gen(r) - teststring = kpov_util.alnum_gen(r, 200) - # no need to check results['mount'] or results['try_mount_nfs'] - # or results['try_mount_smb'] - if results['mount_after'].find('//{}/{} on /mnt/smb type cifs'.format( - params['FILESERVER_NAME'], params['SMB_SHARENAME'])) >= 0: - score += 2 - if results['mount_after'].find('{}:{} on /mnt/nfs type nfs'.format( - params['FILESERVER_IP'], params['NFS_MOUNT'])) >= 0: - score += 2 - if results['ls_smbmount'].find(params['SHARED_FILENAME']) >= 0: - score += 1 - if results['ls_nfs'].find(params['SHARED_FILENAME']) >= 0: - score += 1 - if results['filestr'] == teststring: - score += 2 - filels_later = set(results['filels_later'].split()) - filels = set(results['filels'].split()) - if "".join(filels - filels_later).find(testfile) >= 0: - score += 2 - return score, hints - -def prepare_disks(templates, task_params, global_params): - d = templates['student-fileserver'] - d.mkdir("/srv/nfs") - d.mkdir(task_params['NFS_MOUNT']) - d.write(task_params['NFS_MOUNT'] + "/" + task_params["SHARED_FILENAME"], - task_params["SHARED_CONTENT"]) - d = templates['simpleArbiterDhcpGW'] - d.mkdir('/mnt/nfs') - d.mkdir('/mnt/smb') - write_default_config(templates['simpleArbiterDhcpGW'], global_params) diff --git a/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html b/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html deleted file mode 100644 index bef6792..0000000 --- a/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - snmp_agent_uptime - - -

snmp_agent_uptime

-

Quick instructions

-

- Set up three virtual computers, SimpleArbiter with the disk image - simpleArbiterDhcp, SNMPServer and SNMPClient. Write a program - called upminutes. This program should output the uptime of the - computer in minutes. Set it up on SNMPClient in the home directory - of the user test with the password test. -

-

- Make sure that the SNMP server reports it's uptime in seconds - over SNMP under NET-SNMP-EXTEND-MIB::nsExtendOutput2Table. -

-

- Write a script called beri.sh that reads the value from the - OID 1.3.6.1.4.1.8072.1.3.2.4.1.2 on SNMPServer. Set it up on - SNMPClient in the home directory of the user test. -

-

Instructions

-

Set up of VM VirtualBox

-
    -
  1. - Download the following virtual images (*.vid) from the directory - with images of virtual computers: -
      -
    1. - simpleArbiterDhcp.vdi -
    2. -
    3. - some-bash-console.vdi – twice, one for SNMPServer - and second for SNMPClient -
    4. -
    -
  2. -
  3. - VM VirtualBox WARNING! If you want to use one same virtual image - (some-bash-console.vdi) for two virtual computers - (SNMPServer and SNMPClient), you must change UUID - of one image. -
      -
    1. - Use this command - vboxmanage internalcommands sethduuid name-of-disk.vdi - to change UUID (hint). -
    2. -
    -
  4. -
  5. - Final view of sets VM VirtualBox machines.
    - VM VirtualBox machines -
  6. -
- -

Set up of SNMPServer machine

-
    -
  1. - setup network as “Bridged Adapter” -> Machine-> Settings ->Network - - Install snmpd and snmp packages and tools for inspecting the - data available over SNMP. -
      -
    1. - command apt-get install snmpd snmp snmp-mibs-downloader -
    2. -
    -
  2. - RECOMMENDATION! Before doing any changes to your /etc/snmp/snmpd.conf - file take a copy of original file. -
      -
    1. - command cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig -
    2. -
    -
  3. -
  4. - Set up the snmp server to allow all other computers to access it = edit - snmpd.conf file. -
      -
    1. - command nano /etc/snmp/snmpd.conf - (you can use different editor) -
    2. -
    3. - Check this 4 rows and make sure they look like this:
      - # Listen for connections from the local system only
      - # agentAddress udp:127.0.0.1:161
      - # Listen for connections on all interfaces (both IPv4 *and* IPv6)
      - agentAddress udp:161,udp6:[::1]:161
      -
    4. -
    -
  5. -
  6. - Add a group (community) of computers we deem to be worthy of - accessing all data. This group will be called students = again edit - snmpd.conf file. -
      -
    1. - rocommunity students 0.0.0.0/0 -
    2. -
    3. - change 0.0.0.0./0 into correct address ifconfig -a -
    4. -
    -
  7. -
  8. - OPTIONAL CONFIGURATION. Lower in the same file you can set the - location of the computer snmpd is running on and the name - of the administrator. -
      -
    1. - find under # SYSTEM INFORMATION -
    2. -
    -
  9. -
  10. - Make sure that the SNMP server reports it's uptime in seconds - over SNMP under NET-SNMP-EXTEND-MIB::nsExtendOutput2Table. -
      -
    1. - create script upseconds containing this and save it where - you want:
      - #!/bin/bash
      - uptime=$(</proc/uptime)
      - seconds=${uptime%%.*}
      - echo "Uptime in seconds:" $seconds
      - exit 0
      -
    2. -
    3. - don't forget to make the script runnable:
      - command chmod +x /your_path_to_script/upseconds -
    4. -
    5. - Then edit file snmpd.conf and under # EXTENDING THE AGENT - comment all three tests and add your line of your code - with upsecond script. It will look like this:
      - # extend test1 /bin/echo Hello, world!
      - # extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
      - # extend-sh test3 /bin/sh /tmp/shtest
      - extend-sh "your_name" "your_path_to_script_upseconds" -
      -
    6. -
    -
  11. -
  12. - You need to restart the snmp services. -
      -
    1. - command /etc/init.d/snmpd restart -
    2. -
    -
  13. -
  14. - You can test your configuration through localhost. -
      -
    1. - command snmpwalk localhost -c public -v1 -
    2. -
    -
  15. -
  16. - Also test the correct return of server's uptime in seconds SNMP under - NET-SNMP-EXTEND-MIB::nsExtendOutput2Table. -
      -
    1. - command snmpwalk -c students -v1 IPaddressOfServer - 1.3.6.1.4.1.8072.1.3.2.4.1.2 -
    2. -
    3. - you should get string: "Uptime in seconds: xyz" -
    4. -
    -
  17. -
- -

Set up of SNMPClient machine

-
    -
  1. - Install snmpd and snmp packages. -
      -
    1. - command apt-get install snmpd snmp -
    2. -
    -
  2. - RECOMMENDATION! Before doing any changes to your /etc/snmp/snmpd.conf - file take a copy of original file. -
      -
    1. - command cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig -
    2. -
    -
  3. -
  4. - Set up the snmp client to allow all other computers to access it = edit - snmpd.conf file. -
      -
    1. - command nano /etc/snmp/snmpd.conf - (you can use different editor) -
    2. -
    3. - (un)comment these four lines as below:
      - # Listen for connections from the local system only
      - # agentAddress udp:127.0.0.1:161
      - # Listen for connections on all interfaces (both IPv4 *and* IPv6)
      - agentAddress udp:161,udp6:[::1]:161
      -
    4. -
    -
  5. -
  6. - Add a group (community) of computers we deem to be worthy of - accessing all data. This group will be called students = again edit - snmpd.conf file. -
      -
    1. - rocommunity students 0.0.0.0/0 -
    2. -
    3. - write correct network address = command ifconfig -a -
    4. -
    -
  7. -
  8. - OPTIONAL CONFIGURATION. Lower in the same file you can set the - location of the computer snmpd is running on and the name - of the administrator. -
      -
    1. - find under # SYSTEM INFORMATION -
    2. -
    -
  9. - -
  10. - You need to restart the snmp services. -
      -
    1. - command /etc/init.d/snmpd restart -
    2. -
    -
  11. -
  12. - You can test your configuration through localhost. -
      -
    1. - command snmpwalk localhost -c public -v1 -
    2. -
    -
  13. -
  14. Create the user test with password test -
      -
    1. - command adduser test -
    2. -
    -
  15. -
  16. Login as user test and create program upminutes - in the home directory. This program should output the uptime of the - computer in minutes. -
      -
    1. - command nano upminutes (you can use different editor) -
    2. -
    3. - add the source code:
      - #!/bin/bash
      - uptime=$(</proc/uptime)
      - uptime=${uptime%%.*}
      - minutes=$(( uptime / 60 ))
      - echo $minutes
      - exit 0
      -
    4. -
    5. - don't forget to make the program runnable:
      - command chmod +x /home/test/upminutes -
    6. -
    7. - test the program (it should output the uptime of the - computer in minutes)
      - command /home/test/upminutes -
    8. -
    -
  17. -
  18. As user test and create next script called - beri.sh that reads the value from the OID - 1.3.6.1.4.1.8072.1.3.2.4.1.2. on SNMPServer. Set it up on SNMPClient - in the home directory of the user test. -
      -
    1. - command nano beri.sh (you can use different editor) -
    2. -
    3. - add the source code:
      - #!/bin/bash
      - snmpwalk -c students -v1 IPServerAddress 1.3.6.1.4.1.8072.1.3.2.4.1.2
      - exit 0
      -
    4. -
    5. - don't forget to make the program runnable:
      - command chmod +x /home/test/upminutes - you can test it with ./beri.sh -
    6. -
    -
  19. -
- -

Setting SimpleArbiter

- User: tester - Password: test - - apt-get install libsnmp-python - - diff --git a/kpov_judge/tasks/snmp_agent_uptime/howtos/images/01.png b/kpov_judge/tasks/snmp_agent_uptime/howtos/images/01.png deleted file mode 100644 index 1bd01aa..0000000 Binary files a/kpov_judge/tasks/snmp_agent_uptime/howtos/images/01.png and /dev/null differ diff --git a/kpov_judge/tasks/snmp_agent_uptime/howtos/si/index.html b/kpov_judge/tasks/snmp_agent_uptime/howtos/si/index.html deleted file mode 100644 index f490f6c..0000000 --- a/kpov_judge/tasks/snmp_agent_uptime/howtos/si/index.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - snmp_agent_uptime - - -

snmp_agent_uptime

-

Namen naloge

-

- -

-

Hitra navodila

-

- Naloga: Postavi tri navidezne racunalnike SimpleArbiter s sliko diska simpleArbiterDhcp,SNMPServer in - SNMPClient. - Napiši program upminutes, ki bo izpisal v minutah koliko casa je racunalnik vklopljen. - 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, koliko časa je vklopljen v sekundah. -

-

- Napisi 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. -

-

Navodila

-

Nastavitev VM VirtualBox-a

-
    -
  1. - Prenesi sledeče slike virtualk (*.vid) iz datoteke - z slikami virtualk računalnikov: -
      -
    1. - simpleArbiterDhcp.vdi -
    2. -
    3. - neko-bash-konzolo.vdi (dvakrat), enkrat za SNMPServer - in drugič SNMPClient. -
    4. -
    -
  2. -
  3. - VM VirtualBox OPOZORILO! Ce hoces uporabljati isto sliko virtualke - (neko-bash-konzolo.vdi) za dva navidezna racunalnika - (SNMPServer in SNMPClient), moras spremeniti UUID - ene od slik. -
      -
    1. - Uporabi ta ukaz - vboxmanage internalcommands sethduuid ime-diska.vdi - za spreminjanje UUID (namig). -
    2. -
    -
  4. -
  5. - Primer VM VirtualBox-a po nastavitvi.
    - -
  6. -
- -

Nastavitev SNMPServer virtualke

-
    -
  1. - Nasnemi snmpd and snmp orodja za pregledovanje - podatkov, ki so no voljo preko SNMP. -
      -
    1. - ukaz apt-get install snmpd snmp snmp-mibs-downloader -
    2. -
    -
  2. - PRIPOROCILO! Preden spreminjate vaso datoteko /etc/snmp/snmpd.conf, - naredite kopijo originalne datoteke. -
      -
    1. - ukaz cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig -
    2. -
    -
  3. -
  4. - Nastavi snmp streznik tako, da se bodo lahko nanj povezali drugi racunalniki - (popravi datoteko snmpd.conf). -
      -
    1. - ukaz nano /etc/snmp/snmpd.conf - (lahko uporabis drug urejevalnik besedila) -
    2. -
    3. - odkomentiraj sledece stiri vrstice:
      - # Listen for connections from the local system only
      - # agentAddress udp:127.0.0.1:161
      - # Listen for connections on all interfaces (both IPv4 *and* IPv6)
      - agentAddress udp:161,udp6:[::1]:161
      -
    4. -
    -
  5. -
  6. - Dodaj skupino (community) racunalnikov, ki lahko dostopajo do vseh podatkov. - To skupino bomo poimenovali students (spet potrebno spremeniti datoteko) - snmpd.conf file. -
      -
    1. - rocommunity students 0.0.0.0/0 -
    2. -
    3. - napisi pravilni naslov omrezja = ukaz ifconfig -a -
    4. -
    -
  7. -
  8. - DODATNA (NEOBVEZNA) KONFIGURACIJA. Nizje v isti datoteki lahko nastavis - lokacijo racunalnika, na katerem deluje snmp, ter ime administratorja. -
      -
    1. - poisci pod # SYSTEM INFORMATION -
    2. -
    -
  9. -
  10. - Poskrbi, da bo SNMP streznik prek SNMP pod NET-SNMP-EXTEND-MIB::nsExtendOutpucd - k t2Table sporocal, koliko casa je vklopljen v sekundah. -
      -
    1. - ustvari skripto upseconds, v kateri je zapisano sledece:
      - #!/bin/bash
      - uptime=$(</proc/uptime)
      - seconds=${uptime%%.*}
      - echo "Uptime in seconds:" $seconds
      - exit 0

      - skripto nato shrani kjerkoli hoces -
    2. -
    3. - ne pozabi skripti dodelti pravic, da jo lahko zaganjamo:
      - ukaz chmod +x /pot_do_skripte/upseconds -
    4. -
    5. - Nato uredi datoteko snmpd.conf in pod # EXTENDING THE AGENT - zakomentiraj vse tri teste ter dodaj svojo skripto upseconds. - Zgledati bi moralo nekako tako:
      - # extend test1 /bin/echo Hello, world!
      - # extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
      - # extend-sh test3 /bin/sh /tmp/shtest
      - extend-sh "ime_testa" "pot_to_skripte_upseconds" -
      -
    6. -
    -
  11. -
  12. - Potrebno je ponovno zagnati snmp storitev. -
      -
    1. - ukaz /etc/init.d/snmpd restart -
    2. -
    -
  13. -
  14. - Lahko testiras svoje nastavitve preko localhost-a. -
      -
    1. - ukaz snmpwalk localhost -c public -v1 -
    2. -
    -
  15. -
  16. - Stestiraj tudi, ali SNMP vrne pravilni cas delovanja (uptime) v sekundah - pod NET-SNMP-EXTEND-MIB::nsExtendOutput2Table. -
      -
    1. - ukaz snmpwalk -c students -v1 IPnaslovStreznika - 1.3.6.1.4.1.8072.1.3.2.4.1.2 -
    2. -
    3. - moral bi vrniti taksen string: "Uptime in seconds: xyz" -
    4. -
    -
  17. -
- -

Nastavitev SNMPClient virtualke

-
    -
  1. - Nasnemi snmpd and snmp paketa. -
      -
    1. - ukaz apt-get install snmpd snmp -
    2. -
    -
  2. - PRIPOROCILO! Preden spreminjate vaso datoteko /etc/snmp/snmpd.conf, - naredite kopijo originalne datoteke. -
      -
    1. - ukaz cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig -
    2. -
    -
  3. -
  4. - Nastavi snmp streznik tako, da se bodo lahko nanj povezali drugi racunalniki - (popravi datoteko snmpd.conf). -
      -
    1. - ukaz nano /etc/snmp/snmpd.conf - (lahko uporabis drug urejevalnik besedila) -
    2. -
    3. - odkomentiraj sledece stiri vrstice:
      - # Listen for connections from the local system only
      - # agentAddress udp:127.0.0.1:161
      - # Listen for connections on all interfaces (both IPv4 *and* IPv6)
      - agentAddress udp:161,udp6:[::1]:161
      -
    4. -
    -
  5. -
  6. - Dodaj skupino (community) racunalnikov, ki lahko dostopajo do vseh podatkov. - To skupino bomo poimenovali students (spet potrebno spremeniti datoteko) - snmpd.conf file. -
      -
    1. - rocommunity students 0.0.0.0/0 -
    2. -
    3. - napisi pravilni naslov omrezja = ukaz ifconfig -a -
    4. -
    -
  7. -
  8. - DODATNA (NEOBVEZNA) KONFIGURACIJA. Nizje v isti datoteki lahko nastavis - lokacijo racunalnika, na katerem deluje snmp, ter ime administratorja. -
      -
    1. - poisci pod # SYSTEM INFORMATION -
    2. -
    -
  9. - -
  10. - Potrebno je ponovno zagnati snmp storitev. -
      -
    1. - ukaz /etc/init.d/snmpd restart -
    2. -
    -
  11. -
  12. - Lahko testiras svoje nastavitve preko localhost-a. -
      -
    1. - ukaz snmpwalk localhost -c public -v1 -
    2. -
    -
  13. -
  14. Ustvari uporabnika test z geslom test -
      -
    1. - ukaz adduser test -
    2. -
    -
  15. -
  16. Prijavi se kot uporabnik test ter naredi skripto upminutes - v domacem direktoriju. Ta skripta naj izpisuje cas delovanja racunalnika (uptime) v minutah. -
      -
    1. - ukaz nano upminutes (lahko uporabis drug urejevalnik besedila) -
    2. -
    3. - dodaj sledeco kodo:
      - #!/bin/bash
      - uptime=$(</proc/uptime)
      - uptime=${uptime%%.*}
      - minutes=$(( uptime / 60 ))
      - echo $minutes
      - exit 0
      -
    4. -
    5. - ne pozabi skripti dodelti pravic, da jo lahko zaganjamo:
      - ukaz chmod +x /pot_do_skripte/upminutes -
    6. -
    7. - stestiraj skripto (izpisovati bi morala cas delovanja racunalnika (uptime) v minutah)
      - ukaz /home/test/upminutes -
    8. -
    -
  17. -
  18. Kot uporabnik test naredi se eno skripto beri.shm ki bere - vrednosti od OID 1.3.6.1.4.1.8072.1.3.2.4.1.2. - na SNMPServer. Shrani jo na SNMPClient v domac direktorij uporabnika test. -
      -
    1. - ukaz nano beri.sh (lahko uporabis drug urejevalnik besedila) -
    2. -
    3. - dodaj kodo:
      - #!/bin/bash
      - snmpwalk -c students -v1 IPnaslovStreznika 1.3.6.1.4.1.8072.1.3.2.4.1.2
      - exit 0
      -
    4. -
    5. - ne pozabi skripti dodelti pravic, da jo lahko zaganjamo:
      - ukaz chmod +x /pot_do_skripte/upminutes -
    6. -
    -
  19. -
- - - diff --git a/kpov_judge/tasks/snmp_agent_uptime/task.py b/kpov_judge/tasks/snmp_agent_uptime/task.py deleted file mode 100644 index 919fcb4..0000000 --- a/kpov_judge/tasks/snmp_agent_uptime/task.py +++ /dev/null @@ -1,224 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -# TODO: finish this. -instructions = { - 'si': '''\ -

-Postavi tri navidezne računalnike: SimpleArbiter, SNMPServer in SNMPClient. - -

-Napiši program upminutes, ki bo izpisal v minutah, koliko časa je racunalnik vklopljen. Postavi ga na SNMPClient v domači imenik uporabnika test z geslom test. - -

-Poskrbi, da bo strežnik SNMP pod OID - -

{{SNMP_UPTIME_OID}}
- -

-sporočal, koliko časa je vklopljen v sekundah. - -

-Napiši skripto, poimenovano beri.sh, ki prek SNMP prebere vrednost s simpleArbiterDhcpGWSNMP na OID - -

{{SNMP_CLIENT_OID}}
- -

-kot član skupnosti testers. Postavi jo na SNMPClient, v domači imenik uporabnika test. Poskrbi, da bodo podatki na SNMPServer dostopni za skupino (angl. community) studentje. -''', - 'en': '''\ -

-Set up three virtual computers: SimpleArbiter, SNMPServer and SNMPClient. - -

-Write a program called upminutes. This program should output the uptime of the computer in minutes. Set it up on SNMPClient in the home directory of the user test with the password test. - -

-Make sure that the SNMP server reports its uptime in seconds over SNMP under OID - -

{{SNMP_UPTIME_OID}}
- -

-Write a script called beri.sh that reads the value from the OID - -

{{SNMP_CLIENT_OID}}
- -

-on simpleArbiterDhcpGWSNMP as a member of the community testers. Set it up on SNMPClient in the home directory of the user test. Make all the data available over SNMP readable by the community studentje. -''', -} - -computers = { - 'SNMPClient': { - 'disks': [ - { 'name': 'student-SNMPClient', - - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'SNMPServer': { - 'disks': [ - { 'name': 'student-SNMPServer', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcpGWSNMP', - }, - ], - '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': {'descriptions': {'si': 'Vrednost, dostopna prek SNMP', 'en': 'The value available over SNMP'}, 'w': False, 'public':False, 'type': 'short', 'generated': True}, - 'SNMP_UPTIME_OID': {'descriptions': {'si': 'SNMP_UPTIME_OID (za uptime)', 'en': 'SNMP_UPTIME_OID (for the uptime)'}, 'w': False, 'public':True, 'type': 'str', 'generated': True}, - 'SNMP_CLIENT_OID': {'descriptions': {'si': 'SNMP_CLIENT_OID, ki naj ga klient bere', 'en':'The OID that the client should read'}, 'w': False, 'public':True, 'type': 'OID', 'generated': True}, - 'SERVER_IP': {'descriptions': {'si': 'IP SNMP strežnika', 'en':'IP of the SNMP server'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'CLIENT_IP': {'descriptions': {'si': 'IP SNMP klienta', 'en': 'IP of the SNMP client'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - -} - -def task(SERVER_IP, CLIENT_IP, SNMP_UPTIME_OID, SNMP_CLIENT_OID): - #<== Aleksander Fujs 6310020 ==> - # TODO popravi IPje - import netsnmp - import paramiko - from paramiko import SSHClient - return_results = {} - - client = SSHClient() - client.load_system_host_keys() - client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - - client.connect(SERVER_IP, username='student', password='vaje') - stdin, stdout, stderr = client.exec_command('uptime=$( - - -def gen_params(user_id, params_meta): - import random - params = dict() - r = random.Random(user_id) - # You can also create an OID creation function in kpov_util. - # this should probably return params_meta - - #<== Aleksander Fujs 6310020 ==> - params['SNMP_VALUE'] = kpov_util.alnum_gen(r, 64) - params['SNMP_UPTIME_OID'] = 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."{}".1'.format( - kpov_util.hostname_gen(r)) - params['SNMP_CLIENT_OID'] = '1.3.6.1.4.1.8072.2.9999.9999.{}'.format( - r.randint(0, 255)) - #<== Aleksander Fujs 6310020 ==> - - return params - -def task_check(results, params): - #TODO improve regex - import re - score = 0 - hints = [] - client_script_uptime = int(results['client_script'].strip()) - client_uptime = int(results['client_uptime'].strip()) - d = client_uptime - client_script_uptime*60 - if d >= 0 and d < 62: - score += 3 - else: - hints += ["client uptime script output wrong."] - server_uptime = int(results['server_uptime'].strip()) - lines = results['server_OID'].split('\n') - unique_part_start = params['SNMP_UPTIME_OID'].find('"') - unique_part_end = params['SNMP_UPTIME_OID'].find('"', unique_part_start+1) - unique_part = params['SNMP_UPTIME_OID'][unique_part_start+1:unique_part_end] - server_oid = 'iso.3.6.1.4.1.8072.1.3.2.4.1.2.{}.'.format(len(unique_part)) - server_oid += '.'.join([str(ord(i)) for i in unique_part]) + '.1.' - found_uptime = False - for line in lines: - try: - oid, uptime_s = line.split(':') - d = server_uptime - int(uptime_s.strip()) - if oid.strip() == server_oid and d >= -2 and d <= 5: - found_uptime = True - break - except Exception as e: - pass - if len(lines) <= 50 and found_uptime: - score += 3 - else: - hints += ["Uptime not found in server's MDB"] - if results['client_script2'].find(params['SNMP_VALUE']) >= 0: - score += 4 - else: - hints += ["beri.sh not working properly"] - return score, hints - -def prepare_disks(templates, task_params, global_params): -# d = templates['simpleArbiterDhcp'] - prog = """#!/usr/bin/python -import sys -action = sys.argv[1] -oid = sys.argv[2] - -foo_oid = ".{oid}" -foo_oid_start = foo_oid[:foo_oid.rfind('.')] -foo_oid_end = foo_oid[len(foo_oid_start)+1:] -oid_end = oid[len(foo_oid_start)+1:] -oid_start = oid[:len(foo_oid_start)] - -if action == '-n' and ( - (oid_start == foo_oid_start) and ( - (len(oid_end) == 0) or (int(oid_end) < int(foo_oid_end)) - ) - ): - oid = foo_oid - -if action != '-s' and oid == foo_oid: - print foo_oid - print "string" - print "{val}" -""".format(oid = task_params['SNMP_CLIENT_OID'], val = task_params['SNMP_VALUE']) - templates['simpleArbiterDhcpGWSNMP'].write('/usr/local/bin/snmpext.py', prog) - templates['simpleArbiterDhcpGWSNMP'].chmod(0o755, '/usr/local/bin/snmpext.py') - write_default_config(templates['simpleArbiterDhcpGWSNMP'], global_params) diff --git a/kpov_judge/tasks/snmp_alarms_interfaces/task.py b/kpov_judge/tasks/snmp_alarms_interfaces/task.py deleted file mode 100644 index 03d4509..0000000 --- a/kpov_judge/tasks/snmp_alarms_interfaces/task.py +++ /dev/null @@ -1,107 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -instructions = { - 'si':""" -

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', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'maliBrezNetworkManager': { - 'disks': [ - { 'name': 'maliBrezNetworkManager', - }, - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - - }, - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiterDhcp', - }, - ], - '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': {'descriptions': {'si': 'Naslov maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'descriptions': {'si': 'DNS za maliNetworkManager'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'descriptions': {'si': 'Naslov maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'descriptions': {'si': 'DNS za maliBrezNetworkManager'}, 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - from pexpect 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 = kpov_util.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpov_util.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - hints = [] - 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, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiterDhcp'], global_params) diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/en/index.html b/kpov_judge/tasks/vlc_stream_rtp/howtos/en/index.html deleted file mode 100644 index c9e2714..0000000 --- a/kpov_judge/tasks/vlc_stream_rtp/howtos/en/index.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - -

Summary

- -
    -
  1. Set up a virtual machine
  2. -
  3. Install VLC
  4. -
  5. Create RTP video stream
  6. -
  7. Make sure the stream is accessible from the internet
  8. -
- -

Instructions

- -
    -
  1. -

    Set up a virtual machine

    -

    Use disk simpleArbiter. You can get it here.

    -
  2. - -
  3. -

    Install VLC

    -

    - In file /etc/apt/sources.list replace wheezy with - testing or if missing, add rows: -

    -

    - - deb http://ftp.at.debian.org/debian wheezy main contrib non-free
    - deb-src http://ftp.at.debian.org/debian wheezy main contrib non-free -
    -

    - slika-01 -

    - Check for updates and install VLC with the following commands: -

    -

    - - apt-get update
    - apt-get install vlc -
    -

    -
  4. - -
  5. -

    Create a new stream

    - -

    - Open VLC. In Media menu select Stream. -

    - menu -

    - Here we choose stream source. This can be a file, a network stream or a capture device.
    - For this excercise, add one or more video file by clicking Add ... Continue with a click on button Stream. -

    - stream source -

    - We must also choose the stream destination. For this excercise, choose RTP/MPEG Transport Stream and click Add. - You can configure multiple destinations simultaneously. -

    -

    - Configure destination settings. Enter address and stream name. -

    - stream destination -

    - Next, we can set transcoding, encapsulation, audio and video codecs and also subtitles. When you finish, click Save and Next. -

    - stream settings -

    - In the last step, it is important to check option Stream all elementary streams. - In the text area, we can see the string that can be used to run the stream from a command line. - This is useful if you want to run stream from a computer without graphic interface. -

    - -
  6. - -
  7. -

    Open stream

    -

    - We can now play the stream from another device using VLC. -

    - play stream -
  8. -
- - - - \ No newline at end of file diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/1.png b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/1.png deleted file mode 100644 index 903be70..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/1.png and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/playlist.PNG b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/playlist.PNG deleted file mode 100644 index b815098..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/playlist.PNG and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_finish.PNG b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_finish.PNG deleted file mode 100644 index f429a9b..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_finish.PNG and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_menu.png b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_menu.png deleted file mode 100644 index 01f52c6..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_menu.png and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_open.PNG b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_open.PNG deleted file mode 100644 index 772ffe8..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_open.PNG and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_output.PNG b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_output.PNG deleted file mode 100644 index c3dc2a7..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_output.PNG and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_transcoding.PNG b/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_transcoding.PNG deleted file mode 100644 index 1fbc9f3..0000000 Binary files a/kpov_judge/tasks/vlc_stream_rtp/howtos/images/stream_transcoding.PNG and /dev/null differ diff --git a/kpov_judge/tasks/vlc_stream_rtp/howtos/si/index.html b/kpov_judge/tasks/vlc_stream_rtp/howtos/si/index.html deleted file mode 100644 index c94044b..0000000 --- a/kpov_judge/tasks/vlc_stream_rtp/howtos/si/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - -

Naloga na hitro

- -
    -
  1. Postavi navidezni računalnik
  2. -
  3. Naloži VLC
  4. -
  5. Ustvari RTP video tok
  6. -
  7. Poskrbi, da bo tok dostopen na internetu
  8. -
- -

Navodila

- -
    -
  1. -

    Postavi navidezni računalnik

    -

    Uporabi disk simpleArbiter. Dobiš ga lahko tu.

    -
  2. - -
  3. -

    Naloži VLC

    -

    - V /etc/apt/sources.list v spodnjih vrsticah zamenjaj wheezy z - testing oziroma dodaj vrstice če niso napisane: -

    -

    - - deb http://ftp.at.debian.org/debian wheezy main contrib non-free
    - deb-src http://ftp.at.debian.org/debian wheezy main contrib non-free -
    -

    - slika-01 -

    - Poglej za posodobitve in nato naloži VLC z naslednjimi ukazi: -

    -

    - - apt-get update
    - apt-get install vlc -
    -

    -
  4. - -
  5. -

    Ustvari nov tok

    - -

    - Odpri VLC. V meniju Media izberi Stream. -

    - Meni -

    - V oknu "Open Media" izberemo vir toka. Ta je lahko datoteka, že obstoječ omrežni tok ali pa snemalne naprave.
    - Za namen te naloge lahko z klikom na gumb Add ... dodamo eno ali več video datotek. Nadaljujemo z klikom na Stream. -

    - Vir toka -

    - Določiti moramo tudi destinacijo toka. Za to nalogo izberemo RTP/MPEG Transport Stream in kliknemo Add. - Možno je nastaviti več destinacij hkrati. -

    -

    - Nato izpolnimo nastavitve destinacije z naslovom in imenom toka. -

    - Destinacija toka -

    - V naslednjem koraku lahko nastavimo kodiranje, enkapsulacijo, avdio in video nastavitve ter podnapise. -

    - Nastavitve Toka -

    - V zadnjem koraku je pomembno obkljukati možnost Stream all elementary streams. - V spodnjem tekstovnem polju dobimo niz, ki ga lahko uporabimo za zagon toka iz ukazne vrstice. -

    - -
  6. - -
  7. -

    Odpri tok

    -

    - Na drugem računalniku lahko ustvarjen video tok predvajamo z VLC. -

    - Predvajanje toka -
  8. -
- - - - \ No newline at end of file diff --git a/kpov_judge/tasks/vlc_stream_rtp/task.py b/kpov_judge/tasks/vlc_stream_rtp/task.py deleted file mode 100644 index 427fc0e..0000000 --- a/kpov_judge/tasks/vlc_stream_rtp/task.py +++ /dev/null @@ -1,110 +0,0 @@ -# kpov_util should be imported by add_assignment.py - -# Postavi nek film na Internet tako, da ga bodo lahko ostali videli. -# TODO: finish this - -instructions = { - 'si': '''\ -

-Postavi navidezni računalnik SimpleArbiter in StudentVLC. Poskrbi, da bosta na istem omrežju, od koder bosta imela dostop tudi do interneta. - -

-Na StudentVLC posodobi datoteko /etc/apt/sources.list, preveri posodobitve in naloži VLC. - -

-Posnemi ali kako drugače ustvari film ter poskrbi, da bo film dostopen na lokalnem omrežju prek RTP z imenom toka {{TOK}} na naslovu {{NASLOV}}, vrata {{PORT}}. Računaj, da bodo film lahko videli tvoji sošolci. Kršenje avtorskih pravic je pri reševanju te naloge strogo prepovedano. -''', - 'en': '''\ -

-Set up a virtual computer called SimpleArbiter using the simpleArbiter disk and -a virtual computer called StudentVLC using the student-VLC disk. Make sure they -are on the same network and that they have access to the Internet. - -

-On StundentVLC, update /etc/apt/sources.list, check the for updates and install VLC. - -

-Record or otherwise create a movie and make sure the movie is avaliable on your local network via RTP with the name of the stream {{TOK}} at the address {{NASLOV}} on port {{PORT}}. Take into account that the movie may be seen by your classmates. Copyright infrigement while solving this task is strictly prohibited. -''', -} - -computers = { - 'SimpleArbiter': { - 'disks': [ - { 'name': 'simpleArbiter', - }, - ], - 'network_interfaces': [{'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'StudentVLC': { - 'disks': [ - { 'name': 'student-VLC', - }, - ], - 'network_interfaces': [{'network': 'test-net'}], - 'flavor': 'm1.tiny', - 'config_drive': False - } - -} - -networks = { 'test-net': {'public': True} } - -params_meta = { - 'NASLOV': {'descriptions': {'si': 'RTP multicast IP naslov'}, 'w': False, 'public':True, 'type': 'stream_name', 'generated': True}, - 'PORT': {'descriptions': {'si': 'RTP VRATA'}, 'w': False, 'public':True, 'type': 'port', 'generated': True}, - 'TOK': {'descriptions': {'si': 'Naslov (ime) toka'}, 'w': False, 'public':True, 'type': 'IP', 'generated': True}, -} - -def task(NASLOV, TOK): - import pexpect - results = dict() - results['ps'] = pexpect.run('ps xa') - results['tcpdump_hex'] = pexpect.run('sudo /usr/sbin/tcpdump -x -c 2 dst host 239.255.255.255 and port 9875'.format(NASLOV)) - results['tcpdump'] = pexpect.run('sudo /usr/sbin/tcpdump -c 8 dst host {}'.format(NASLOV)) - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - net = kpov_util.IPv4_net_gen(r, min_hosts = 16, - local=True, multicast=True) - params['NASLOV'] = kpov_util.IPv4_addr_gen(r, net, 1)[0] - params['PORT'] = str(r.randint(5000, 6000)) - params['TOK'] = kpov_util.hostname_gen(r) - return params - -def task_check(results, params): - import re - score = 0 - hints = [] - p1_s = "" - sname = "" - try: - packs = results['tcpdump_hex'].split('> 239.255.255.255.9875: UDP, length') - p1 = packs[1] - p1_l = p1.split('\n') - p1_d = p1_l[1:-1] - p1_s = "" - for i in p1_d: - p1_s = p1_s + "".join([j.strip() for j in i.split(' ')[1:]]) - sname = "".join([hex(ord(i))[2:] for i in params['TOK']]) - except: - hints.append("problem parsing RTP stream capture result") - if p1_s.find(sname) > 2: - score += 5 - else: - hints.append("stream name not found in stream announcement") - s = "IP [^ ]* > {}.{}: UDP, length [0-9]+".format( - re.escape(params['NASLOV']), - params['PORT']) - if re.search(s, results['tcpdump']): - score += 5 - else: - hints.append("RTP stream not detected in " + results['tcpdump']) - return score, hints - -def prepare_disks(templates, task_params, global_params): - write_default_config(templates['simpleArbiter'], global_params) diff --git a/kpov_judge/test_prepare_disks.py b/kpov_judge/test_prepare_disks.py deleted file mode 100755 index bdb3f89..0000000 --- a/kpov_judge/test_prepare_disks.py +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env python3 - -import fcntl -import glob -import inspect -import os -import sys -import urllib.request - -import guestfs -import paramiko -import yaml - -import kpov_util -from test_task import http_auth -from util import write_default_config - -class SSHGuestFs: - def __init__(self, hostname, username, password): - return_results = {} - client = paramiko.SSHClient() - client.load_system_host_keys() - client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - client.connect(hostname, username=username, password=password) - self.conn = client - def __del__(self): - try: - self.conn.close() - except: - pass - def chmod(self, mode, path): - self.conn.exec_command('chmod {} "{}"'.format(oct(mode), path)) - def chown(self, owner, group, path): - self.conn.exec_command('chown {}.{} "{}"'.format(str(owner), str(group), path)) - def command(self, arguments): - self.conn.exec_command(arguments) - def cp(self, src, dest): - self.conn.exec_command('cp "{}" "{}"'.format(src, dest)) - def cp_a(self, src, dest): - self.conn.exec_command('cp -a "{}" "{}"'.format(src, dest)) - def cp_r(self, src, dest): - self.conn.exec_command('cp -r "{}" "{}"'.format(src, dest)) - def dd(self, src, dest): - self.conn.exec_command('dd if="{}" of="{}"'.format(src, dest)) - def df(self): - stdin, stdout, stderr = self.conn.exec_command('df') - return stdin.read() - def download(self, remotefilename, filename): - stdin, stdout, stderr = self.conn.exec_command('dd if="{}"'.format(path)) - with open(filename, 'w') as f: - data = stdin.read(4096) - while data: - f.write(data) - data = stdin.read(4096) - def download_offset (self, remotefilename, filename, offset, size): - stdin, stdout, stderr = self.conn.exec_command('dd bs=1 skip={} count={} if="{}"'.format( - offset, size ,path)) - with open(filename, 'w') as f: - data = stdin.read(4096) - while data: - f.write(data) - data = stdin.read(4096) - def du(self, path): - stdin, stdout, stderr = self.conn.exec_command('du "{}"'.format(path)) - return stdin.read() - def equal(self, file1, file2): - pass - def file(self, path): - stdin, stdout, stderr = self.conn.exec_command('file "{}"'.format(path)) - return stdin.read() - def ln(self, target, linkname): - self.conn.exec_command('ln "{}" "{}"'.format(target, linkname)) - def ln_s(self, target, linkname): - self.conn.exec_command('ln -s "{}" "{}"'.format(target, linkname)) - def ln_f(self, target, linkname): - self.conn.exec_command('ln -f "{}" "{}"'.format(target, linkname)) - def ln_sf(self, target, linkname): - self.conn.exec_command('ln -sf "{}" "{}"'.format(target, linkname)) - def getxattrs(self, path): - pass - #path = path) - #stdin, stdout, stderr = self.conn.exec_command('du "{}"'.format(path)) - #return stdin.read() - def mv (self, src, dest): - self.conn.exec_command('mv "{}" "{}"'.format(src, dest)) - def mkdir (self, path): - self.conn.exec_command('mkdir -p "{}"'.format(path)) - def read_file (self, path): - sftp_client = self.conn.open_sftp() - f = sftp_client.file(path, mode='r', bufsize=-1) - s = f.read() - f.close() - return s - def readdir (self, dir): - sftp_client = self.conn.open_sftp() - return sftp_client.listdir(path) - def readlink (self, path): - stdin, stdout, stderr = self.conn.exec_command('readlink "{}"'.format(path)) - return stdin.read() - def rename (self, oldpath, newpath): - return self.mv(oldpath, newpath) - def rm (self, path): - stdin, stdout, stderr = self.conn.exec_command('rm "{}"'.format(path)) - def rm_rf (self, path): - stdin, stdout, stderr = self.conn.exec_command('rm -rf "{}"'.format(path)) - def rmdir (self, path): - stdin, stdout, stderr = self.conn.exec_command('rmdir "{}"'.format(path)) - def touch (self, path): - """Touch acts like the touch(1) command. It can be used to - update the timestamps on a file, or, if the file does - not exist, to create a new zero-length file. - - This command only works on regular files, and will fail - on other file types such as directories, symbolic links, - block special etc. - """ - self.conn.exec_command('touch "{}"'.format(path)) - def setxattr (self, xattr, val, vallen, path): - pass - def write (self, path, content): - """This call creates a file called "path". The content of - the file is the string "content" (which can contain any - 8 bit data). - - See also "g.write_append". - """ - sftp_client = self.conn.open_sftp() - f = sftp_client.file(path, mode='w', bufsize=-1) - f.write(content) - f.close() - - def write_append (self, path, content): - """This call appends "content" to the end of file "path". - If "path" does not exist, then a new file is created. - - See also "g.write". - """ - sftp_client = self.conn.open_sftp() - f = sftp_client.file(path, mode='a', bufsize=-1) - f.write(content) - f.close() - - -if __name__ == '__main__': - if len(sys.argv) != 1: - print("Usage: " + sys.argv[0]) - print("Run prepare_disks on running computers over ssh") - print("The task name and params are read from ~/.kpov_params.yaml") - - yaml_config_file = os.path.expanduser("~/.kpov_params.yaml") - with open(yaml_config_file) as f: - params = yaml.load(f) - task_name = params['task_name'] - try: - task_url = params['task_url'] - task_name = params['task_name'] - if task_url.startswith('http'): - http_auth(task_url, params['username'], params['password']) - req = urllib.request.Request("{task_url}/{task_name}/task.py".format(**params)) - source = urllib.request.urlopen(req).read() - if not source: - raise Exception('no such task: {}'.format(task_name)) - d = {} - exec(compile(source, 'task.py', 'exec'), globals(), d) - computers, prepare_disks = d['computers'], d['prepare_disks'] - except Exception as e: - print(e) - exit(1) - - templates = dict() - sshguestfs_params = params.get('sshguestfs_params', dict()) - task_sshguestfs_params = sshguestfs_params.get(task_name, dict()) - for computer_name, computer in computers.items(): - comp_params = task_sshguestfs_params.get(computer_name, dict()) - for k in ['hostname', 'username', 'password']: - try: - p = comp_params[k] - except: - p = input("{} {}:".format(computer_name, k)) - comp_params[k] = p - comp_connection = None - try: - comp_connection = SSHGuestFs(**comp_params) - task_sshguestfs_params[computer_name] = comp_params - except Exception as e: - print(e) - task_sshguestfs_params.pop(computer_name, None) - for disk in computer['disks']: - disk_name = disk['name'] - templates[disk_name] = comp_connection - sshguestfs_params[task_name] = task_sshguestfs_params - params['sshguestfs_params'] = sshguestfs_params - with open(yaml_config_file, 'w') as f: - # print "dumping", params - yaml.dump(params, f) - prepare_disks(templates, params['task_params'][task_name], params) diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py deleted file mode 100755 index 43aaf38..0000000 --- a/kpov_judge/test_task.py +++ /dev/null @@ -1,246 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import collections -import getpass -import inspect -import io -import json -import locale -import os -import random -import readline -import sys -import urllib.request - -import yaml -import kpov_util - -locale.setlocale(locale.LC_ALL, ['C', 'utf8']) -readline.set_completer_delims(readline.get_completer_delims().replace('/', '')) -readline.parse_and_bind('tab: complete') - -TASK_URL = "file://" + os.getcwd() + '/tasks' -PARAMS_FILE = os.path.expanduser("~/.kpov_params.yaml") -DEFAULT_LANGUAGE = 'si' - -def print_header(title, spacing=1): - print('\n'*spacing + '> {}'.format(title)) - -# get the parameters for a task either from the user or from a file -def get_params(params, params_meta, language=None): - # prefill input() prompt with given text - def rlinput(prompt, prefill=''): - readline.set_startup_hook(lambda: readline.insert_text(prefill)) - try: - return input(prompt) - finally: - readline.set_startup_hook() - - if language is None: - language = params.get('language', DEFAULT_LANGUAGE) - - # print all non-writable parameters first, then prompt for writable ones - for name, meta in sorted(params_meta.items(), key=lambda n: n[1].get('w', True)): - description = meta.get('descriptions', {}).get(language, name) - if name not in params: - params[name] = None - if meta.get('w', True): - try: - if meta.get('masked', False): - s = getpass.getpass('{}: '.format(description)) - else: - s = rlinput('{}: '.format(description), params.get(name, '')) - if s: - params[name] = s - except EOFError: - print() - else: - print('{}: {}'.format(name, params.get(name, ''))) - return params - -def add_meta_to_argparser(argparser, meta, defaults={}): - language = defaults.get('language', DEFAULT_LANGUAGE) - for k, v in meta.items(): - try: - desc = v['descriptions'][language].encode("utf-8") - except: - desc = k - argparser.add_argument('--'+k, nargs='?', type=str, help=desc, - default=defaults.get(k, None)) - -def load_params(filename): - try: - return yaml.load(open(filename)) - except: - return {} - -def locate_task(params, argparser, quiet=False): - # first the URL where all tasks are stored - url_meta = { - 'task_url': {'descriptions': {'si': 'URL z nalogami', 'en': 'Root URL for all tasks'}} - } - if 'task_url' not in params: - params['task_url'] = TASK_URL - add_meta_to_argparser(argparser, meta=url_meta, defaults=params) - args, unknown_args = argparser.parse_known_args() - params['task_url'] = args.task_url - if not quiet: - print_header('Task', spacing=0) - params = get_params(params, url_meta) - - # and finally, the name of the task - fetch_params_meta = collections.OrderedDict({'task_name': {'descriptions': {'si': 'Ime naloge', 'en': 'Task name'}}}) - add_meta_to_argparser(argparser, meta=fetch_params_meta, defaults=params) - args, unknown_args = argparser.parse_known_args() - # update params with the now known args - for k, v in fetch_params_meta.items(): - params[k] = vars(args).get(k, params.get(k, None)) - if not quiet: - params = get_params(params, fetch_params_meta) - return params - -def http_auth(url, username, password): - password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() - password_mgr.add_password(None, url, username, password) - handler = urllib.request.HTTPBasicAuthHandler(password_mgr) - opener = urllib.request.build_opener(handler) - urllib.request.install_opener(opener) # now all calls to urlopen use our opener - -def load_task(stream): - # the stream should definitions for the functions task(…), - # task_check and gen_params, and a dictionary params_meta - d = {} - exec(compile(source, 'task.py', 'exec'), globals(), d) - return d['task'], d['task_check'], d['params_meta'], d['gen_params'] - - -if __name__ == '__main__': - # get the parameters needed to get to the task, such as the URLs, the name of the task and optionally an ID from the student - # start with the the parameters needed for the dialog gui to work - argparser = argparse.ArgumentParser(conflict_handler='resolve', - description='Test a KPOV Judge task.') - argparser.add_argument('-h', '--help', action='store_true') - argparser.add_argument('-q', '--quiet', action='store_true', - help='disable prompts') - argparser.add_argument('-g', '--generate_params', action='store_true', - help='generate initial values for the task parameters') - argparser.add_argument('-pf', '--params_file', nargs='?', default=PARAMS_FILE, - help='a local file with saved param values') - basic_args, unknown_args = argparser.parse_known_args() - - # get default parameters including language - params = load_params(basic_args.params_file) - argparser.add_argument('-l', '--language', nargs='?', - default=params.get('language', DEFAULT_LANGUAGE), - help='the language used') - basic_args, unknown_args = argparser.parse_known_args() - params['language'] = basic_args.language - - if basic_args.help: - argparser.print_help() - exit(0) - - # continue with the parameters needed to get the task - params = locate_task(params, argparser, quiet=basic_args.quiet) - # TODO: if the task name is missing or invalid, try to get a list of tasks - # get task source and generate params if neccessarry - try: - task_url = params['task_url'] - task_name = params['task_name'] - - source = urllib.request.urlopen("{task_url}/{task_name}/task.py".format(**params)).read() - if not source: - raise Exception('no such task: {}'.format(task_name)) - task, task_check, task_params_meta, gen_params = load_task(source) - except Exception as e: - print(e) - with open(basic_args.params_file, 'w') as f: - yaml.dump(params, f) - exit(1) - - # get stored task parameters - params['task_params'] = params.get('task_params', {}) - task_params = params['task_params'].setdefault(task_name, {}) - tokens = params.setdefault('tokens', {}) - - # ensure we have a submission token - if task_url.startswith('http'): - n_tries = 3 - while n_tries > 0: - try: - if tokens.get(task_name): - response = urllib.request.urlopen( - '{task_url}/{task_name}/params.json'.format(**params), - data=urllib.parse.urlencode({'token': tokens.get(task_name)}).encode()) - response = json.load(io.TextIOWrapper(response)) - if response: - # got params - task_params.update(response) - break - else: - # did not get a token, try again with password - del tokens[task_name] - n_tries -= 1 - - if not tokens.get(task_name): - # get the student's ID and password - # TODO clunky, should refactor all argument-getting stuff - user_meta = collections.OrderedDict(( - ('username', {'descriptions': {'si': 'Uporabniško ime', 'en': 'Username'}}), - ('password', {'descriptions': {'si': 'Geslo', 'en': 'Password'}, 'masked': True}), - )) - print_header('KPOV login') - user_params = get_params(params, user_meta, params['language']) - - http_auth(task_url, user_params['username'], user_params['password']) - response = urllib.request.urlopen('{task_url}/{task_name}/token.json'.format(**params)) - response = json.load(io.TextIOWrapper(response)) - if response: - tokens[task_name] = response['token'] - params['username'] = user_params['username'] - except Exception as ex: - print(ex) - - if basic_args.generate_params: - #prejema lahko samo stringe in ne številk (potrebno je str(int) - # print ("params before: {} {}".format(params, task_params)) - task_params.update(gen_params(params['username'], task_params_meta)) - # print ("params after: {} {}".format(params, task_params)) - - task_argparser = argparse.ArgumentParser(parents=[argparser], conflict_handler='resolve', add_help=True) - add_meta_to_argparser(task_argparser, task_params_meta, defaults=task_params) - args = vars(task_argparser.parse_args()) - for k in task_params_meta: - if args.get(k): - task_params[k] = args[k] - if not basic_args.quiet: - print_header('Task parameters') - task_params = get_params(task_params, task_params_meta, language=params['language']) - - public_params = {} - for k in inspect.getargs(task.__code__)[0]: - public_params[k] = task_params[k] - params['task_params'][params['task_name']] = task_params - - # save parameters for the next run - with open(basic_args.params_file, 'w') as f: - yaml.dump(params, f) - - try: - print_header('Results', spacing=0 if basic_args.quiet else 1) - print('Running task... ', end='', flush=True) - task_result = task(**public_params) - print('checking task... ', end='', flush=True) - task_params['token'] = tokens[task_name] # hack to avoid changing task_check signature - score, hints = task_check(task_result, task_params) - del task_params['token'] - print('done!') - print('Score: {}'.format(score)) - - print_header('Hints') - for hint in hints: - print(hint.strip()) - except Exception as e: - import traceback - traceback.print_exc() diff --git a/kpov_judge/util.py b/kpov_judge/util.py deleted file mode 100644 index 6d9e085..0000000 --- a/kpov_judge/util.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -import yaml - -def write_default_config(disk, global_params): - home = '/home/test' - params_file = os.path.join(home, '.kpov_params.yaml') - default_params = {} - for k in [ - 'task_name', - 'username', - 'task_url']: - if k in global_params: - default_params[k] = global_params[k] - disk.write(params_file, yaml.dump(default_params)) - disk.chown(1001, 1001, params_file) - - mydir = os.path.dirname(os.path.abspath(__file__)) - # write testing script and helper - for f in ['test_task.py', 'kpov_util.py']: - src = os.path.join(mydir, f) - dst = os.path.join('/home/test', f) - disk.write(dst, open(src).read()) - disk.chmod(0o755, dst) - disk.copy_in(os.path.join(mydir, 'random_data'), '/home/test') diff --git a/kpov_judge/web/kpov.wsgi b/kpov_judge/web/kpov.wsgi deleted file mode 100644 index b55e6ac..0000000 --- a/kpov_judge/web/kpov.wsgi +++ /dev/null @@ -1 +0,0 @@ -from kpov_judge import app as kpovjudge diff --git a/kpov_judge/web/kpov_judge/babel.cfg b/kpov_judge/web/kpov_judge/babel.cfg deleted file mode 100644 index f0234b3..0000000 --- a/kpov_judge/web/kpov_judge/babel.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[python: **.py] -[jinja2: **/templates/**.html] -extensions=jinja2.ext.autoescape,jinja2.ext.with_ diff --git a/kpov_judge/web/kpov_judge/icons/computer.svg b/kpov_judge/web/kpov_judge/icons/computer.svg deleted file mode 100644 index 6da674d..0000000 --- a/kpov_judge/web/kpov_judge/icons/computer.svg +++ /dev/null @@ -1,1877 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/web/kpov_judge/icons/drive-harddisk.svg b/kpov_judge/web/kpov_judge/icons/drive-harddisk.svg deleted file mode 100644 index 5f36f85..0000000 --- a/kpov_judge/web/kpov_judge/icons/drive-harddisk.svg +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Drive - Hard Disk - - - Jakub Steiner - - - - - hdd - hard drive - fixed - media - solid - - - - - http://jimmac.musichall.cz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/web/kpov_judge/icons/internet.svg b/kpov_judge/web/kpov_judge/icons/internet.svg deleted file mode 100644 index 5efbd24..0000000 --- a/kpov_judge/web/kpov_judge/icons/internet.svg +++ /dev/null @@ -1,3398 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/web/kpov_judge/kpov_draw_setup.py b/kpov_judge/web/kpov_judge/kpov_draw_setup.py deleted file mode 100644 index 41f5e01..0000000 --- a/kpov_judge/web/kpov_judge/kpov_draw_setup.py +++ /dev/null @@ -1,43 +0,0 @@ -import pygraphviz as pgv - -def draw_setup(computers, networks, destination=None, - icon_prefix = '../../../static/icons/', - format='svg', icon_path = '', icon_suffix = None): - if icon_suffix is None: - icon_suffix = format - icon_suffix = '.' + icon_suffix - G = pgv.AGraph(imagepath=icon_path + '/') - print(G.graph_attr) - have_internet = [] - for net in networks: - net_name = net.get('name', 'net') - if net.get('public', False): - have_internet.append(net_name) - G.add_node('net-' + net_name, label=net_name, shape='rectangle') - if len(have_internet): - G.add_node('net-' + 'internet', - label='internet', - labelloc='b', - image=icon_prefix + 'internet' + icon_suffix, - shape='none') - for n in have_internet: - G.add_edge('net-' + n, 'net-internet') - for properties in computers: - c = properties.get('name', '') - label_str = '< ' - label = label_str.format(c, icon_prefix + 'computer' + icon_suffix) - for hdd in properties.get('disks', []): - icon = icon_prefix + 'drive-harddisk' + icon_suffix - label += ''.format(icon, hdd['name']) - label += '
{}
{}
>' - G.add_node('comp-' + c, - label = label, - shape='box', labelloc='b') - for iface in properties.get('network_interfaces', []): - G.add_edge('comp-' + c, 'net-' + iface['network']) - return G.draw(path=destination, format=format, prog='dot') - -if __name__ == '__main__': - import sample_task as task - print(draw_setup(task.computers, task.networks)) - diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py deleted file mode 100755 index 47e413e..0000000 --- a/kpov_judge/web/kpov_judge/kpov_judge.py +++ /dev/null @@ -1,289 +0,0 @@ -#!/usr/bin/env python3 - -import collections -import datetime -import json -import random -import settings -import traceback -import uuid - -from kpov_draw_setup import draw_setup -import kpov_util - -import pymongo -import flask -from flask import Flask, g, session, redirect, url_for, abort, render_template, flash, app, request, Response -from flask.ext.babel import Babel, gettext, ngettext, format_datetime, _ -import jinja2 - -app = Flask(__name__) -app.config.from_object(settings) -babel = Babel(app) - -@babel.localeselector -def get_locale(): - # terrible hack, should store as user preference in the DB - if '/en/' in request.path: - return 'en' - if '/si/' in request.path: - return 'sl' - return request.accept_languages.best_match(['sl', 'en']) - - -@app.before_request -def before_request(): - g.db = pymongo.MongoClient(app.config['DB_URI']).get_default_database() - - -@app.route('/') -@app.route('/classes/') -def index(): - student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody') - classes = g.db.classes.find({}, {'class_id': 1, 'name': 1}).sort('class_id') - return render_template('index.html', student_id=student_id, classes=classes) - - -@app.route('/classes//') -def class_tasks(class_id): - student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody') - clas = g.db.classes.find_one({'class_id': class_id}) - tasks = g.db.tasks.find({'class_id': class_id}, {'task_id': 1}).sort('task_id') - if tasks is not None: - task_list = [i['task_id'] for i in tasks] - else: - task_list = [] - return render_template('class_tasks.html', student_id=student_id, tasks=task_list, clas=clas) - - -@app.route('/tasks////setup.', methods=['GET']) -def setup_svg(class_id, task_id, lang, ending): - db = g.db - fmt, mimetype = { - 'svg':('svg', 'image/svg+xml'), - 'png':('png', 'image/png'), - }[ending] - networks = list(db.networks.find({'class_id': class_id, 'task_id': task_id})) - computers = list(db.computers_meta.find({'class_id': class_id, 'task_id': task_id})) - return Response(draw_setup(computers, networks, format=fmt, - icon_path=app.config['STATIC_DIR']), - mimetype=mimetype) - - -@app.route('/tasks///task.py') -def task_source(class_id, task_id): - db = g.db - try: - return db.tasks.find_one({'class_id': class_id, 'task_id': task_id})['source'] - except: - return '' - - -@app.route('/tasks///task.html') -def task_html(class_id, task_id): - return render_template('task.html', task=task_source(class_id, task_id)) - - -def get_params(class_id, task_id, student_id, db): - try: - meta = db.task_params_meta.find_one({'class_id': class_id, 'task_id': task_id})['params'] - except Exception: - return {'mama': 'ZAKVAJ?'}, {'mama': {'public': True}} - - params = db.task_params.find_one({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}) - if params is None or 'params' not in params: # TODO try with $exists: params or smth. - try: - gen_params_source = db.gen_params.find_one({'class_id': class_id, 'task_id': task_id})['source'] - gen_params_code = compile(gen_params_source, 'generator.py', 'exec') - d = {} - exec(gen_params_code, globals(), d) - params = d['gen_params'](student_id, meta) - db.task_params.update({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}, - {'$set': {'params': params}}, upsert=True) - params = d['gen_params'](student_id, meta) # TODO this is repeated, is it necessary? - for computer in db.computers_meta.find({'class_id': class_id, 'task_id': task_id}): - try: - name = computer.pop('name') - del computer['_id'] - del computer['task_id'] - except Exception: - pass - db.student_computers.update({'class_id': class_id, 'task_id': task_id, 'student_id': student_id, 'name': name}, - {'$set': computer}, upsert=True) - except Exception as e: - meta = {'crash': {'public': True}} - params = {'crash': "Parameter creator crashed or missing:\n{}".format( - traceback.format_exc())} - else: - params = params['params'] - return params, meta - - -@app.route('/tasks///') -def task_lang_redirect(class_id, task_id): - return redirect(url_for('task_greeting', class_id=class_id, task_id=task_id, lang=app.config['DEFAULT_LANG'])) - - -@app.route('/tasks////howto/') -def task_howto(class_id, task_id, lang): - db = g.db - return db.howtos.find_one({'class_id': class_id, 'task_id': task_id, 'lang': lang}).get('text', '') - - -@app.route('/tasks////images/') -def task_image(class_id, task_id, lang, fname): - db = g.db - return db.howto_images.find_one({'class_id': class_id, 'task_id': task_id, 'fname': fname}).get('data', '') - - -@app.route('/tasks////') -def task_greeting(class_id, task_id, lang): - student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody') - db = g.db - # generate the parameters as soon as the student visits - params, meta = get_params(class_id, task_id, student_id, db) - instr_ok = True - try: - instructions = db.task_instructions.find_one({'class_id': class_id, 'task_id': task_id}) - instructions = instructions.get(lang, instructions[app.config['DEFAULT_LANG']]) - except Exception: - try: - instructions = list(instructions.values())[0] - except Exception as e: - instructions = str(e) - instr_ok = False - if instr_ok: - try: - public_params = [] - for k, v in meta.items(): - if v.get('public', False): - public_params += [{ - 'name': k, - 'value': params.get(k), - 'description': v.get('descriptions', {}).get(lang) - }] - except Exception as e: - instructions = str(e) - - computer_list = list(db.student_computers.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id})) - - backing_files = collections.defaultdict(set) - for computer in computer_list: - if 'disk_urls' not in computer: - continue - for name, disk in computer['disk_urls'].items(): - for fmt in disk['formats']: - backing_files[fmt] |= set(disk[fmt][1:]) - - if request.args.get('narediStack', 'false') == 'true': - #db.student_tasks.update({'task_id': task_id, 'student_id': student_id}, {'$set': {'create_openstack': True}}, upsert = True) - openstackCreated = False # Spremeni na True, ko odkomentiras zgornjo vrstico. - else: - if db.student_tasks.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id, 'openstack_created': True}).count() > 0: - openstackCreated = True - elif db.student_tasks.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id, 'create_openstack': True}).count() > 0: - openstackCreated = True - else: - openstackCreated = False - - try: - result = db.results.find_one( - {'$query': {'class_id': class_id, 'task_id': task_id, 'student_id': student_id}, - '$orderby': collections.OrderedDict([('result', -1), ('time', 1)])}, - {'result': 1, 'status': 1, 'hints': 1, 'time': True, '_id': 0}) - result['time'] = format_datetime(result['time']) - print(result) - except Exception: - result = None - - return render_template('task_greeting.html', - disk_base_url='/'.join([app.config['STUDENT_DISK_URL'], student_id, class_id, task_id, '']), - class_id=class_id, - task_id=task_id, - computers=sorted((c for c in computer_list if 'disk_urls' in c), key=lambda c: c['name']), - backing_files={fmt: sorted(images) for fmt, images in backing_files.items()}, - lang='sl' if lang == 'si' else lang, # TODO s/si/sl in all tasks (and maybe elsewhere) - openstack=openstackCreated, - instructions=jinja2.Template(instructions), - params=public_params, - result=result, - **{p['name']: p['value'] for p in public_params}) - - -@app.route('/tasks///token.json') -def get_token(class_id, task_id): - db = g.db - student_id = flask.app.request.environ.get('REMOTE_USER', 'Nobody') - token = str(uuid.uuid4()) - db.task_params.update({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}, - {'$set': {'token': token}}, upsert=True) - return json.dumps({'token': token}) - - -@app.route('/tasks///params.json', methods=['POST']) -def params_json(class_id, task_id): - db = g.db - token = flask.app.request.form['token'] - record = db.task_params.find_one({'class_id': class_id, 'task_id': task_id, 'token': token}) - if not record: - return json.dumps({}) - params, meta = get_params(record['class_id'], record['task_id'], record['student_id'], db) - shown_params = {} - for name, param in params.items(): - if meta.get(name, {'public': False})['public']: - shown_params[name] = param - return json.dumps(shown_params) - - -@app.route('/tasks///results.json', methods=['POST']) -def results_json(class_id, task_id): - db = g.db - token = flask.app.request.form.get('token', '') - task = db.task_params.find_one({'class_id': class_id, 'task_id': task_id, 'token': token}) - if not task: - return json.dumps({'result': 0, 'hints': ['invalid token'], 'status': 'NOT OK'}) - - params = task['params'] - if params is None: - return json.dumps({'result': 0, 'hints': ['no parameters found for task'], 'status': 'NOT OK'}) # no such task - - results = json.loads(flask.app.request.form['results']) - user_params = json.loads(flask.app.request.form['params']) - - meta = db.task_params_meta.find_one({'task_id': task_id}) - if meta is None: - meta = {} - else: - meta = meta['params'] - for param_name, param_meta in meta.items(): - if param_meta.get('w', False) and param_name in user_params: - params[param_name] = user_params[param_name] - - # hack to get token into task_check function - # TODO rethink the API - params['token'] = token - try: - task_check_source = db.task_checkers.find_one({'class_id': class_id, 'task_id': task_id})['source'] - d = {} - exec(compile(task_check_source, 'checker.py', 'exec'), globals(), d) - res, hints = d['task_check'](collections.defaultdict(str, results), params) - except Exception as e: - hints = ["Checker died: " + str(e)] - res = 0 - if (isinstance(res, int) or isinstance(res, float)) and res > 0: - res_status = 'OK' - else: - res_status = 'NOT OK' - - db.results.insert({ - 'class_id': class_id, 'task_id': task_id, - 'result': res, 'hints': hints, 'status': res_status, - 'student_id': task['student_id'], - 'response': results, - 'time': datetime.datetime.now() - }) - return json.dumps({'result': res, 'hints': hints, 'status': res_status}) - - -if __name__ == '__main__': - app.run(host='0.0.0.0') diff --git a/kpov_judge/web/kpov_judge/kpov_util.py b/kpov_judge/web/kpov_judge/kpov_util.py deleted file mode 120000 index 20fecf4..0000000 --- a/kpov_judge/web/kpov_judge/kpov_util.py +++ /dev/null @@ -1 +0,0 @@ -../../kpov_util.py \ No newline at end of file diff --git a/kpov_judge/web/kpov_judge/random_data b/kpov_judge/web/kpov_judge/random_data deleted file mode 120000 index 6a83e61..0000000 --- a/kpov_judge/web/kpov_judge/random_data +++ /dev/null @@ -1 +0,0 @@ -../../random_data \ No newline at end of file diff --git a/kpov_judge/web/kpov_judge/settings.py b/kpov_judge/web/kpov_judge/settings.py deleted file mode 120000 index 8889b19..0000000 --- a/kpov_judge/web/kpov_judge/settings.py +++ /dev/null @@ -1 +0,0 @@ -../../settings.py \ No newline at end of file diff --git a/kpov_judge/web/kpov_judge/static/icons/computer.png b/kpov_judge/web/kpov_judge/static/icons/computer.png deleted file mode 100644 index aebd82e..0000000 Binary files a/kpov_judge/web/kpov_judge/static/icons/computer.png and /dev/null differ diff --git a/kpov_judge/web/kpov_judge/static/icons/computer.svg b/kpov_judge/web/kpov_judge/static/icons/computer.svg deleted file mode 100644 index 6da674d..0000000 --- a/kpov_judge/web/kpov_judge/static/icons/computer.svg +++ /dev/null @@ -1,1877 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/web/kpov_judge/static/icons/drive-harddisk.png b/kpov_judge/web/kpov_judge/static/icons/drive-harddisk.png deleted file mode 100644 index ce482f2..0000000 Binary files a/kpov_judge/web/kpov_judge/static/icons/drive-harddisk.png and /dev/null differ diff --git a/kpov_judge/web/kpov_judge/static/icons/drive-harddisk.svg b/kpov_judge/web/kpov_judge/static/icons/drive-harddisk.svg deleted file mode 100644 index 5f36f85..0000000 --- a/kpov_judge/web/kpov_judge/static/icons/drive-harddisk.svg +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Drive - Hard Disk - - - Jakub Steiner - - - - - hdd - hard drive - fixed - media - solid - - - - - http://jimmac.musichall.cz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/web/kpov_judge/static/icons/internet.png b/kpov_judge/web/kpov_judge/static/icons/internet.png deleted file mode 100644 index 2f70cbf..0000000 Binary files a/kpov_judge/web/kpov_judge/static/icons/internet.png and /dev/null differ diff --git a/kpov_judge/web/kpov_judge/static/icons/internet.svg b/kpov_judge/web/kpov_judge/static/icons/internet.svg deleted file mode 100644 index 5efbd24..0000000 --- a/kpov_judge/web/kpov_judge/static/icons/internet.svg +++ /dev/null @@ -1,3398 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/kpov_judge/web/kpov_judge/static/style.css b/kpov_judge/web/kpov_judge/static/style.css deleted file mode 100644 index 363fbc4..0000000 --- a/kpov_judge/web/kpov_judge/static/style.css +++ /dev/null @@ -1,72 +0,0 @@ -a.back { - text-decoration: none; -} - -body { - margin: 0 auto; - max-width: 60em; - padding: 1em 2em; -} - -code { - background-color: #d6d6d6; - color: black; - font-size: 1.2em; - padding: 0.20em 0.25em 0; -} - -dl { - margin-top: 0.5em; -} -dt { - margin-top: 0.5em; -} -dd { - margin-left: 1em; -} - -h1, h2, h3 { - margin-bottom: 0.5em; -} -h2 { - font-size: 110%; -} -h3 { - font-size: 105%; -} - -p { - hyphens: auto; - margin-top: 0.5em; - margin-bottom: 0; - padding-top: 0; - text-align: justify; -} - -pre { - margin-left: 1em; - overflow: auto; -} - -.tooltip { /* hide and position tooltip */ - top: 1em; - left: 1em; - background-color: black; - color: white; - border-radius: 5px; - opacity: 0; - position: absolute; - -webkit-transition: opacity 0.5s; - -moz-transition: opacity 0.5s; - -ms-transition: opacity 0.5s; - -o-transition: opacity 0.5s; - transition: opacity 0.5s; -} - -.hover { - position: relative; -} - -.hover:hover .tooltip { /* display tooltip on hover */ - opacity: 1; -} diff --git a/kpov_judge/web/kpov_judge/templates/class_tasks.html b/kpov_judge/web/kpov_judge/templates/class_tasks.html deleted file mode 100644 index 4b6a523..0000000 --- a/kpov_judge/web/kpov_judge/templates/class_tasks.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -

{{clas.name}}

- -

-{{ _('Zdravo, %(student)s.', student=student_id) }} - -

-

{{ _('Naloge') }}

- -
    -{% for t in tasks %} -
  • {{t}} -{% endfor %} -
diff --git a/kpov_judge/web/kpov_judge/templates/index.html b/kpov_judge/web/kpov_judge/templates/index.html deleted file mode 100644 index 4c2ba47..0000000 --- a/kpov_judge/web/kpov_judge/templates/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -

KPOV Judge

- -

-{{ _('Zdravo, %(student)s.', student=student_id) }} - -

-

{{ _('Predmeti') }}

- -
    -{% for c in classes %} -
  • {{c.name}} -{% endfor %} -
diff --git a/kpov_judge/web/kpov_judge/templates/params.html b/kpov_judge/web/kpov_judge/templates/params.html deleted file mode 100644 index 0648f66..0000000 --- a/kpov_judge/web/kpov_judge/templates/params.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - -

-{{task_id}} -

-
-

Parametri

-
-{% for k, v in params.items() %} -
{{k}}:
{{params_meta[k]['descriptions']['si']}}
-{% if params_meta[k]["w"] %} - -{% else %} -{{v}} -{% endif %}
-{% endfor %} -

-
-
- - diff --git a/kpov_judge/web/kpov_judge/templates/results.html b/kpov_judge/web/kpov_judge/templates/results.html deleted file mode 100644 index 7f05208..0000000 --- a/kpov_judge/web/kpov_judge/templates/results.html +++ /dev/null @@ -1,15 +0,0 @@ - - -

-{{task_id}} -

-

-

Rezultati

-
    -{% for k, v in results.items() %} -
  • {{k}}: {{v}}
  • -{% endfor %} -
-

- - diff --git a/kpov_judge/web/kpov_judge/templates/task.html b/kpov_judge/web/kpov_judge/templates/task.html deleted file mode 100644 index ddad5d8..0000000 --- a/kpov_judge/web/kpov_judge/templates/task.html +++ /dev/null @@ -1,12 +0,0 @@ - - - -

-{{task_id}} -

-

-

{{task}}
-

- - diff --git a/kpov_judge/web/kpov_judge/templates/task_greeting.html b/kpov_judge/web/kpov_judge/templates/task_greeting.html deleted file mode 100644 index b10a49d..0000000 --- a/kpov_judge/web/kpov_judge/templates/task_greeting.html +++ /dev/null @@ -1,141 +0,0 @@ - - - -KPOV Judge - - - - -

- {{task_id}} - [ -{% for lang in ('en', 'si') %} -{{lang}} -{% endfor %} -] -

- -
-{{ _('Shema omrežja za nalogo.') }} -

{{ _('Naloga') }}

- -{% include instructions %} - -

-{{ _('Podrobna navodila.') }} -
-

- -
-
-

{{ _('Računalniki') }}

-{% if computers %} -
- {% for c in computers %} -
{{c['name']}} -
    - {% for name, disk in c['disk_urls'].items() %} -
  • {{name}} [ {% for fmt in disk['formats'] %}{{fmt}} {% endfor %}] - {% else %} - {% endfor %} -
-{% endfor %} -
- -

- -{{ _('Za GNS3 uporabite slike v formatu qcow2, za katere rabite še zaledne datoteke (angl. backing files). Za VirtualBox uporabite slike VMDK, ki ne podpirajo zalednih datotek in so zato precej večje. Namesto prenosa lahko slike VMDK pretvorite iz formata qcow2.') }} - -{% if backing_files %} -

-

{{ _('Zaledne datoteke') }}

-

-{{ _('Vsako od spodnjih slik prenesete samo pri prvi nalogi, v kateri se pojavi. Vse datoteke morajo biti v istem imeniku.') }} - -

-{% for fmt, images in backing_files.items() %} - {% if images %} -
{{fmt}} -
    - {% for image in images %} -
  • {{image}}
  • - {% endfor %} -
- {% endif %} -{% endfor %} -
-
-{% endif %} - -{% else %} -

{{ _('Slike navideznih diskov so v izdelavi in bodo kmalu na voljo.') }} -{% endif %} -

- -
-

{{ _('Status') }}

-

-{% if result is none %} -{{ _('Naloga nima še nobenega poskusa.') }} -{% elif result['result'] == 10 %} -{{ _('Naloga je uspešno opravljena dne %(time)s.', time=result['time']) }} -{% else %} -{{ _('Naloga še ni opravljena, najvišji rezultat je %(score)s.', score=result['result']) }} -{% endif %} - -

-{{ _('Program za preverjanje.') }} - -

{{ _('Parametri') }}

-
-{% for p in params if p['value'] %} -
{{ p['name'] }}{% if p['description'] %} … {{ p['description'] }}{% endif %}
-
{{ p['value'] }}
-{% endfor %} -
-
-
- -{# -

-{% if openstack %} -Openstack projekt za to vajo je že ustvarjen ali v izdelavi (funkcionalnost še ne deluje). -{% else %} -Ustvari Openstack projekt za to vajo (funkcionalnost še ne deluje). -{% endif %} -#} diff --git a/kpov_judge/web/kpov_judge/translations/en/LC_MESSAGES/messages.po b/kpov_judge/web/kpov_judge/translations/en/LC_MESSAGES/messages.po deleted file mode 100644 index c8cac2d..0000000 --- a/kpov_judge/web/kpov_judge/translations/en/LC_MESSAGES/messages.po +++ /dev/null @@ -1,144 +0,0 @@ -# English translations for PROJECT. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2019-02-20 19:31+0100\n" -"PO-Revision-Date: 2018-10-13 20:57+0200\n" -"Last-Translator: FULL NAME \n" -"Language-Team: en \n" -"Plural-Forms: nplurals=2; plural=(n != 1)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" - -#: templates/class_tasks.html:7 templates/index.html:7 -#, python-format -msgid "Zdravo, %(student)s." -msgstr "Hi, %(student)s." - -#: templates/class_tasks.html:10 -msgid "Naloge" -msgstr "Tasks" - -#: templates/index.html:10 -msgid "Predmeti" -msgstr "Classes" - -#: templates/task_greeting.html:54 -msgid "Shema omrežja za nalogo." -msgstr "Network graph for this task." - -#: templates/task_greeting.html:55 -msgid "Naloga" -msgstr "Task" - -#: templates/task_greeting.html:60 -msgid "Podrobna navodila." -msgstr "Detailed instructions." - -#: templates/task_greeting.html:66 -msgid "Računalniki" -msgstr "Computers" - -#: templates/task_greeting.html:82 -msgid "" -"Za GNS3 uporabite slike v formatu qcow2, za katere rabite še zaledne " -"datoteke (angl. backing files). Za VirtualBox " -"uporabite slike VMDK, ki ne podpirajo zalednih datotek in so zato precej " -"večje. Namesto prenosa lahko slike VMDK pretvorite iz formata qcow2." -msgstr "" -"For GNS3 use qcow2 images, which require the backing files below. " -"For VirtualBox use VMDK images, which do not support backing files and " -"are thus much larger. Alternatively you can " -"convert qcow2 images yourself." - -#: templates/task_greeting.html:86 -msgid "Zaledne datoteke" -msgstr "Backing files" - -#: templates/task_greeting.html:88 -msgid "" -"Vsako od spodnjih slik prenesete samo pri prvi nalogi, v kateri se " -"pojavi. Vse datoteke morajo biti v istem imeniku." -msgstr "" -"Download each of the images below only if you do not have it yet. " -"All files must be placed in the same directory." - -#: templates/task_greeting.html:106 -msgid "Slike navideznih diskov so v izdelavi. Stran osvežite čez nekaj minut." -msgstr "Disk images are being generated. Please refresh the page after a few minutes." - -#: templates/task_greeting.html:111 -msgid "Status" -msgstr "Status" - -#: templates/task_greeting.html:114 -msgid "Naloga nima še nobenega poskusa." -msgstr "This task has not been attempted yet." - -#: templates/task_greeting.html:116 -#, python-format -msgid "Naloga je uspešno opravljena dne %(time)s." -msgstr "This task was solved on %(time)s." - -#: templates/task_greeting.html:118 -#, python-format -msgid "Naloga še ni opravljena, najvišji rezultat je %(score)s." -msgstr "This task has not been solved yet, the highest score is %(score)s." - -#: templates/task_greeting.html:122 -msgid "Program za preverjanje." -msgstr "Testing program." - -#: templates/task_greeting.html:124 -msgid "Parametri" -msgstr "Parameters" - -#~ msgid "Trenutno so na voljo naloge:" -#~ msgstr "Available tasks:" - -#~ msgid "Trenutno so na voljo predmeti:" -#~ msgstr "Available classes" - -#~ msgid "Rezultati" -#~ msgstr "Results" - -#~ msgid "Ogledate si lahko:" -#~ msgstr "You can view:" - -#~ msgid "opisi parametrov" -#~ msgstr "parameter descriptions" - -#~ msgid "preverjalni program" -#~ msgstr "checking program" - -#~ msgid "Slike diskov za to nalogo:" -#~ msgstr "Disk images for this task:" - -#~ msgid "Osnovne slike" -#~ msgstr "Backing images" - -#~ msgid "" -#~ msgstr "" - -#~ msgid "Rezultat" -#~ msgstr "Result" - -#~ msgid "" -#~ "Za GNS3 uporabite slike v formatu " -#~ "qcow2, za katere rabite še zaledne " -#~ "datoteke (angl. backing " -#~ "files). VirtualBox ne podpira zalednih" -#~ " datotek, zato so slike VDI precej" -#~ " večje. Namesto prenosa lahko slike " -#~ "VDI dobite " -#~ "iz formata qcow2." -#~ msgstr "" - diff --git a/kpov_judge/web/kpov_judge/translations/sl/LC_MESSAGES/messages.po b/kpov_judge/web/kpov_judge/translations/sl/LC_MESSAGES/messages.po deleted file mode 100644 index 2382073..0000000 --- a/kpov_judge/web/kpov_judge/translations/sl/LC_MESSAGES/messages.po +++ /dev/null @@ -1,145 +0,0 @@ -# Slovenian translations for PROJECT. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2019-02-20 19:31+0100\n" -"PO-Revision-Date: 2018-10-13 02:29+0200\n" -"Last-Translator: FULL NAME \n" -"Language-Team: sl \n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 " -"|| n%100==4 ? 2 : 3)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 1.3\n" - -#: templates/class_tasks.html:7 templates/index.html:7 -#, python-format -msgid "Zdravo, %(student)s." -msgstr "" - -#: templates/class_tasks.html:10 -msgid "Naloge" -msgstr "" - -#: templates/index.html:10 -msgid "Predmeti" -msgstr "" - -#: templates/task_greeting.html:54 -msgid "Shema omrežja za nalogo." -msgstr "" - -#: templates/task_greeting.html:55 -msgid "Naloga" -msgstr "" - -#: templates/task_greeting.html:60 -msgid "Podrobna navodila." -msgstr "" - -#: templates/task_greeting.html:66 -msgid "Računalniki" -msgstr "" - -#: templates/task_greeting.html:82 -msgid "" -"Za GNS3 uporabite slike v formatu qcow2, za katere rabite še zaledne " -"datoteke (angl. backing files). Za VirtualBox " -"uporabite slike VMDK, ki ne podpirajo zalednih datotek in so zato precej " -"večje. Namesto prenosa lahko slike VMDK pretvorite iz formata qcow2." -msgstr "" - -#: templates/task_greeting.html:86 -msgid "Zaledne datoteke" -msgstr "" - -#: templates/task_greeting.html:88 -msgid "" -"Vsako od spodnjih slik prenesete samo pri prvi nalogi, v kateri se " -"pojavi. Vse datoteke morajo biti v istem imeniku." -msgstr "" - -#: templates/task_greeting.html:106 -msgid "Slike navideznih diskov so v izdelavi in bodo kmalu na voljo." -msgstr "" - -#: templates/task_greeting.html:111 -msgid "Status" -msgstr "" - -#: templates/task_greeting.html:114 -msgid "Naloga nima še nobenega poskusa." -msgstr "" - -#: templates/task_greeting.html:116 -#, python-format -msgid "Naloga je uspešno opravljena dne %(time)s." -msgstr "" - -#: templates/task_greeting.html:118 -#, python-format -msgid "Naloga še ni opravljena, najvišji rezultat je %(score)s." -msgstr "" - -#: templates/task_greeting.html:122 -msgid "Program za preverjanje." -msgstr "" - -#: templates/task_greeting.html:124 -msgid "Parametri" -msgstr "" - -#~ msgid "Trenutno so na voljo naloge:" -#~ msgstr "" - -#~ msgid "Trenutno so na voljo predmeti:" -#~ msgstr "" - -#~ msgid "Rezultati" -#~ msgstr "" - -#~ msgid "Ogledate si lahko:" -#~ msgstr "" - -#~ msgid "rezultate" -#~ msgstr "" - -#~ msgid "parametre" -#~ msgstr "" - -#~ msgid "opisi parametrov" -#~ msgstr "" - -#~ msgid "preverjalni program" -#~ msgstr "" - -#~ msgid "Slike diskov za to nalogo:" -#~ msgstr "" - -#~ msgid "Osnovne slike" -#~ msgstr "" - -#~ msgid "" -#~ msgstr "" - -#~ msgid "Rezultat" -#~ msgstr "" - -#~ msgid "" -#~ "Za GNS3 uporabite slike v formatu " -#~ "qcow2, za katere rabite še zaledne " -#~ "datoteke (angl. backing " -#~ "files). VirtualBox ne podpira zalednih" -#~ " datotek, zato so slike VDI precej" -#~ " večje. Namesto prenosa lahko slike " -#~ "VDI dobite " -#~ "iz formata qcow2." -#~ msgstr "" - -- cgit v1.2.1