Readium LCP 服务器存储库
As a retailer, public library or specialized e-distributor, you are distributing EPUB or PDF ebooks, audiobooks packaged using the LPF or RPF (.audiobook) formats, or comics packaged using the RPF (.divina) format. You want them protected by the Readium LCP DRM. Your CMS (Content Management system) already handles publications, users, purchases or loans, your technical team is able to integrate this CMS with a License server by creating a new http endpoint in the CMS and requesting the License Server via its REST interface, and this team is also able to compile and deploy a Go open-source codebase. If you are in this situation, this open-source codebase is made for you.
Using the tools provided in this project you can:
A detailed documentation is found in the Wiki pages of the project. You really have to read it before you start testing this application.
A new v2 codebase has been developed in the EDRLab GitHub space, lcp-server repository, and this new version has been sufficiently tested to now be ready for production. For existing users, moving from LCP Server v1 to v2 is not recommended in 2026. The two codebases are functionally equivalent, but there is no ETL (Extract Transform Load) procedure ready yet.
Binaries are only pre-built on demand and for a service fee, therefore in the general case you'll need to get a working Golang installation. Please refer to the official Go documentation for installation procedures at https://golang.org/.
This software is working with go 1.19 or higher. It is currently maintained using go 1.21 (February 2024).
You must put in place:
1/ the License Server, active in your intranet, not accessible from the Web, only accessible from your CMS via a REST API.
2/ the Status Server, accessible from the Web via a REST API, using https (you'll need to install a reverse proxy).
3/ a License Gateway, i.e. a piece of sofware you'll have to develop, which takes a request for an existing LCP license from a reading app, interrogates your database in order to get user information relative to this license, calls the License Server endpoint and returns this fresh LCP license back to the caller app (more information in the project Wiki).
4/ a large storage volume for encrypted publications. It can be either a file system accessible from the Web via HTTP URLs, or an S3 bucket. Note that publications are encrypted once: every license generated for such publication is pointing at the same encrypted file. Because these publications are stronlgy encrypted and the decryption key is secured in your SQL database, public access to these files is not problematic.
The servers require the setup of an SQL Database.
lcpserverand lsdserver processes require separate database names, i.e. separate SQLite files. Out of the box, this open-source software is using what we call the "basic" (or "test") LCP profile, i.e. a testing mode provided by the LCP open standard. Licenses generated with this "basic" profile are perfectly handled by reading applications based on Readium Mobile, as well as by Thorium Reader.
But this profile, because it is open, does not offer any security. Security is provided by a "production" profile, i.e. confidential crypto information and a personal X.509 certificate delivered to trusted implementers by EDRLab. EDRLab is the wordwide LCP Certification Authority. Licenses generated with the "production" profile are handled by any LCP compliant Reading System.
The server software is composed of several independant parts:
A command line utility for content encryption. This utility can be included in any processing pipeline.
lcpencrypt can:
A License server implements Readium Licensed Content Protection.
Its functionalities can only be accessed after client authentication.
Its private functionalities are:
A Status Server implements Readium License Status Document.
Its public functionalities are:
Its private functionalities (authentication required) are:
A Frontend Test Server is also provided in the project. This is a demo server we developed to provide a micro-CMS and a user interface for testing LCP licenses. It is active on https://front-prod.edrlab.org/frontend/. We do not consider it production ready, we don't update it (despite evolutions in node, npm, and the multiple node modules used a dependencies) and it will disappear in the next major version of the codebase. The Frontend Test Server MUST NOT be used in production.
This is why the installation of the Frontend Test Server is not described in the following instructions.
Assuming a working Go installation (go 1.16 or higher) ...
Simply use the go install command.
# fetch, build and install the different packages and their dependencies
go install github.com/readium/readium-lcp-server/lcpencrypt@latest
go install github.com/readium/readium-lcp-server/lcpserver@latest
go install github.com/readium/readium-lcp-server/lsdserver@latest"@latest" can be replaced by a specific version, e.g. "@V1.8.0" (warning: use a capital V).
You should now find the generated binaries in $GOPATH/bin:
lcpencrypt: the command line encryption tool,lcpserver: the license server,lsdserver: the status server.The project supports Go modules. Developers can therefore clone the codebase in the directory of their choice. This will be required to move the LCP Server to its production mode later.
Our recommendation is to use a structure like the one below:
|-
|-readium
|- readium-lcp-server // where the codebase is cloned
|- // see below, configuration
Move to the readium directory and use:
git clone https://github.com/readium/readium-lcp-server.git Then compile the code with:
cd readium-lcp-server
go build -o $GOPATH/bin ./lcpencrypt
go build -o $GOPATH/bin ./lcpserver
go build -o $GOPATH/bin ./lsdserverYou should now find the generated binaries in $GOPATH/bin (or $GOBIN if this environment variable is set).
Note: on a Linux Alpine server, the addition of the musl tag is required for building lcpserver.
go build -tags musl -o $GOPATH/bin ./lcpencryptYou must first install a GCC compiler in order to compile the SQLite module and to later move to "production mode". TDM-GCC gives great results.
Also, in the previous instructions, replace:
Our recommendation is to use a structure like the one below:
|-
|-readium
|- readium-lcp-server // where the codebase is cloned
|- config // where the configuration files and X509 certificates are maintained
|- db // where the sqlite database files are stored (if sqlite is used)
|- tmp // where temporary files are createdThe server is controlled by a yaml configuration file (e.g. "config.yaml") stored in a convenient folder, eg. /usr/local/var/lcp.
The License Server and Status Server will search their configuration file in the go bin directory by default; but the path to the file should be changed using an environment variable:
READIUM_LCPSERVER_CONFIG for the License serverREADIUM_LSDSERVER_CONFIG for the Status serverThe value of the each global variable is an absolute path to the configuration file for the given server. The two servers may share the same configuration file (useful if they are executed on the same server) or each server may get its own configuration file; this is your choice.
The LCP and LSD servers also require authenticated API requests for some of their functionalities. A password file formatted as an Apache "htpasswd" file is used for such authentication data. The htpasswd file format is of the form:
User:$apr1$OMWGq53X$Qf17b.ezwEM947Vrr/oTh0An example of password file generator is found here.
The password file may be shared between the LCP and LSD servers if the same credentials are used for both. The exact location and name of the file have no importance, as it will be referenced from the configuration file; but we recommand to name it htpasswd and place this file in the same folder as the configuration file, eg. /usr/local/var/lcp.
The License server requires an X509 certificate and its associated private key. The exact location and name of these files have no importance, as they will be referenced from the configuration file; but we recommand to keep the file name of the file provided by EDRLab and place these files in a subfolder of the previous one, eg. /usr/local/var/lcp/cert.
A test certificate (cert-edrlab-test.pem) and private key (privkey-edrlab-test.pem) are provided in the test/cert directory of the project. These files are be used as long as the LCP server is configured in test mode (profile = basic). They are replaced by a provider specific certificate and private key when the server is moved to its production mode.
A quick-start configuration meant only for test purposes is available in test/config.yaml. This file includes a default configuration for the the LCP, LSD and frontend servers.
/usr/local/var/lcptest/config.yaml file into LCP_HOME READIUM_*_CONFIG env variables, which must reference the configuration filecert, db,暂无开放 Issues,或尚未同步最近议题。