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/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 -->
<!--
<xs:complexType name="e_repomir_sync_proto">
@ -18,16 +27,23 @@
</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: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="domain" type="xs:token" minOccurs="1"/>
<xs:element name="port" minOccurs="0" type="t_net_port"/>
<xs:element name="path" minOccurs="1" type="t_unix_filepath"/>
<xs:element name="bwlimit" minOccurs="0" type="xs:positiveInteger"/>
</xs:all>

</xs:complexType>

</xs:schema>

View File

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

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

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

<xs:complexType name="t_unix_nixpass">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="passwordPlain">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<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:complexType name="t_unix_args">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="long" type="t_unix_arg"/>
<xs:element name="short" type="t_unix_arg"/>
</xs:choice>
</xs:complexType>

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

<xs:simpleType name="t_unix_posixUserGroup">
<!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
https://unix.stackexchange.com/a/435120/284004 -->
<xs:restriction base="xs:token">
<xs:pattern value="\s*[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}$)\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="t_unix_nixpass">
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element name="passwordPlain">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<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_shadowhash">
<!-- http://man7.org/linux/man-pages/man3/crypt.3.html#NOTES -->
<xs:restriction base="xs:token">
<xs:pattern value="\s*($1)?($[a-zA-Z0-9./]{1,16})$[a-zA-Z0-9./]{22}\s*"/><!-- md5 -->
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="t_unix_passwd_hashtypes">
<xs:restriction base="xs:string">
<xs:enumeration value="md5"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="t_unix_user">
<xs:sequence>
<xs:element name="password" minOccurs="0" maxOccurs="1" type="t_unix_nixpass"/>
<xs:element name="xGroup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<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>
<!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282 -->
<xs:simpleType name="t_unix_portablePosixFilename">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z0-9._-]+"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="t_unix_posixUserGroup">
<!-- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282
https://unix.stackexchange.com/a/435120/284004 -->
<xs:restriction base="xs:token">
<xs:pattern value="\s*[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}$)\s*"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>

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

<xs:complexType name="t_unix_user">
<xs:sequence>
<xs:element name="password" minOccurs="0" maxOccurs="1" type="t_unix_nixpass"/>
<xs:element name="xGroup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="t_unix_posixUserGroup" use="required"/>
<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>

View File

@ -19,7 +19,15 @@
<xs:complexType>
<xs:sequence minOccurs="1">
<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:sequence>
<xs:attribute name="name" type="xs:ID" use="required"/>