├── dockerfile ├── vars.sh ├── init.sh ├── init-dc.sh ├── samba-provision.sh ├── init-fs.sh ├── Dockerfile └── samba-join.sh ├── .github └── workflows │ └── publish-to-docker-hub.yml ├── README.md ├── docker-compose.yml └── LICENSE /dockerfile/vars.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Variables 4 | DOMAIN_FQDN_LCASE=${DOMAIN_FQDN,,} 5 | DOMAIN_FQDN_UCASE=${DOMAIN_FQDN^^} 6 | DOMAIN_NETBIOS=${DOMAIN_FQDN_UCASE%%.*} 7 | 8 | CONFIG_DIR=/etc/samba/config 9 | CONFIG_FILE=$CONFIG_DIR/smb.conf 10 | DEFAULT_CONFIG_FILE=/etc/samba/smb.conf 11 | USERMAP_FILE=$CONFIG_DIR/user.map 12 | 13 | KERBEROS_CONFIG_FILE=/etc/krb5.conf -------------------------------------------------------------------------------- /dockerfile/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Call the vars script 4 | SCRIPT_PATH=$(dirname "$0") 5 | source "$SCRIPT_PATH"/vars.sh 6 | 7 | if [ -f "$CONFIG_FILE" ]; then 8 | 9 | # We assume Samba is provisioned. 10 | 11 | # Use the Kerberos configuration the provisioning tool created for us 12 | cp -f /var/lib/samba/private/krb5.conf /etc/krb5.conf 13 | 14 | # Create a link from the expected config file location to our custom location on the Docker host 15 | rm -f "$DEFAULT_CONFIG_FILE" 16 | ln -s "$CONFIG_FILE" "$DEFAULT_CONFIG_FILE" 17 | 18 | # Run Samba (blocking) 19 | exec samba --interactive --no-process-group 20 | 21 | else 22 | 23 | echo "No Samba config file found at: $CONFIG_FILE" 24 | echo "Please exec into the container and provision Samba by running the following commands:" 25 | echo " docker exec -it samba bash" 26 | echo " $SCRIPT_PATH/$PROVISION_SCRIPT" 27 | sleep infinity 28 | 29 | fi 30 | -------------------------------------------------------------------------------- /dockerfile/init-dc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Call the vars script 4 | SCRIPT_PATH=$(dirname "$0") 5 | source "$SCRIPT_PATH"/vars.sh 6 | 7 | # Set local variables 8 | PROVISION_SCRIPT=samba-provision.sh 9 | 10 | if [ -f "$CONFIG_FILE" ]; then 11 | 12 | # We assume Samba is provisioned. 13 | 14 | # Use the Kerberos configuration the provisioning tool created for us 15 | cp -f /var/lib/samba/private/krb5.conf "$KERBEROS_CONFIG_FILE" 16 | 17 | # Create a link from the expected config file location to our custom location on the Docker host 18 | rm -f "$DEFAULT_CONFIG_FILE" 19 | ln -s "$CONFIG_FILE" "$DEFAULT_CONFIG_FILE" 20 | 21 | # Run Samba (blocking) 22 | exec samba --interactive --no-process-group 23 | 24 | else 25 | 26 | echo "No Samba config file found at: $CONFIG_FILE" 27 | echo "Please exec into the container and provision Samba by running the following commands:" 28 | echo " docker exec -it samba bash" 29 | echo " $SCRIPT_PATH/$PROVISION_SCRIPT" 30 | sleep infinity 31 | 32 | fi 33 | -------------------------------------------------------------------------------- /dockerfile/samba-provision.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Call the vars script 6 | SCRIPT_PATH=$(dirname "$0") 7 | source "$SCRIPT_PATH"/vars.sh 8 | 9 | if [ -f "$CONFIG_FILE" ]; then 10 | 11 | echo "Samba config file found at: $CONFIG_FILE" 12 | echo "Samba seems to be provisioned already. Exiting." 13 | 14 | exit 1 15 | 16 | fi 17 | 18 | # Provision a new AD domain 19 | samba-tool domain provision --use-rfc2307 --server-role=dc --dns-backend=SAMBA_INTERNAL --realm="${DOMAIN_FQDN_UCASE}" --domain="${DOMAIN_NETBIOS}" --host-ip=${DC_IP} 20 | 21 | # Disable password expiry, etc. 22 | samba-tool domain passwordsettings set --history-length=0 23 | samba-tool domain passwordsettings set --min-pwd-age=0 24 | samba-tool domain passwordsettings set --max-pwd-age=0 25 | 26 | # smb.conf: replace the default DNS forwarder (127.0.0.11) with our main DNS server IP address 27 | sed -i "/dns forwarder/c\\\tdns forwarder = ${DNSFORWARDER}" "$DEFAULT_CONFIG_FILE" 28 | 29 | # smb.conf: disable NetBIOS 30 | sed -i "/\[global\]/a \\\tdisable netbios = yes" "$DEFAULT_CONFIG_FILE" 31 | 32 | # smb.conf: move the config created by the provisioning tool to our target directory 33 | mv "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE" 34 | -------------------------------------------------------------------------------- /dockerfile/init-fs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Call the vars script 4 | SCRIPT_PATH=$(dirname "$0") 5 | source "$SCRIPT_PATH"/vars.sh 6 | 7 | # Set local variables 8 | JOIN_SCRIPT=samba-join.sh 9 | 10 | # hosts: replace multiple entries with only one 11 | # Note: the file is mounted by Docker, so we cannot change its inode. We can, however, change its contents. 12 | cp -f /etc/hosts /etc/hosts.new 13 | sed -i "/\\s\\+${FS_NAME}/d" /etc/hosts.new 14 | echo -e "${FS_IP}\\t${FS_NAME}.${DOMAIN_FQDN_LCASE}\\t${FS_NAME}" >> /etc/hosts.new 15 | cp -f /etc/hosts.new /etc/hosts 16 | rm -f /etc/hosts.new 17 | 18 | if [ -f "$CONFIG_FILE" ]; then 19 | 20 | # We assume Samba is configured. 21 | 22 | # Create a link from the expected config file location to our custom location on the Docker host 23 | rm -f "$DEFAULT_CONFIG_FILE" 24 | ln -s "$CONFIG_FILE" "$DEFAULT_CONFIG_FILE" 25 | 26 | # Run supervisord (which in turn starts the Samba processes) 27 | exec /usr/bin/supervisord --nodaemon --configuration=/etc/supervisor/config/supervisord.conf 28 | 29 | else 30 | 31 | echo "No Samba config file found at: $CONFIG_FILE" 32 | echo "Please exec into the container and join a domain by running the following commands:" 33 | echo " docker exec -it samba bash" 34 | echo " $SCRIPT_PATH/$JOIN_SCRIPT" 35 | sleep infinity 36 | 37 | fi 38 | -------------------------------------------------------------------------------- /dockerfile/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 AS base 2 | 3 | # Silent install 4 | ARG DEBIAN_FRONTEND=noninteractive 5 | 6 | # Install packages 7 | RUN apt-get update && apt-get install -y \ 8 | acl \ 9 | attr \ 10 | samba \ 11 | smbclient \ 12 | krb5-config \ 13 | krb5-user \ 14 | libpam-krb5 \ 15 | winbind \ 16 | libnss-winbind \ 17 | libpam-winbind \ 18 | python3-setproctitle \ 19 | ldb-tools \ 20 | tini \ 21 | supervisor \ 22 | inetutils-ping \ 23 | dnsutils \ 24 | iproute2 \ 25 | nano \ 26 | && rm -rf /var/lib/apt/lists/* 27 | 28 | # Remove the default smb.conf 29 | RUN rm /etc/samba/smb.conf 30 | 31 | # Helper files 32 | RUN mkdir -p /usr/helpers 33 | COPY --chmod=755 vars.sh /usr/helpers/vars.sh 34 | 35 | # 36 | # Target stage for DCs 37 | # 38 | FROM base AS dc 39 | 40 | COPY --chmod=755 init-dc.sh /usr/helpers/init-dc.sh 41 | COPY --chmod=755 samba-provision.sh /usr/helpers/samba-provision.sh 42 | 43 | # Start Samba via Tini and our init script 44 | ENTRYPOINT ["/bin/tini", "--", "/usr/helpers/init-dc.sh"] 45 | 46 | # 47 | # Target stage for FSs 48 | # 49 | FROM base AS fs 50 | 51 | COPY --chmod=755 init-fs.sh /usr/helpers/init-fs.sh 52 | COPY --chmod=755 samba-join.sh /usr/helpers/samba-join.sh 53 | 54 | # Start Samba via Tini and our init script 55 | ENTRYPOINT ["/bin/tini", "--", "/usr/helpers/init-fs.sh"] 56 | -------------------------------------------------------------------------------- /.github/workflows/publish-to-docker-hub.yml: -------------------------------------------------------------------------------- 1 | name: Publish Docker image 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | push_to_registry: 9 | 10 | name: Push Docker image to Docker Hub 11 | runs-on: ubuntu-latest 12 | permissions: 13 | packages: write 14 | contents: read 15 | attestations: write 16 | id-token: write 17 | 18 | strategy: 19 | matrix: 20 | target: [dc, fs] 21 | 22 | steps: 23 | 24 | - name: Check out the repo 25 | uses: actions/checkout@v4 26 | 27 | - name: Extract metadata (tags, labels) for Docker 28 | id: meta 29 | uses: docker/metadata-action@v5 30 | with: 31 | images: ${{ vars.DOCKERHUB_IMAGE_BASE }}.${{ matrix.target }} 32 | tags: | 33 | type=semver,pattern={{version}} 34 | type=semver,pattern={{major}}.{{minor}} 35 | type=semver,pattern={{major}} 36 | type=sha 37 | 38 | - name: Set up QEMU 39 | uses: docker/setup-qemu-action@v3 40 | 41 | - name: Set up Docker Buildx 42 | uses: docker/setup-buildx-action@v3 43 | 44 | - name: Log in to Docker Hub 45 | uses: docker/login-action@v3 46 | with: 47 | username: ${{ secrets.DOCKERHUB_USERNAME }} 48 | password: ${{ secrets.DOCKERHUB_TOKEN }} 49 | 50 | - name: Build and push Docker image 51 | id: push 52 | uses: docker/build-push-action@v6 53 | with: 54 | context: dockerfile 55 | platforms: linux/amd64,linux/arm64 56 | target: ${{ matrix.target }} 57 | push: true 58 | tags: ${{ steps.meta.outputs.tags }} 59 | labels: ${{ steps.meta.outputs.labels }} 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Modern Samba Active Directory & File Server Docker Container Environment for Home Servers and Small Businesses 2 | 3 | There aren't many configurations for running a Samba Active Directory domain controller and a Samba file server in Docker containers. Those that I could find had so many issues that I decided to build my own configuration from scratch. 4 | 5 | ## Features 6 | 7 | - **Modern & secure** configuration based on Samba v4. 8 | - Easily **upgradable** to a new base OS and new Samba versions. 9 | - Bullet-proof **networking** with support for: 10 | - Forwarding of the AD DNS zone from the main DNS server to the Samba DC. 11 | - Forwarding from the Samba DC to the main DNS server. 12 | - Dynamic DNS updates of domain members. 13 | - Static external IP address (required for domain controllers). 14 | - Communication between container and host (normally isolated). 15 | - Separate containers for the AD domain controller and the file server as recommended by the Samba Wiki. 16 | - Samba Active Directory can be used as the **central user authentication system** by IAM tools like Authelia for single sign-on (SSO). 17 | - AD domain **provisioning** and member **join scripts**. 18 | - All data is stored outside the containers in bind-mounted Docker volumes so that the containers can be re-built at any time. 19 | - The file server container supports: 20 | - POSIX ACLs. 21 | - Windows permissions/ACLs. 22 | - If used with an unprivileged Docker container, the option `acl_xattr:security_acl_name = user.NTACL` must be set on shares ([docs](https://www.samba.org/samba/docs/current/man-html/vfs_acl_xattr.8.html)). 23 | - Windows ACLs require the following settings in `smb.conf`: 24 | - `vfs objects = acl_xattr` 25 | - `acl_xattr:ignore system acls = yes` 26 | - `map acl inherit = yes` 27 | - Access-based enumeration (ABE). 28 | - Samba recycle bin. 29 | 30 | ## Documentation 31 | 32 | Please see my [series of blog posts](https://helgeklein.com/blog/samba-active-directory-in-a-docker-container-installation-guide/) for instructions. The articles explain all aspects of the configuration in detail.- -------------------------------------------------------------------------------- /dockerfile/samba-join.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Call the vars script 6 | SCRIPT_PATH=$(dirname "$0") 7 | source "$SCRIPT_PATH"/vars.sh 8 | 9 | if [ -f "$CONFIG_FILE" ]; then 10 | 11 | echo "Samba config file found at: $CONFIG_FILE" 12 | echo "Samba seems to be configured already. Exiting." 13 | 14 | exit 1 15 | 16 | fi 17 | 18 | # krb5.conf: write the Kerberos configuration file 19 | echo "[libdefaults]" > "$KERBEROS_CONFIG_FILE" 20 | echo "default_realm = $DOMAIN_FQDN_UCASE" >> "$KERBEROS_CONFIG_FILE" 21 | echo "dns_lookup_realm = false" >> "$KERBEROS_CONFIG_FILE" 22 | echo "dns_lookup_kdc = true" >> "$KERBEROS_CONFIG_FILE" 23 | 24 | # smb.conf: write the Samba configuration file 25 | echo "[global]" > "$DEFAULT_CONFIG_FILE" 26 | echo " workgroup = ${DOMAIN_NETBIOS}" >> "$DEFAULT_CONFIG_FILE" 27 | echo " security = ADS" >> "$DEFAULT_CONFIG_FILE" 28 | echo " realm = ${DOMAIN_FQDN_UCASE}" >> "$DEFAULT_CONFIG_FILE" 29 | echo " idmap config * : backend = tdb" >> "$DEFAULT_CONFIG_FILE" 30 | echo " idmap config * : range = 3000-7999" >> "$DEFAULT_CONFIG_FILE" 31 | echo " idmap config ${DOMAIN_NETBIOS} : backend = rid" >> "$DEFAULT_CONFIG_FILE" 32 | echo " idmap config ${DOMAIN_NETBIOS} : range = 10000-999999" >> "$DEFAULT_CONFIG_FILE" 33 | echo " winbind use default domain = yes" >> "$DEFAULT_CONFIG_FILE" 34 | #echo " vfs objects = acl_xattr" >> "$DEFAULT_CONFIG_FILE" 35 | #echo " map acl inherit = yes" >> "$DEFAULT_CONFIG_FILE" 36 | #echo " acl_xattr:ignore system acls = yes" >> "$DEFAULT_CONFIG_FILE" # Without this, Windows ACL Editor shows Unix permissions in addition to Windows ACLs. 37 | echo " username map = ${USERMAP_FILE}" >> "$DEFAULT_CONFIG_FILE" 38 | echo " dedicated keytab file = /etc/krb5.keytab" >> "$DEFAULT_CONFIG_FILE" 39 | echo " kerberos method = secrets and keytab" >> "$DEFAULT_CONFIG_FILE" 40 | echo " winbind refresh tickets = yes" >> "$DEFAULT_CONFIG_FILE" 41 | 42 | # user.map: map the domain's Administrator account to the local root user 43 | echo "!root = ${DOMAIN_NETBIOS}\Administrator" > "$USERMAP_FILE" 44 | 45 | # If /var/lib/samba is a Docker bind mount the "private" directory needs to be created explicitly or the domain join fails 46 | if [ ! -d /var/lib/samba/private ]; then 47 | mkdir /var/lib/samba/private 48 | fi 49 | 50 | # Join the domain 51 | echo "Joining the domain ${DOMAIN_FQDN_LCASE}..." 52 | samba-tool domain join ${DOMAIN_FQDN_LCASE} MEMBER -U Administrator 53 | 54 | # smb.conf: move the config created/modified/used by the join tool to our target directory 55 | mv "$DEFAULT_CONFIG_FILE" "$CONFIG_FILE" 56 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | 3 | dc1: 4 | container_name: ${DC_NAME} 5 | hostname: ${DC_NAME} 6 | build: 7 | context: ./dockerfile 8 | target: dc 9 | restart: unless-stopped 10 | volumes: 11 | - /etc/localtime:/etc/localtime:ro 12 | - ./config-dc1:/etc/samba/config 13 | - ./data-dc1:/var/lib/samba 14 | environment: 15 | - DOMAIN_FQDN=${DOMAIN_FQDN} 16 | - DOMAIN_DN=${DOMAIN_DN} 17 | - DNSFORWARDER=${MAIN_DNS_IP} 18 | - DC_IP=${DC_IP} 19 | dns_search: 20 | - ${DOMAIN_FQDN} 21 | dns: 22 | - ${DC_IP} 23 | - ${MAIN_DNS_IP} 24 | extra_hosts: 25 | - ${DC_NAME}.${DOMAIN_FQDN}:${DC_IP} 26 | privileged: true # Run as true root. Required on a DC because the vfs_acl_xattr module is enabled automatically, which uses the security.* namespace (see https://www.samba.org/samba/docs/current/man-html/vfs_acl_xattr.8.html). 27 | networks: 28 | sambanet: 29 | ipv4_address: ${DC_IP} 30 | 31 | fs1: 32 | container_name: ${FS_NAME} 33 | hostname: ${FS_NAME} 34 | build: 35 | context: ./dockerfile 36 | target: fs 37 | restart: unless-stopped 38 | volumes: 39 | - /etc/localtime:/etc/localtime:ro 40 | - ./config-fs1/kerberos/krb5.conf:/etc/krb5.conf 41 | - ./config-fs1/kerberos/krb5.keytab:/etc/krb5.keytab 42 | - ./config-fs1/samba:/etc/samba/config 43 | - ./config-fs1/supervisor:/etc/supervisor/config:ro 44 | - ./data-fs1:/var/lib/samba 45 | - ./shares-fs1:/srv/samba 46 | environment: 47 | - DOMAIN_FQDN=${DOMAIN_FQDN} 48 | - DOMAIN_DN=${DOMAIN_DN} 49 | - FS_NAME=${FS_NAME} 50 | - FS_IP=${FS_IP} 51 | dns_search: 52 | - ${DOMAIN_FQDN} 53 | dns: 54 | - ${MAIN_DNS_IP} 55 | extra_hosts: 56 | - ${FS_NAME}.${DOMAIN_FQDN}:${FS_IP} 57 | # privileged: true # Run as true root. Required by Samba because it uses the security.* namespace (see https://www.samba.org/samba/docs/current/man-html/vfs_acl_xattr.8.html). 58 | networks: 59 | sambanet: 60 | ipv4_address: ${FS_IP} 61 | depends_on: 62 | - dc1 63 | 64 | networks: 65 | sambanet: 66 | driver: macvlan 67 | driver_opts: 68 | parent: ${HOST_INTERFACE} 69 | ipam: 70 | config: 71 | - subnet: "${SUBNET}" # Shared with the host 72 | gateway: "${GATEWAY}" # Same as on the host 73 | ip_range: "${CONTAINER_IP_RANGE}" # Tell Docker which IP addresses are available for containers 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------