From 61f46537a37c0c2de474d86ac4df14ce93feacc1 Mon Sep 17 00:00:00 2001 From: Michael Reifenberger Date: Sun, 10 Mar 2019 13:07:06 +0000 Subject: [PATCH] Add rubywarden (formerly known as bitwarden-ruby) a small, self-contained API server written in Ruby and Sinatra to provide a private backend for the open-source Bitwarden apps. This port follows the bitwarden-ruby port which was created and maintained by feld@ but doesnt try to manage all ruby dependencies. --- security/ruby-bitwarden/Makefile | 35 ++++++++++++ security/ruby-bitwarden/distinfo | 3 + security/ruby-bitwarden/files/pkg-message.in | 9 +++ .../ruby-bitwarden/files/rubywarden-api.in | 48 ++++++++++++++++ security/ruby-bitwarden/pkg-descr | 4 ++ security/ruby-bitwarden/pkg-plist | 56 +++++++++++++++++++ 6 files changed, 155 insertions(+) create mode 100644 security/ruby-bitwarden/Makefile create mode 100644 security/ruby-bitwarden/distinfo create mode 100644 security/ruby-bitwarden/files/pkg-message.in create mode 100644 security/ruby-bitwarden/files/rubywarden-api.in create mode 100644 security/ruby-bitwarden/pkg-descr create mode 100644 security/ruby-bitwarden/pkg-plist diff --git a/security/ruby-bitwarden/Makefile b/security/ruby-bitwarden/Makefile new file mode 100644 index 000000000000..34056c6842df --- /dev/null +++ b/security/ruby-bitwarden/Makefile @@ -0,0 +1,35 @@ +# Created by: Mark Felder +# $FreeBSD$ + +PORTNAME= rubywarden +DISTVERSION= 0.0.0.20190207 +CATEGORIES= security www + +MAINTAINER= mr@FreeBSD.org +COMMENT= Ruby implementation of the BitWarden API + +LICENSE= ISCL + +RUN_DEPENDS= rubygem-bundler>=1.16:sysutils/rubygem-bundler + +USES= sqlite +USE_RUBY= yes +RUBY_NO_BUILD_DEPENDS= yes + +USE_GITHUB= yes +GH_ACCOUNT= jcs +GH_TAGNAME= 5ba9f9821971942d082e327edcf7f02e8ad4c4a7 + +NO_ARCH= yes +NO_BUILD= yes + +USE_RC_SUBR= rubywarden-api +SUB_FILES= pkg-message +SUB_LIST+= RUBY_WITH_SUFFIX="${RUBY_WITH_SUFFIX}" + +do-install: + ${MKDIR} ${STAGEDIR}/${WWWDIR} + (cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}/${WWWDIR}) + +.include + diff --git a/security/ruby-bitwarden/distinfo b/security/ruby-bitwarden/distinfo new file mode 100644 index 000000000000..3599cf49a2fe --- /dev/null +++ b/security/ruby-bitwarden/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1552216607 +SHA256 (jcs-rubywarden-0.0.0.20190207-5ba9f9821971942d082e327edcf7f02e8ad4c4a7_GH0.tar.gz) = 6dce8c391480726200d1f7a9d2f1fad4fe435f25a0c96427b3782ba96a8adbc2 +SIZE (jcs-rubywarden-0.0.0.20190207-5ba9f9821971942d082e327edcf7f02e8ad4c4a7_GH0.tar.gz) = 38046 diff --git a/security/ruby-bitwarden/files/pkg-message.in b/security/ruby-bitwarden/files/pkg-message.in new file mode 100644 index 000000000000..c477066b8328 --- /dev/null +++ b/security/ruby-bitwarden/files/pkg-message.in @@ -0,0 +1,9 @@ +************************************************************************* + + After installation of this port you have to install the necessary + rubygem dependencies. + + Follow the instructions in %%WWWDIR%%/README.md + +************************************************************************* + diff --git a/security/ruby-bitwarden/files/rubywarden-api.in b/security/ruby-bitwarden/files/rubywarden-api.in new file mode 100644 index 000000000000..cc6327884a47 --- /dev/null +++ b/security/ruby-bitwarden/files/rubywarden-api.in @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Created by: Mark Felder +# $FreeBSD$ +# + +# PROVIDE: rubywarden-api +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# +# Add the following line to /etc/rc.conf to enable `rubywarden-api': +# +# rubywarden_api_enable="YES" + +. /etc/rc.subr +name=rubywarden_api + +rcvar=rubywarden_api_enable +load_rc_config ${name} + +: ${rubywarden_api_enable:=NO} +: ${rubywarden_api_port:=4567} +: ${rubywarden_api_signups:=NO} +: ${rubywarden_api_user:=www} +: ${rubywarden_api_group:=www} +: ${rubywarden_api_chdir=/usr/local/www/rubywarden} + +pidfile="/var/run/rubywarden/${name}.pid" +procname=%%RUBY_WITH_SUFFIX%% +command="%%PREFIX%%/bin/rackup" +command_args="-P ${pidfile} -p ${rubywarden_api_port} -E production config.ru 2>&1 | logger -t rubywarden &" +start_precmd="start_precmd" + +start_precmd() +{ + if [ ! -e /var/run/rubywarden ] ; then + install -d -o ${rubywarden_api_user} -g ${rubywarden_api_group} /var/run/rubywarden; + fi + + checkyesno rubywarden_api_signups + if [ "$?" -eq 0 ]; then + export ALLOW_SIGNUPS=1 + echo "Bitwarden Signups Enabled" + fi +} + +run_rc_command "$1" diff --git a/security/ruby-bitwarden/pkg-descr b/security/ruby-bitwarden/pkg-descr new file mode 100644 index 000000000000..efaa37ed2c79 --- /dev/null +++ b/security/ruby-bitwarden/pkg-descr @@ -0,0 +1,4 @@ +A small, self-contained API server written in Ruby and Sinatra to +provide a private backend for the open-source Bitwarden apps. + +WWW: https://github.com/jcs/rubywarden diff --git a/security/ruby-bitwarden/pkg-plist b/security/ruby-bitwarden/pkg-plist new file mode 100644 index 000000000000..426e8260caa2 --- /dev/null +++ b/security/ruby-bitwarden/pkg-plist @@ -0,0 +1,56 @@ +%%WWWDIR%%/.gitignore +%%WWWDIR%%/API.md +%%WWWDIR%%/AR-MIGRATE.md +%%WWWDIR%%/Gemfile +%%WWWDIR%%/Gemfile.lock +%%WWWDIR%%/LICENSE +%%WWWDIR%%/README.md +%%WWWDIR%%/Rakefile +%%WWWDIR%%/config.ru +%%WWWDIR%%/db/.gitkeep +%%WWWDIR%%/db/config.yml +%%WWWDIR%%/db/migrate/201803%%RUBY_SUFFIX%%145941_create_users.rb +%%WWWDIR%%/db/migrate/201803%%RUBY_SUFFIX%%151103_create_devices.rb +%%WWWDIR%%/db/migrate/201803%%RUBY_SUFFIX%%151113_create_folders.rb +%%WWWDIR%%/db/migrate/201803%%RUBY_SUFFIX%%151117_create_ciphers.rb +%%WWWDIR%%/db/migrate/20180518070354_set_default_value_for_favorite.rb +%%WWWDIR%%/db/migrate/20180818095054_create_attachments.rb +%%WWWDIR%%/db/migrate/20180818201731_user_kdf_iterations.rb +%%WWWDIR%%/db/migrate/20180818212323_add_user_kdf_type.rb +%%WWWDIR%%/lib/app.rb +%%WWWDIR%%/lib/attachment.rb +%%WWWDIR%%/lib/bitwarden.rb +%%WWWDIR%%/lib/cipher.rb +%%WWWDIR%%/lib/db.rb +%%WWWDIR%%/lib/dbmodel.rb +%%WWWDIR%%/lib/device.rb +%%WWWDIR%%/lib/folder.rb +%%WWWDIR%%/lib/helper.rb +%%WWWDIR%%/lib/helpers/attachment_helpers.rb +%%WWWDIR%%/lib/helpers/request_helpers.rb +%%WWWDIR%%/lib/routes/api.rb +%%WWWDIR%%/lib/routes/attachments.rb +%%WWWDIR%%/lib/routes/icons.rb +%%WWWDIR%%/lib/routes/identity.rb +%%WWWDIR%%/lib/rubywarden.rb +%%WWWDIR%%/lib/user.rb +%%WWWDIR%%/spec/attachment_spec.rb +%%WWWDIR%%/spec/bitwarden_importer_spec.rb +%%WWWDIR%%/spec/cipher_spec.rb +%%WWWDIR%%/spec/cipherstring_spec.rb +%%WWWDIR%%/spec/db_spec.rb +%%WWWDIR%%/spec/fixtures/bitwarden_export.csv +%%WWWDIR%%/spec/folder_spec.rb +%%WWWDIR%%/spec/icon_spec.rb +%%WWWDIR%%/spec/identity_spec.rb +%%WWWDIR%%/spec/spec_helper.rb +%%WWWDIR%%/spec/user_spec.rb +%%WWWDIR%%/tools/1password_import.rb +%%WWWDIR%%/tools/activate_totp.rb +%%WWWDIR%%/tools/bitwarden_import.rb +%%WWWDIR%%/tools/change_master_password.rb +%%WWWDIR%%/tools/keepass_import.rb +%%WWWDIR%%/tools/lastpass_import.rb +%%WWWDIR%%/tools/migrate_to_ar.rb +%%WWWDIR%%/tools/mitm.rb +@dir(www,www,0750) %%WWWDIR%%/db