~andreserl/+junk/cobbler

« back to all changes in this revision

Viewing changes to .pc/59_add_csrf_protection.patch/web/cobbler_web/templates/generic_list.tmpl

  • Committer: Andres Rodriguez
  • Date: 2011-12-09 17:39:33 UTC
  • mfrom: (50.1.5 trunk)
  • Revision ID: andreserl@ubuntu.com-20111209173933-6mel1k0noqjd1vad
Tags: 2.1.0+git20110602-0ubuntu26.2
* SECURITY UPDATE: arbitrary code execution via PYTHON_EGG_CACHE in insecure
  location (LP: #858875)
  - debian/patches/58_fix_egg_cache.patch: move PYTHON_EGG_CACHE to
    /var/lib/cobbler/webui_cache (copied from fix to precise).
* SECURITY UPDATE: CSRF vulnerability in cobbler-web (LP: #858878)
  - debian/patches/59_add_csrf_protection.patch: use Django's built-in
    CSRF protection (taken from upstream).
* SECURITY UPDATE: arbitrary code execution via web interface (LP: #858883)
  - debian/patches/60_yaml_safe_load.patch: use yaml.safe_load instead of
    yaml.load (taken from upstream).
* SECURITY UPDATE: users.digest file is world readable (LP: #858860)
  - debian/cobbler.postinst: create /etc/cobbler/users.digest as 600
* SECURITY UPDATE: webui_sessions uses insecure permissions (LP: #863755)
  - debian/cobbler.postinst: fix permissions on webui_{sessions,cache} to
    0700

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{% extends "master.tmpl" %}
 
2
{% load site %}
 
3
{% block content %}
 
4
 
 
5
<script type="text/javascript">
 
6
function items_check_all(){
 
7
    var checkall = document.getElementById("itemsall").checked
 
8
    var items    = document.getElementsByName("items")
 
9
    for(i=0; i<items.length; ++i) {
 
10
        items[i].checked=checkall;
 
11
        items_check(items[i])
 
12
    }
 
13
}
 
14
 
 
15
function items_check(obj) {
 
16
    obj.parentNode.parentNode.className=(obj.checked)? 'selected' : '';
 
17
}
 
18
 
 
19
function items_checked_values() {
 
20
    var items = document.getElementsByName("items")
 
21
    var values = new Array();
 
22
    for(i=0; i<items.length; ++i) {
 
23
        if (items[i].checked) {
 
24
            values.push(items[i].value)
 
25
        }
 
26
    }
 
27
    s = values.join(" ")
 
28
    return s;
 
29
}
 
30
 
 
31
function obj_rename(old) {
 
32
    var newname = window.prompt("Change {{ what }} name to?",old);
 
33
    if (newname != null) {
 
34
        window.location = "/cobbler_web/{{ what }}/rename/" + old + "/" + newname;
 
35
    }
 
36
}
 
37
function obj_copy(old) {
 
38
    var newname = window.prompt("Name for the new {{ what }}?",old);
 
39
    if (newname != null) {
 
40
        window.location = "/cobbler_web/{{ what }}/copy/" + old + "/" + newname;
 
41
    }
 
42
}
 
43
function obj_delete(old) {
 
44
    if (confirm("Delete {{ what }} (" + old + ") and all child objects?")) {
 
45
        window.location = "/cobbler_web/{{ what }}/delete/" + old;
 
46
    }
 
47
}
 
48
 
 
49
function action(otype) {
 
50
    sel_action = document.getElementById("actions").value
 
51
    what   = sel_action.split("|")[0]
 
52
    action = sel_action.split("|")[1]
 
53
    document.location = "/cobbler_web/" + what + "/" + action
 
54
}
 
55
 
 
56
function action_multi(otype) {
 
57
    var values = items_checked_values()
 
58
    if (values == "") {
 
59
       return
 
60
    }
 
61
    document.getElementById("names").value = values
 
62
 
 
63
    sel_batchaction = document.getElementById("batchactions").value
 
64
    action = sel_batchaction.split("|")[0]
 
65
    param  = sel_batchaction.split("|")[1]
 
66
 
 
67
    if (action == "profile") {
 
68
        param = window.prompt("New installation profile name for checked systems?","")
 
69
        if ((param == null) || (param == "")) {
 
70
            return
 
71
        }
 
72
        value = 1
 
73
    }
 
74
    else {
 
75
        value = null
 
76
    }
 
77
    if ((action == "power") && (param == "on")) {
 
78
        value = confirm("Confirm: Really power up all checked systems?")
 
79
    }
 
80
    if ((action == "power") && (param == "off")) {
 
81
        value = confirm("Confirm: Really power down all checked systems?")
 
82
    }
 
83
    if ((action == "power") && (param == "reboot")) {
 
84
        value = confirm("Confirm: Really reboot all checked systems?")
 
85
    }
 
86
    if ((action == "netboot") && (param == "enable")) {
 
87
        value = confirm("Confirm: Really flag all checked systems for PXE reinstallation?")
 
88
    }
 
89
    if ((action == "netboot") && (param == "disable")) {
 
90
        value = confirm("Confirm: Really disable all checked systems for PXE reinstallation?")
 
91
    }
 
92
    if ((action == "delete" ) && (param == "delete")) {
 
93
        value = confirm("Confirm: Really delete all checked " + otype + "?" )
 
94
    }
 
95
    if ((action == "reposync")) {
 
96
        value = "reposync"
 
97
    }
 
98
 
 
99
    if (value) {
 
100
        document.myform.action = "/cobbler_web/" + otype + "/multi/" + action + "/" + param
 
101
        document.myform.submit()  
 
102
    }
 
103
    else {
 
104
        alert("Operation aborted.")
 
105
    }
 
106
}
 
107
</script>
 
108
<h1>{{ what|title }}s</h1>
 
109
<hr />
 
110
<ul id="submenubar">
 
111
  <li>
 
112
    <a class="action" href="/cobbler_web/{{what}}/edit">Create new {{ what }}</a>
 
113
    {% ifequal what "profile" %}<a class="action" href="/cobbler_web/sub{{what}}/edit">Create new sub-{{ what }}</a>{% endifequal %}
 
114
  </li>
 
115
  <li>
 
116
    <select id="batchactions">
 
117
      <option value="" selected="selected">Batch Actions</option>
 
118
      {% for title,action,value in batchactions %}<option value="{{ action }}|{{ value }}">{{ title }}</option>{% endfor %}
 
119
    </select>
 
120
    <input class="button" type="button" value="go" onclick="javascript:action_multi('{{ what }}')" />
 
121
  </li>
 
122
  {% include "paginate.tmpl" %}
 
123
</ul>
 
124
 
 
125
<form name="myform" method="post" action="/cobbler_web/{{ what }}/action">
 
126
  <table id="listitems" cellspacing="0">
 
127
    <thead>
 
128
      <tr>
 
129
        <th>
 
130
          <input type="checkbox" id="itemsall" onclick="javascript:items_check_all();" />
 
131
        </th>
 
132
{% for value in columns %}
 
133
        <th>
 
134
          <a href="/cobbler_web/{{ what }}/modifylist/sort/{{ value.0 }}">{{ value.0|title }}</a>
 
135
  {% ifequal value.1 "asc" %}
 
136
          &darr;
 
137
  {% endifequal %}
 
138
  {% ifequal value.1 "desc" %}
 
139
          &uarr;
 
140
  {% endifequal %}
 
141
        </th>
 
142
{% endfor %}
 
143
        <th>Actions</th>
 
144
      </tr>
 
145
    </thead>
 
146
    <tbody>
 
147
{% for item in items %}
 
148
      <tr class="{% cycle 'rowodd' 'roweven' %}">
 
149
        <td><input type="checkbox" name="items" value="{{ item.0.1 }}" onclick="javascript:items_check(this);" /></td>
 
150
  {% for value in item %}
 
151
        <td>
 
152
    {% ifequal value.0 "name" %}
 
153
          <a href="/cobbler_web/{{ what }}/edit/{{ value.1 }}">{{ value.1 }}</a>
 
154
    {% endifequal %}
 
155
    {% ifequal value.2 "editlink" %}
 
156
      {% ifnotequal value.1 "~" %}
 
157
          <a href="/cobbler_web/{{ value.0 }}/edit/{{ value.1 }}">{{ value.1 }}</a>
 
158
      {% endifnotequal %}
 
159
    {% endifequal %}
 
160
    {% ifequal value.2 "checkbox" %}
 
161
      {% ifequal value.1 1 %}
 
162
          <input type="checkbox" name="{{ item.name }}" id="{{ item.name }}" value="{{ item.name }}" disabled="disabled" checked="checked" />
 
163
      {% else %}
 
164
          <input type="checkbox" name="{{ item.name }}" id="{{ item.name }}" value="{{ item.name }}" disabled="disabled" />
 
165
      {% endifequal %}
 
166
    {% endifequal %}
 
167
    {% ifequal value.2 "text" %}
 
168
          {{ value.1 }}
 
169
    {% endifequal %}
 
170
        </td>
 
171
  {% endfor %}
 
172
        <td>
 
173
          <a class="action" href="/cobbler_web/{{ what }}/edit/{{ item.0.1 }}">Edit</a>
 
174
          <span class="action" onClick="javascript:obj_copy('{{ item.0.1 }}')">Copy</span> 
 
175
          <span class="action" onClick="javascript:obj_rename('{{ item.0.1 }}')">Rename</span> 
 
176
          <span class="action" onClick="javascript:obj_delete('{{ item.0.1 }}')">Delete</span> 
 
177
  {% ifequal what "system" %}
 
178
          <span class="action" onClick="window.location='/cblr/svc/op/ks/system/{{ item.0.1 }}'">View kickstart</span>
 
179
  {% endifequal %}
 
180
  {% ifequal what "profile" %}
 
181
          <span class="action" onClick="window.location='/cblr/svc/op/ks/profile/{{ item.0.1 }}'">View kickstart</span>
 
182
  {% endifequal %}
 
183
        </td>
 
184
      </tr>
 
185
{% endfor %}
 
186
    </tbody>
 
187
  </table>
 
188
  <input type="hidden" name="names" id="names" value=""/>
 
189
</form>
 
190
{% include "filter.tmpl" %}
 
191
 
 
192
{% endblock content %}