about to change up a lot of stuff...

This commit is contained in:
brent s. 2020-06-14 00:53:19 -04:00
parent 6d3a9f5d3a
commit 2219fbe4c0
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
3 changed files with 143 additions and 96 deletions

View File

@ -7,6 +7,15 @@
<xs:include schemaLocation="../types/net.xsd"/> <xs:include schemaLocation="../types/net.xsd"/>
<xs:include schemaLocation="../types/unix.xsd"/> <xs:include schemaLocation="../types/unix.xsd"/>


<xs:complexType name="e_repomir_owner">
<xs:sequence minOccurs="1">
<xs:choice minOccurs="1" maxOccurs="2">
<xs:element name="user" type="t_unix_posixUserGroup" maxOccurs="1"/>
<xs:element name="group" type="t_unix_posixUserGroup" maxOccurs="1"/>
</xs:choice>
</xs:sequence>
</xs:complexType>

<!-- Commented out; we don't bother with SSH variants. See also e_repomir_upstream --> <!-- Commented out; we don't bother with SSH variants. See also e_repomir_upstream -->
<!-- <!--
<xs:complexType name="e_repomir_sync_proto"> <xs:complexType name="e_repomir_sync_proto">
@ -18,16 +27,23 @@
</xs:complexType> </xs:complexType>
--> -->


<xs:complexType name="e_repomir_tstmp_file">
<xs:simpleContent>
<xs:extension base="t_unix_filepath">
<xs:attribute name="timeFormat" type="xs:string" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>


<xs:complexType name="e_repomir_upstream"> <xs:complexType name="e_repomir_upstream">
<xs:all minOccurs="1"> <xs:all minOccurs="1">
<!-- <xs:element name="syncType" type="e_repomir_sync_proto" minOccurs="1"/> --> <!-- <xs:element name="syncType" type="e_repomir_sync_proto" minOccurs="1"/> -->
<xs:element name="syncType" type="t_repomir_synctype" minOccurs="1"/> <xs:element name="syncType" type="t_repomir_synctype" minOccurs="1"/>
<xs:element name="domain" type="xs:token" minOccurs="1"/> <xs:element name="domain" type="xs:token" minOccurs="1"/>
<xs:element name="port" minOccurs="0" type="t_net_port"/> <xs:element name="port" minOccurs="0" type="t_net_port"/>
<xs:element name="path" minOccurs="1" type="t_unix_filepath"/> <xs:element name="path" minOccurs="1" type="t_unix_filepath"/>
<xs:element name="bwlimit" minOccurs="0" type="xs:positiveInteger"/>
</xs:all> </xs:all>

</xs:complexType> </xs:complexType>


</xs:schema> </xs:schema>

View File

@ -3,104 +3,127 @@
elementFormDefault="qualified" elementFormDefault="qualified"
attributeFormDefault="unqualified"> attributeFormDefault="unqualified">


<xs:include schemaLocation="./std.xsd"/> <xs:include schemaLocation="./std.xsd"/>


<xs:simpleType name="t_unix_filepath"> <xs:complexType name="t_unix_arg">
<xs:restriction base="xs:string"> <xs:simpleContent>
<xs:pattern value="\s*(~?/[^/]+)+/?\s*"/> <xs:extension base="xs:string">
<xs:whiteSpace value="collapse"/> <xs:attribute name="value" type="xs:string" use="optional"/>
</xs:restriction> </xs:extension>
</xs:simpleType> </xs:simpleContent>
</xs:complexType>


<xs:complexType name="t_unix_nixpass"> <xs:complexType name="t_unix_args">
<xs:choice minOccurs="1" maxOccurs="1"> <xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="passwordPlain"> <xs:element name="long" type="t_unix_arg"/>
<xs:complexType> <xs:element name="short" type="t_unix_arg"/>
<xs:simpleContent> </xs:choice>
<xs:extension base="xs:string"> </xs:complexType>
<xs:attribute name="hashType" use="optional" default="md5" type="t_unix_passwd_hashtypes"/>
<xs:attribute name="rounds" use="optional" default="5000" type="xs:positiveInteger"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="passwordHash">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_unix_shadowhash">
<xs:attribute name="hashType" use="optional" default="md5" type="t_unix_passwd_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="locked" use="optional" default="false" type="xs:boolean"/>
</xs:complexType>


<xs:simpleType name="t_unix_passwd_hashtypes"> <!-- This is more or less the same as t_unix_filepath with the exception of it allowing "/". -->
<xs:restriction base="xs:string"> <xs:simpleType name="t_unix_dirpath">
<xs:enumeration value="md5"/> <xs:restriction base="xs:string">
</xs:restriction> <xs:pattern value="\s*(~?/[^/]*)+/?\s*"/>
</xs:simpleType> <xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>


<!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282 --> <xs:simpleType name="t_unix_filepath">
<xs:simpleType name="t_unix_portablePosixFilename"> <xs:restriction base="xs:string">
<xs:restriction base="xs:string"> <xs:pattern value="\s*(~?/[^/]+)+/?\s*"/>
<xs:pattern value="[A-Za-z0-9._-]+"/> <xs:whiteSpace value="collapse"/>
<xs:whiteSpace value="collapse"/> </xs:restriction>
</xs:restriction> </xs:simpleType>
</xs:simpleType>


<xs:simpleType name="t_unix_posixUserGroup"> <xs:complexType name="t_unix_nixpass">
<!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437 <xs:choice minOccurs="1" maxOccurs="1">
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282 <xs:element name="passwordPlain">
https://unix.stackexchange.com/a/435120/284004 --> <xs:complexType>
<xs:restriction base="xs:token"> <xs:simpleContent>
<xs:pattern value="\s*[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}$)\s*"/> <xs:extension base="xs:string">
<xs:whiteSpace value="collapse"/> <xs:attribute name="hashType" use="optional" default="md5" type="t_unix_passwd_hashtypes"/>
</xs:restriction> <xs:attribute name="rounds" use="optional" default="5000" type="xs:positiveInteger"/>
</xs:simpleType> </xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="passwordHash">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="t_unix_shadowhash">
<xs:attribute name="hashType" use="optional" default="md5" type="t_unix_passwd_hashtypes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="locked" use="optional" default="false" type="xs:boolean"/>
</xs:complexType>


<xs:simpleType name="t_unix_shadowhash"> <xs:simpleType name="t_unix_passwd_hashtypes">
<!-- http://man7.org/linux/man-pages/man3/crypt.3.html#NOTES --> <xs:restriction base="xs:string">
<xs:restriction base="xs:token"> <xs:enumeration value="md5"/>
<xs:pattern value="\s*($1)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{22}\s*"/><!-- md5 --> </xs:restriction>
<xs:whiteSpace value="collapse"/> </xs:simpleType>
</xs:restriction>
</xs:simpleType>


<xs:complexType name="t_unix_user"> <!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282 -->
<xs:sequence> <xs:simpleType name="t_unix_portablePosixFilename">
<xs:element name="password" minOccurs="0" maxOccurs="1" type="t_unix_nixpass"/> <xs:restriction base="xs:string">
<xs:element name="xGroup" minOccurs="0" maxOccurs="unbounded"> <xs:pattern value="[A-Za-z0-9._-]+"/>
<xs:complexType> <xs:whiteSpace value="collapse"/>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/> </xs:restriction>
<xs:attribute name="create" type="xs:boolean" use="optional" default="false"/> </xs:simpleType>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
</xs:complexType> <xs:simpleType name="t_unix_posixUserGroup">
<xs:unique name="uniq_unix_grp"> <!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437
<xs:selector xpath="xGroup"/> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
<xs:field xpath="@name"/> https://unix.stackexchange.com/a/435120/284004 -->
</xs:unique> <xs:restriction base="xs:token">
</xs:element> <xs:pattern value="\s*[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}$)\s*"/>
</xs:sequence> <xs:whiteSpace value="collapse"/>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/> </xs:restriction>
<xs:attribute name="home" type="t_unix_filepath" use="optional"/> </xs:simpleType>
<xs:attribute name="uid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="group" type="t_unix_posixUserGroup" use="optional"/> <xs:simpleType name="t_unix_shadowhash">
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/> <!-- http://man7.org/linux/man-pages/man3/crypt.3.html#NOTES -->
<xs:attribute name="comment" type="t_std_nonempty" use="optional"/> <xs:restriction base="xs:token">
<xs:attribute name="sudo" type="xs:boolean" use="optional" default="false"/> <xs:pattern value="\s*($1)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{22}\s*"/><!-- md5 -->
<xs:attribute name="sudoPassword" type="xs:boolean" use="optional" default="true"/> <xs:whiteSpace value="collapse"/>
<xs:attribute name="shell" type="t_unix_filepath" use="optional" default="/bin/bash"/> </xs:restriction>
<!-- TODO: change the positiveIntegers to xs:duration? or union? --> </xs:simpleType>
<!-- Might be pointless since the smallest increment is 1 day in
shadow(5). --> <xs:complexType name="t_unix_user">
<xs:attribute name="minAge" type="xs:positiveInteger" use="optional"/> <xs:sequence>
<xs:attribute name="maxAge" type="xs:positiveInteger" use="optional"/> <xs:element name="password" minOccurs="0" maxOccurs="1" type="t_unix_nixpass"/>
<xs:attribute name="warnDays" type="xs:positiveInteger" use="optional"/> <xs:element name="xGroup" minOccurs="0" maxOccurs="unbounded">
<xs:attribute name="inactiveDays" type="xs:positiveInteger" use="optional"/> <xs:complexType>
<xs:attribute name="expireDate" type="t_std_epoch_or_iso" use="optional"/> <xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
</xs:complexType> <xs:attribute name="create" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
</xs:complexType>
<xs:unique name="uniq_unix_grp">
<xs:selector xpath="xGroup"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<xs:attribute name="home" type="t_unix_filepath" use="optional"/>
<xs:attribute name="uid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="group" type="t_unix_posixUserGroup" use="optional"/>
<xs:attribute name="gid" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="comment" type="t_std_nonempty" use="optional"/>
<xs:attribute name="sudo" type="xs:boolean" use="optional" default="false"/>
<xs:attribute name="sudoPassword" type="xs:boolean" use="optional" default="true"/>
<xs:attribute name="shell" type="t_unix_filepath" use="optional" default="/bin/bash"/>
<!-- TODO: change the positiveIntegers to xs:duration? or union? -->
<!-- Might be pointless since the smallest increment is 1 day in
shadow(5). -->
<xs:attribute name="minAge" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="maxAge" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="warnDays" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="inactiveDays" type="xs:positiveInteger" use="optional"/>
<xs:attribute name="expireDate" type="t_std_epoch_or_iso" use="optional"/>
</xs:complexType>


</xs:schema> </xs:schema>

View File

@ -19,7 +19,15 @@
<xs:complexType> <xs:complexType>
<xs:sequence minOccurs="1"> <xs:sequence minOccurs="1">
<xs:choice minOccurs="1" maxOccurs="unbounded"> <xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="upstream" type="e_repomir_upstream"/> <xs:element name="upstream" type="e_repomir_upstream" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="dest" type="t_unix_filepath" minOccurs="1" maxOccurs="1"/>
<xs:element name="lastLocalCheck" type="e_repomir_tstmp_file" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="lastLocalSync" type="e_repomir_tstmp_file" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="lastRemoteUpdate" type="e_repomir_tstmp_file" minOccurs="0" maxOccurs="1"/>
<xs:element name="lastRemoteSync" type="e_repomir_tstmp_file" minOccurs="0" maxOccurs="1"/>
<xs:element name="mountCheck" type="t_unix_dirpath" minOccurs="1"/>
<xs:element name="owner" type="e_repomir_owner" minOccurs="0"/>
<xs:element name="rsyncArgs" minOccurs="0" maxOccurs="1" type="t_unix_args"/>
</xs:choice> </xs:choice>
</xs:sequence> </xs:sequence>
<xs:attribute name="name" type="xs:ID" use="required"/> <xs:attribute name="name" type="xs:ID" use="required"/>