diff --git a/Deploy/docker-compose.yml b/Deploy/docker-compose.yml index 0c03ae7b3..566a02938 100644 --- a/Deploy/docker-compose.yml +++ b/Deploy/docker-compose.yml @@ -5,7 +5,7 @@ log: ports: - 1514:514 registry: - image: library/registry:2.1.1 + image: library/registry:2.3.0 volumes: - /data/registry:/storage - ./config/registry/:/etc/registry/ diff --git a/License.txt b/LICENSE similarity index 100% rename from License.txt rename to LICENSE diff --git a/Notice.txt b/Notice.txt deleted file mode 100644 index b0f177166..000000000 --- a/Notice.txt +++ /dev/null @@ -1,11 +0,0 @@ -Harbor 0.1.0 Beta - -Copyright (c) 2016 VMware, Inc. All Rights Reserved. - -This product is licensed to you under the Apache License, Version 2.0 (the "License"). -You may not use this product except in compliance with the License. - -This product may include a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the subcomponent's license, as noted in the LICENSE file. \ No newline at end of file diff --git a/README.md b/README.md index fa16384ac..4e34c5fd8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # Harbor -Harbor is a project to provide enterprise capabilities for Docker Registry V2. It wraps the registry server to provide authorization and user interface. +Project Harbor is an enterprise-class registry server. It extends the open source Docker Registry server by adding more functionalities usually required by an enterprise. Harbor is designed to be deployed in a private environment of an organization. A private registry is important for organizations who care much about security. In addition, a private registry improves productivity by eliminating the need to download images from public network. This is very helpful to container users who do not have a good network to the Internet. In particular, Harbor accelerates the progress of Chinese developers, because they no longer need to pull images from the Internet. ### Features * **Role Based Access Control**: Users and docker repositories are organized via "projects", a user can have differernt permission for images under a namespace. -* **Convenient user interface**: User can easily browse, search docker repositories, manage projects/namepaces. -* **LDAP support**: harbor can easily integrate to the existing ldap of entreprise. -* **Audting**: All the access to the repositories hosted on Harbor are immediately recorded and can be used for auditing purpose. +* **Graphical user portal**: User can easily browse, search docker repositories, manage projects/namepaces. +* **AD/LDAP support**: Harbor integrates with existing AD/LDAP of enterprise for user authentication and management. +* **Audting**: All the operations to the repositories are tracked and can be used for auditing purpose. +* **Internationalization**: Localized for English and Chinese languages. More languages can be added. +* **RESTful API**: RESTful APIs are provided for most administrative operations of Harbor. The integration with other management software becomes easy. ### Try it Harbor is self contained and can be easily deployed via docker-compose. @@ -22,5 +24,5 @@ $ docker-compose up ``` ### License -Harbor is available under the [Apache 2 license](License.txt). +Harbor is available under the [Apache 2 license](LICENSE). diff --git a/service/notification.go b/service/notification.go index 745dc56fb..f686f26ec 100644 --- a/service/notification.go +++ b/service/notification.go @@ -17,6 +17,7 @@ package service import ( "encoding/json" + "regexp" "strings" "github.com/vmware/harbor/dao" @@ -31,7 +32,7 @@ type NotificationHandler struct { beego.Controller } -const mediaTypeManifest = "application/vnd.docker.distribution.manifest.v1+json" +const manifestPattern = `^application/vnd.docker.distribution.manifest.v\d\+json` // Post handles POST request, and records audit log or refreshes cache based on event. func (n *NotificationHandler) Post() { @@ -45,8 +46,14 @@ func (n *NotificationHandler) Post() { return } var username, action, repo, project string + var matched bool for _, e := range notification.Events { - if e.Target.MediaType == mediaTypeManifest && strings.HasPrefix(e.Request.UserAgent, "docker") { + matched, err = regexp.MatchString(manifestPattern, e.Target.MediaType) + if err != nil { + beego.Error("Failed to match the media type against pattern, error: %v", err) + matched = false + } + if matched && strings.HasPrefix(e.Request.UserAgent, "docker") { username = e.Actor.Name action = e.Action repo = e.Target.Repository