mirror of
https://github.com/aleho/onlyoffice-ce-docker-license.git
synced 2025-12-31 13:14:05 +01:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
697835396d | ||
|
|
73bd42b61b | ||
|
|
bd859cd0b1 | ||
|
|
ce96de1d2b | ||
|
|
f78cf9366c | ||
|
|
4418f05958 | ||
|
|
a6e7e5dc2a | ||
|
|
b9a687f4f9 | ||
|
|
b40abf44f3 | ||
|
|
1105492df0 | ||
|
|
3c264e164a | ||
|
|
ad729642be | ||
|
|
b0858e052f | ||
|
|
21a3f620a5 | ||
|
|
2b876e7729 | ||
|
|
4dbf466ea4 | ||
|
|
42d32196fa | ||
|
|
6f4181f51a | ||
|
|
4a19854542 | ||
|
|
a17ec8bbf7 | ||
|
|
fe1a3d4391 | ||
|
|
a1431337a4 | ||
|
|
86721ea9db |
25
.github/workflows/docker-image.yml
vendored
Normal file
25
.github/workflows/docker-image.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set version
|
||||
id: version
|
||||
run: echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
echo Building version ${{ steps.version.outputs.release_version }}...
|
||||
docker build . --file Dockerfile --tag alehoho/oo-ce-docker-license:${{ steps.version.outputs.release_version }}
|
||||
85
Dockerfile
85
Dockerfile
@@ -1,37 +1,66 @@
|
||||
ARG oo_version=5.5.0.165
|
||||
FROM onlyoffice/documentserver:$oo_version
|
||||
## Build stage
|
||||
ARG product_version=6.2.2
|
||||
ARG build_number=21
|
||||
ARG oo_root='/var/www/onlyoffice/documentserver'
|
||||
|
||||
FROM onlyoffice/documentserver:${product_version}.${build_number} as build-stage
|
||||
ARG product_version
|
||||
ARG build_number
|
||||
ARG oo_root
|
||||
|
||||
ENV PRODUCT_VERSION=${product_version}
|
||||
ENV BUILD_NUMBER=${build_number}
|
||||
|
||||
# Mobile apps patching
|
||||
ARG me_search='isSupportEditFeature:function(){return!1}'
|
||||
ARG me_patch='s/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g'
|
||||
|
||||
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/documenteditor/mobile/app.js \
|
||||
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/documenteditor/mobile/app.js
|
||||
|
||||
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js \
|
||||
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js
|
||||
|
||||
RUN grep -q "${me_search}" ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js \
|
||||
&& sed -si "${me_patch}" ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js
|
||||
|
||||
|
||||
RUN sed -is \
|
||||
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
|
||||
/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/mobile/app.js
|
||||
# Rebuild with license checks replaced
|
||||
ARG build_deps="git make g++ nodejs npm"
|
||||
RUN apt-get update && apt-get install -y ${build_deps}
|
||||
|
||||
RUN sed -is \
|
||||
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
|
||||
/var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/mobile/app.js
|
||||
|
||||
RUN sed -is \
|
||||
's/isSupportEditFeature:function(){return!1}/isSupportEditFeature:function(){return true}/g' \
|
||||
/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/mobile/app.js
|
||||
ARG tag=v${product_version}.${build_number}
|
||||
RUN mkdir /build \
|
||||
&& git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/build_tools.git /build/build_tools \
|
||||
&& git clone --quiet --branch $tag --depth 1 https://github.com/ONLYOFFICE/server.git /build/server
|
||||
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3-pip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip3 install pycryptodome
|
||||
WORKDIR /build/server
|
||||
|
||||
RUN npm install -g pkg grunt grunt-cli
|
||||
|
||||
COPY license.patch /build/
|
||||
RUN git apply /build/license.patch
|
||||
|
||||
RUN make \
|
||||
&& pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/FileConverter --targets=node10-linux -o /build/converter \
|
||||
&& pkg /build/build_tools/out/linux_64/onlyoffice/documentserver/server/DocService --targets=node10-linux --options max_old_space_size=4096 -o /build/docservice \
|
||||
&& cp /build/converter ${oo_root}/server/FileConverter/converter \
|
||||
&& cp /build/docservice ${oo_root}/server/DocService/docservice
|
||||
|
||||
|
||||
COPY license.py /tmp/
|
||||
RUN python3 /tmp/license.py
|
||||
## Prod image
|
||||
FROM onlyoffice/documentserver:${product_version}.${build_number}
|
||||
ARG oo_root
|
||||
|
||||
RUN pip3 uninstall -y pycryptodome \
|
||||
&& apt-get purge -y python3-pip \
|
||||
&& apt-get purge -y --autoremove \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build-stage ${oo_root}/web-apps/apps/documenteditor/mobile/app.js \
|
||||
${oo_root}/web-apps/apps/documenteditor/mobile/app.js
|
||||
COPY --from=build-stage ${oo_root}/web-apps/apps/presentationeditor/mobile/app.js \
|
||||
${oo_root}/web-apps/apps/presentationeditor/mobile/app.js
|
||||
COPY --from=build-stage ${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js \
|
||||
${oo_root}/web-apps/apps/spreadsheeteditor/mobile/app.js
|
||||
|
||||
|
||||
COPY run-oo.sh /usr/local/bin/run-oo.sh
|
||||
RUN chmod a+x /usr/local/bin/run-oo.sh
|
||||
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/run-oo.sh" ]
|
||||
COPY --from=build-stage ${oo_root}/server/FileConverter/converter \
|
||||
${oo_root}/server/FileConverter/converter
|
||||
COPY --from=build-stage ${oo_root}/server/DocService/docservice \
|
||||
${oo_root}/server/DocService/docservice
|
||||
|
||||
73
README.md
73
README.md
@@ -1,21 +1,78 @@
|
||||
# OnlyOffice Community server with license
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Podman CLI
|
||||
|
||||
```sh
|
||||
podman run \
|
||||
--name=onlyoffice \
|
||||
--detach \
|
||||
--publish=80:80 \
|
||||
docker.io/alehoho/oo-ce-docker-license
|
||||
```
|
||||
|
||||
### Docker CLI
|
||||
|
||||
```sh
|
||||
docker run \
|
||||
--name=onlyoffice \
|
||||
--detach \
|
||||
--publish=80:80 \
|
||||
alehoho/oo-ce-docker-license
|
||||
```
|
||||
|
||||
### docker-compose.yml
|
||||
|
||||
```yml
|
||||
services:
|
||||
onlyoffice:
|
||||
container_name: onlyoffice
|
||||
image: alehoho/oo-ce-docker-license
|
||||
ports:
|
||||
- "80"
|
||||
```
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
### Buildah CLI
|
||||
|
||||
```sh
|
||||
buildah build-using-dockerfile \
|
||||
--tag=onlyoffice-patched \
|
||||
https://github.com/aleho/onlyoffice-ce-docker-license.git
|
||||
```
|
||||
|
||||
### Docker CLI
|
||||
|
||||
```sh
|
||||
docker build \
|
||||
--tag=onlyoffice-patched \
|
||||
https://github.com/aleho/onlyoffice-ce-docker-license.git
|
||||
```
|
||||
|
||||
```sh
|
||||
docker run \
|
||||
--name=onlyoffice \
|
||||
--detach \
|
||||
--volume=$(pwd)/ooData:/var/www/onlyoffice/Data onlyoffice-patched \
|
||||
onlyoffice-patched
|
||||
|
||||
### docker-compose.yml
|
||||
|
||||
```yml
|
||||
services:
|
||||
onlyoffice:
|
||||
container_name: onlyoffice
|
||||
image: onlyoffice-patched
|
||||
build:
|
||||
context: https://github.com/aleho/onlyoffice-ce-docker-license.git
|
||||
…
|
||||
```
|
||||
|
||||
### Verify
|
||||
|
||||
To verify that the container is running successfully open
|
||||
`[server-url]/healthcheck` (has to return `true`) and for the version number open
|
||||
`[server-url]/web-apps/apps/api/documents/api.js` and check the header comment.
|
||||
|
||||
|
||||
## Background
|
||||
Recently, just about a month after Nextcloud announced their partnership with
|
||||
Ascensio and featuring a community version of OnlyOffice, the latter decided
|
||||
@@ -27,10 +84,10 @@ feature. Only after some outcries Ascensio deigned to release a statement and
|
||||
a new, albeit "limited", offer of €90 for home servers.
|
||||
|
||||
In my opinion these deceptive practices are unacceptable for a company
|
||||
advertising itself and their product as open source .
|
||||
advertising itself and their product as open source.
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
This repo is heavily inspired by the works of
|
||||
This repo was heavily inspired by the works of
|
||||
[Zegorax/OnlyOffice-Unlimited](https://github.com/Zegorax/OnlyOffice-Unlimited).
|
||||
|
||||
151
license.patch
Normal file
151
license.patch
Normal file
@@ -0,0 +1,151 @@
|
||||
From ae791a4d73a613138a2fee024e04bf8009032617 Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Hofbauer <alex@derhofbauer.at>
|
||||
Date: Sun, 27 Dec 2020 21:49:37 +0100
|
||||
Subject: [PATCH] Patch for license
|
||||
|
||||
---
|
||||
Common/sources/commondefines.js | 4 ++--
|
||||
Common/sources/constants.js | 2 +-
|
||||
Common/sources/license.js | 16 ++++++++--------
|
||||
DocService/sources/DocsCoServer.js | 5 +++--
|
||||
DocService/sources/server.js | 1 -
|
||||
FileConverter/sources/convertermaster.js | 1 -
|
||||
Makefile | 2 +-
|
||||
7 files changed, 15 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/Common/sources/commondefines.js b/Common/sources/commondefines.js
|
||||
index a57f353..78edbd3 100644
|
||||
--- a/Common/sources/commondefines.js
|
||||
+++ b/Common/sources/commondefines.js
|
||||
@@ -992,8 +992,8 @@ const c_oAscUnlockRes = {
|
||||
Empty: 2
|
||||
};
|
||||
|
||||
-const buildVersion = '4.1.2';
|
||||
-const buildNumber = 37;
|
||||
+const buildVersion = '6.2.2';
|
||||
+const buildNumber = 21;
|
||||
|
||||
exports.TaskQueueData = TaskQueueData;
|
||||
exports.CMailMergeSendData = CMailMergeSendData;
|
||||
diff --git a/Common/sources/constants.js b/Common/sources/constants.js
|
||||
index 2b79e02..738df37 100644
|
||||
--- a/Common/sources/constants.js
|
||||
+++ b/Common/sources/constants.js
|
||||
@@ -70,7 +70,7 @@ exports.LICENSE_RESULT = {
|
||||
ExpiredLimited: 11
|
||||
};
|
||||
|
||||
-exports.LICENSE_CONNECTIONS = 20;
|
||||
+exports.LICENSE_CONNECTIONS = 9999;
|
||||
exports.LICENSE_EXPIRE_USERS_ONE_DAY = 24 * 60 * 60; // day in seconds
|
||||
|
||||
exports.AVS_OFFICESTUDIO_FILE_UNKNOWN = 0x0000;
|
||||
diff --git a/Common/sources/license.js b/Common/sources/license.js
|
||||
index 19f0b61..43adc9b 100644
|
||||
--- a/Common/sources/license.js
|
||||
+++ b/Common/sources/license.js
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
const constants = require('./constants');
|
||||
|
||||
-const buildDate = '6/29/2016';
|
||||
+const buildDate = '2021-04-19T14:36:00.000Z';
|
||||
const oBuildDate = new Date(buildDate);
|
||||
|
||||
exports.readLicense = function*() {
|
||||
@@ -43,17 +43,17 @@ exports.readLicense = function*() {
|
||||
count: 1,
|
||||
type: c_LR.Success,
|
||||
light: false,
|
||||
- packageType: constants.PACKAGE_TYPE_OS,
|
||||
+ packageType: constants.PACKAGE_TYPE_I,
|
||||
mode: constants.LICENSE_MODE.None,
|
||||
branding: false,
|
||||
connections: constants.LICENSE_CONNECTIONS,
|
||||
- customization: false,
|
||||
+ customization: true,
|
||||
usersCount: 0,
|
||||
- usersExpire: constants.LICENSE_EXPIRE_USERS_ONE_DAY,
|
||||
- hasLicense: false,
|
||||
- plugins: false,
|
||||
+ usersExpire: new Date("2099-01-01T23:59:59.000Z").getTime() / 1000,
|
||||
+ hasLicense: true,
|
||||
+ plugins: true,
|
||||
buildDate: oBuildDate,
|
||||
- endDate: null
|
||||
+ endDate: "2099-01-01T23:59:59.000Z"
|
||||
};
|
||||
};
|
||||
-exports.packageType = constants.PACKAGE_TYPE_OS;
|
||||
+exports.packageType = constants.PACKAGE_TYPE_I;
|
||||
diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js
|
||||
index bd209ea..9151489 100644
|
||||
--- a/DocService/sources/DocsCoServer.js
|
||||
+++ b/DocService/sources/DocsCoServer.js
|
||||
@@ -103,6 +103,7 @@ const pubsubService = require('./pubsubRabbitMQ');
|
||||
const queueService = require('./../../Common/sources/taskqueueRabbitMQ');
|
||||
const rabbitMQCore = require('./../../Common/sources/rabbitMQCore');
|
||||
const activeMQCore = require('./../../Common/sources/activeMQCore');
|
||||
+const license = require('./../../Common/sources/license');
|
||||
|
||||
const editorDataStorage = require('./' + configCommon.get('services.CoAuthoring.server.editorDataStorage'));
|
||||
let cfgEditor = JSON.parse(JSON.stringify(config.get('editor')));
|
||||
@@ -162,7 +163,7 @@ let connections = []; // Активные соединения
|
||||
let lockDocumentsTimerId = {};//to drop connection that can't unlockDocument
|
||||
let pubsub;
|
||||
let queue;
|
||||
-let licenseInfo = {type: constants.LICENSE_RESULT.Error, light: false, branding: false, customization: false, plugins: false};
|
||||
+let licenseInfo = license.readLicense().next().value;
|
||||
let shutdownFlag = false;
|
||||
|
||||
const MIN_SAVE_EXPIRATION = 60000;
|
||||
@@ -2976,7 +2977,7 @@ exports.install = function(server, callbackFunction) {
|
||||
});
|
||||
};
|
||||
exports.setLicenseInfo = function(data) {
|
||||
- licenseInfo = data;
|
||||
+ logger.debug('Not updating license info', data)
|
||||
};
|
||||
exports.getLicenseInfo = function() {
|
||||
return licenseInfo;
|
||||
diff --git a/DocService/sources/server.js b/DocService/sources/server.js
|
||||
index b623759..29574bd 100644
|
||||
--- a/DocService/sources/server.js
|
||||
+++ b/DocService/sources/server.js
|
||||
@@ -129,7 +129,6 @@ try {
|
||||
} catch (e) {
|
||||
logger.warn('Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability');
|
||||
}
|
||||
-fs.watchFile(configCommon.get('license').get('license_file'), updateLicense);
|
||||
setInterval(updateLicense, 86400000);
|
||||
|
||||
// Если захочется использовать 'development' и 'production',
|
||||
diff --git a/FileConverter/sources/convertermaster.js b/FileConverter/sources/convertermaster.js
|
||||
index c246bb8..9fe3d41 100644
|
||||
--- a/FileConverter/sources/convertermaster.js
|
||||
+++ b/FileConverter/sources/convertermaster.js
|
||||
@@ -85,7 +85,6 @@ if (cluster.isMaster) {
|
||||
|
||||
updateLicense();
|
||||
|
||||
- fs.watchFile(configCommon.get('license').get('license_file'), updateLicense);
|
||||
setInterval(updateLicense, 86400000);
|
||||
} else {
|
||||
const converter = require('./converter');
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 40bf93e..1df9c10 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -83,7 +83,7 @@ DEBUG = $(BRANDING_DIR)/debug.js
|
||||
.PHONY: all clean install uninstall build-date
|
||||
|
||||
.NOTPARALLEL:
|
||||
-all: $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(CORE_FONTS) $(LICENSE) $(WELCOME) $(INFO) build-date
|
||||
+all: $(SCHEMA) $(LICENSE) $(WELCOME) $(INFO) build-date
|
||||
|
||||
build-date: $(GRUNT_FILES)
|
||||
sed "s|\(const buildVersion = \).*|\1'${PRODUCT_VERSION}';|" -i $(COMMON_DEFINES_JS)
|
||||
--
|
||||
2.30.2
|
||||
|
||||
87
license.py
87
license.py
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from Crypto.Hash import SHA, SHA256
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from Crypto.PublicKey import RSA
|
||||
from shutil import copyfile
|
||||
import json
|
||||
import codecs
|
||||
|
||||
|
||||
|
||||
def gen_keys():
|
||||
privKey = RSA.generate(1024)
|
||||
publKey = privKey.publickey().exportKey('PEM')
|
||||
|
||||
f = open("/var/www/onlyoffice/license_key.pub", "w+")
|
||||
f.write(publKey.decode('utf-8'))
|
||||
f.close()
|
||||
|
||||
return publKey, privKey
|
||||
|
||||
|
||||
|
||||
def write_license(publKey, privKey):
|
||||
license = {
|
||||
"branding": False,
|
||||
"connections": 9999,
|
||||
"customization": False,
|
||||
"end_date": "2099-01-01T23:59:59.000Z",
|
||||
"light": "False",
|
||||
"mode": "",
|
||||
"portal_count": "0",
|
||||
"process": 2,
|
||||
"ssbranding": False,
|
||||
"test": "False",
|
||||
"trial": "False",
|
||||
"user_quota": "0",
|
||||
"users_count": 9999,
|
||||
"users_expire": 99999,
|
||||
"whiteLabel": False,
|
||||
"customer_id": "customerID",
|
||||
"start_date": "2020-01-01T00:00:00.000Z",
|
||||
"users": [],
|
||||
"version": 2
|
||||
}
|
||||
|
||||
jsonData = codecs.encode(json.dumps(license, separators=(',', ':')), encoding='utf-8')
|
||||
|
||||
digest = SHA.new(jsonData)
|
||||
signer = PKCS1_v1_5.new(privKey)
|
||||
signature = signer.sign(digest)
|
||||
finalSignature = signature.hex()
|
||||
|
||||
license['signature'] = finalSignature
|
||||
|
||||
f = open("/var/www/onlyoffice/license.lic", "w+")
|
||||
f.write(json.dumps(license))
|
||||
f.close
|
||||
|
||||
|
||||
|
||||
def patch_files():
|
||||
basePath = "/var/www/onlyoffice/documentserver/server/"
|
||||
files = ["DocService/docservice", "FileConverter/converter"]
|
||||
|
||||
for file in files:
|
||||
f = open(basePath + file, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
replacedData = data.replace(b"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----", bytes(publKey))
|
||||
|
||||
f = open(basePath + file, 'wb')
|
||||
f.write(replacedData)
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
|
||||
print("Generating and exporting key pair...")
|
||||
publKey, privKey = gen_keys()
|
||||
|
||||
print("Writing license file...")
|
||||
write_license(publKey, privKey)
|
||||
|
||||
print("Patching document server and converter...")
|
||||
patch_files()
|
||||
Reference in New Issue
Block a user