From 3e8b2056f19a5ffb79e768a80bc2614fc2bfb575 Mon Sep 17 00:00:00 2001 From: Al-waleed shihadeh Date: Thu, 28 Nov 2019 20:42:07 +0100 Subject: [PATCH 1/2] Add readme --- ReadMe.md | 91 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 1 + 2 files changed, 92 insertions(+) create mode 100644 ReadMe.md diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..b26a22a --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,91 @@ +```sh +____ _ ____ +| _ \ _ _| |__ _ _ / ___| ___ _ __ ___ ___ +| |_) | | | | '_ \| | | | | | _ / _ \ '_ ` _ \/ __| +| _ <| |_| | |_) | |_| | | |_| | __/ | | | | \__ \ +|_| \_\\__,_|_.__/ \__, | \____|\___|_| |_| |_|___/ + |___/ +``` +[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT) + +This project is built on top of [Geminabox](https://github.com/geminabox/geminabox) and provide the follwoing featuers for the gem server. + +- Protecting upload/delete web requests using ldap authentication. +- Generating API keys for the users. +- Protecting api call using ldap authentication or api keys. +- Manage ussers in three groups admin, maintainer and developer. + - developer is the default group and it has only read access. + - maintainer allow the users to push and delete their own gems only. + - admin allow users to push delete all gems. + +# Development Setup + + - Start the server + + ```sh + $> bundle install + $> STORE_FORMAT=yaml RACK_ENV=production rackup + ``` + + - Start rack console + + ```sh + $> STORE_FORMAT=yaml RACK_ENV=production bin/console + ``` + +# Ldap configs + ldap configs can be found under config/ldap.yml, you can either modfify the file or manage the configs using enviornment variables. + + ``` + production: &ldap_defaults + hostname: <%= ENV.fetch('LDAP_HOST', '127.0.0.1') %> + basedn: <%= ENV.fetch('LDAP_BASEDN', 'dc=shihadeh,dc=cloud') %> + rootdn: <%= ENV.fetch('LDAP_ROOTDN', 'cn=admin,dc=shihadeh,dc=cloud') %> + passdn: <%= ENV.fetch('LDAP_PASSDN', 'test1234') %> + scope: :subtree + auth: true + port: <%= ENV.fetch('LDAP_PORT', '389') %> + username_ldap_attribut: <%= ENV.fetch('LDAP_USERNAME_LDAP_ATTRIBUT', 'givenName') %> + ldap_group_base: <%= ENV.fetch('LDAP_LDAP_GROUP_BASE', 'ou=Groups,dc=shihadeh,dc=cloud') %> + ldap_group_filter: <%= ENV.fetch('LDAP_LDAP_GROUP_FILTER', '(&(objectClass=groupOfNames)(member={dn}))') %> + ldaps: false + starttls: false + tls_options: nil + ``` + +# Enviornment variables + - GEM_DATA_DIR_PATH : path to the data folder. + - STORE_FORMAT: either yaml or text (YAML::Store, PStore). + - LDAP_HOST: ldap ip or hostname + - LDAP_BASEDN + - LDAP_ROOTDN + - LDAP_PASSDN + - LDAP_PORT + - LDAP_USERNAME_LDAP_ATTRIBUT + - LDAP_LDAP_GROUP_BASE + - LDAP_LDAP_GROUP_FILTER + - RACK_ENV + - WEB_CONCURRENCY + - MAX_THREADS + - PORT + +# Middleware +- ApiKey +- HealthCheck : midiilware for supporting health check endpoints under `http://host/health` +- SignUp +- ApiGem +- WebRequestsLdapAuth + +# Docker + +- Build docker image + +``` +$> IMAGE_TAG=latest make build +``` + +- Start compleate stack (ldap server, admin ui and gems server) with docker-compose + +``` +docker-compose up -d +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 2a4b353..494a8af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ services: environment: - PORT=8080 - GEM_DATA_DIR_PATH=/application/data + - STORE_FORMAT=text - LDAP_HOST=ldap_server - LDAP_BASEDN=dc=shihadeh,dc=cloud - LDAP_ROOTDN=cn=admin,dc=shihadeh,dc=cloud From 60b9221e6de128e98abd2c0685b8622c9aedba13 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2019 19:44:22 +0000 Subject: [PATCH 2/2] Bump net-ldap from 0.15.0 to 0.16.0 Bumps [net-ldap](https://github.com/ruby-ldap/ruby-net-ldap) from 0.15.0 to 0.16.0. - [Release notes](https://github.com/ruby-ldap/ruby-net-ldap/releases) - [Changelog](https://github.com/ruby-ldap/ruby-net-ldap/blob/master/History.rdoc) - [Commits](https://github.com/ruby-ldap/ruby-net-ldap/compare/v0.15.0...v0.16.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 78d1875..27b6a7a 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source 'https://rubygems.org' gem 'geminabox', git: 'https://github.com/geminabox/geminabox.git', ref: '0d7bce1a26c534d8af2054c59a8db59e36c1d0ec' -gem 'net-ldap', '~> 0.15.0' +gem 'net-ldap', '~> 0.16.0' gem 'puma', '~> 4.3.0' gem 'rack-auth-ldap', git: 'https://github.com/Ultragreen/rack-auth-ldap.git', diff --git a/Gemfile.lock b/Gemfile.lock index a2f07e8..f41d173 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,7 +32,7 @@ GEM multipart-post (2.1.1) mustermann (1.0.3) nesty (1.0.2) - net-ldap (0.15.0) + net-ldap (0.16.0) nio4r (2.5.2) parallel (1.19.1) parser (2.6.5.0) @@ -70,7 +70,7 @@ PLATFORMS DEPENDENCIES geminabox! - net-ldap (~> 0.15.0) + net-ldap (~> 0.16.0) puma (~> 4.3.0) rack-auth-ldap! rack-console