From f3e2c6f2add893710dc9a54098acff13c5934a90 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Tue, 21 Oct 2014 21:35:40 +0000 Subject: Separated tasks from lectures git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@2 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/add_assignment.py | 54 --------- kpov_judge/add_task.py | 54 +++++++++ kpov_judge/instructions_extractor.py | 24 ++++ kpov_judge/lectures/fri_kpov/01/evaluation | 1 + kpov_judge/lectures/fri_kpov/01/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/01/preparation | 1 + kpov_judge/lectures/fri_kpov/02/evaluation | 1 + kpov_judge/lectures/fri_kpov/02/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/02/preparation | 1 + kpov_judge/lectures/fri_kpov/03/evaluation | 1 + kpov_judge/lectures/fri_kpov/03/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/03/preparation | 1 + kpov_judge/lectures/fri_kpov/04/evaluation | 1 + kpov_judge/lectures/fri_kpov/04/lecture/idea.txt | 1 + kpov_judge/lectures/fri_kpov/04/preparation | 1 + kpov_judge/lectures/fri_kpov/05/evaluation | 1 + kpov_judge/lectures/fri_kpov/05/lecture/idea.txt | 1 + kpov_judge/lectures/fri_kpov/05/preparation | 1 + kpov_judge/lectures/fri_kpov/06/evaluation | 1 + kpov_judge/lectures/fri_kpov/06/lecture/idea.txt | 1 + kpov_judge/lectures/fri_kpov/06/preparation | 1 + kpov_judge/lectures/fri_kpov/07/evaluation | 1 + kpov_judge/lectures/fri_kpov/07/lecture/idea.txt | 1 + kpov_judge/lectures/fri_kpov/07/preparation | 1 + kpov_judge/lectures/fri_kpov/08/evaluation | 1 + kpov_judge/lectures/fri_kpov/08/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/08/preparation | 1 + kpov_judge/lectures/fri_kpov/09/evaluation | 1 + kpov_judge/lectures/fri_kpov/09/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/09/preparation | 1 + kpov_judge/lectures/fri_kpov/10/evaluation | 1 + kpov_judge/lectures/fri_kpov/10/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/10/preparation | 1 + kpov_judge/lectures/fri_kpov/11/evaluation | 1 + kpov_judge/lectures/fri_kpov/11/lecture/idea.txt | 1 + kpov_judge/lectures/fri_kpov/11/preparation | 1 + kpov_judge/lectures/fri_kpov/12/evaluation | 1 + kpov_judge/lectures/fri_kpov/12/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/12/preparation | 1 + kpov_judge/lectures/fri_kpov/13/evaluation | 1 + kpov_judge/lectures/fri_kpov/13/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/13/preparation | 1 + kpov_judge/lectures/fri_kpov/14/evaluation | 1 + kpov_judge/lectures/fri_kpov/14/lecture/idea.txt | 2 + kpov_judge/lectures/fri_kpov/14/preparation | 1 + kpov_judge/tasks/copy_rename_100_files/task.py | 120 ++++++++++++++++++++ .../evaluation/task.py | 120 ++++++++++++++++++++ .../lecture/ideja.txt | 1 + .../tasks/copy_rename_20_files_tail_env/task.py | 106 +++++++++++++++++ .../tasks/copy_rename_40_files/evaluation/task.py | 120 -------------------- .../tasks/copy_rename_40_files/lecture/ideja.txt | 1 - .../tasks/copy_rename_40_files/preparation/task.py | 106 ----------------- kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip | Bin 0 -> 499 bytes .../tasks/custom_rdate/howtos/images/bu1.png | Bin 0 -> 979 bytes .../tasks/custom_rdate/howtos/images/bu15.png | Bin 0 -> 679 bytes .../tasks/custom_rdate/howtos/images/bu2.png | Bin 0 -> 826 bytes .../tasks/custom_rdate/howtos/images/bu3.png | Bin 0 -> 13656 bytes .../tasks/custom_rdate/howtos/images/bu4.png | Bin 0 -> 1564 bytes .../tasks/custom_rdate/howtos/images/bu5.png | Bin 0 -> 11278 bytes .../tasks/custom_rdate/howtos/images/bu6.png | Bin 0 -> 15244 bytes .../tasks/custom_rdate/howtos/images/bu7.png | Bin 0 -> 3842 bytes .../tasks/custom_rdate/howtos/images/bu8.png | Bin 0 -> 3420 bytes .../tasks/custom_rdate/howtos/images/bu9.png | Bin 0 -> 4245 bytes .../howtos/images/predvaja_clip_image003.gif | Bin 0 -> 686 bytes kpov_judge/tasks/custom_rdate/howtos/images/s1.png | Bin 0 -> 700 bytes kpov_judge/tasks/custom_rdate/howtos/images/s2.png | Bin 0 -> 3882 bytes kpov_judge/tasks/custom_rdate/howtos/images/s3.png | Bin 0 -> 3569 bytes kpov_judge/tasks/custom_rdate/howtos/si/index.html | 57 ++++++++++ kpov_judge/tasks/custom_rdate/lecture/ideja.txt | 2 + kpov_judge/tasks/custom_rdate/task.py | 107 +++++++++++++++++ kpov_judge/tasks/dhcp_dns/evaluation/task.py | 118 ------------------- kpov_judge/tasks/dhcp_dns/lecture/ideja.txt | 1 - kpov_judge/tasks/dhcp_dns/preparation/task.py | 112 ------------------ kpov_judge/tasks/dhcp_dns_predefined_ip/task.py | 118 +++++++++++++++++++ kpov_judge/tasks/entrance_exam/task.py | 2 + kpov_judge/tasks/ieee802/evaluation/task.py | 116 ------------------- kpov_judge/tasks/ieee802/lecture/ideja.txt | 2 - kpov_judge/tasks/ieee802/preparation/task.py | 117 ------------------- .../tasks/isc_dhcp_live_boot/lecture/ideja.txt | 1 + kpov_judge/tasks/isc_dhcp_live_boot/task.py | 112 ++++++++++++++++++ kpov_judge/tasks/ldap/evaluation/task.py | 123 -------------------- kpov_judge/tasks/ldap/lecture/ideja.txt | 2 - kpov_judge/tasks/ldap/preparation/task.py | 111 ------------------ kpov_judge/tasks/ldap_import/task.py | 123 ++++++++++++++++++++ kpov_judge/tasks/ldap_search/lecture/ideja.txt | 2 + kpov_judge/tasks/ldap_search/task.py | 111 ++++++++++++++++++ kpov_judge/tasks/nat/evaluation/task.py | 122 -------------------- kpov_judge/tasks/nat/lecture/ideja.txt | 2 - kpov_judge/tasks/nat/preparation/task.py | 125 -------------------- kpov_judge/tasks/nat_port_forward/task.py | 122 ++++++++++++++++++++ kpov_judge/tasks/nat_vlc/lecture/ideja.txt | 2 + kpov_judge/tasks/nat_vlc/task.py | 125 ++++++++++++++++++++ kpov_judge/tasks/network_boot/evaluation/task.py | 121 -------------------- kpov_judge/tasks/network_boot/lecture/ideja.txt | 1 - kpov_judge/tasks/network_boot/preparation/task.py | 90 --------------- .../tasks/network_boot_custom_program/task.py | 121 ++++++++++++++++++++ kpov_judge/tasks/openvpn/evaluation/task.py | 122 -------------------- kpov_judge/tasks/openvpn/lecture/ideja.txt | 2 - kpov_judge/tasks/openvpn/preparation/task.py | 121 -------------------- kpov_judge/tasks/openvpn_multiple_hops/task.py | 122 ++++++++++++++++++++ .../tasks/openvpn_simple_smb/lecture/ideja.txt | 2 + kpov_judge/tasks/openvpn_simple_smb/task.py | 121 ++++++++++++++++++++ kpov_judge/tasks/openwrt/evaluation/task.py | 120 -------------------- kpov_judge/tasks/openwrt/lecture/ideja.txt | 2 - kpov_judge/tasks/openwrt/preparation/task.py | 122 -------------------- kpov_judge/tasks/openwrt/task.py | 120 ++++++++++++++++++++ kpov_judge/tasks/public_ip_ssh/lecture/ideja.txt | 2 + kpov_judge/tasks/public_ip_ssh/task.py | 51 +++++++++ .../tasks/public_ssh_motd_http/lecture/ideja.txt | 1 + kpov_judge/tasks/public_ssh_motd_http/task.py | 120 ++++++++++++++++++++ kpov_judge/tasks/radius/evaluation/task.py | 126 --------------------- kpov_judge/tasks/radius/lecture/ideja.txt | 1 - kpov_judge/tasks/radius/preparation/task.py | 91 --------------- kpov_judge/tasks/radius_multiple_realms/task.py | 126 +++++++++++++++++++++ .../tasks/radius_mysql_pam/lecture/ideja.txt | 1 + kpov_judge/tasks/radius_mysql_pam/task.py | 91 +++++++++++++++ kpov_judge/tasks/rdate/evaluation/task.py | 121 -------------------- kpov_judge/tasks/rdate/lecture/ideja.txt | 2 - .../tasks/rdate/preparation/TejoLicen/rServe.zip | Bin 499 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu1.png | Bin 979 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu15.png | Bin 679 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu2.png | Bin 826 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu3.png | Bin 13656 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu4.png | Bin 1564 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu5.png | Bin 11278 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu6.png | Bin 15244 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu7.png | Bin 3842 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu8.png | Bin 3420 -> 0 bytes .../tasks/rdate/preparation/howtos/images/bu9.png | Bin 4245 -> 0 bytes .../howtos/images/predvaja_clip_image003.gif | Bin 686 -> 0 bytes .../tasks/rdate/preparation/howtos/images/s1.png | Bin 700 -> 0 bytes .../tasks/rdate/preparation/howtos/images/s2.png | Bin 3882 -> 0 bytes .../tasks/rdate/preparation/howtos/images/s3.png | Bin 3569 -> 0 bytes .../tasks/rdate/preparation/howtos/si/index.html | 57 ---------- kpov_judge/tasks/rdate/preparation/task.py | 107 ----------------- kpov_judge/tasks/rdate_64bit/task.py | 121 ++++++++++++++++++++ kpov_judge/tasks/remote_ssh/evaluation/task.py | 51 --------- kpov_judge/tasks/remote_ssh/lecture/ideja.txt | 2 - kpov_judge/tasks/remote_ssh/preparation/task.py | 4 - kpov_judge/tasks/set_ip_dhcp_hostname/task.py | 104 +++++++++++++++++ .../set_ip_static_dhcp/evaluation/navodila.html | 9 -- .../tasks/set_ip_static_dhcp/howtos/images/04.png | Bin 0 -> 11706 bytes .../tasks/set_ip_static_dhcp/howtos/images/09.png | Bin 0 -> 187608 bytes .../tasks/set_ip_static_dhcp/howtos/images/10.png | Bin 0 -> 193147 bytes .../tasks/set_ip_static_dhcp/howtos/images/11.png | Bin 0 -> 189272 bytes .../tasks/set_ip_static_dhcp/howtos/images/12.png | Bin 0 -> 163954 bytes .../tasks/set_ip_static_dhcp/howtos/images/13.png | Bin 0 -> 175600 bytes .../tasks/set_ip_static_dhcp/howtos/images/17.png | Bin 0 -> 7062 bytes .../tasks/set_ip_static_dhcp/howtos/si/index.html | 73 ++++++++++++ .../preparation/howtos/images/04.png | Bin 11706 -> 0 bytes .../preparation/howtos/images/09.png | Bin 187608 -> 0 bytes .../preparation/howtos/images/10.png | Bin 193147 -> 0 bytes .../preparation/howtos/images/11.png | Bin 189272 -> 0 bytes .../preparation/howtos/images/12.png | Bin 163954 -> 0 bytes .../preparation/howtos/images/13.png | Bin 175600 -> 0 bytes .../preparation/howtos/images/17.png | Bin 7062 -> 0 bytes .../preparation/howtos/si/index.html | 73 ------------ .../tasks/set_ip_static_dhcp/preparation/task.py | 121 -------------------- kpov_judge/tasks/set_ip_static_dhcp/task.py | 121 ++++++++++++++++++++ kpov_judge/tasks/set_motd/evaluation/navodila.txt | 8 -- kpov_judge/tasks/set_motd/evaluation/task.py | 72 ------------ kpov_judge/tasks/set_motd/preparation/task.py | 94 --------------- kpov_judge/tasks/set_motd/task.py | 81 +++++++++++++ .../tasks/set_motd_egotrip/evaluation/task.py | 120 -------------------- .../tasks/set_motd_egotrip/lecture/ideja.txt | 1 - .../tasks/set_motd_egotrip/preparation/task.py | 2 - kpov_judge/tasks/smb_nfs/lecture/ideja.txt | 1 + kpov_judge/tasks/smb_nfs/task.py | 90 +++++++++++++++ kpov_judge/tasks/snmp/evaluation/task.py | 124 -------------------- kpov_judge/tasks/snmp/lecture/ideja.txt | 2 - kpov_judge/tasks/snmp/preparation/task.py | 104 ----------------- .../tasks/snmp_agent_uptime/lecture/ideja.txt | 2 + kpov_judge/tasks/snmp_agent_uptime/task.py | 104 +++++++++++++++++ kpov_judge/tasks/snmp_alarms_interfaces/task.py | 124 ++++++++++++++++++++ kpov_judge/tasks/vlc_stream_rtp/lecture/ideja.txt | 2 + kpov_judge/tasks/vlc_stream_rtp/task.py | 122 ++++++++++++++++++++ kpov_judge/test_task.py | 109 ++++++++++++++++++ 177 files changed, 3292 insertions(+), 3225 deletions(-) delete mode 100755 kpov_judge/add_assignment.py create mode 100755 kpov_judge/add_task.py create mode 100644 kpov_judge/instructions_extractor.py create mode 120000 kpov_judge/lectures/fri_kpov/01/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/01/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/01/preparation create mode 120000 kpov_judge/lectures/fri_kpov/02/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/02/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/02/preparation create mode 120000 kpov_judge/lectures/fri_kpov/03/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/03/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/03/preparation create mode 120000 kpov_judge/lectures/fri_kpov/04/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/04/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/04/preparation create mode 120000 kpov_judge/lectures/fri_kpov/05/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/05/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/05/preparation create mode 120000 kpov_judge/lectures/fri_kpov/06/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/06/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/06/preparation create mode 120000 kpov_judge/lectures/fri_kpov/07/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/07/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/07/preparation create mode 120000 kpov_judge/lectures/fri_kpov/08/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/08/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/08/preparation create mode 120000 kpov_judge/lectures/fri_kpov/09/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/09/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/09/preparation create mode 120000 kpov_judge/lectures/fri_kpov/10/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/10/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/10/preparation create mode 120000 kpov_judge/lectures/fri_kpov/11/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/11/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/11/preparation create mode 120000 kpov_judge/lectures/fri_kpov/12/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/12/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/12/preparation create mode 120000 kpov_judge/lectures/fri_kpov/13/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/13/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/13/preparation create mode 120000 kpov_judge/lectures/fri_kpov/14/evaluation create mode 100644 kpov_judge/lectures/fri_kpov/14/lecture/idea.txt create mode 120000 kpov_judge/lectures/fri_kpov/14/preparation create mode 100644 kpov_judge/tasks/copy_rename_100_files/task.py create mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/evaluation/task.py create mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/lecture/ideja.txt create mode 100644 kpov_judge/tasks/copy_rename_20_files_tail_env/task.py delete mode 100644 kpov_judge/tasks/copy_rename_40_files/evaluation/task.py delete mode 100644 kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/copy_rename_40_files/preparation/task.py create mode 100644 kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu1.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu15.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu2.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu3.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu4.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu5.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu6.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu7.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu8.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/bu9.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/predvaja_clip_image003.gif create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/s1.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/s2.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/images/s3.png create mode 100644 kpov_judge/tasks/custom_rdate/howtos/si/index.html create mode 100644 kpov_judge/tasks/custom_rdate/lecture/ideja.txt create mode 100644 kpov_judge/tasks/custom_rdate/task.py delete mode 100644 kpov_judge/tasks/dhcp_dns/evaluation/task.py delete mode 100644 kpov_judge/tasks/dhcp_dns/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/dhcp_dns/preparation/task.py create mode 100644 kpov_judge/tasks/dhcp_dns_predefined_ip/task.py create mode 100644 kpov_judge/tasks/entrance_exam/task.py delete mode 100644 kpov_judge/tasks/ieee802/evaluation/task.py delete mode 100644 kpov_judge/tasks/ieee802/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/ieee802/preparation/task.py create mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/lecture/ideja.txt create mode 100644 kpov_judge/tasks/isc_dhcp_live_boot/task.py delete mode 100644 kpov_judge/tasks/ldap/evaluation/task.py delete mode 100644 kpov_judge/tasks/ldap/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/ldap/preparation/task.py create mode 100644 kpov_judge/tasks/ldap_import/task.py create mode 100644 kpov_judge/tasks/ldap_search/lecture/ideja.txt create mode 100644 kpov_judge/tasks/ldap_search/task.py delete mode 100644 kpov_judge/tasks/nat/evaluation/task.py delete mode 100644 kpov_judge/tasks/nat/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/nat/preparation/task.py create mode 100644 kpov_judge/tasks/nat_port_forward/task.py create mode 100644 kpov_judge/tasks/nat_vlc/lecture/ideja.txt create mode 100644 kpov_judge/tasks/nat_vlc/task.py delete mode 100644 kpov_judge/tasks/network_boot/evaluation/task.py delete mode 100644 kpov_judge/tasks/network_boot/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/network_boot/preparation/task.py create mode 100644 kpov_judge/tasks/network_boot_custom_program/task.py delete mode 100644 kpov_judge/tasks/openvpn/evaluation/task.py delete mode 100644 kpov_judge/tasks/openvpn/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/openvpn/preparation/task.py create mode 100644 kpov_judge/tasks/openvpn_multiple_hops/task.py create mode 100644 kpov_judge/tasks/openvpn_simple_smb/lecture/ideja.txt create mode 100644 kpov_judge/tasks/openvpn_simple_smb/task.py delete mode 100644 kpov_judge/tasks/openwrt/evaluation/task.py delete mode 100644 kpov_judge/tasks/openwrt/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/openwrt/preparation/task.py create mode 100644 kpov_judge/tasks/openwrt/task.py create mode 100644 kpov_judge/tasks/public_ip_ssh/lecture/ideja.txt create mode 100644 kpov_judge/tasks/public_ip_ssh/task.py create mode 100644 kpov_judge/tasks/public_ssh_motd_http/lecture/ideja.txt create mode 100644 kpov_judge/tasks/public_ssh_motd_http/task.py delete mode 100644 kpov_judge/tasks/radius/evaluation/task.py delete mode 100644 kpov_judge/tasks/radius/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/radius/preparation/task.py create mode 100644 kpov_judge/tasks/radius_multiple_realms/task.py create mode 100644 kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt create mode 100644 kpov_judge/tasks/radius_mysql_pam/task.py delete mode 100644 kpov_judge/tasks/rdate/evaluation/task.py delete mode 100644 kpov_judge/tasks/rdate/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/s1.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/s2.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/images/s3.png delete mode 100644 kpov_judge/tasks/rdate/preparation/howtos/si/index.html delete mode 100644 kpov_judge/tasks/rdate/preparation/task.py create mode 100644 kpov_judge/tasks/rdate_64bit/task.py delete mode 100644 kpov_judge/tasks/remote_ssh/evaluation/task.py delete mode 100644 kpov_judge/tasks/remote_ssh/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/remote_ssh/preparation/task.py create mode 100644 kpov_judge/tasks/set_ip_dhcp_hostname/task.py delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html delete mode 100644 kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py create mode 100644 kpov_judge/tasks/set_ip_static_dhcp/task.py delete mode 100644 kpov_judge/tasks/set_motd/evaluation/navodila.txt delete mode 100644 kpov_judge/tasks/set_motd/evaluation/task.py delete mode 100644 kpov_judge/tasks/set_motd/preparation/task.py create mode 100644 kpov_judge/tasks/set_motd/task.py delete mode 100644 kpov_judge/tasks/set_motd_egotrip/evaluation/task.py delete mode 100644 kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/set_motd_egotrip/preparation/task.py create mode 100644 kpov_judge/tasks/smb_nfs/lecture/ideja.txt create mode 100644 kpov_judge/tasks/smb_nfs/task.py delete mode 100644 kpov_judge/tasks/snmp/evaluation/task.py delete mode 100644 kpov_judge/tasks/snmp/lecture/ideja.txt delete mode 100644 kpov_judge/tasks/snmp/preparation/task.py create mode 100644 kpov_judge/tasks/snmp_agent_uptime/lecture/ideja.txt create mode 100644 kpov_judge/tasks/snmp_agent_uptime/task.py create mode 100644 kpov_judge/tasks/snmp_alarms_interfaces/task.py create mode 100644 kpov_judge/tasks/vlc_stream_rtp/lecture/ideja.txt create mode 100644 kpov_judge/tasks/vlc_stream_rtp/task.py create mode 100755 kpov_judge/test_task.py diff --git a/kpov_judge/add_assignment.py b/kpov_judge/add_assignment.py deleted file mode 100755 index 2453eeb..0000000 --- a/kpov_judge/add_assignment.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import pymongo -from bson.son import SON -import sys -import inspect -import kpov_random_helpers -import settings -import guestfs -import glob - -if __name__ == '__main__': - if len(sys.argv) != 3: - print "Usage: {0} task_name task_source.py" - print "The task_source should contain two functions - task(param1, param2, ...) and task_check(res, params)" - task_id = sys.argv[1] - fname = sys.argv[2] - db = pymongo.Connection(settings.DB_HOST).kpov - try: - db.authenticate(settings.USERNAME, settings.PASSWORD) - except Exception, e: - print "Not authenticated:"+str(e) - #no auth or auth config? - source = open(fname).read() - code = compile(source, fname, 'exec') - # the following line creates: - # task, task_check, gen_params, prepare_disks, computers, params_meta. - exec(code) - task_source = inspect.getsource(task) - task_check_source = inspect.getsource(task_check) - gen_params_source = inspect.getsource(gen_params) - prepare_disks_source = inspect.getsource(prepare_disks) - x = params_meta.keys() # check for existence - db.computers_meta.remove({'task_id': task_id}) - auto_networks = set([None]) - for k, v in computers.iteritems(): - for n in v.get('networks_interfaces', []): - auto_networks.add(n.get('network', None)) - db.computers_meta.update({'task_id': task_id, 'name': k}, {'$set': v}, upsert=True) - auto_networks.remove(None) - db.networks.remove({'task_id': task_id}) - try: - net_list = networks.iteritems() - except: - net_list = [(k, {'public': False}) for k in auto_networks] - for k, v in net_list: - db.networks.update({'task_id': task_id, 'name': k}, {'$set': v}, upsert=True) - db.task_checkers.update({'task_id': task_id}, {'$set': {'source': task_check_source}}, upsert=True) - db.tasks.update({'task_id': task_id},{'$set': {'source': task_source}}, upsert=True) - db.prepare_disks.update({'task_id': task_id}, {'$set': {'source': prepare_disks_source}}, upsert=True) - db.gen_params.update({'task_id': task_id}, {'$set': {'source': gen_params_source}}, upsert=True) - db.task_params_meta.update({'task_id': task_id}, {'$set': {'params': params_meta}}, upsert=True) - diff --git a/kpov_judge/add_task.py b/kpov_judge/add_task.py new file mode 100755 index 0000000..2453eeb --- /dev/null +++ b/kpov_judge/add_task.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import pymongo +from bson.son import SON +import sys +import inspect +import kpov_random_helpers +import settings +import guestfs +import glob + +if __name__ == '__main__': + if len(sys.argv) != 3: + print "Usage: {0} task_name task_source.py" + print "The task_source should contain two functions - task(param1, param2, ...) and task_check(res, params)" + task_id = sys.argv[1] + fname = sys.argv[2] + db = pymongo.Connection(settings.DB_HOST).kpov + try: + db.authenticate(settings.USERNAME, settings.PASSWORD) + except Exception, e: + print "Not authenticated:"+str(e) + #no auth or auth config? + source = open(fname).read() + code = compile(source, fname, 'exec') + # the following line creates: + # task, task_check, gen_params, prepare_disks, computers, params_meta. + exec(code) + task_source = inspect.getsource(task) + task_check_source = inspect.getsource(task_check) + gen_params_source = inspect.getsource(gen_params) + prepare_disks_source = inspect.getsource(prepare_disks) + x = params_meta.keys() # check for existence + db.computers_meta.remove({'task_id': task_id}) + auto_networks = set([None]) + for k, v in computers.iteritems(): + for n in v.get('networks_interfaces', []): + auto_networks.add(n.get('network', None)) + db.computers_meta.update({'task_id': task_id, 'name': k}, {'$set': v}, upsert=True) + auto_networks.remove(None) + db.networks.remove({'task_id': task_id}) + try: + net_list = networks.iteritems() + except: + net_list = [(k, {'public': False}) for k in auto_networks] + for k, v in net_list: + db.networks.update({'task_id': task_id, 'name': k}, {'$set': v}, upsert=True) + db.task_checkers.update({'task_id': task_id}, {'$set': {'source': task_check_source}}, upsert=True) + db.tasks.update({'task_id': task_id},{'$set': {'source': task_source}}, upsert=True) + db.prepare_disks.update({'task_id': task_id}, {'$set': {'source': prepare_disks_source}}, upsert=True) + db.gen_params.update({'task_id': task_id}, {'$set': {'source': gen_params_source}}, upsert=True) + db.task_params_meta.update({'task_id': task_id}, {'$set': {'params': params_meta}}, upsert=True) + diff --git a/kpov_judge/instructions_extractor.py b/kpov_judge/instructions_extractor.py new file mode 100644 index 0000000..5574389 --- /dev/null +++ b/kpov_judge/instructions_extractor.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import glob +import os.path +from bson.son import SON +import sys + + +if __name__ == '__main__': + l = glob.glob(sys.argv[1]) + l.sort() + for week in l: + print "---------------" + for part in ['preparation', 'evaluation']: + try: + print week.split('/')[2], '-' , part, ':' + with open(os.path.join(week, part, 'task.py')) as f: + task_code = compile(f.read(), 'task.py', 'exec') + exec(task_code) + print instructions['si'].encode('utf-8') + except Exception, e: + print e + pass + diff --git a/kpov_judge/lectures/fri_kpov/01/evaluation b/kpov_judge/lectures/fri_kpov/01/evaluation new file mode 120000 index 0000000..bc7800d --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/01/evaluation @@ -0,0 +1 @@ +../../../tasks/set_motd \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/01/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/01/lecture/idea.txt new file mode 100644 index 0000000..e05a775 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/01/lecture/idea.txt @@ -0,0 +1,2 @@ +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/lectures/fri_kpov/01/preparation b/kpov_judge/lectures/fri_kpov/01/preparation new file mode 120000 index 0000000..bc7800d --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/01/preparation @@ -0,0 +1 @@ +../../../tasks/set_motd \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/02/evaluation b/kpov_judge/lectures/fri_kpov/02/evaluation new file mode 120000 index 0000000..aa80e13 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/02/evaluation @@ -0,0 +1 @@ +../../../tasks/public_ip_ssh \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/02/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/02/lecture/idea.txt new file mode 100644 index 0000000..23f5dcc --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/02/lecture/idea.txt @@ -0,0 +1,2 @@ +Primer pristopnega kolokvija. Odgovori na vprašanja. Pogoste težave v Virtualbox. +X11, desktopi, nastavitve. diff --git a/kpov_judge/lectures/fri_kpov/02/preparation b/kpov_judge/lectures/fri_kpov/02/preparation new file mode 120000 index 0000000..92a2558 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/02/preparation @@ -0,0 +1 @@ +../../../tasks/mock_entrance_exam \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/03/evaluation b/kpov_judge/lectures/fri_kpov/03/evaluation new file mode 120000 index 0000000..83669c5 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/03/evaluation @@ -0,0 +1 @@ +../../../tasks/set_ip_dhcp_hostname \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/03/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/03/lecture/idea.txt new file mode 100644 index 0000000..92d984c --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/03/lecture/idea.txt @@ -0,0 +1,2 @@ +Mrežne nastavitve pod Linuxom. Ukazi za delo z mrežo. tcpdump. NetworkManager. +dbus. diff --git a/kpov_judge/lectures/fri_kpov/03/preparation b/kpov_judge/lectures/fri_kpov/03/preparation new file mode 120000 index 0000000..ecf9a02 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/03/preparation @@ -0,0 +1 @@ +../../../tasks/set_ip_static_dhcp \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/04/evaluation b/kpov_judge/lectures/fri_kpov/04/evaluation new file mode 120000 index 0000000..8c03708 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/04/evaluation @@ -0,0 +1 @@ +../../../tasks/copy_rename_100_files \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/04/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/04/lecture/idea.txt new file mode 100644 index 0000000..1a29e34 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/04/lecture/idea.txt @@ -0,0 +1 @@ +Vprašanja/odgovori glede pristopnega kolokvija. Bashizmi. Morda window managerji. diff --git a/kpov_judge/lectures/fri_kpov/04/preparation b/kpov_judge/lectures/fri_kpov/04/preparation new file mode 120000 index 0000000..bf8f78f --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/04/preparation @@ -0,0 +1 @@ +../../../tasks/copy_rename_20_files_tail_env \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/05/evaluation b/kpov_judge/lectures/fri_kpov/05/evaluation new file mode 120000 index 0000000..bfe5840 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/05/evaluation @@ -0,0 +1 @@ +../../../tasks/public_ssh_motd_http \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/05/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/05/lecture/idea.txt new file mode 100644 index 0000000..91c85c2 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/05/lecture/idea.txt @@ -0,0 +1 @@ +Reši pristopni kolokvij z visoko oceno. diff --git a/kpov_judge/lectures/fri_kpov/05/preparation b/kpov_judge/lectures/fri_kpov/05/preparation new file mode 120000 index 0000000..214ed3a --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/05/preparation @@ -0,0 +1 @@ +../../../tasks/entrance_exam \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/06/evaluation b/kpov_judge/lectures/fri_kpov/06/evaluation new file mode 120000 index 0000000..13f05ef --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/06/evaluation @@ -0,0 +1 @@ +../../../tasks/dhcp_dns_predefined_ip \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/06/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/06/lecture/idea.txt new file mode 100644 index 0000000..89f3a3a --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/06/lecture/idea.txt @@ -0,0 +1 @@ +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/lectures/fri_kpov/06/preparation b/kpov_judge/lectures/fri_kpov/06/preparation new file mode 120000 index 0000000..aaee75c --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/06/preparation @@ -0,0 +1 @@ +../../../tasks/isc_dhcp_live_boot \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/07/evaluation b/kpov_judge/lectures/fri_kpov/07/evaluation new file mode 120000 index 0000000..a033e6b --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/07/evaluation @@ -0,0 +1 @@ +../../../tasks/network_boot_custom_program \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/07/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/07/lecture/idea.txt new file mode 100644 index 0000000..a380311 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/07/lecture/idea.txt @@ -0,0 +1 @@ +Zaženi računalnik. Spremeni initrd. Zaženi sistem prek NFS. Spremeni podatke v squashfs. diff --git a/kpov_judge/lectures/fri_kpov/07/preparation b/kpov_judge/lectures/fri_kpov/07/preparation new file mode 120000 index 0000000..338e3c4 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/07/preparation @@ -0,0 +1 @@ +../../../tasks/smb_nfs \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/08/evaluation b/kpov_judge/lectures/fri_kpov/08/evaluation new file mode 120000 index 0000000..9f38dbd --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/08/evaluation @@ -0,0 +1 @@ +../../../tasks/snmp_alarms_interfaces \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/08/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/08/lecture/idea.txt new file mode 100644 index 0000000..0832279 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/08/lecture/idea.txt @@ -0,0 +1,2 @@ +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/lectures/fri_kpov/08/preparation b/kpov_judge/lectures/fri_kpov/08/preparation new file mode 120000 index 0000000..43d41d1 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/08/preparation @@ -0,0 +1 @@ +../../../tasks/snmp_agent_uptime \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/09/evaluation b/kpov_judge/lectures/fri_kpov/09/evaluation new file mode 120000 index 0000000..4cf01e0 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/09/evaluation @@ -0,0 +1 @@ +../../../tasks/rdate_64bit \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/09/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/09/lecture/idea.txt new file mode 100644 index 0000000..0fb111a --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/09/lecture/idea.txt @@ -0,0 +1,2 @@ +Napiši svoj rdate klient. Nastavi računalnik, da bo uro sinhroniziral z NTP strežnika. + diff --git a/kpov_judge/lectures/fri_kpov/09/preparation b/kpov_judge/lectures/fri_kpov/09/preparation new file mode 120000 index 0000000..93958cb --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/09/preparation @@ -0,0 +1 @@ +../../../tasks/custom_rdate \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/10/evaluation b/kpov_judge/lectures/fri_kpov/10/evaluation new file mode 120000 index 0000000..7dad5da --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/10/evaluation @@ -0,0 +1 @@ +../../../tasks/openvpn_multiple_hops \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/10/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/10/lecture/idea.txt new file mode 100644 index 0000000..3ae0c92 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/10/lecture/idea.txt @@ -0,0 +1,2 @@ +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/lectures/fri_kpov/10/preparation b/kpov_judge/lectures/fri_kpov/10/preparation new file mode 120000 index 0000000..88dd369 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/10/preparation @@ -0,0 +1 @@ +../../../tasks/openvpn_simple_smb \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/11/evaluation b/kpov_judge/lectures/fri_kpov/11/evaluation new file mode 120000 index 0000000..632bdfe --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/11/evaluation @@ -0,0 +1 @@ +../../../tasks/radius_multiple_realms \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/11/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/11/lecture/idea.txt new file mode 100644 index 0000000..fd9d1a9 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/11/lecture/idea.txt @@ -0,0 +1 @@ +Nastavi apache tako, da se boš nanj prijavila s pomočjo avtentikacije pri sosedu. diff --git a/kpov_judge/lectures/fri_kpov/11/preparation b/kpov_judge/lectures/fri_kpov/11/preparation new file mode 120000 index 0000000..193fb07 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/11/preparation @@ -0,0 +1 @@ +../../../tasks/radius_mysql_pam \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/12/evaluation b/kpov_judge/lectures/fri_kpov/12/evaluation new file mode 120000 index 0000000..63a7017 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/12/evaluation @@ -0,0 +1 @@ +../../../tasks/nat_port_forward \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/12/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/12/lecture/idea.txt new file mode 100644 index 0000000..852ee43 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/12/lecture/idea.txt @@ -0,0 +1,2 @@ +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/lectures/fri_kpov/12/preparation b/kpov_judge/lectures/fri_kpov/12/preparation new file mode 120000 index 0000000..28b7694 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/12/preparation @@ -0,0 +1 @@ +../../../tasks/nat_vlc \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/13/evaluation b/kpov_judge/lectures/fri_kpov/13/evaluation new file mode 120000 index 0000000..350e3c0 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/13/evaluation @@ -0,0 +1 @@ +../../../tasks/openwrt \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/13/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/13/lecture/idea.txt new file mode 100644 index 0000000..7e12372 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/13/lecture/idea.txt @@ -0,0 +1,2 @@ +Postavi OpenWRT na router. Usposobi predvajanje filmov na Raspberry PI. + diff --git a/kpov_judge/lectures/fri_kpov/13/preparation b/kpov_judge/lectures/fri_kpov/13/preparation new file mode 120000 index 0000000..3fa7bd2 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/13/preparation @@ -0,0 +1 @@ +../../../tasks/vlc_stream_rtp \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/14/evaluation b/kpov_judge/lectures/fri_kpov/14/evaluation new file mode 120000 index 0000000..e6e31f2 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/14/evaluation @@ -0,0 +1 @@ +../../../tasks/ldap_import \ No newline at end of file diff --git a/kpov_judge/lectures/fri_kpov/14/lecture/idea.txt b/kpov_judge/lectures/fri_kpov/14/lecture/idea.txt new file mode 100644 index 0000000..e9647ce --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/14/lecture/idea.txt @@ -0,0 +1,2 @@ +Postavi strežnik OpenLDAP. Ustvari shemo. Ustvari uporabnika. Uporabi LDAP kot backend za RADIUS. + diff --git a/kpov_judge/lectures/fri_kpov/14/preparation b/kpov_judge/lectures/fri_kpov/14/preparation new file mode 120000 index 0000000..51c2854 --- /dev/null +++ b/kpov_judge/lectures/fri_kpov/14/preparation @@ -0,0 +1 @@ +../../../tasks/ldap_search \ No newline at end of file diff --git a/kpov_judge/tasks/copy_rename_100_files/task.py b/kpov_judge/tasks/copy_rename_100_files/task.py new file mode 100644 index 0000000..834cb2a --- /dev/null +++ b/kpov_judge/tasks/copy_rename_100_files/task.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/evaluation/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/evaluation/task.py new file mode 100644 index 0000000..834cb2a --- /dev/null +++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/evaluation/task.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/lecture/ideja.txt b/kpov_judge/tasks/copy_rename_20_files_tail_env/lecture/ideja.txt new file mode 100644 index 0000000..1a29e34 --- /dev/null +++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/lecture/ideja.txt @@ -0,0 +1 @@ +Vprašanja/odgovori glede pristopnega kolokvija. Bashizmi. Morda window managerji. 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 new file mode 100644 index 0000000..05bfd2c --- /dev/null +++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# TODO: finish this! +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Prijavi se na sistem. +V domači mapi najdeš imenik Mapa z 20 datotekami. + - preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji + - Napiši čim krajši ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi + - 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) + - 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. + - 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 + +""" +} + +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 + + }, + '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/copy_rename_40_files/evaluation/task.py b/kpov_judge/tasks/copy_rename_40_files/evaluation/task.py deleted file mode 100644 index 834cb2a..0000000 --- a/kpov_judge/tasks/copy_rename_40_files/evaluation/task.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt b/kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt deleted file mode 100644 index 1a29e34..0000000 --- a/kpov_judge/tasks/copy_rename_40_files/lecture/ideja.txt +++ /dev/null @@ -1 +0,0 @@ -Vprašanja/odgovori glede pristopnega kolokvija. Bashizmi. Morda window managerji. diff --git a/kpov_judge/tasks/copy_rename_40_files/preparation/task.py b/kpov_judge/tasks/copy_rename_40_files/preparation/task.py deleted file mode 100644 index 05bfd2c..0000000 --- a/kpov_judge/tasks/copy_rename_40_files/preparation/task.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# TODO: finish this! -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Prijavi se na sistem. -V domači mapi najdeš imenik Mapa z 20 datotekami. - - preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji - - Napiši čim krajši ukaz, ki vse datoteke iz /home/user/mapa/mojimenik premakne v /home/user/novi - - 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) - - 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. - - 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 - -""" -} - -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 - - }, - '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip b/kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip new file mode 100644 index 0000000..9061692 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/TejoLicen/rServe.zip differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu1.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu1.png new file mode 100644 index 0000000..c6eeac8 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu1.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu15.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu15.png new file mode 100644 index 0000000..c2ac808 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu15.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu2.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu2.png new file mode 100644 index 0000000..85fcfa8 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu2.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu3.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu3.png new file mode 100644 index 0000000..831e764 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu3.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu4.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu4.png new file mode 100644 index 0000000..495351a Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu4.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu5.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu5.png new file mode 100644 index 0000000..103e0e6 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu5.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu6.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu6.png new file mode 100644 index 0000000..b032223 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu6.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu7.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu7.png new file mode 100644 index 0000000..bd50500 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu7.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu8.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu8.png new file mode 100644 index 0000000..98f7812 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu8.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/bu9.png b/kpov_judge/tasks/custom_rdate/howtos/images/bu9.png new file mode 100644 index 0000000..9ed78ce Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/bu9.png 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 new file mode 100644 index 0000000..02be389 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/predvaja_clip_image003.gif differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/s1.png b/kpov_judge/tasks/custom_rdate/howtos/images/s1.png new file mode 100644 index 0000000..52b6ee5 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/s1.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/s2.png b/kpov_judge/tasks/custom_rdate/howtos/images/s2.png new file mode 100644 index 0000000..78a65ce Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/s2.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/images/s3.png b/kpov_judge/tasks/custom_rdate/howtos/images/s3.png new file mode 100644 index 0000000..c32eae1 Binary files /dev/null and b/kpov_judge/tasks/custom_rdate/howtos/images/s3.png differ diff --git a/kpov_judge/tasks/custom_rdate/howtos/si/index.html b/kpov_judge/tasks/custom_rdate/howtos/si/index.html new file mode 100644 index 0000000..a22f5c2 --- /dev/null +++ b/kpov_judge/tasks/custom_rdate/howtos/si/index.html @@ -0,0 +1,57 @@ + + + + + + + +

XX. predvaja:


+

Naloga na hitro:


+ Nastavi uro na streniku s pomojo rdate. Napii program, ki pretvori 24-bitna tevila z dvojikim komplementom v decimalno obliko.

+

Navodila:


+ 1. Iz imenika s slikami virtualnih raunalnikov povlecite sliki Student.vdi(klient) in SimpleArbiter.vdi(strenik).
+ 2. Z VirtualBoxom (ali ostalim programom za virtualne raunalnike) ustvarite dva virtualna raunalnika in jim kot disk za shranjevanje podajte Student.vdi ter SimpleArbiter.vdi.
+ 3. Zaenite oba navidezna raunalnika.
+ 4. Na Student se prijavite z uporabnikom root in geslom kaboom na SimpleArbiter pa z uporabnikom tester in geslom SedemKrogovPekla.

+ +

Prvi del naloge: posodobi uro raunalnika s pomojo rdate.


+ 1. Preverite in si zapiite IP naslov na SimpleArbiter. (ifconfig)


+ 2. Z ukazom sudo apt-get install rdate namestimo program rdate.
+ 3. Na Student z pomojo rdate posodobi uro raunalnika. rdate IP_SIMPLE_ARBITER

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

+


+

Drugi del naloge: napii program, ki pretvori binarni zapis 32-bitnega tevila v decimalnega.


+ Nalogo lahko reite v Javi ali v Pythonu. Prav tako pa lahko kodo piete v poljubnem tekstovnem urejevalniku.

+


+ JAVA------
+ 1. Z ukazom nano bintodec3.java ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
+ 2. Napiemo program za pretvarjanje 24-bitnega tevila z dvojikim komplementom v decimalno obliko
+

+ 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
+ 4. e je e nimamo, naloimo Javo sudo apt-get install openjdk-6-jdk

+ 5. Prevedemo program javac bintodec3.java
+ 6. Lahko ga e zaenemo ter preizkusimo java bintodec3. Na standardni vhod vnaamo 24-bitno tevilo v estnajstiki obliki

+

PYTHON------
+ 1. Z ukazom nano bintodec3.py ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
+ 2. Napiemo program za pretvarjanje 24-bitnega tevila z dvojikim komplementom v decimalno obliko
+
+ 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
+ 4. Program zaenemo z ukazom python bintodec3.py



+ + +

+

Testiranje

+ 1. Lahko poenemo tester; z ukazom ./run_test.py
+
+ 2. Kot "Upor. Ime" in "Geslo" napiite vae podatke uilnice. (npr.: "pz1234@student.uni-lj.si" in "geslo123")
+
+ 3. Kot ime naloge vpiite XX.predvaja.
+ 4. Ko vas program vpraa po poti programa vnesite vao pot do programa za pretvarjanje. (npr.: e imate program bintodec3.py v isti mapi kot program run_test.py, vnesete: ./bintodec3.py)
+ 5. Povpraa tudi po IP naslovu SimpleArbiterja, vnesite.
+ 6. e je lo vse po srei, program vrne OK vi pa ste opravili nalogo.

+ +
+ + + diff --git a/kpov_judge/tasks/custom_rdate/lecture/ideja.txt b/kpov_judge/tasks/custom_rdate/lecture/ideja.txt new file mode 100644 index 0000000..0fb111a --- /dev/null +++ b/kpov_judge/tasks/custom_rdate/lecture/ideja.txt @@ -0,0 +1,2 @@ +Napiši svoj rdate klient. Nastavi računalnik, da bo uro sinhroniziral z NTP strežnika. + diff --git a/kpov_judge/tasks/custom_rdate/task.py b/kpov_judge/tasks/custom_rdate/task.py new file mode 100644 index 0000000..caf6298 --- /dev/null +++ b/kpov_judge/tasks/custom_rdate/task.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py +# TODO: finish this! + +instructions = { + 'si':u""" +Postavi dva navidezna računalnika - SimpleArbiterDhcpRdate s slike diska simpleArbiterRdate ter rdateClient. +Na rdateClient ustvarite uporabnika test z geslom test. Nastavite čas na rdateClient tako, da kot rdate strežnik +uporabite SimpleArbiterDhcpRdate. Nato v domačem imeniku uporabnika test spravite program z imenom guliver, ki prebere 4 byte +podatkov s standardnega vhoda in jih pretvori v predznačeno celo število, pri čemer naj uporablja zapis z debelim koncem (big endian). +Število naj program izpiše na standardni izhod. +""" +} + +computers = { + 'rdateClient': { + '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': 'simpleArbiterDhcpRdate', + # 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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/dhcp_dns/evaluation/task.py b/kpov_judge/tasks/dhcp_dns/evaluation/task.py deleted file mode 100644 index 5e443ce..0000000 --- a/kpov_judge/tasks/dhcp_dns/evaluation/task.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Ustvari tri navidezne računalnike. Za enega (SimpleArbiter) uporabi sliko diska simpleArbiter. Na drugega (DHCP_server) postavi strežnika -DHCP in DNS. Poskrbi, da bo preostali računalnik (DHCP_client) dobil naslov, ki ga prebereš na SimpleArbiterju. Na SimpleArbiterju preberi -še ime in IP nekega računalnika (HOSTNAME_X in IP_X). Poskrbi, da bo DNS strežnik za HOSTNAME_X vrnil 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_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/dhcp_dns/lecture/ideja.txt b/kpov_judge/tasks/dhcp_dns/lecture/ideja.txt deleted file mode 100644 index 89f3a3a..0000000 --- a/kpov_judge/tasks/dhcp_dns/lecture/ideja.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/tasks/dhcp_dns/preparation/task.py b/kpov_judge/tasks/dhcp_dns/preparation/task.py deleted file mode 100644 index c060db6..0000000 --- a/kpov_judge/tasks/dhcp_dns/preparation/task.py +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# TODO: dokoncaj! -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Postavi štiri navidezne računalnike - simpleArbiter, DHCP_server, -BootableClientA ter BootableClientB. Na simpleArbiter preberi naslove IP_GW, IP_DHCP, -IP_B ter najdi datoteko A. - -Na DHCP_server postavi DHCP strežnik s pomočjo ISC dhcp 3 na naslovu IP_DHCP. -SimpleArbiter naj dobi IP_GW. DHCP_server naj ga uporabi kot gateway. -Če se zaganja BootableClientB, naj se sistem zažene z live ISO in dobi svoj IP. -Če se zaganja katerikoli drug, naj se sistem zažene v datoteko z imenom A. -Tako BootableClientA kot BootableClientB naj bosta brez diskov. -""" -} - -computers = { - 'DHCPServer': { - 'disks': [ - { 'name': 'DHCPServer', - }, - { 'name': 'bootable_iso', - 'options':{'readonly': True}, - 'parts': [], - }, - #{ 'name': 'CDROM', - # 'options':{'readonly': True}, - # 'parts': [],# no parts, no mounting. - #} - ], - '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': 'simpleArbiterDhcp', - }, - #{ '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': {'opis': 'IP DHCP streznika', 'w': False, 'public': True, 'type':'IP', 'generated': True}, - 'IP_GW': {'opis': 'IP SimpleArbiterja', 'w': False, 'public': True, 'type':'IP', 'generated': True}, - 'MAC_BOOT': {'opis': 'MAC racunalnika, ki se zazene z ISO', 'w': True, 'public': True, 'type':'MAC', 'generated': False}, - 'IP_BOOT': {'opis': 'IP racunalnika, ki se zazene z ISO', 'w': True, 'public': True, 'type':'IP', 'generated': False}, - 'BOOT_FNAME': {'opis': 'Ime datoteke', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, -} - -def task(IP_DHCP, IP_GW, MAC_BOOT, BOOT_FNAME): - # check the IP - # ping the DHCP server - # 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '10.75.0.0/10', 24) - params['IP_DHCP'], params['IP_GW'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['BOOT_FNAME'] = kpovRandomHelpers.filename_gen(r) - # IP_NM, DNS_NM, IP_static, DNS_static) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py new file mode 100644 index 0000000..5e443ce --- /dev/null +++ b/kpov_judge/tasks/dhcp_dns_predefined_ip/task.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Ustvari tri navidezne računalnike. Za enega (SimpleArbiter) uporabi sliko diska simpleArbiter. Na drugega (DHCP_server) postavi strežnika +DHCP in DNS. Poskrbi, da bo preostali računalnik (DHCP_client) dobil naslov, ki ga prebereš na SimpleArbiterju. Na SimpleArbiterju preberi +še ime in IP nekega računalnika (HOSTNAME_X in IP_X). Poskrbi, da bo DNS strežnik za HOSTNAME_X vrnil 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_NM': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/entrance_exam/task.py b/kpov_judge/tasks/entrance_exam/task.py new file mode 100644 index 0000000..272407c --- /dev/null +++ b/kpov_judge/tasks/entrance_exam/task.py @@ -0,0 +1,2 @@ +instructions = {'si': u""" +Reši poizkusni pristopni kolokvij z visoko oceno.""" } diff --git a/kpov_judge/tasks/ieee802/evaluation/task.py b/kpov_judge/tasks/ieee802/evaluation/task.py deleted file mode 100644 index a7a81d1..0000000 --- a/kpov_judge/tasks/ieee802/evaluation/task.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Nastavi Radius strežnik. Postavi sistem za avtentikacijo s pomočjo IEEE 802. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/ieee802/lecture/ideja.txt b/kpov_judge/tasks/ieee802/lecture/ideja.txt deleted file mode 100644 index 98380fc..0000000 --- a/kpov_judge/tasks/ieee802/lecture/ideja.txt +++ /dev/null @@ -1,2 +0,0 @@ -Poveži se na omrežje IEEE 802 s pomočjo WPA supplicanta. Vzpostavi omrežje z avtentikacijo. - diff --git a/kpov_judge/tasks/ieee802/preparation/task.py b/kpov_judge/tasks/ieee802/preparation/task.py deleted file mode 100644 index 29a02cd..0000000 --- a/kpov_judge/tasks/ieee802/preparation/task.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py -# Poveži se na omrežje IEEE802.11 s pomočjo NetworkManagerja. Poglej ustvarjeno konfiguracijo za wpa supplicant. -# http://oob.freeshell.org/nzwireless/intro.html -instructions = { - 'si':u""" -Poveži se na omrežje IEEE802 s pomočjo NetworkManagerja. Poglej ustvarjeno konfiguracijo za wpa supplicant. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/lecture/ideja.txt b/kpov_judge/tasks/isc_dhcp_live_boot/lecture/ideja.txt new file mode 100644 index 0000000..89f3a3a --- /dev/null +++ b/kpov_judge/tasks/isc_dhcp_live_boot/lecture/ideja.txt @@ -0,0 +1 @@ +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/tasks/isc_dhcp_live_boot/task.py b/kpov_judge/tasks/isc_dhcp_live_boot/task.py new file mode 100644 index 0000000..c060db6 --- /dev/null +++ b/kpov_judge/tasks/isc_dhcp_live_boot/task.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# TODO: dokoncaj! +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Postavi štiri navidezne računalnike - simpleArbiter, DHCP_server, +BootableClientA ter BootableClientB. Na simpleArbiter preberi naslove IP_GW, IP_DHCP, +IP_B ter najdi datoteko A. + +Na DHCP_server postavi DHCP strežnik s pomočjo ISC dhcp 3 na naslovu IP_DHCP. +SimpleArbiter naj dobi IP_GW. DHCP_server naj ga uporabi kot gateway. +Če se zaganja BootableClientB, naj se sistem zažene z live ISO in dobi svoj IP. +Če se zaganja katerikoli drug, naj se sistem zažene v datoteko z imenom A. +Tako BootableClientA kot BootableClientB naj bosta brez diskov. +""" +} + +computers = { + 'DHCPServer': { + 'disks': [ + { 'name': 'DHCPServer', + }, + { 'name': 'bootable_iso', + 'options':{'readonly': True}, + 'parts': [], + }, + #{ 'name': 'CDROM', + # 'options':{'readonly': True}, + # 'parts': [],# no parts, no mounting. + #} + ], + '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': 'simpleArbiterDhcp', + }, + #{ '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': {'opis': 'IP DHCP streznika', 'w': False, 'public': True, 'type':'IP', 'generated': True}, + 'IP_GW': {'opis': 'IP SimpleArbiterja', 'w': False, 'public': True, 'type':'IP', 'generated': True}, + 'MAC_BOOT': {'opis': 'MAC racunalnika, ki se zazene z ISO', 'w': True, 'public': True, 'type':'MAC', 'generated': False}, + 'IP_BOOT': {'opis': 'IP racunalnika, ki se zazene z ISO', 'w': True, 'public': True, 'type':'IP', 'generated': False}, + 'BOOT_FNAME': {'opis': 'Ime datoteke', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, +} + +def task(IP_DHCP, IP_GW, MAC_BOOT, BOOT_FNAME): + # check the IP + # ping the DHCP server + # 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '10.75.0.0/10', 24) + params['IP_DHCP'], params['IP_GW'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['BOOT_FNAME'] = kpovRandomHelpers.filename_gen(r) + # IP_NM, DNS_NM, IP_static, DNS_static) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/ldap/evaluation/task.py b/kpov_judge/tasks/ldap/evaluation/task.py deleted file mode 100644 index fee168a..0000000 --- a/kpov_judge/tasks/ldap/evaluation/task.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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', - }, - #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/ldap/lecture/ideja.txt b/kpov_judge/tasks/ldap/lecture/ideja.txt deleted file mode 100644 index e9647ce..0000000 --- a/kpov_judge/tasks/ldap/lecture/ideja.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/tasks/ldap/preparation/task.py b/kpov_judge/tasks/ldap/preparation/task.py deleted file mode 100644 index c123c92..0000000 --- a/kpov_judge/tasks/ldap/preparation/task.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers 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':u""" -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 USER_A, geslo PASS_A, -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 spreminjanje podatkov za objekt -CN=USER_A,DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si ter ustvarjanje novih objektov v DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si - -Na SimpleArbiter ustvari program, ki bo s pomočjo ldapsearch izpisala seznam lastnosti (otrok), ki jih ima poljuben objekt v domeni DOMENA.kpov.lusy.fri.uni-lj.si. Ime objekta (CN) naj program sprejme kot prvi argument. -""" -} - -computers = { - 'LDAPServer': { - 'disks': [ - { 'name': 'LDAPServer', - }, - #{ '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 = { - 'LDAP_USERNAME': {'opis': 'Uporabnisko ime v LDAP', 'w': False, 'public':True, 'type': 'username', 'generated': True}, - 'LDAP_PASSWORD': {'opis': 'Geslo v LDAP', 'w': False, 'public':True, 'type': 'password', 'generated': True}, - 'BIND_USERNAME': {'opis': 'Uporabnisko ime za dostop do LDAP', 'w': False, 'public':True, 'type': 'username', 'generated': True}, - 'BIND_PASSWORD': {'opis': 'Geslo za dostop do LDAP', 'w': False, 'public':True, 'type': 'password', 'generated': True}, -} - -def task(LDAP_USERNAME, LDAP_PASSWORD, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/ldap_import/task.py b/kpov_judge/tasks/ldap_import/task.py new file mode 100644 index 0000000..fee168a --- /dev/null +++ b/kpov_judge/tasks/ldap_import/task.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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', + }, + #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/ldap_search/lecture/ideja.txt b/kpov_judge/tasks/ldap_search/lecture/ideja.txt new file mode 100644 index 0000000..e9647ce --- /dev/null +++ b/kpov_judge/tasks/ldap_search/lecture/ideja.txt @@ -0,0 +1,2 @@ +Postavi strežnik OpenLDAP. Ustvari shemo. Ustvari uporabnika. Uporabi LDAP kot backend za RADIUS. + diff --git a/kpov_judge/tasks/ldap_search/task.py b/kpov_judge/tasks/ldap_search/task.py new file mode 100644 index 0000000..c123c92 --- /dev/null +++ b/kpov_judge/tasks/ldap_search/task.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers 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':u""" +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 USER_A, geslo PASS_A, +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 spreminjanje podatkov za objekt +CN=USER_A,DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si ter ustvarjanje novih objektov v DC=DOMENA,DC=kpov,DC=lusy,DC=fri,DC=uni-lj,DC=si + +Na SimpleArbiter ustvari program, ki bo s pomočjo ldapsearch izpisala seznam lastnosti (otrok), ki jih ima poljuben objekt v domeni DOMENA.kpov.lusy.fri.uni-lj.si. Ime objekta (CN) naj program sprejme kot prvi argument. +""" +} + +computers = { + 'LDAPServer': { + 'disks': [ + { 'name': 'LDAPServer', + }, + #{ '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 = { + 'LDAP_USERNAME': {'opis': 'Uporabnisko ime v LDAP', 'w': False, 'public':True, 'type': 'username', 'generated': True}, + 'LDAP_PASSWORD': {'opis': 'Geslo v LDAP', 'w': False, 'public':True, 'type': 'password', 'generated': True}, + 'BIND_USERNAME': {'opis': 'Uporabnisko ime za dostop do LDAP', 'w': False, 'public':True, 'type': 'username', 'generated': True}, + 'BIND_PASSWORD': {'opis': 'Geslo za dostop do LDAP', 'w': False, 'public':True, 'type': 'password', 'generated': True}, +} + +def task(LDAP_USERNAME, LDAP_PASSWORD, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/nat/evaluation/task.py b/kpov_judge/tasks/nat/evaluation/task.py deleted file mode 100644 index 763dee4..0000000 --- a/kpov_judge/tasks/nat/evaluation/task.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Postavi dva računalnika - SimpleArbiter z diska simpleArbiter ter -NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo -povezan v Internet, z drugim pa na SimpleArbiter. 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. Poskrbi, da -bo omrežje med SimpleArbiter in NATServer na področju NET. Nato poskrbi, da se -bo promet z Interneta na vrata PORT_OUTER prepošiljal na SimpleArbiter na vrata PORT_INNER. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/nat/lecture/ideja.txt b/kpov_judge/tasks/nat/lecture/ideja.txt deleted file mode 100644 index 852ee43..0000000 --- a/kpov_judge/tasks/nat/lecture/ideja.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/tasks/nat/preparation/task.py b/kpov_judge/tasks/nat/preparation/task.py deleted file mode 100644 index 6fb5700..0000000 --- a/kpov_judge/tasks/nat/preparation/task.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers 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':u""" -Postavi dva navidezna računalnika - SimpleArbiter z diskom simpleArbiter -ter NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo povezan -na simpleArbiter, z drugim pa na Internet. Na simpleArbiter preberi naslov, -na katerem si lahko ogledaš kratek filmček. Nastavi omrežje med NATServer in simpleArbiter -tako, da bo na področju, ki ga vidiš v filmčku. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/nat_port_forward/task.py b/kpov_judge/tasks/nat_port_forward/task.py new file mode 100644 index 0000000..763dee4 --- /dev/null +++ b/kpov_judge/tasks/nat_port_forward/task.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Postavi dva računalnika - SimpleArbiter z diska simpleArbiter ter +NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo +povezan v Internet, z drugim pa na SimpleArbiter. 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. Poskrbi, da +bo omrežje med SimpleArbiter in NATServer na področju NET. Nato poskrbi, da se +bo promet z Interneta na vrata PORT_OUTER prepošiljal na SimpleArbiter na vrata PORT_INNER. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/nat_vlc/lecture/ideja.txt b/kpov_judge/tasks/nat_vlc/lecture/ideja.txt new file mode 100644 index 0000000..852ee43 --- /dev/null +++ b/kpov_judge/tasks/nat_vlc/lecture/ideja.txt @@ -0,0 +1,2 @@ +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/tasks/nat_vlc/task.py b/kpov_judge/tasks/nat_vlc/task.py new file mode 100644 index 0000000..6fb5700 --- /dev/null +++ b/kpov_judge/tasks/nat_vlc/task.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers 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':u""" +Postavi dva navidezna računalnika - SimpleArbiter z diskom simpleArbiter +ter NATServer. NATServer naj ima dva omrežna vmesnika - z enim naj bo povezan +na simpleArbiter, z drugim pa na Internet. Na simpleArbiter preberi naslov, +na katerem si lahko ogledaš kratek filmček. Nastavi omrežje med NATServer in simpleArbiter +tako, da bo na področju, ki ga vidiš v filmčku. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/network_boot/evaluation/task.py b/kpov_judge/tasks/network_boot/evaluation/task.py deleted file mode 100644 index 8d1c308..0000000 --- a/kpov_judge/tasks/network_boot/evaluation/task.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/network_boot/lecture/ideja.txt b/kpov_judge/tasks/network_boot/lecture/ideja.txt deleted file mode 100644 index a380311..0000000 --- a/kpov_judge/tasks/network_boot/lecture/ideja.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/tasks/network_boot/preparation/task.py b/kpov_judge/tasks/network_boot/preparation/task.py deleted file mode 100644 index 8c54bf6..0000000 --- a/kpov_judge/tasks/network_boot/preparation/task.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py -# TODO: dokoncaj! -instructions = { - 'si':u""" -Postavi dva navidezna računalnika (simpleArbiterDhcp in FileServer). Na SimpleArbiterDhcp poišči imenik -Mapa ter preberi pot NFS_POT ter ime imenika v skupni rabi SAMBA_SHARE. Skopiraj datoteke iz imenika Mapa, -na FileServer. Poskrbi, da bo imenik z datotekami dostopen prek NFS v imeniku NFS_POT in prek SMB na imeniku v skupni -rabi SAMBA_SHARE. SimpleArbiterDhcp naj ima prek NFS pravico pisati po imeniku. -""" -} - -computers = { - 'FileServer': { - 'disks': [ - { 'name': 'FileServer', - }, - #{ '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 = { - 'SMB_NAME': {'opis': 'SMB ime streznika', 'w': False, 'public':True, 'type': 'hostname', 'generated': True}, - 'SMB_SHARENAME': {'opis': 'Imenik v skupni rabi', 'w': False, 'public':True, 'type': 'filename', 'generated': True}, - 'NFS_MOUNT': {'opis': 'Imenik, dostopen prek NFS', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, - 'SHARED_FILENAME': {'opis': 'Ime datoteke, ki je deljena', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, - 'SHARED_FILENAME_CONTENT': {'opis': 'Vsebina datoteke', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, -} - -def task(SMB_NAME, NFS_MOUNT, SHARED_FILENAME, SHARED_FILENAME_CONTENT): - # mount the NFS mount - # mount the SMB mount - # read the filename content - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/network_boot_custom_program/task.py b/kpov_judge/tasks/network_boot_custom_program/task.py new file mode 100644 index 0000000..8d1c308 --- /dev/null +++ b/kpov_judge/tasks/network_boot_custom_program/task.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/openvpn/evaluation/task.py b/kpov_judge/tasks/openvpn/evaluation/task.py deleted file mode 100644 index 679d136..0000000 --- a/kpov_judge/tasks/openvpn/evaluation/task.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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 = { - '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/openvpn/lecture/ideja.txt b/kpov_judge/tasks/openvpn/lecture/ideja.txt deleted file mode 100644 index 3ae0c92..0000000 --- a/kpov_judge/tasks/openvpn/lecture/ideja.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/tasks/openvpn/preparation/task.py b/kpov_judge/tasks/openvpn/preparation/task.py deleted file mode 100644 index 2ca15fc..0000000 --- a/kpov_judge/tasks/openvpn/preparation/task.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Postavi dva navidezna računalnika - SimpleArbiter z diska SimpleArbiterVPN ter -VPNClient. Na VPNClient nastavite OpenVPN klienta tako, da se bo povezal na SimpleArbiter. -OpenVPN nastavite tako, da bosta strežnik in klient uporabila skupno skrivnost, ki jo -preberete na SimpleArbiter. Nato poskrbite, da bo VPNClient na navideznem omrežju prek NFS omogočil -dostop do imenika /home/test/IME_IMENIKA, pri čemer IME_IMENIKA preberite na SimpleArbiter. -V ta imenik skopirajte datoteke, ki so prek SMB dostopne na SimpleArbiter. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/openvpn_multiple_hops/task.py b/kpov_judge/tasks/openvpn_multiple_hops/task.py new file mode 100644 index 0000000..679d136 --- /dev/null +++ b/kpov_judge/tasks/openvpn_multiple_hops/task.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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 = { + '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/openvpn_simple_smb/lecture/ideja.txt b/kpov_judge/tasks/openvpn_simple_smb/lecture/ideja.txt new file mode 100644 index 0000000..3ae0c92 --- /dev/null +++ b/kpov_judge/tasks/openvpn_simple_smb/lecture/ideja.txt @@ -0,0 +1,2 @@ +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/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py new file mode 100644 index 0000000..2ca15fc --- /dev/null +++ b/kpov_judge/tasks/openvpn_simple_smb/task.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Postavi dva navidezna računalnika - SimpleArbiter z diska SimpleArbiterVPN ter +VPNClient. Na VPNClient nastavite OpenVPN klienta tako, da se bo povezal na SimpleArbiter. +OpenVPN nastavite tako, da bosta strežnik in klient uporabila skupno skrivnost, ki jo +preberete na SimpleArbiter. Nato poskrbite, da bo VPNClient na navideznem omrežju prek NFS omogočil +dostop do imenika /home/test/IME_IMENIKA, pri čemer IME_IMENIKA preberite na SimpleArbiter. +V ta imenik skopirajte datoteke, ki so prek SMB dostopne na SimpleArbiter. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/openwrt/evaluation/task.py b/kpov_judge/tasks/openwrt/evaluation/task.py deleted file mode 100644 index 3326065..0000000 --- a/kpov_judge/tasks/openwrt/evaluation/task.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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', - }, - #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/openwrt/lecture/ideja.txt b/kpov_judge/tasks/openwrt/lecture/ideja.txt deleted file mode 100644 index 7e12372..0000000 --- a/kpov_judge/tasks/openwrt/lecture/ideja.txt +++ /dev/null @@ -1,2 +0,0 @@ -Postavi OpenWRT na router. Usposobi predvajanje filmov na Raspberry PI. - diff --git a/kpov_judge/tasks/openwrt/preparation/task.py b/kpov_judge/tasks/openwrt/preparation/task.py deleted file mode 100644 index 934dfe6..0000000 --- a/kpov_judge/tasks/openwrt/preparation/task.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py -# Postavi nek film na Internet tako, da ga bodo lahko ostali videli. -# TODO: finish this - -instructions = { - 'si':u""" -Postavi navidezni računalnik SimpleArbiter z diska simpleArbiter. -Na simpleArbiter preberi naslov filma ter ime toka TOK. Posnemi ali kako drugače ustvari -film ter poskrbi, da bo film dostopen na Internetu prek RTP z imenom toka TOK. Računaj, -da bodo film lahko videli tvoji sošolci. Kršenje avtorskih pravic je pri reševanju te naloge -strogo prepovedano. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/openwrt/task.py b/kpov_judge/tasks/openwrt/task.py new file mode 100644 index 0000000..3326065 --- /dev/null +++ b/kpov_judge/tasks/openwrt/task.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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', + }, + #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/public_ip_ssh/lecture/ideja.txt b/kpov_judge/tasks/public_ip_ssh/lecture/ideja.txt new file mode 100644 index 0000000..23f5dcc --- /dev/null +++ b/kpov_judge/tasks/public_ip_ssh/lecture/ideja.txt @@ -0,0 +1,2 @@ +Primer pristopnega kolokvija. Odgovori na vprašanja. Pogoste težave v Virtualbox. +X11, desktopi, nastavitve. diff --git a/kpov_judge/tasks/public_ip_ssh/task.py b/kpov_judge/tasks/public_ip_ssh/task.py new file mode 100644 index 0000000..0468b7d --- /dev/null +++ b/kpov_judge/tasks/public_ip_ssh/task.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# bson.son.SON an +# kpovRandomHelpers should be imported by add_assignment.py +OrderedDict = SON + +instructions = { + 'si':u""" +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': 'Test' }] + } +} + +params_meta = { + 'peer_ip': {'opis': 'Naslov ssh strežnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False}, + 'peer_user': {'opis': 'ime uporabnika', 'w': False, 'public': True, 'type': 'username', 'generated': True}, + 'peer_passwd': {'opis': '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 kpovRandomHelpers.default_gen(user_id, params_meta) + +def task_check(results, params): + import pxssh + import pexpect + results = dict() + s = pxssh.pxssh() + peer_ip, peer_user, peer_passwd = params['peer_ip'], params['peer_user'], params['peer_passwd'] + try: + s.login(peer_ip, peer_user, peer_passwd) + s.logout() + except: + return 0 + return 10 + +def prepare_disks(templates, params): + pass + # print d1.ls('/') diff --git a/kpov_judge/tasks/public_ssh_motd_http/lecture/ideja.txt b/kpov_judge/tasks/public_ssh_motd_http/lecture/ideja.txt new file mode 100644 index 0000000..91c85c2 --- /dev/null +++ b/kpov_judge/tasks/public_ssh_motd_http/lecture/ideja.txt @@ -0,0 +1 @@ +Reši pristopni kolokvij z visoko oceno. diff --git a/kpov_judge/tasks/public_ssh_motd_http/task.py b/kpov_judge/tasks/public_ssh_motd_http/task.py new file mode 100644 index 0000000..cd3d970 --- /dev/null +++ b/kpov_judge/tasks/public_ssh_motd_http/task.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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', + }, + #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/radius/evaluation/task.py b/kpov_judge/tasks/radius/evaluation/task.py deleted file mode 100644 index 5472d10..0000000 --- a/kpov_judge/tasks/radius/evaluation/task.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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', - }, - #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/radius/lecture/ideja.txt b/kpov_judge/tasks/radius/lecture/ideja.txt deleted file mode 100644 index fd9d1a9..0000000 --- a/kpov_judge/tasks/radius/lecture/ideja.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/tasks/radius/preparation/task.py b/kpov_judge/tasks/radius/preparation/task.py deleted file mode 100644 index c160464..0000000 --- a/kpov_judge/tasks/radius/preparation/task.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Ustvari dva navidezna računalnika - SimpleArbiter z diska simpleArbiterDhcp ter -RadiusServer. Na RadiusServer namesti OpenRadius. Na SimpleArbiter preberi ime in priimek -uporabnika ter ga dodaj v konfiguracijo OpenRadius na RadiusServer. Na SimpleArbiter -preberi skrivnost ter poskrbi, da se bo s to skrivnostjo SimpleArbiter lahko povezal -na RadiusServer. - -Nato na OpenRadius namesti še podatkovno bazo mysql. Na SimpleArbiter preberi še ime podatkovne baze, -uporabniško ime na bazi ter geslo, s katerim se bo lahko klient s SimpleArbiter na to bazo lahko povezal. -Ustvari podatkovno bazo. V bazi ustvari tabelo "users" s stolpcema username ter password. -Na RadiusServer ustvari uporabnika test. Nastavi PAM tako, da se bo geslo uporabnika primerjalo z vnosom -v tabeli v mysql, namesto da se uporabi datoteka /etc/passwd oziroma /etc/shadow. -""" -} - -computers = { - 'RadiusServer': { - 'disks': [ - { 'name': 'RadiusServer', - }, - #{ '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 = { - 'RADIUS_SECRET':{'opis': 'Skrivnost RADIUS', 'w': False, 'public':True, 'type': 'passwd', 'generated': True}, - 'RADIUS_USERNAME': {'opis': 'Username v RADIUS', 'w': True, 'public':True, 'type': 'username', 'generated': False}, - 'RADIUS_PASSWORD': {'opis': 'Geslo v RADIUS', 'w': False, 'public':True, 'type': '', 'generated': True}, - 'MYSQL_ADMIN_USER':{'opis': 'Username za dostop do MySQL', 'w': True, 'public':True, 'type': 'username', 'generated': False}, - 'MYSQL_ADMIN_PASSWORD': {'opis': 'Geslo za dostop do MySQL', 'w': True, 'public':True, 'type': 'passwd', 'generated': True}, - 'MYSQL_PAM_USERNAME': {'opis': 'Username v MySQL', 'w': True, 'public': True, 'type': 'IP', 'generated': False}, - 'MYSQL_PAM_PASSWORD': {'opis': 'Geslo za uporabnika v MySQL', 'w': True, 'public': True, 'type': 'passwd', 'generated': False}, -} - -def task(RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, MYSQL_ADMIN_USER, MYSQL_ADMIN_PASSWORD, MYSQL_PAM_USERNAME, MYSQL_PAM_PASSWORD): - results = dict() - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/radius_multiple_realms/task.py b/kpov_judge/tasks/radius_multiple_realms/task.py new file mode 100644 index 0000000..5472d10 --- /dev/null +++ b/kpov_judge/tasks/radius_multiple_realms/task.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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', + }, + #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt b/kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt new file mode 100644 index 0000000..fd9d1a9 --- /dev/null +++ b/kpov_judge/tasks/radius_mysql_pam/lecture/ideja.txt @@ -0,0 +1 @@ +Nastavi apache tako, da se boš nanj prijavila s pomočjo avtentikacije pri sosedu. diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py new file mode 100644 index 0000000..c160464 --- /dev/null +++ b/kpov_judge/tasks/radius_mysql_pam/task.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Ustvari dva navidezna računalnika - SimpleArbiter z diska simpleArbiterDhcp ter +RadiusServer. Na RadiusServer namesti OpenRadius. Na SimpleArbiter preberi ime in priimek +uporabnika ter ga dodaj v konfiguracijo OpenRadius na RadiusServer. Na SimpleArbiter +preberi skrivnost ter poskrbi, da se bo s to skrivnostjo SimpleArbiter lahko povezal +na RadiusServer. + +Nato na OpenRadius namesti še podatkovno bazo mysql. Na SimpleArbiter preberi še ime podatkovne baze, +uporabniško ime na bazi ter geslo, s katerim se bo lahko klient s SimpleArbiter na to bazo lahko povezal. +Ustvari podatkovno bazo. V bazi ustvari tabelo "users" s stolpcema username ter password. +Na RadiusServer ustvari uporabnika test. Nastavi PAM tako, da se bo geslo uporabnika primerjalo z vnosom +v tabeli v mysql, namesto da se uporabi datoteka /etc/passwd oziroma /etc/shadow. +""" +} + +computers = { + 'RadiusServer': { + 'disks': [ + { 'name': 'RadiusServer', + }, + #{ '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 = { + 'RADIUS_SECRET':{'opis': 'Skrivnost RADIUS', 'w': False, 'public':True, 'type': 'passwd', 'generated': True}, + 'RADIUS_USERNAME': {'opis': 'Username v RADIUS', 'w': True, 'public':True, 'type': 'username', 'generated': False}, + 'RADIUS_PASSWORD': {'opis': 'Geslo v RADIUS', 'w': False, 'public':True, 'type': '', 'generated': True}, + 'MYSQL_ADMIN_USER':{'opis': 'Username za dostop do MySQL', 'w': True, 'public':True, 'type': 'username', 'generated': False}, + 'MYSQL_ADMIN_PASSWORD': {'opis': 'Geslo za dostop do MySQL', 'w': True, 'public':True, 'type': 'passwd', 'generated': True}, + 'MYSQL_PAM_USERNAME': {'opis': 'Username v MySQL', 'w': True, 'public': True, 'type': 'IP', 'generated': False}, + 'MYSQL_PAM_PASSWORD': {'opis': 'Geslo za uporabnika v MySQL', 'w': True, 'public': True, 'type': 'passwd', 'generated': False}, +} + +def task(RADIUS_SECRET, RADIUS_USERNAME, RADIUS_PASSWORD, MYSQL_ADMIN_USER, MYSQL_ADMIN_PASSWORD, MYSQL_PAM_USERNAME, MYSQL_PAM_PASSWORD): + results = dict() + return results + +def gen_params(user_id, params_meta): + params = dict() + r = random.Random(user_id) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/rdate/evaluation/task.py b/kpov_judge/tasks/rdate/evaluation/task.py deleted file mode 100644 index bd77c13..0000000 --- a/kpov_judge/tasks/rdate/evaluation/task.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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', - }, - #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/rdate/lecture/ideja.txt b/kpov_judge/tasks/rdate/lecture/ideja.txt deleted file mode 100644 index 0fb111a..0000000 --- a/kpov_judge/tasks/rdate/lecture/ideja.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/tasks/rdate/preparation/TejoLicen/rServe.zip b/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip deleted file mode 100644 index 9061692..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/TejoLicen/rServe.zip and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png deleted file mode 100644 index c6eeac8..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu1.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png deleted file mode 100644 index c2ac808..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu15.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png deleted file mode 100644 index 85fcfa8..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu2.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png deleted file mode 100644 index 831e764..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu3.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png deleted file mode 100644 index 495351a..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu4.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png deleted file mode 100644 index 103e0e6..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu5.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png deleted file mode 100644 index b032223..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu6.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png deleted file mode 100644 index bd50500..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu7.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png deleted file mode 100644 index 98f7812..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu8.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png b/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png deleted file mode 100644 index 9ed78ce..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/bu9.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif b/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif deleted file mode 100644 index 02be389..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/predvaja_clip_image003.gif and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png deleted file mode 100644 index 52b6ee5..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/s1.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png deleted file mode 100644 index 78a65ce..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/s2.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png b/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png deleted file mode 100644 index c32eae1..0000000 Binary files a/kpov_judge/tasks/rdate/preparation/howtos/images/s3.png and /dev/null differ diff --git a/kpov_judge/tasks/rdate/preparation/howtos/si/index.html b/kpov_judge/tasks/rdate/preparation/howtos/si/index.html deleted file mode 100644 index a22f5c2..0000000 --- a/kpov_judge/tasks/rdate/preparation/howtos/si/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - -

XX. predvaja:


-

Naloga na hitro:


- Nastavi uro na streniku s pomojo rdate. Napii program, ki pretvori 24-bitna tevila z dvojikim komplementom v decimalno obliko.

-

Navodila:


- 1. Iz imenika s slikami virtualnih raunalnikov povlecite sliki Student.vdi(klient) in SimpleArbiter.vdi(strenik).
- 2. Z VirtualBoxom (ali ostalim programom za virtualne raunalnike) ustvarite dva virtualna raunalnika in jim kot disk za shranjevanje podajte Student.vdi ter SimpleArbiter.vdi.
- 3. Zaenite oba navidezna raunalnika.
- 4. Na Student se prijavite z uporabnikom root in geslom kaboom na SimpleArbiter pa z uporabnikom tester in geslom SedemKrogovPekla.

- -

Prvi del naloge: posodobi uro raunalnika s pomojo rdate.


- 1. Preverite in si zapiite IP naslov na SimpleArbiter. (ifconfig)


- 2. Z ukazom sudo apt-get install rdate namestimo program rdate.
- 3. Na Student z pomojo rdate posodobi uro raunalnika. rdate IP_SIMPLE_ARBITER

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

-


-

Drugi del naloge: napii program, ki pretvori binarni zapis 32-bitnega tevila v decimalnega.


- Nalogo lahko reite v Javi ali v Pythonu. Prav tako pa lahko kodo piete v poljubnem tekstovnem urejevalniku.

-


- JAVA------
- 1. Z ukazom nano bintodec3.java ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
- 2. Napiemo program za pretvarjanje 24-bitnega tevila z dvojikim komplementom v decimalno obliko
-

- 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
- 4. e je e nimamo, naloimo Javo sudo apt-get install openjdk-6-jdk

- 5. Prevedemo program javac bintodec3.java
- 6. Lahko ga e zaenemo ter preizkusimo java bintodec3. Na standardni vhod vnaamo 24-bitno tevilo v estnajstiki obliki

-

PYTHON------
- 1. Z ukazom nano bintodec3.py ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano
- 2. Napiemo program za pretvarjanje 24-bitnega tevila z dvojikim komplementom v decimalno obliko
-
- 3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.
- 4. Program zaenemo z ukazom python bintodec3.py



- - -

-

Testiranje

- 1. Lahko poenemo tester; z ukazom ./run_test.py
-
- 2. Kot "Upor. Ime" in "Geslo" napiite vae podatke uilnice. (npr.: "pz1234@student.uni-lj.si" in "geslo123")
-
- 3. Kot ime naloge vpiite XX.predvaja.
- 4. Ko vas program vpraa po poti programa vnesite vao pot do programa za pretvarjanje. (npr.: e imate program bintodec3.py v isti mapi kot program run_test.py, vnesete: ./bintodec3.py)
- 5. Povpraa tudi po IP naslovu SimpleArbiterja, vnesite.
- 6. e je lo vse po srei, program vrne OK vi pa ste opravili nalogo.

- -
- - - diff --git a/kpov_judge/tasks/rdate/preparation/task.py b/kpov_judge/tasks/rdate/preparation/task.py deleted file mode 100644 index caf6298..0000000 --- a/kpov_judge/tasks/rdate/preparation/task.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py -# TODO: finish this! - -instructions = { - 'si':u""" -Postavi dva navidezna računalnika - SimpleArbiterDhcpRdate s slike diska simpleArbiterRdate ter rdateClient. -Na rdateClient ustvarite uporabnika test z geslom test. Nastavite čas na rdateClient tako, da kot rdate strežnik -uporabite SimpleArbiterDhcpRdate. Nato v domačem imeniku uporabnika test spravite program z imenom guliver, ki prebere 4 byte -podatkov s standardnega vhoda in jih pretvori v predznačeno celo število, pri čemer naj uporablja zapis z debelim koncem (big endian). -Število naj program izpiše na standardni izhod. -""" -} - -computers = { - 'rdateClient': { - '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': 'simpleArbiterDhcpRdate', - # 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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/rdate_64bit/task.py b/kpov_judge/tasks/rdate_64bit/task.py new file mode 100644 index 0000000..bd77c13 --- /dev/null +++ b/kpov_judge/tasks/rdate_64bit/task.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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', + }, + #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/remote_ssh/evaluation/task.py b/kpov_judge/tasks/remote_ssh/evaluation/task.py deleted file mode 100644 index 0468b7d..0000000 --- a/kpov_judge/tasks/remote_ssh/evaluation/task.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# bson.son.SON an -# kpovRandomHelpers should be imported by add_assignment.py -OrderedDict = SON - -instructions = { - 'si':u""" -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': 'Test' }] - } -} - -params_meta = { - 'peer_ip': {'opis': 'Naslov ssh strežnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'peer_user': {'opis': 'ime uporabnika', 'w': False, 'public': True, 'type': 'username', 'generated': True}, - 'peer_passwd': {'opis': '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 kpovRandomHelpers.default_gen(user_id, params_meta) - -def task_check(results, params): - import pxssh - import pexpect - results = dict() - s = pxssh.pxssh() - peer_ip, peer_user, peer_passwd = params['peer_ip'], params['peer_user'], params['peer_passwd'] - try: - s.login(peer_ip, peer_user, peer_passwd) - s.logout() - except: - return 0 - return 10 - -def prepare_disks(templates, params): - pass - # print d1.ls('/') diff --git a/kpov_judge/tasks/remote_ssh/lecture/ideja.txt b/kpov_judge/tasks/remote_ssh/lecture/ideja.txt deleted file mode 100644 index 23f5dcc..0000000 --- a/kpov_judge/tasks/remote_ssh/lecture/ideja.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/tasks/remote_ssh/preparation/task.py b/kpov_judge/tasks/remote_ssh/preparation/task.py deleted file mode 100644 index ea2b361..0000000 --- a/kpov_judge/tasks/remote_ssh/preparation/task.py +++ /dev/null @@ -1,4 +0,0 @@ -instructions = { - 'si':u""" -Reši poizkusni pristopni kolokvij.""" -} diff --git a/kpov_judge/tasks/set_ip_dhcp_hostname/task.py b/kpov_judge/tasks/set_ip_dhcp_hostname/task.py new file mode 100644 index 0000000..2defe2a --- /dev/null +++ b/kpov_judge/tasks/set_ip_dhcp_hostname/task.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# TODO: finish thi +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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': {'opis': 'Naslov za DHCP', 'w': False, 'public': False, 'type': 'IP', 'generated': True}, + 'Hostname_DHCP': {'opis': 'Ime DHCP', 'w': False, 'public': True, 'type': 'hostname', 'generated': True}, + 'IP_static': {'opis': 'Naslov BREZ_DHCP', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'IP_dhcp_static': {'opis': '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): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['IP_DHCP'], params['IP_static'], params['IP_dhcp_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 3) + params['Hostname_DHCP'] = kpovRandomHelpers.hostname_gen(r) + return params + +def task_check(results, params): + import re + score = -9 + if results['bla']: + score += 3 + return score + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] +# create config for static_DHCP +# set static_DHCP hostname + pass + diff --git a/kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html b/kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html deleted file mode 100644 index df4c68d..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/evaluation/navodila.html +++ /dev/null @@ -1,9 +0,0 @@ -

Usposobite tri računalnike: -

-

-

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. Uporabniško ime ter geslo na SimpleArbiter sta

tester
in
SedemKrogovPekla
.

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 new file mode 100644 index 0000000..754c200 Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/04.png 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 new file mode 100644 index 0000000..866a51d Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/09.png 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 new file mode 100644 index 0000000..d6ccf42 Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/10.png 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 new file mode 100644 index 0000000..10b5ec7 Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/11.png 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 new file mode 100644 index 0000000..0a87ae6 Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/12.png 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 new file mode 100644 index 0000000..e71474a Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/13.png 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 new file mode 100644 index 0000000..d4bba87 Binary files /dev/null and b/kpov_judge/tasks/set_ip_static_dhcp/howtos/images/17.png 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 new file mode 100644 index 0000000..9b56a81 --- /dev/null +++ b/kpov_judge/tasks/set_ip_static_dhcp/howtos/si/index.html @@ -0,0 +1,73 @@ +

+

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. Iz imenika s slikami virtualnih računalnikov povlecite slike maliNetworkManager, maliBrezNetworkManager, SimpleArbiterDhcp
  2. + +
  3. Nastavite omrežja navideznih računalnikov tako, da bo
    1. omrežni vmesnik SimpleArbiterDhcp povezan na isto omrežje kot edini omrežni vmesnik maliNetworkManager in maliBrezNetworkManager,
    + 2. vmesnik SimpleArbiterDhcp bo povezan na NAT ali fizično omrežje, kjer prek DHCP dobi naslov in pot (prehod, gateway) do Interneta.
  4. + +
  5. Zaženite SimpleArbiterDhcp. Prijavite se kot uporabnik tester z geslom SedemKrogovPekla
  6. +
  7. +slika-04
    +Z ukazom
    ping 193.2.1.66
    preverite, ali je SimpleArbiterDhcp na Internetu. Če je, boste približno vsako sekundo dobili odziv. Ping prekinete +s kombinacijo tipk CTRL+C.
    + Če SimpleArbiterDhcp 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 03.predvaja
  12. + +
  13. Preberite statični IP maliNetworkManager. Pustite SimpleArbiterDhcp 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 SimpleArbiterDhcp kot statični IP A.
    +V DNS servers dodajte naslov Arnesovega DNS: 193.2.1.66 +
  25. +
  26. Kliknite "Save"
  27. + +
  28. Preklopite na SimpleArbiterDhcp. 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
    +    10.0.1.2
    +    netmask 255.255.255.128
    +    dns-nameservers 10.0.1.5
    +
    +
  35. + +
  36. Shranite nastavitve. Z ukazom reboot ponovno zaženite maliBrezNetworkManager. NetworkManager ob zagonu računalnika +prebere, kateri omrežni vmesniki so nastavljeni v /etc/network/interfaces. Za te vmesnike potem ne skrbi več.
  37. + +Na SimpleArbiterDhcp pritisnite OK. Če je šlo vse po sreči, ste opravili tokratno nalogo. +
+

diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png deleted file mode 100644 index 754c200..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/04.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png deleted file mode 100644 index 866a51d..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/09.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png deleted file mode 100644 index d6ccf42..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/10.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png deleted file mode 100644 index 10b5ec7..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/11.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png deleted file mode 100644 index 0a87ae6..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/12.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png deleted file mode 100644 index e71474a..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/13.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png deleted file mode 100644 index d4bba87..0000000 Binary files a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/images/17.png and /dev/null differ diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html b/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html deleted file mode 100644 index 9b56a81..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/preparation/howtos/si/index.html +++ /dev/null @@ -1,73 +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. Iz imenika s slikami virtualnih računalnikov povlecite slike maliNetworkManager, maliBrezNetworkManager, SimpleArbiterDhcp
  2. - -
  3. Nastavite omrežja navideznih računalnikov tako, da bo
    1. omrežni vmesnik SimpleArbiterDhcp povezan na isto omrežje kot edini omrežni vmesnik maliNetworkManager in maliBrezNetworkManager,
    - 2. vmesnik SimpleArbiterDhcp bo povezan na NAT ali fizično omrežje, kjer prek DHCP dobi naslov in pot (prehod, gateway) do Interneta.
  4. - -
  5. Zaženite SimpleArbiterDhcp. Prijavite se kot uporabnik tester z geslom SedemKrogovPekla
  6. -
  7. -slika-04
    -Z ukazom
    ping 193.2.1.66
    preverite, ali je SimpleArbiterDhcp na Internetu. Če je, boste približno vsako sekundo dobili odziv. Ping prekinete -s kombinacijo tipk CTRL+C.
    - Če SimpleArbiterDhcp 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 03.predvaja
  12. - -
  13. Preberite statični IP maliNetworkManager. Pustite SimpleArbiterDhcp 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 SimpleArbiterDhcp kot statični IP A.
    -V DNS servers dodajte naslov Arnesovega DNS: 193.2.1.66 -
  25. -
  26. Kliknite "Save"
  27. - -
  28. Preklopite na SimpleArbiterDhcp. 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
    -    10.0.1.2
    -    netmask 255.255.255.128
    -    dns-nameservers 10.0.1.5
    -
    -
  35. - -
  36. Shranite nastavitve. Z ukazom reboot ponovno zaženite maliBrezNetworkManager. NetworkManager ob zagonu računalnika -prebere, kateri omrežni vmesniki so nastavljeni v /etc/network/interfaces. Za te vmesnike potem ne skrbi več.
  37. - -Na SimpleArbiterDhcp pritisnite OK. Če je šlo vse po sreči, ste opravili tokratno nalogo. -
-

diff --git a/kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py b/kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py deleted file mode 100644 index 1d79a61..0000000 --- a/kpov_judge/tasks/set_ip_static_dhcp/preparation/task.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -Ustvari tri navidezne računalnike. Za prvega -uporabi sliko diska simpleArbiterDhcp, za drugega sliko diska -maliNetworkManager, za tretjega sliko diska maliBrezNetworkManager. -Računalnike imenujmo enako kot slike diska. -Na maliBrezNetworkManager izklopi networkmanager. Na -Izklopi NetworkManager. Na obeh ročno nastavi IP naslova ter naslova -DNS strežnikov. Naslove dobiš na simpleArbiterDhcp. -""" -} - -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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - return score - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/set_ip_static_dhcp/task.py b/kpov_judge/tasks/set_ip_static_dhcp/task.py new file mode 100644 index 0000000..1d79a61 --- /dev/null +++ b/kpov_judge/tasks/set_ip_static_dhcp/task.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +Ustvari tri navidezne računalnike. Za prvega +uporabi sliko diska simpleArbiterDhcp, za drugega sliko diska +maliNetworkManager, za tretjega sliko diska maliBrezNetworkManager. +Računalnike imenujmo enako kot slike diska. +Na maliBrezNetworkManager izklopi networkmanager. Na +Izklopi NetworkManager. Na obeh ročno nastavi IP naslova ter naslova +DNS strežnikov. Naslove dobiš na simpleArbiterDhcp. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + return score + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/set_motd/evaluation/navodila.txt b/kpov_judge/tasks/set_motd/evaluation/navodila.txt deleted file mode 100644 index 755719f..0000000 --- a/kpov_judge/tasks/set_motd/evaluation/navodila.txt +++ /dev/null @@ -1,8 +0,0 @@ -Poskrbite, da se bo ob prijavi uporabnika (v Message Of The Day, MOTD) prek ssh izpisal nek niz. -Računalnik nastavite tako, da bo dostopen s testnega računalnika (Test). Uporabniško ime na testnem računalniku je tester, geslo SedemKrogovPekla . - -Uporabniško ime in niz dobite kot parametre ob zagonu run_test.py. Pri nizu pazite, saj utegne biti dovolj dolg, da brez premikanja kurzorja ne bo takoj viden. - -IP navideznega računalnika ter geslo nastavite sami. Računalnik lahko namestite sami, lahko pa uporabite računalnik Student, na katerem imate uporabnika student z geslom vaje . Geslo uporabnika root je kaboom . - -Ocenjevalni program pričakuje, da se bo ob koncu prijave pojavila ukazna vrstica oblike uporabnisko_ime@ime_racunalnika:~$ . Pazite, da se bo takšna vrstica pojavila šele po nizu, ki ste ga dobili v navodilih. diff --git a/kpov_judge/tasks/set_motd/evaluation/task.py b/kpov_judge/tasks/set_motd/evaluation/task.py deleted file mode 100644 index 3338c80..0000000 --- a/kpov_judge/tasks/set_motd/evaluation/task.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# bson.son.SON an -# kpovRandomHelpers should be imported by add_assignment.py -# OrderedDict = SON - - -instructions = { - "si":u""" -Ustvari dva navidezna računalnika - imenujmo ju Test in Student. Za računalnik Test uporabite -sliko diska, poimenovano Test. Na računalniku Test dobite kratek niz. Poskrbite, da se bo ta -kratki niz pojavil v sporočilu, ki se ob prijavi izpiše na računalniku Student. Temu sporočilu v -angleščini rečemo "message of the day" - MOTD. -""" -} - -computers = { - 'Test': { - 'disks': [ - { 'name': 'Test', - }, - ], - 'flavor': 'm1.tiny', - 'network_interfaces': [{'network': 'net1'}], - 'config_drive': True, - 'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"} - }, - 'Student': { - 'disks': [ - { 'name': 'Student', } - ], - '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"} - } - -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'peer_ip': {'opis': 'IP računalnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'peer_user': {'opis': 'ime uporabnika', 'w': False, 'public': True, 'type': 'username', 'generated': True}, - 'peer_passwd': {'opis': 'geslo uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False}, - 'niz': {'w': False, 'public': True, 'type': 'short_text', 'generated': True}, -} - -def task(peer_ip, peer_user, peer_passwd, niz): - "Check whether ssh works" - import pxssh - import pexpect - results = dict() - s = pxssh.pxssh() - s.login (peer_ip, peer_user, peer_passwd, original_prompt=r'{0}@.*:\~\$'.format(peer_user),auto_prompt_reset=False) - results['motd'] = s.before # print everything before the prompt. - return results - -def gen_params(user_id, params_meta): - return kpovRandomHelpers.default_gen(user_id, params_meta) - -def task_check(results, params): - niz = params['niz'] - score = 0 - if (results['motd'].find(niz) > -1): - score += 10 - return score - -def prepare_disks(templates, params): - # print d1.ls('/') - pass diff --git a/kpov_judge/tasks/set_motd/preparation/task.py b/kpov_judge/tasks/set_motd/preparation/task.py deleted file mode 100644 index e634959..0000000 --- a/kpov_judge/tasks/set_motd/preparation/task.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# bson.son.SON an -# kpovRandomHelpers should be imported by add_assignment.py -# OrderedDict = SON - -instructions = { - 'si':u""" -Namesti VirtualBox. Ustvari dva navidezna računalnika. Pri enem od njiju (imenujmo ga TEST) -kot disk uporabi datoteko Test_disk1. Na drugega (imenujmo ga A) namesti poljubno Linux distribucijo. -Poskrbi, da bosta oba računalnika na istem omrežju. Na računalnik A namesti strežnik ssh. -Z računalnika TEST se prek ssh poveži na A. Poskrbi, da bo TEST imel dostop tako do Interneta, kot -tudi do računalnika A. -""" -} - -computers = { - 'A': { - 'disks': [ - { 'name': 'A_disk1', - 'parts': [{'dev': 'a1', 'path': '/'}], - }, - #{ 'name': 'CDROM', - # 'options':{'readonly': True}, - # 'parts': [],# no parts, no mounting. - #} - ], - 'image': 'KPOV-bombica01', - 'flavor': 'm1.kpov', - 'network_interfaces': [{'network': 'net1'}], - 'config_drive': True, - 'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"} - }, - 'TEST': { - 'disks': [ - { 'name': 'Test_disk1', - # attempt automount - }, - #{ 'name': 'CDROM', - # 'options': {'readonly': True}, - # 'parts': [{'dev': 'b1', 'path': '/cdrom'}], - #}, - ], - 'image': 'KPOV-bombica01', - 'flavor': 'm1.kpov', - 'network_interfaces': [{'network': 'net1'},{'network':'test-net'}], - 'config_drive': False - }, -} - -networks = { 'net1': {'public': False}, 'test-net': {'public': True} } - -params_meta = { - 'peer_ip': {'opis': 'Naslov ssh strežnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False}, - 'peer_user': {'opis': 'ime uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False}, - 'peer_passwd': {'opis': 'geslo uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False}, - 'addon_disk_filename': {'w': False, 'public': False, 'generated': True}, # datoteka na dodatnem disku -} - -def task(peer_ip, peer_user, peer_passwd): - "Check whether ssh works" - import pxssh - import pexpect - results = dict() - s = pxssh.pxssh() - s.login (peer_ip, peer_user, peer_passwd) - results['motd'] = s.before # print everything before the prompt. - s.sendline('ls /mnt') - s.prompt() - results['ls_remote'] = s.before - s.logout() - results['ls_local'] = pexpect.run('ls ~/') - return results - -def gen_params(user_id, params_meta): - return kpovRandomHelpers.default_gen(user_id, params_meta) - -def task_check(results, params): - fname = params['addon_disk_filename'] - score = 0 - if (results['ls_remote'].find(fname) > -1): - score += 5 - if (results['ls_local'].find(fname) > -1): - score += 5 - return score - -def prepare_disks(templates, params): - d1 = templates['A_disk1'] - # print "touching", d1 - d1.touch('/{0}.txt'.format(params['addon_disk_filename'])) - # print "writing to", '/{0}.txt'.format(params['addon_disk_filename']) - d1.write('/{0}.txt'.format(params['addon_disk_filename']), 'Studentje na KPOV ste ZAKON!') - # print d1.ls('/') diff --git a/kpov_judge/tasks/set_motd/task.py b/kpov_judge/tasks/set_motd/task.py new file mode 100644 index 0000000..b4a14fc --- /dev/null +++ b/kpov_judge/tasks/set_motd/task.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# bson.son.SON an +# kpovRandomHelpers should be imported by add_assignment.py +# OrderedDict = SON + + +instructions = { + "si":u""" +Ustvari dva navidezna računalnika - imenujmo ju Test in Student. Za računalnik Test uporabite +sliko diska, poimenovano Test. Na računalniku Test dobite kratek niz. Poskrbite, da se bo ta +kratki niz pojavil v sporočilu, ki se ob prijavi izpiše na računalniku Student. Temu sporočilu v +angleščini rečemo "message of the day" - MOTD. + +Poskrbite, da se bo ob prijavi uporabnika (v Message Of The Day, MOTD) prek ssh izpisal nek niz. +Računalnik nastavite tako, da bo dostopen s testnega računalnika (Test). + +Uporabniško ime in niz dobite kot parametre ob zagonu run_test.py. Pri nizu pazite, saj utegne biti dovolj dolg, da brez premikanja kurzorja ne bo takoj viden. + +IP navideznega računalnika ter geslo nastavite sami. + +Ocenjevalni program pričakuje, da se bo ob koncu prijave pojavila ukazna vrstica oblike uporabnisko_ime@ime_racunalnika:~$ . Pazite, da se bo takšna vrstica pojavila šele po nizu, ki ste ga dobili v navodilih. +""" +} + +computers = { + 'Test': { + 'disks': [ + { 'name': 'Test', + }, + ], + 'flavor': 'm1.tiny', + 'network_interfaces': [{'network': 'net1'}], + 'config_drive': True, + 'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"} + }, + 'Student': { + 'disks': [ + { 'name': 'Student', } + ], + '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"} + } + +} + +networks = { 'net1': {'public': False}, 'test-net': {'public': True} } + +params_meta = { + 'peer_ip': {'opis': 'IP računalnika', 'w': True, 'public':True, 'type': 'IP', 'generated': False}, + 'peer_user': {'opis': 'ime uporabnika', 'w': False, 'public': True, 'type': 'username', 'generated': True}, + 'peer_passwd': {'opis': 'geslo uporabnika', 'w': True, 'public': True, 'type': 'alnumstr', 'generated': False}, + 'niz': {'w': False, 'public': True, 'type': 'short_text', 'generated': True}, +} + +def task(peer_ip, peer_user, peer_passwd, niz): + "Check whether ssh works" + import pxssh + import pexpect + results = dict() + s = pxssh.pxssh() + s.login (peer_ip, peer_user, peer_passwd, original_prompt=r'{0}@.*:\~\$'.format(peer_user),auto_prompt_reset=False) + results['motd'] = s.before # print everything before the prompt. + return results + +def gen_params(user_id, params_meta): + return kpovRandomHelpers.default_gen(user_id, params_meta) + +def task_check(results, params): + niz = params['niz'] + score = 0 + if (results['motd'].find(niz) > -1): + score += 10 + return score + +def prepare_disks(templates, params): + # print d1.ls('/') + pass diff --git a/kpov_judge/tasks/set_motd_egotrip/evaluation/task.py b/kpov_judge/tasks/set_motd_egotrip/evaluation/task.py deleted file mode 100644 index cd3d970..0000000 --- a/kpov_judge/tasks/set_motd_egotrip/evaluation/task.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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', - }, - #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt b/kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt deleted file mode 100644 index 91c85c2..0000000 --- a/kpov_judge/tasks/set_motd_egotrip/lecture/ideja.txt +++ /dev/null @@ -1 +0,0 @@ -Reši pristopni kolokvij z visoko oceno. diff --git a/kpov_judge/tasks/set_motd_egotrip/preparation/task.py b/kpov_judge/tasks/set_motd_egotrip/preparation/task.py deleted file mode 100644 index 272407c..0000000 --- a/kpov_judge/tasks/set_motd_egotrip/preparation/task.py +++ /dev/null @@ -1,2 +0,0 @@ -instructions = {'si': u""" -Reši poizkusni pristopni kolokvij z visoko oceno.""" } diff --git a/kpov_judge/tasks/smb_nfs/lecture/ideja.txt b/kpov_judge/tasks/smb_nfs/lecture/ideja.txt new file mode 100644 index 0000000..a380311 --- /dev/null +++ b/kpov_judge/tasks/smb_nfs/lecture/ideja.txt @@ -0,0 +1 @@ +Zaženi računalnik. Spremeni initrd. Zaženi sistem prek NFS. Spremeni podatke v squashfs. diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py new file mode 100644 index 0000000..8c54bf6 --- /dev/null +++ b/kpov_judge/tasks/smb_nfs/task.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py +# TODO: dokoncaj! +instructions = { + 'si':u""" +Postavi dva navidezna računalnika (simpleArbiterDhcp in FileServer). Na SimpleArbiterDhcp poišči imenik +Mapa ter preberi pot NFS_POT ter ime imenika v skupni rabi SAMBA_SHARE. Skopiraj datoteke iz imenika Mapa, +na FileServer. Poskrbi, da bo imenik z datotekami dostopen prek NFS v imeniku NFS_POT in prek SMB na imeniku v skupni +rabi SAMBA_SHARE. SimpleArbiterDhcp naj ima prek NFS pravico pisati po imeniku. +""" +} + +computers = { + 'FileServer': { + 'disks': [ + { 'name': 'FileServer', + }, + #{ '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 = { + 'SMB_NAME': {'opis': 'SMB ime streznika', 'w': False, 'public':True, 'type': 'hostname', 'generated': True}, + 'SMB_SHARENAME': {'opis': 'Imenik v skupni rabi', 'w': False, 'public':True, 'type': 'filename', 'generated': True}, + 'NFS_MOUNT': {'opis': 'Imenik, dostopen prek NFS', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, + 'SHARED_FILENAME': {'opis': 'Ime datoteke, ki je deljena', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, + 'SHARED_FILENAME_CONTENT': {'opis': 'Vsebina datoteke', 'w': False, 'public': True, 'type': 'filename', 'generated': True}, +} + +def task(SMB_NAME, NFS_MOUNT, SHARED_FILENAME, SHARED_FILENAME_CONTENT): + # mount the NFS mount + # mount the SMB mount + # read the filename content + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/snmp/evaluation/task.py b/kpov_judge/tasks/snmp/evaluation/task.py deleted file mode 100644 index e8fb908..0000000 --- a/kpov_judge/tasks/snmp/evaluation/task.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py - -instructions = { - 'si':u""" -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', - }, - #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, - 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, - 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, -} - -def task(IP_NM, DNS_NM, IP_static, DNS_static): - 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) - params['DNS_NM'] = r.choice(dns_servers) - params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) - params['DNS_static'] = r.choice(dns_servers) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/snmp/lecture/ideja.txt b/kpov_judge/tasks/snmp/lecture/ideja.txt deleted file mode 100644 index 0832279..0000000 --- a/kpov_judge/tasks/snmp/lecture/ideja.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/tasks/snmp/preparation/task.py b/kpov_judge/tasks/snmp/preparation/task.py deleted file mode 100644 index 7bd6069..0000000 --- a/kpov_judge/tasks/snmp/preparation/task.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# kpovRandomHelpers should be imported by add_assignment.py -# TODO: finish this. - -instructions = { - 'si':u""" -Postavi tri navidezne računalnike - SimpleArbiter s sliko diska simpleArbiterDhcp, -SNMPServer in SNMPClient. Napiši program upminutes, ki bo izpisal, kako dolgo je računalnik vklopljen v minutah. -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, kako dolgo je vklopljen v sekundah. - -Napiši 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. -""" -} - - -computers = { - 'SNMPClient': { - 'disks': [ - { 'name': 'SNMPClient', - - }, - #{ 'name': 'CDROM', - # 'options':{'readonly': True}, - # 'parts': [],# no parts, no mounting. - #} - ], - 'network_interfaces': [{'network': 'net1'}], - 'flavor': 'm1.tiny', - 'config_drive': False - }, - 'SNMPServer': { - 'disks': [ - { 'name': 'SNMPServer', - }, - #{ '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 = { - 'SNMP_VALUE': {'opis': 'Vrednost, dostopna prek SNMP', 'w': False, 'public':True, 'type': 'number', 'generated': True}, - 'SNMP_OID_ON_SERVER': {'opis': 'OID, na katerem je vrednost dostopna', 'w': False, 'public':True, 'type': 'OID', 'generated': True}, - 'SNMP_OID_ON_CLIENT': {'opis': 'OID, ki naj ga klient bere', 'w': False, 'public':True, 'type': 'OID', 'generated': True}, -} - -def task(SNMP_VALUE, SNMP_OID_ON_SERVER, SNMP_OID_ON_CLIENT): - # run cpu temp script on client - # run SNMP read SNMP_OID_ON_CLIENT script on client - # read data on SNMP_OID_ON_CLIENT - # read data from SNMP server - return results - -def gen_params(user_id, params_meta): - params = dict() - r = random.Random(user_id) - return params - -def task_check(results, params): - import re - score = -9 - 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 - -def prepare_disks(templates, params): -# d = templates['simpleArbiterDhcp'] - pass - diff --git a/kpov_judge/tasks/snmp_agent_uptime/lecture/ideja.txt b/kpov_judge/tasks/snmp_agent_uptime/lecture/ideja.txt new file mode 100644 index 0000000..0832279 --- /dev/null +++ b/kpov_judge/tasks/snmp_agent_uptime/lecture/ideja.txt @@ -0,0 +1,2 @@ +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/tasks/snmp_agent_uptime/task.py b/kpov_judge/tasks/snmp_agent_uptime/task.py new file mode 100644 index 0000000..7bd6069 --- /dev/null +++ b/kpov_judge/tasks/snmp_agent_uptime/task.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py +# TODO: finish this. + +instructions = { + 'si':u""" +Postavi tri navidezne računalnike - SimpleArbiter s sliko diska simpleArbiterDhcp, +SNMPServer in SNMPClient. Napiši program upminutes, ki bo izpisal, kako dolgo je računalnik vklopljen v minutah. +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, kako dolgo je vklopljen v sekundah. + +Napiši 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. +""" +} + + +computers = { + 'SNMPClient': { + 'disks': [ + { 'name': 'SNMPClient', + + }, + #{ 'name': 'CDROM', + # 'options':{'readonly': True}, + # 'parts': [],# no parts, no mounting. + #} + ], + 'network_interfaces': [{'network': 'net1'}], + 'flavor': 'm1.tiny', + 'config_drive': False + }, + 'SNMPServer': { + 'disks': [ + { 'name': 'SNMPServer', + }, + #{ '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 = { + 'SNMP_VALUE': {'opis': 'Vrednost, dostopna prek SNMP', 'w': False, 'public':True, 'type': 'number', 'generated': True}, + 'SNMP_OID_ON_SERVER': {'opis': 'OID, na katerem je vrednost dostopna', 'w': False, 'public':True, 'type': 'OID', 'generated': True}, + 'SNMP_OID_ON_CLIENT': {'opis': 'OID, ki naj ga klient bere', 'w': False, 'public':True, 'type': 'OID', 'generated': True}, +} + +def task(SNMP_VALUE, SNMP_OID_ON_SERVER, SNMP_OID_ON_CLIENT): + # run cpu temp script on client + # run SNMP read SNMP_OID_ON_CLIENT script on client + # read data on SNMP_OID_ON_CLIENT + # read data from SNMP server + return results + +def gen_params(user_id, params_meta): + params = dict() + r = random.Random(user_id) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/snmp_alarms_interfaces/task.py b/kpov_judge/tasks/snmp_alarms_interfaces/task.py new file mode 100644 index 0000000..e8fb908 --- /dev/null +++ b/kpov_judge/tasks/snmp_alarms_interfaces/task.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py + +instructions = { + 'si':u""" +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', + }, + #{ '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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/tasks/vlc_stream_rtp/lecture/ideja.txt b/kpov_judge/tasks/vlc_stream_rtp/lecture/ideja.txt new file mode 100644 index 0000000..7e12372 --- /dev/null +++ b/kpov_judge/tasks/vlc_stream_rtp/lecture/ideja.txt @@ -0,0 +1,2 @@ +Postavi OpenWRT na router. Usposobi predvajanje filmov na Raspberry PI. + diff --git a/kpov_judge/tasks/vlc_stream_rtp/task.py b/kpov_judge/tasks/vlc_stream_rtp/task.py new file mode 100644 index 0000000..934dfe6 --- /dev/null +++ b/kpov_judge/tasks/vlc_stream_rtp/task.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# kpovRandomHelpers should be imported by add_assignment.py +# Postavi nek film na Internet tako, da ga bodo lahko ostali videli. +# TODO: finish this + +instructions = { + 'si':u""" +Postavi navidezni računalnik SimpleArbiter z diska simpleArbiter. +Na simpleArbiter preberi naslov filma ter ime toka TOK. Posnemi ali kako drugače ustvari +film ter poskrbi, da bo film dostopen na Internetu prek RTP z imenom toka TOK. Računaj, +da bodo film lahko videli tvoji sošolci. Kršenje avtorskih pravic je pri reševanju te naloge +strogo prepovedano. +""" +} + +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': {'opis': 'Naslov maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'DNS_NM': {'opis': 'DNS za maliNetworkManager', 'w': False, 'public':True, 'type': 'IP', 'generated': True}, + 'IP_static': {'opis': 'Naslov maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, + 'DNS_static': {'opis': 'DNS za maliBrezNetworkManager', 'w': False, 'public': True, 'type': 'IP', 'generated': True}, +} + +def task(IP_NM, DNS_NM, IP_static, DNS_static): + 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 = kpovRandomHelpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24) + params['DNS_NM'] = r.choice(dns_servers) + params['IP_NM'], params['IP_static'] = kpovRandomHelpers.IPv4_addr_gen(r, net, 2) + params['DNS_static'] = r.choice(dns_servers) + return params + +def task_check(results, params): + import re + score = -9 + 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 + +def prepare_disks(templates, params): +# d = templates['simpleArbiterDhcp'] + pass + diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py new file mode 100755 index 0000000..894bfe6 --- /dev/null +++ b/kpov_judge/test_task.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import yaml +import json +import urllib +import urllib2 +import dialog +import os +import inspect +import sys + +# SERVER_URL = "http://localhost/kpov_judge/" +SERVER_URL = "http://kpov.fri.uni-lj.si/kpov_judge/" +TASK_URL = SERVER_URL + '{task_id}/task.py' +PARAMS_URL = SERVER_URL + '{task_id}/params.json' +SUBMIT_URL = SERVER_URL + '{task_id}/results.json' + +PARAMS_FILE = os.path.expanduser("~/.kpov_params.yaml") + +def get_params(params, param_names, meta, d): + for name in param_names: + m = meta.get(name, {}) + if d is not None: + ret, s = d.inputbox(m.get('opis', name), init=params.get(name, '')) + if ret == 0 and m.get('w', False): + params[name] = s + else: + if name not in params: + raise "Missing param: {0}".format(name) + return params + +def auth_open(url, username, password): + password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() +# Add the username and password. +# If we knew the realm, we could use it instead of None. + password_mgr.add_password(None, SERVER_URL, username, password) + handler = urllib2.HTTPBasicAuthHandler(password_mgr) +# create "opener" (OpenerDirector instance) + opener = urllib2.build_opener(handler) +# use the opener to fetch a URL +# opener.open(SERVER_URL) +# Install the opener. +# Now all calls to urllib2.urlopen use our opener. + urllib2.install_opener(opener) + +def load_checker(request): + source = response.read() + t = compile(source, 'task.py', 'exec') + exec(t) + args_list = inspect.getargs(task.func_code)[0] + return task, args_list, param_meta + +if __name__ == '__main__': + try: + try: + saved_params = yaml.load(open(PARAMS_FILE)) + except: + print "Missing - creating anew.", PARAMS_FILE + saved_params = dict() + if len(sys.argv) > 1 and sys.argv[1] == '-q': + d = None + else: + d = dialog.Dialog(dialog="dialog") + basic_params = { + # 'param_name': ('prompt', editable) + "student_id": {'opis':"Upor. ime:", 'w': True}, + "student_password": {'opis':"Geslo:", 'w': True}, + "task_id": {'opis': "Naloga:", 'w': True}} + saved_params = get_params(saved_params, ['student_id', 'student_password', 'task_id'], basic_params, d) + task_id = saved_params['task_id'] + yaml.dump(saved_params, open(PARAMS_FILE, 'w')) + auth_open(SERVER_URL, saved_params['student_id'], saved_params['student_password']) + # get parameters + req = urllib2.Request(PARAMS_URL.format(**saved_params)) + response = urllib2.urlopen(req) + web_params = json.load(response) + task_params_dict = saved_params.get('tasks', {}) + task_params = task_params_dict.get(task_id, {}) + saved_params['tasks'] = task_params_dict + task_params.update(web_params) + # get task source + req = urllib2.Request(TASK_URL.format(**saved_params)) + response = urllib2.urlopen(req) + # load task_check over the net + task, args_list, meta = load_checker(response) + # get missing parameters from user + task_params = get_params(task_params, args_list, meta, d) + # save + # run checker + valid_task_params = dict() + for i in args_list: + valid_task_params[i] = task_params[i] + saved_params['tasks'][task_id] = valid_task_params + results = task(**valid_task_params) + data = urllib.urlencode({ + 'results': json.dumps(results), + 'params': json.dumps(valid_task_params) + }) + req = urllib2.Request(SUBMIT_URL.format(**saved_params), data) + response = urllib2.urlopen(req) + if d is not None: + d.msgbox(response.read()) + yaml.dump(saved_params, open(PARAMS_FILE, 'w')) + # d.add_persistent_args([('background_title', 'KPOVv')]) + except Exception, e: + yaml.dump(saved_params, open(PARAMS_FILE, 'w')) + print "problem!" + print e -- cgit v1.2.1