diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..6e536c5071 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: go + +go: + - 1.5.3 + +go_import_path: github.com/vmware/harbor + +service: + - mysql + +env: GO15VENDOREXPERIMENT=1 DB_HOST=127.0.0.1 DB_PORT=3306 DB_USR=root DB_PWD= + +install: + - sudo apt-get update && sudo apt-get install -y libldap2-dev + - go get -d github.com/docker/distribution + - go get -d github.com/docker/libtrust + - go get -d github.com/go-sql-driver/mysql + - go get github.com/golang/lint/golint + - go get github.com/GeertJohan/fgt + +before_script: + # create tables and load data + - mysql < ./Deploy/db/registry.sql -uroot --verbose + +script: + - go list ./... | grep -v /vendor/ | xargs -L1 fgt golint + - go list ./... | grep -v 'vendor' | xargs -L1 go vet + - go list ./... | grep -v 'vendor' | xargs -L1 go test -v diff --git a/Deploy/docker-compose.yml b/Deploy/docker-compose.yml index 0c03ae7b3a..566a029381 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 b0f1771669..0000000000 --- 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 fa16384ac2..4e34c5fd83 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/auth/ldap/ldap.go b/auth/ldap/ldap.go index 6316f53273..bc24cb8fec 100644 --- a/auth/ldap/ldap.go +++ b/auth/ldap/ldap.go @@ -57,7 +57,6 @@ func (l *Auth) Authenticate(m models.AuthModel) (*models.User, error) { if err != nil { return nil, err } - defer ldap.Close() ldap.SetOption(openldap.LDAP_OPT_PROTOCOL_VERSION, openldap.LDAP_VERSION3) @@ -73,6 +72,7 @@ func (l *Auth) Authenticate(m models.AuthModel) (*models.User, error) { if err != nil { return nil, err } + defer ldap.Close() scope := openldap.LDAP_SCOPE_SUBTREE // LDAP_SCOPE_BASE, LDAP_SCOPE_ONELEVEL, LDAP_SCOPE_SUBTREE filter := "objectClass=*" diff --git a/service/notification.go b/service/notification.go index 745dc56fb1..7da62cb2d3 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: ", err) + matched = false + } + if matched && strings.HasPrefix(e.Request.UserAgent, "docker") { username = e.Actor.Name action = e.Action repo = e.Target.Repository diff --git a/views/reset-password-mail.tpl b/views/reset-password-mail.tpl index e79cdfddb9..1bc5370c03 100644 --- a/views/reset-password-mail.tpl +++ b/views/reset-password-mail.tpl @@ -16,6 +16,6 @@
{{.Hint}}:
- {{.Url}}/resetPassword?reset_uuid={{.Uuid}} + {{.URL}}/resetPassword?reset_uuid={{.UUID}} \ No newline at end of file