summaryrefslogtreecommitdiffstats
path: root/policy_metadata/xsl_metadata.rng
blob: 0116d810720688024f55cb246f3c81c33545dfad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?xml version="1.0" encoding="utf-8"?>
<!--
Author: Sumit Bose <sbose@redhat.com>

Copyright (C) 2008  Red Hat
see file 'COPYING' for use and warranty information

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; version 2 only

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.

You should have received a copy of the GNU Lesser General Public License
along with this program; see the file COPYING.LGPL.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
-->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
xmlns:a="http://freeipa.org/xml/rng/ns/annotations/1.0"
xmlns:md="http://freeipa.org/xsl/metadata/1.0"
xmlns:pa="http://freeipa.org/xml/rng/ns/plugable_architecture/1.0">


  <a:doc>md:output_handler should be the first element after xsl:stylesheet. The
  content of the stylesheet can be validated separately.</a:doc>
  <start ns="http://freeipa.org/xsl/metadata/1.0">
    <element>
      <anyName/>
      <ref name="output_handler"/>
      <ref name="any"/>
    </element>
  </start>

  <a:doc>With the md:output_handler element it is possible to define how the
  policy data is processed after the XSLT transformation is applied. The idea
  is that a driver program or script can access this metadata information with
  a suitable XPath and can handle the output of the transformation
  accordingly.</a:doc>
  <define name="output_handler">
    <element name="md:output_handler">
      <oneOrMore>
        <choice>

          <a:doc>md:file is the typical output handler for IPA config policies.
          The driver program will created a file and write the output of the
          transformation to this this or merge with the content of the local
          file depending on the information provided by the policy.</a:doc>
          <element name="md:file">
            <ref name="selector"/>
            <ref name="file_properties"/>
          </element>

          <a:doc>The md:exec_with_args will use a line of the output of the
          transformation a command line argument of a program.</a:doc>
          <element name="md:exec_with_args">
            <ref name="selector"/>
            <ref name="exec_properties"/>
          </element>

          <a:doc>The result of the XSLT transformation will be piped by the
          driver to stdin of another program when using
          md:exec_with_stdin_pipe.</a:doc>
          <element name="md:exec_with_stdin_pipe">
            <ref name="selector"/>
            <ref name="exec_properties"/>
          </element>

          <a:doc>Maybe we will have a separate output handler to write to the
          client's ldb.</a:doc>
          <element name="md:ldb">
            <ref name="selector"/>
          </element>

        </choice>
      </oneOrMore>
    </element>
  </define>


  <a:doc>It is possible to generate more than one type of output for more than
  one output handler. To switch between different types of output a parameter
  with different values can be used. The driver program can access the name of
  the parameter (md:param_name) and the value (md:param_value) of the current
  output handler with suitable XPath statements.</a:doc>
  <define name="selector">
    <optional>
      <attribute name="md:param_name">
        <text/>
      </attribute>
      <attribute name="md:param_value">
        <text/>
      </attribute>
    </optional>
  </define>

  <a:doc>It is important that a file is created with the right access
  permissions to avoid either security or usability troubles.</a:doc>
  <define name="file_properties">
    <a:doc>md:name, the full name of the file, is the only required
    attribute.</a:doc>
    <attribute name="md:name">
      <data type="string">
        <param name="pattern">/.*</param>
      </data>
    </attribute>
    <a:doc>The standard unix access control to a file is determined by its
    owner, its group and the access permissions. If this attributes are missing
    a sensible default should be assumes. For example owner root, group root and
    0400 permissions. You have to define either all three or none of the
    attributes.</a:doc>
    <optional>
      <attribute name="md:owner">
        <text/>
      </attribute>
      <attribute name="md:group">
        <text/>
      </attribute>
      <a:doc>The permission must be specified in octal mode.</a:doc>
      <attribute name="md:permission">
        <data type="string">
          <param name="pattern">[0-7]{4}</param>
        </data>
      </attribute>
    </optional>
    <a:doc>If the client system supports SELinux you can specify the SELinux
    context for the file, otherwise a sensible default will be used
    (restorecon).</a:doc>
    <optional>
      <attribute name="md:selinux_context">
        <text/>
      </attribute>
    </optional>
  </define>

  <a:doc>To execute a process we need the full path of the file to execute,
  optional some arguments and the user and group context under which the procrss
  should run. If md:user and md:group are missing, the least privileges, e.g.
  nobody/nogroup should be assumed.</a:doc>
  <define name="exec_properties">
    <attribute name="md:command">
      <data type="string">
        <param name="pattern">/.*</param>
      </data>
    </attribute>
    <optional>
      <attribute name="md:arguments">
        <text/>
      </attribute>
    </optional>
    <optional>
      <attribute name="md:user">
        <text/>
      </attribute>
      <attribute name="md:group">
        <text/>
      </attribute>
    </optional>
  </define>

  <a:doc>The following is a dummy element to catch all elements from
  different namespaces, e.g. comments and documentation</a:doc>
  <define name="any">
    <zeroOrMore>
      <choice>
        <attribute>
          <anyName/>
        </attribute>
        <text/>
        <element>
          <anyName/>
          <ref name="any"/>
        </element>
      </choice>
    </zeroOrMore>
  </define>


</grammar>