[Bps-public-commit] rt-extension-externalstorage-box branch, master, updated. 2d11967633b82ffa2d2724a1873f5de94a93cfb6

Shawn Moore shawn at bestpractical.com
Thu Sep 15 17:47:48 EDT 2016


The branch, master has been updated
       via  2d11967633b82ffa2d2724a1873f5de94a93cfb6 (commit)
       via  49b7bb04641e7eab446c2146d796d9314035afa4 (commit)
       via  2dc83c250869e60bb645243c90e0f2382b398fe0 (commit)
       via  11dff61faf7bc49f588c08d864a5566162584729 (commit)
      from  847a58aca7a33c2c79649849c7581df59b5c50f0 (commit)

Summary of changes:
 README                                  | 122 ++++++++++++++++++++++++++++++++
 lib/RT/Extension/ExternalStorage/Box.pm |  45 +++++++-----
 2 files changed, 149 insertions(+), 18 deletions(-)
 create mode 100644 README

- Log -----------------------------------------------------------------
commit 11dff61faf7bc49f588c08d864a5566162584729
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Sep 15 20:43:53 2016 +0000

    The usual place for keys is var/data/ (alongside gpg and smime)

diff --git a/lib/RT/Extension/ExternalStorage/Box.pm b/lib/RT/Extension/ExternalStorage/Box.pm
index a70f5d7..f6a5b99 100644
--- a/lib/RT/Extension/ExternalStorage/Box.pm
+++ b/lib/RT/Extension/ExternalStorage/Box.pm
@@ -196,8 +196,8 @@ Save your password where you put the client_id and client_secret!
 
 15.) create a directory for you private and public key in the rt4 install directory such as:
 
-	mkdir -p /opt/rt4/etc/keys
-	mv *.pem /opt/rt4/etc/keys/
+	mkdir -p /opt/rt4/var/data/box.com
+	mv *.pem /opt/rt4/var/data/box.com/
 
 16.) Under Settings >> Business Settings find the field "Enterprise ID" and copy that to your list of secrets.
 
@@ -209,7 +209,7 @@ Save your password where you put the client_id and client_secret!
 		Type => 'Box',
 		KeyId => "KEY ID FROM STEP 13",
 		EnterpriseId =>  'ENTERPRISE ID FROM STEP 16',
-		PrivateKey => "/opt/rt4/etc/keys/private_key.pem",
+		PrivateKey => "/opt/rt4/var/data/box.com/private_key.pem",
 		Password => "PASSWORD FROM STEP 11",
 		ClientId =>  "CLIENT ID FROM STEP 5",
 		ClientSecret => "CLIENT SECRET FROM STEP 5");

commit 2dc83c250869e60bb645243c90e0f2382b398fe0
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Sep 15 21:33:27 2016 +0000

    Setup instruction cleanup

diff --git a/lib/RT/Extension/ExternalStorage/Box.pm b/lib/RT/Extension/ExternalStorage/Box.pm
index f6a5b99..cc1df47 100644
--- a/lib/RT/Extension/ExternalStorage/Box.pm
+++ b/lib/RT/Extension/ExternalStorage/Box.pm
@@ -188,43 +188,46 @@ and the corresponding public:
 
 Save your password where you put the client_id and client_secret!
 
-12.) Copy and paste your public key into the "Public Key" box and click "Verify" and then "Save", you may have to enter your F2A credentials again after this.
+12.) Copy and paste your the contents of public_key.pem into the "Public Key" box and click "Verify" and then "Save", you may have to enter your F2A credentials again after this.
 
 13.) Copy the Key ID next to Public Key 1 to the same safe place you are keeping your other secrets.
 
 14.) At the bottom of the page click "Save Applications"
 
-15.) create a directory for you private and public key in the rt4 install directory such as:
+15.) create a directory for your private and public keys in the rt4 install directory such as:
 
 	mkdir -p /opt/rt4/var/data/box.com
 	mv *.pem /opt/rt4/var/data/box.com/
 
-16.) Under Settings >> Business Settings find the field "Enterprise ID" and copy that to your list of secrets.
+16.) Under Settings >> Business Settings (or https://app.box.com/master/settings) find the field "Enterprise ID" and copy that to your list of secrets.
 
 17.) Edit your RT_SiteConfig.pm file to enable the "Box" backend using the values you've saved in a safe place:
 
-	Plugin('RT::Extension::ExternalStorage');
+	Plugin('RT::Extension::ExternalStorage::Box');
 
 	Set(%ExternalStorage,
-		Type => 'Box',
-		KeyId => "KEY ID FROM STEP 13",
-		EnterpriseId =>  'ENTERPRISE ID FROM STEP 16',
-		PrivateKey => "/opt/rt4/var/data/box.com/private_key.pem",
-		Password => "PASSWORD FROM STEP 11",
-		ClientId =>  "CLIENT ID FROM STEP 5",
-		ClientSecret => "CLIENT SECRET FROM STEP 5");
+		Type         => 'Box',
+		KeyId        => 'KEY ID FROM STEP 13',
+		EnterpriseId => 'ENTERPRISE ID FROM STEP 16',
+		PrivateKey   => '/opt/rt4/var/data/box.com/private_key.pem',
+		Password     => 'PASSWORD FROM STEP 11',
+		ClientId     => 'CLIENT ID FROM STEP 5',
+		ClientSecret => 'CLIENT SECRET FROM STEP 5',
+	);
 
 18.) Trial run
 
-Assuming your private key is installed and readable by your webserver process you should now have the integration working.  Running:
+Assuming your private key is installed and readable by your webserver process you should now have the integration working.  If you're on RT 4.2, running:
 
 	/opt/rt4/local/plugins/RT-Extension-ExternalStorage/sbin/extract-attachments
 
-by hand should copy the large files out of the current database and migrate them to Box.com.
+or on RT 4.4, running:
+
+	/opt/rt4/sbin/sbin/rt-externalize-attachments
 
-19.) Add that script to a cron job such as:
+by hand should copy the large files out of the current database and migrate them to Box.com.
 
-	 0 0 * * * root /opt/rt4/local/plugins/RT-Extension-ExternalStorage/sbin/extract-attachments
+19.) Add the above script to a cron job, as described in the ExternalStorage documentation
 
 =head1 AUTHOR
 

commit 49b7bb04641e7eab446c2146d796d9314035afa4
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Sep 15 21:33:37 2016 +0000

    In 4.4, the Backend role doesn't have Extension:: in its namespace

diff --git a/lib/RT/Extension/ExternalStorage/Box.pm b/lib/RT/Extension/ExternalStorage/Box.pm
index cc1df47..3445f27 100644
--- a/lib/RT/Extension/ExternalStorage/Box.pm
+++ b/lib/RT/Extension/ExternalStorage/Box.pm
@@ -55,7 +55,13 @@ package RT::Extension::ExternalStorage::Box;
 our $VERSION = '0.01';
 
 use Role::Basic qw/with/;
-with 'RT::Extension::ExternalStorage::Backend';
+
+if ( RT::Handle::cmp_version($RT::VERSION,'4.4.0') >= 0 ){
+    with 'RT::ExternalStorage::Backend';
+}
+else {
+    with 'RT::Extension::ExternalStorage::Backend';
+}
 
 our ( $Box );
 

commit 2d11967633b82ffa2d2724a1873f5de94a93cfb6
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Sep 15 21:34:06 2016 +0000

    Version README

diff --git a/README b/README
new file mode 100644
index 0000000..2e3ffd6
--- /dev/null
+++ b/README
@@ -0,0 +1,122 @@
+NAME
+    RT::Extension::ExternalStorage::Box - Store attachments on box.com
+
+SETUP
+    1.) Signup for an account at box.
+
+    2.) Login to developer.box.com or
+    https://app.box.com/developers/services
+
+    3.) click Get Started if this is your first application
+
+    4.) create a unique name for your app, for example rt-myorganization
+
+    OAuth2 Parameters:
+
+    5.) copy client_id and client_secret somewhere safe for later use
+
+    6.) Add a redirect uri, it must be https, but need not exist. We won't
+    be using it anyways.
+
+    7.) under "Authentication Type" select "Server Authentication (OAuth2.0
+    with JWT)"
+
+    8.) under Scopes, Enterprise select:
+
+            * Manage app users
+
+    9.) Before you can enable Public Key Managment, under Settings >>
+    Security >>
+
+            * select "Login verification: Require 2-step verification for unrecognized logins"
+
+    10.) Go back to your app and under Public Key Management
+
+            * Select "Add Public Key"
+
+    11.) Using openssl, generate a public / private key pair in pem format
+    by either:
+
+             perl -Ilib -MStorage::Box::Auth -e 'Storage::Box::Auth->new->generate_keys("your_key_password_here")'
+
+    Or use openssl to generate a private rsa aes256 key of 2048 bytes long:
+
+            openssl genrsa -aes256 -out private_key.pem 2048
+
+    and the corresponding public:
+
+            openssl rsa -pubout -in private_key.pem -out public_key.pem
+
+    Save your password where you put the client_id and client_secret!
+
+    12.) Copy and paste your the contents of public_key.pem into the "Public
+    Key" box and click "Verify" and then "Save", you may have to enter your
+    F2A credentials again after this.
+
+    13.) Copy the Key ID next to Public Key 1 to the same safe place you are
+    keeping your other secrets.
+
+    14.) At the bottom of the page click "Save Applications"
+
+    15.) create a directory for your private and public keys in the rt4
+    install directory such as:
+
+            mkdir -p /opt/rt4/var/data/box.com
+            mv *.pem /opt/rt4/var/data/box.com/
+
+    16.) Under Settings >> Business Settings (or
+    https://app.box.com/master/settings) find the field "Enterprise ID" and
+    copy that to your list of secrets.
+
+    17.) Edit your RT_SiteConfig.pm file to enable the "Box" backend using
+    the values you've saved in a safe place:
+
+            Plugin('RT::Extension::ExternalStorage::Box');
+
+            Set(%ExternalStorage,
+                    Type         => 'Box',
+                    KeyId        => 'KEY ID FROM STEP 13',
+                    EnterpriseId => 'ENTERPRISE ID FROM STEP 16',
+                    PrivateKey   => '/opt/rt4/var/data/box.com/private_key.pem',
+                    Password     => 'PASSWORD FROM STEP 11',
+                    ClientId     => 'CLIENT ID FROM STEP 5',
+                    ClientSecret => 'CLIENT SECRET FROM STEP 5',
+            );
+
+    18.) Trial run
+
+    Assuming your private key is installed and readable by your webserver
+    process you should now have the integration working. If you're on RT
+    4.2, running:
+
+            /opt/rt4/local/plugins/RT-Extension-ExternalStorage/sbin/extract-attachments
+
+    or on RT 4.4, running:
+
+            /opt/rt4/sbin/sbin/rt-externalize-attachments
+
+    by hand should copy the large files out of the current database and
+    migrate them to Box.com.
+
+    19.) Add the above script to a cron job, as described in the
+    ExternalStorage documentation
+
+AUTHOR
+    Best Practical Solutions, LLC <modules at bestpractical.com>
+
+BUGS
+    All bugs should be reported via email to
+
+        L<bug-RT-Extension-ExternalStorage-Box at rt.cpan.org|mailto:bug-RT-Extension-ExternalStorage-Box at rt.cpan.org>
+
+    or via the web at
+
+        L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-ExternalStorage-Box>.
+
+COPYRIGHT
+    This extension is Copyright (C) 2016 Best Practical Solutions, LLC.
+
+    This is free software, licensed under:
+
+      The GNU General Public License, Version 2, June 1991
+

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list