From c590b026d64076b6eb47c67352684de18527c175 Mon Sep 17 00:00:00 2001 From: Willy Reyno Date: Mon, 1 Jun 2020 11:15:55 +0200 Subject: [PATCH 01/16] Added warning for URLRequest and service named app A docker-compose service named "app" will systematically return a blank PDF when using `URLRequest()`. Added a warning to recommend people to rename their service if it's named "app". --- docs/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 1ad30e01..54f5e121 100755 --- a/docs/index.html +++ b/docs/index.html @@ -972,7 +972,11 @@ $request->setMargins(Request::NO_MARGINS); $dest = 'result.pdf'; $client->store($request, $dest); - + +
+

Attention: If your docker-compose service is named app, you will have to rename it. URLRequest returns a blank page due to Chrome not handling http://app URL.

+
+

Custom HTTP headers

@@ -1778,4 +1782,4 @@ restart your Gotenberg instances from time to time to ensure a nominal behaviour - \ No newline at end of file + From 24cbe98ac2b8161eaa09c231f991b7f37f5470ff Mon Sep 17 00:00:00 2001 From: Tom van den Berg Date: Mon, 1 Jun 2020 15:31:36 +0200 Subject: [PATCH 02/16] Add feature to have chrome ignore certificate errors when printing using an URL. --- cmd/gotenberg/main.go | 2 +- internal/pkg/chrome/chrome.go | 19 ++++++++++++------- internal/pkg/conf/conf.go | 19 +++++++++++++++++++ test/cmd/chrome.go | 2 +- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/cmd/gotenberg/main.go b/cmd/gotenberg/main.go index 4759d7d6..c9fa4e0b 100644 --- a/cmd/gotenberg/main.go +++ b/cmd/gotenberg/main.go @@ -28,7 +28,7 @@ func main() { systemLogger.DebugOpf(op, "configuration: %+v", config) if !config.DisableGoogleChrome() { // start Google Chrome headless. - if err := chrome.Start(systemLogger); err != nil { + if err := chrome.Start(systemLogger, config.IgnoreCertificateErrors()); err != nil { systemLogger.FatalOp(op, err) } } diff --git a/internal/pkg/chrome/chrome.go b/internal/pkg/chrome/chrome.go index a2250cfc..adf9a03f 100644 --- a/internal/pkg/chrome/chrome.go +++ b/internal/pkg/chrome/chrome.go @@ -16,11 +16,11 @@ import ( ) // Start starts Google Chrome headless in background. -func Start(logger xlog.Logger) error { +func Start(logger xlog.Logger, urlIgnoreCertificateErrors bool) error { const op string = "chrome.Start" logger.DebugOp(op, "starting new Google Chrome headless process on port 9222...") resolver := func() error { - cmd, err := cmd(logger) + cmd, err := cmd(logger, urlIgnoreCertificateErrors) if err != nil { return err } @@ -32,7 +32,7 @@ func Start(logger xlog.Logger) error { // if the process failed to start correctly, // we have to restart it. if !isViable(logger) { - return restart(logger, cmd.Process) + return restart(logger, cmd.Process, urlIgnoreCertificateErrors) } return nil } @@ -42,7 +42,7 @@ func Start(logger xlog.Logger) error { return nil } -func cmd(logger xlog.Logger) (*exec.Cmd, error) { +func cmd(logger xlog.Logger, urlIgnoreCertificateErrors bool) (*exec.Cmd, error) { const op string = "chrome.cmd" binary := "google-chrome-stable" args := []string{ @@ -66,6 +66,11 @@ func cmd(logger xlog.Logger) (*exec.Cmd, error) { "--mute-audio", "--no-first-run", } + + if urlIgnoreCertificateErrors { + args = append(args, "--ignore-certificate-errors") + } + cmd, err := xexec.Command(logger, binary, args...) if err != nil { return nil, xerror.New(op, err) @@ -93,7 +98,7 @@ func kill(logger xlog.Logger, proc *os.Process) error { return nil } -func restart(logger xlog.Logger, proc *os.Process) error { +func restart(logger xlog.Logger, proc *os.Process, urlIgnoreCertificateErrors bool) error { const op string = "chrome.restart" logger.DebugOp(op, "restarting Google Chrome headless process using port 9222...") resolver := func() error { @@ -101,7 +106,7 @@ func restart(logger xlog.Logger, proc *os.Process) error { if err := kill(logger, proc); err != nil { return err } - cmd, err := cmd(logger) + cmd, err := cmd(logger, urlIgnoreCertificateErrors) if err != nil { return err } @@ -113,7 +118,7 @@ func restart(logger xlog.Logger, proc *os.Process) error { // if the process failed to restart correctly, // we have to restart it again. if !isViable(logger) { - return restart(logger, cmd.Process) + return restart(logger, cmd.Process, urlIgnoreCertificateErrors) } return nil } diff --git a/internal/pkg/conf/conf.go b/internal/pkg/conf/conf.go index 45d1bce1..73757f2d 100644 --- a/internal/pkg/conf/conf.go +++ b/internal/pkg/conf/conf.go @@ -40,6 +40,8 @@ const ( // DefaultGoogleChromeRpccBufferSizeEnvVar contains the name // of the environment variable "DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE". DefaultGoogleChromeRpccBufferSizeEnvVar string = "DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE" + // Allow self signed certificates when using a remote url + URLIgnoreCertificateErrorsEnvVar string = "URL_IGNORE_CERTIFICATE_ERRORS" ) // Config contains the application @@ -53,6 +55,7 @@ type Config struct { defaultListenPort int64 disableGoogleChrome bool disableUnoconv bool + urlIgnoreCertificateErrors bool logLevel xlog.Level rootPath string maximumGoogleChromeRpccBufferSize int64 @@ -75,6 +78,7 @@ func DefaultConfig() Config { rootPath: "/", maximumGoogleChromeRpccBufferSize: 104857600, // ~100 MB defaultGoogleChromeRpccBufferSize: 1048576, // 1 MB + urlIgnoreCertificateErrors: false, } } @@ -188,6 +192,14 @@ func FromEnv() (Config, error) { if err != nil { return c, err } + urlIgnoreCertificateErrors, err := xassert.BoolFromEnv( + URLIgnoreCertificateErrorsEnvVar, + c.urlIgnoreCertificateErrors, + ) + c.urlIgnoreCertificateErrors = urlIgnoreCertificateErrors + if err != nil { + return c, err + } return c, nil } result, err := resolver() @@ -274,3 +286,10 @@ func (c Config) MaximumGoogleChromeRpccBufferSize() int64 { func (c Config) DefaultGoogleChromeRpccBufferSize() int64 { return c.defaultGoogleChromeRpccBufferSize } + +// IgnoreCertificateErrors returns true if +// Google Chrome should ignore certificate errors +// in case of self signed certificates for example. +func (c Config) IgnoreCertificateErrors() bool { + return c.urlIgnoreCertificateErrors +} diff --git a/test/cmd/chrome.go b/test/cmd/chrome.go index 73d96474..ad5e5e7c 100644 --- a/test/cmd/chrome.go +++ b/test/cmd/chrome.go @@ -14,7 +14,7 @@ func main() { systemLogger.FatalOp(op, err) } // start Google Chrome headless. - if err := chrome.Start(systemLogger); err != nil { + if err := chrome.Start(systemLogger, config.IgnoreCertificateErrors()); err != nil { systemLogger.FatalOp(op, err) } } From 1e6926ee2dde094b384c458173cdeee0cf15ac94 Mon Sep 17 00:00:00 2001 From: Tom van den Berg Date: Tue, 2 Jun 2020 16:06:17 +0200 Subject: [PATCH 03/16] Add ignoreCertificateErrors tests + docs --- .../docs/content/03-environment-variables.md | 4 ++ docs/index.html | 22 +++++++---- internal/pkg/conf/conf_test.go | 38 +++++++++++++++++++ 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/build/docs/content/03-environment-variables.md b/build/docs/content/03-environment-variables.md index b1522740..61ef06b4 100644 --- a/build/docs/content/03-environment-variables.md +++ b/build/docs/content/03-environment-variables.md @@ -58,6 +58,10 @@ The hard limit is 100 MB and is defined by Google Chrome itself. > The default Google Chrome rpcc buffer size may also be overridden per request thanks to the form field `googleChromeRpccBufferSize`. > See the [rpcc buffer size section](#html.rpcc_buffer_size). +## Ignore certificate errors + +By default Chrome will not accept certificate errors when using the URL print method. Setting this environment variable to `"1"` will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production. + ## Disable LibreOffice (unoconv) You may also disable LibreOffice (unoconv) with `DISABLE_UNOCONV`. diff --git a/docs/index.html b/docs/index.html index 1ad30e01..f09933dc 100755 --- a/docs/index.html +++ b/docs/index.html @@ -167,14 +167,14 @@ $ make publish GOTENBERG_USER_GID=You may also add it in your Docker Compose stack:

-
version: '3'
+
version: '3'
 
-services:
+services:
 
   # your other services
 
-  gotenberg:
-    image: thecodingmachine/gotenberg:6
+  gotenberg:
+    image: thecodingmachine/gotenberg:6
 
@@ -332,6 +332,12 @@ The hard limit is 100 MB and is defined by Google Chrome itself.

See the rpcc buffer size section.

+

Ignore certificate errors

+ +

By default the chrome instance will not accept certificate errors when using the URL print method. Setting this environment variable to "1" will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production.

+

Disable LibreOffice (unoconv)

@@ -1700,14 +1706,14 @@ if the API is under heavy load.

For instance, using the following Docker Compose file:

-
version: '3'
+
version: '3'
 
-services:
+services:
 
   # your other services
 
-  gotenberg:
-    image: thecodingmachine/gotenberg:6
+  gotenberg:
+    image: thecodingmachine/gotenberg:6
 

You may now launch your services using:

diff --git a/internal/pkg/conf/conf_test.go b/internal/pkg/conf/conf_test.go index 678ac2aa..b7855023 100644 --- a/internal/pkg/conf/conf_test.go +++ b/internal/pkg/conf/conf_test.go @@ -380,6 +380,43 @@ func TestDefaultGoogleChromeRpccBufferSizeFromEnv(t *testing.T) { os.Unsetenv(DefaultGoogleChromeRpccBufferSizeEnvVar) } +func TestIgnoreCertificateErrorsFromEnv(t *testing.T) { + var ( + expected Config + result Config + err error + ) + // URL_IGNORE_CERTIFICATE_ERRORS correctly set to true. + os.Setenv(URLIgnoreCertificateErrorsEnvVar, "1") + expected = DefaultConfig() + expected.urlIgnoreCertificateErrors = true + result, err = FromEnv() + assert.Nil(t, err) + assert.Equal(t, expected, result) + os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) + // URL_IGNORE_CERTIFICATE_ERRORS correctly set to false. + os.Setenv(URLIgnoreCertificateErrorsEnvVar, "0") + expected = DefaultConfig() + expected.urlIgnoreCertificateErrors = false + result, err = FromEnv() + assert.Nil(t, err) + assert.Equal(t, expected, result) + os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) + // URL_IGNORE_CERTIFICATE_ERRORS wrongly set. + os.Setenv(URLIgnoreCertificateErrorsEnvVar, "foo") + expected = DefaultConfig() + result, err = FromEnv() + test.AssertError(t, err) + assert.Equal(t, expected, result) + os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) + // URL_IGNORE_CERTIFICATE_ERRORS not set at all. + expected = DefaultConfig() + expected.urlIgnoreCertificateErrors = false + result, err = FromEnv() + assert.Nil(t, err) + assert.Equal(t, expected, result) +} + func TestGetters(t *testing.T) { result := DefaultConfig() assert.Equal(t, result.maximumWaitTimeout, result.MaximumWaitTimeout()) @@ -394,4 +431,5 @@ func TestGetters(t *testing.T) { assert.Equal(t, result.rootPath, result.RootPath()) assert.Equal(t, result.maximumGoogleChromeRpccBufferSize, result.MaximumGoogleChromeRpccBufferSize()) assert.Equal(t, result.defaultGoogleChromeRpccBufferSize, result.DefaultGoogleChromeRpccBufferSize()) + assert.Equal(t, result.urlIgnoreCertificateErrors, result.IgnoreCertificateErrors()) } From dbdf8871cc2ce2e55c6525bd7485882aff6a8637 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 09:19:12 +0200 Subject: [PATCH 04/16] tini no more writeable by gotenberg user --- build/package/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/package/Dockerfile b/build/package/Dockerfile index 09a8f9af..67a686d2 100644 --- a/build/package/Dockerfile +++ b/build/package/Dockerfile @@ -10,7 +10,7 @@ FROM thecodingmachine/gotenberg:workspace AS workspace ARG VERSION ENV GOOS=linux \ - GOARCH=amd64 \ + GOARCH=amd64 \ CGO_ENABLED=0 # Define our workding outside of $GOPATH (we're using go modules). @@ -42,7 +42,7 @@ LABEL authors="Julien Neuhart " ARG TINI_VERSION -ADD --chown=gotenberg https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static /tini +ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static /tini RUN chmod +x /tini ENTRYPOINT [ "/tini", "--" ] From f86091382fd533b7e385ab4681347662cd3328c8 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 09:19:31 +0200 Subject: [PATCH 05/16] updating dependencies --- go.mod | 13 ++++++------- go.sum | 27 ++++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 2199c0a1..0bd876df 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.14 require ( github.com/dustin/go-humanize v1.0.0 - github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect github.com/kr/text v0.2.0 // indirect github.com/labstack/echo/v4 v4.1.16 github.com/labstack/gommon v0.3.0 @@ -15,13 +14,13 @@ require ( github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 github.com/russross/blackfriday/v2 v2.0.1 github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect - github.com/sirupsen/logrus v1.5.0 - github.com/stretchr/testify v1.5.1 - golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79 // indirect - golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 // indirect + github.com/sirupsen/logrus v1.6.0 + github.com/stretchr/testify v1.6.0 + golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 // indirect + golang.org/x/net v0.0.0-20200602114024-627f9648deb9 // indirect golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a - golang.org/x/sys v0.0.0-20200501052902-10377860bb8e // indirect + golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 // indirect golang.org/x/text v0.3.2 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect - gopkg.in/yaml.v2 v2.2.8 // indirect + gopkg.in/yaml.v3 v3.0.0-20200603094226-e3079894b1e8 // indirect ) diff --git a/go.sum b/go.sum index fbdf8826..19259e66 100644 --- a/go.sum +++ b/go.sum @@ -10,7 +10,6 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -43,13 +42,13 @@ github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q= -github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho= +github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= @@ -59,15 +58,15 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79 h1:IaQbIIB2X/Mp/DKctl6ROxz1KyMlKp4uyvL6+kQ7C88= -golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM= +golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= +golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= @@ -80,8 +79,8 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e h1:hq86ru83GdWTlfQFZGO4nZJTU4Bs2wfHl8oFHRaXsfc= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y= +golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -96,5 +95,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200603094226-e3079894b1e8 h1:jL/vaozO53FMfZLySWM+4nulF3gQEC6q5jH90LPomDo= +gopkg.in/yaml.v3 v3.0.0-20200603094226-e3079894b1e8/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From b25456835a412fdfca6b4f8706d495fb7773f433 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 11:52:17 +0200 Subject: [PATCH 06/16] sanitizing filename parameter of toHTML function --- internal/pkg/printer/markdown.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pkg/printer/markdown.go b/internal/pkg/printer/markdown.go index 97f5d797..bbbeea7b 100644 --- a/internal/pkg/printer/markdown.go +++ b/internal/pkg/printer/markdown.go @@ -3,15 +3,14 @@ package printer import ( "bytes" "fmt" - "html/template" - "io/ioutil" - "path/filepath" - "github.com/microcosm-cc/bluemonday" "github.com/russross/blackfriday/v2" "github.com/thecodingmachine/gotenberg/internal/pkg/xerror" "github.com/thecodingmachine/gotenberg/internal/pkg/xlog" "github.com/thecodingmachine/gotenberg/internal/pkg/xrand" + "html/template" + "io/ioutil" + "path/filepath" ) // NewMarkdownPrinter returns a Printer which @@ -58,6 +57,7 @@ type templateData struct { func markdownToHTML(dirPath, filename string) (template.HTML, error) { const op string = "printer.markdownToHTML" + filename = filepath.Base(filename) fpath := fmt.Sprintf("%s/%s", dirPath, filename) b, err := ioutil.ReadFile(fpath) if err != nil { From 5540438595d8414b34bf3a026bc502204fcb28c7 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 12:00:57 +0200 Subject: [PATCH 07/16] adding missing comment from previous commit --- internal/pkg/printer/markdown.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/pkg/printer/markdown.go b/internal/pkg/printer/markdown.go index bbbeea7b..4bffdcce 100644 --- a/internal/pkg/printer/markdown.go +++ b/internal/pkg/printer/markdown.go @@ -57,6 +57,7 @@ type templateData struct { func markdownToHTML(dirPath, filename string) (template.HTML, error) { const op string = "printer.markdownToHTML" + // avoid directory traversal. filename = filepath.Base(filename) fpath := fmt.Sprintf("%s/%s", dirPath, filename) b, err := ioutil.ReadFile(fpath) From 542fe18dcd9ba8c6af07a580cff024c7052aae64 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 12:06:01 +0200 Subject: [PATCH 08/16] avoir directory traversal when uploading a file --- internal/app/xhttp/pkg/context/context.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/app/xhttp/pkg/context/context.go b/internal/app/xhttp/pkg/context/context.go index 9e5fd11c..b0ddb7c4 100644 --- a/internal/app/xhttp/pkg/context/context.go +++ b/internal/app/xhttp/pkg/context/context.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" "time" + "path/filepath" "github.com/labstack/echo/v4" "github.com/thecodingmachine/gotenberg/internal/app/xhttp/pkg/resource" @@ -106,7 +107,9 @@ func (ctx *Context) WithResource(directoryName string) error { return r, err } defer in.Close() // nolint: errcheck - if err := r.WithFile(fh.Filename, in); err != nil { + // avoid directory traversal. + filename := filepath.Base(fh.Filename) + if err := r.WithFile(filename, in); err != nil { return r, err } } From 8a218a66260805a6bc1b5ab6b8d3f81aee82df60 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 15:05:27 +0200 Subject: [PATCH 09/16] using a (more) random directory name for user profile tmp dir + improving performance with a go routine --- internal/pkg/printer/office.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/pkg/printer/office.go b/internal/pkg/printer/office.go index 79f66e93..52fffa56 100644 --- a/internal/pkg/printer/office.go +++ b/internal/pkg/printer/office.go @@ -94,13 +94,14 @@ func (p officePrinter) Print(destination string) error { func (p officePrinter) unoconv(ctx context.Context, fpath, destination string) error { const op string = "printer.unoconv" resolver := func() error { + dirName := xrand.Get() port, err := freeport.GetFreePort() if err != nil { return err } args := []string{ "--user-profile", - fmt.Sprintf("///tmp/%d", port), + fmt.Sprintf("///tmp/%s", dirName), "--port", fmt.Sprintf("%d", port), "--format", @@ -116,11 +117,7 @@ func (p officePrinter) unoconv(ctx context.Context, fpath, destination string) e err = xexec.Run(ctx, p.logger, "unoconv", args...) // always remove user profile folders created by LibreOffice. // see https://github.com/thecodingmachine/gotenberg/issues/192. - userProfileDirPath := fmt.Sprintf("/tmp/%d", port) - if err := os.RemoveAll(userProfileDirPath); err != nil { - // find a way to bubble up this error? - p.logger.ErrorOpf(op, "failed to remove user profile directory '%s': %s", userProfileDirPath, err.Error()) - } + go cleanupUserProfile(p.logger, dirName) if err != nil { // find a way to check it in the handlers? if p.opts.PageRanges != "" && strings.Contains(err.Error(), "exit status 5") { @@ -140,6 +137,15 @@ func (p officePrinter) unoconv(ctx context.Context, fpath, destination string) e return nil } +func cleanupUserProfile(logger xlog.Logger, dirName string) { + const op = "printer.cleanupUserProfile" + path := fmt.Sprintf("/tmp/%s", dirName) + if err := os.RemoveAll(path); err != nil { + // find a way to bubble up this error? + logger.ErrorOpf(op, "failed to remove user profile directory '%s': %s", path, err.Error()) + } +} + // Compile-time checks to ensure type implements desired interfaces. var ( _ = Printer(new(officePrinter)) From a7cef5a1c668897dd7c96a72165ba8d58b7e04d1 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 15:05:51 +0200 Subject: [PATCH 10/16] got fmt --- internal/app/xhttp/pkg/context/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/app/xhttp/pkg/context/context.go b/internal/app/xhttp/pkg/context/context.go index b0ddb7c4..dee4d670 100644 --- a/internal/app/xhttp/pkg/context/context.go +++ b/internal/app/xhttp/pkg/context/context.go @@ -4,11 +4,11 @@ import ( "fmt" "io" "net/http" + "path/filepath" "reflect" "strconv" "strings" "time" - "path/filepath" "github.com/labstack/echo/v4" "github.com/thecodingmachine/gotenberg/internal/app/xhttp/pkg/resource" From 6c1a46aee5c114c15bf707f5a19c88b28f5fc675 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 5 Jun 2020 15:56:07 +0200 Subject: [PATCH 11/16] minor update of the documentation --- build/docs/content/01-install.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docs/content/01-install.md b/build/docs/content/01-install.md index c1a27401..a3758fdf 100644 --- a/build/docs/content/01-install.md +++ b/build/docs/content/01-install.md @@ -24,7 +24,7 @@ For instance: ```bash $ git clone https://github.com/thecodingmachine/gotenberg.git -$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=6.2.0 +$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=version ``` > `master` branch is always up-to-date with the latest version of the API. diff --git a/docs/index.html b/docs/index.html index 1ad30e01..d0db910f 100755 --- a/docs/index.html +++ b/docs/index.html @@ -154,7 +154,7 @@

For instance:

$ git clone https://github.com/thecodingmachine/gotenberg.git
-$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=6.2.0
+$ make publish GOTENBERG_USER_GID=your_custom_gid GOTENBERG_USER_UID=your_custom_uid DOCKER_REGISTRY=your_registry DOCKER_USER=registry_user DOCKER_PASSWORD=registry_password VERSION=version
 
From 4d46b98e7fb35b4fa8df134199af290801901696 Mon Sep 17 00:00:00 2001 From: tomjvdberg <47381148+tomjvdberg@users.noreply.github.com> Date: Mon, 8 Jun 2020 08:31:57 +0200 Subject: [PATCH 12/16] Apply suggestions from code review Co-authored-by: Julien Neuhart --- .../docs/content/03-environment-variables.md | 6 ++-- cmd/gotenberg/main.go | 2 +- internal/pkg/chrome/chrome.go | 16 +++++----- internal/pkg/conf/conf.go | 22 +++++++------- internal/pkg/conf/conf_test.go | 30 +++++++++---------- test/cmd/chrome.go | 2 +- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/build/docs/content/03-environment-variables.md b/build/docs/content/03-environment-variables.md index 61ef06b4..de22646d 100644 --- a/build/docs/content/03-environment-variables.md +++ b/build/docs/content/03-environment-variables.md @@ -58,9 +58,11 @@ The hard limit is 100 MB and is defined by Google Chrome itself. > The default Google Chrome rpcc buffer size may also be overridden per request thanks to the form field `googleChromeRpccBufferSize`. > See the [rpcc buffer size section](#html.rpcc_buffer_size). -## Ignore certificate errors +## Google Chrome ignore certificate errors -By default Chrome will not accept certificate errors when using the URL print method. Setting this environment variable to `"1"` will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production. +When performing a [URL](#url) conversion, Google Chrome will not accept certificate errors . + +You may allow insecure connections by setting `GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS` variable to `"1"`. **You should be careful with this feature and only enable it in your development environment.** ## Disable LibreOffice (unoconv) diff --git a/cmd/gotenberg/main.go b/cmd/gotenberg/main.go index c9fa4e0b..6f0135f2 100644 --- a/cmd/gotenberg/main.go +++ b/cmd/gotenberg/main.go @@ -28,7 +28,7 @@ func main() { systemLogger.DebugOpf(op, "configuration: %+v", config) if !config.DisableGoogleChrome() { // start Google Chrome headless. - if err := chrome.Start(systemLogger, config.IgnoreCertificateErrors()); err != nil { + if err := chrome.Start(systemLogger, config.GoogleChromeIgnoreCertificateErrors()); err != nil { systemLogger.FatalOp(op, err) } } diff --git a/internal/pkg/chrome/chrome.go b/internal/pkg/chrome/chrome.go index adf9a03f..07a3df1b 100644 --- a/internal/pkg/chrome/chrome.go +++ b/internal/pkg/chrome/chrome.go @@ -16,11 +16,11 @@ import ( ) // Start starts Google Chrome headless in background. -func Start(logger xlog.Logger, urlIgnoreCertificateErrors bool) error { +func Start(logger xlog.Logger, ignoreCertificateErrors bool) error { const op string = "chrome.Start" logger.DebugOp(op, "starting new Google Chrome headless process on port 9222...") resolver := func() error { - cmd, err := cmd(logger, urlIgnoreCertificateErrors) + cmd, err := cmd(logger, ignoreCertificateErrors) if err != nil { return err } @@ -32,7 +32,7 @@ func Start(logger xlog.Logger, urlIgnoreCertificateErrors bool) error { // if the process failed to start correctly, // we have to restart it. if !isViable(logger) { - return restart(logger, cmd.Process, urlIgnoreCertificateErrors) + return restart(logger, cmd.Process, ignoreCertificateErrors) } return nil } @@ -42,7 +42,7 @@ func Start(logger xlog.Logger, urlIgnoreCertificateErrors bool) error { return nil } -func cmd(logger xlog.Logger, urlIgnoreCertificateErrors bool) (*exec.Cmd, error) { +func cmd(logger xlog.Logger, ignoreCertificateErrors bool) (*exec.Cmd, error) { const op string = "chrome.cmd" binary := "google-chrome-stable" args := []string{ @@ -67,7 +67,7 @@ func cmd(logger xlog.Logger, urlIgnoreCertificateErrors bool) (*exec.Cmd, error) "--no-first-run", } - if urlIgnoreCertificateErrors { + if ignoreCertificateErrors { args = append(args, "--ignore-certificate-errors") } @@ -98,7 +98,7 @@ func kill(logger xlog.Logger, proc *os.Process) error { return nil } -func restart(logger xlog.Logger, proc *os.Process, urlIgnoreCertificateErrors bool) error { +func restart(logger xlog.Logger, proc *os.Process, ignoreCertificateErrors bool) error { const op string = "chrome.restart" logger.DebugOp(op, "restarting Google Chrome headless process using port 9222...") resolver := func() error { @@ -106,7 +106,7 @@ func restart(logger xlog.Logger, proc *os.Process, urlIgnoreCertificateErrors bo if err := kill(logger, proc); err != nil { return err } - cmd, err := cmd(logger, urlIgnoreCertificateErrors) + cmd, err := cmd(logger, ignoreCertificateErrors) if err != nil { return err } @@ -118,7 +118,7 @@ func restart(logger xlog.Logger, proc *os.Process, urlIgnoreCertificateErrors bo // if the process failed to restart correctly, // we have to restart it again. if !isViable(logger) { - return restart(logger, cmd.Process, urlIgnoreCertificateErrors) + return restart(logger, cmd.Process, ignoreCertificateErrors) } return nil } diff --git a/internal/pkg/conf/conf.go b/internal/pkg/conf/conf.go index 73757f2d..3f3cbe99 100644 --- a/internal/pkg/conf/conf.go +++ b/internal/pkg/conf/conf.go @@ -40,8 +40,9 @@ const ( // DefaultGoogleChromeRpccBufferSizeEnvVar contains the name // of the environment variable "DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE". DefaultGoogleChromeRpccBufferSizeEnvVar string = "DEFAULT_GOOGLE_CHROME_RPCC_BUFFER_SIZE" - // Allow self signed certificates when using a remote url - URLIgnoreCertificateErrorsEnvVar string = "URL_IGNORE_CERTIFICATE_ERRORS" + // GoogleChromeIgnoreCertificateErrorsEnvVar contains the name + // of the environment variable "GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS". + GoogleChromeIgnoreCertificateErrorsEnvVar string = "GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS" ) // Config contains the application @@ -55,7 +56,7 @@ type Config struct { defaultListenPort int64 disableGoogleChrome bool disableUnoconv bool - urlIgnoreCertificateErrors bool + googleChromeIgnoreCertificateErrors bool logLevel xlog.Level rootPath string maximumGoogleChromeRpccBufferSize int64 @@ -78,7 +79,7 @@ func DefaultConfig() Config { rootPath: "/", maximumGoogleChromeRpccBufferSize: 104857600, // ~100 MB defaultGoogleChromeRpccBufferSize: 1048576, // 1 MB - urlIgnoreCertificateErrors: false, + googleChromeIgnoreCertificateErrors: false, } } @@ -192,11 +193,11 @@ func FromEnv() (Config, error) { if err != nil { return c, err } - urlIgnoreCertificateErrors, err := xassert.BoolFromEnv( - URLIgnoreCertificateErrorsEnvVar, - c.urlIgnoreCertificateErrors, + googleChromeIgnoreCertificateErrors, err := xassert.BoolFromEnv( + GoogleChromeIgnoreCertificateErrorsEnvVar, + c.googleChromeIgnoreCertificateErrors, ) - c.urlIgnoreCertificateErrors = urlIgnoreCertificateErrors + c.googleChromeIgnoreCertificateErrors = googleChromeIgnoreCertificateErrors if err != nil { return c, err } @@ -287,9 +288,6 @@ func (c Config) DefaultGoogleChromeRpccBufferSize() int64 { return c.defaultGoogleChromeRpccBufferSize } -// IgnoreCertificateErrors returns true if -// Google Chrome should ignore certificate errors -// in case of self signed certificates for example. -func (c Config) IgnoreCertificateErrors() bool { +func (c Config) GoogleChromeIgnoreCertificateErrors() bool { return c.urlIgnoreCertificateErrors } diff --git a/internal/pkg/conf/conf_test.go b/internal/pkg/conf/conf_test.go index b7855023..1fbb1cf7 100644 --- a/internal/pkg/conf/conf_test.go +++ b/internal/pkg/conf/conf_test.go @@ -380,38 +380,38 @@ func TestDefaultGoogleChromeRpccBufferSizeFromEnv(t *testing.T) { os.Unsetenv(DefaultGoogleChromeRpccBufferSizeEnvVar) } -func TestIgnoreCertificateErrorsFromEnv(t *testing.T) { +func TestGoogleChromeIgnoreCertificateErrorsFromEnv(t *testing.T) { var ( expected Config result Config err error ) - // URL_IGNORE_CERTIFICATE_ERRORS correctly set to true. - os.Setenv(URLIgnoreCertificateErrorsEnvVar, "1") + // GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS correctly set to true. + os.Setenv(GoogleChromeIgnoreCertificateErrorsEnvVar, "1") expected = DefaultConfig() - expected.urlIgnoreCertificateErrors = true + expected.googleChromeIgnoreCertificateErrors = true result, err = FromEnv() assert.Nil(t, err) assert.Equal(t, expected, result) - os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) - // URL_IGNORE_CERTIFICATE_ERRORS correctly set to false. - os.Setenv(URLIgnoreCertificateErrorsEnvVar, "0") + os.Unsetenv(GoogleChromeIgnoreCertificateErrorsEnvVar) + // GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS correctly set to false. + os.Setenv(GooleChromeIgnoreCertificateErrorsEnvVar, "0") expected = DefaultConfig() - expected.urlIgnoreCertificateErrors = false + expected.googleChromeIgnoreCertificateErrors = false result, err = FromEnv() assert.Nil(t, err) assert.Equal(t, expected, result) - os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) - // URL_IGNORE_CERTIFICATE_ERRORS wrongly set. - os.Setenv(URLIgnoreCertificateErrorsEnvVar, "foo") + os.Unsetenv(GoogleChromeIgnoreCertificateErrorsEnvVar) + // GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS wrongly set. + os.Setenv(GoogleChromeIgnoreCertificateErrorsEnvVar, "foo") expected = DefaultConfig() result, err = FromEnv() test.AssertError(t, err) assert.Equal(t, expected, result) - os.Unsetenv(URLIgnoreCertificateErrorsEnvVar) - // URL_IGNORE_CERTIFICATE_ERRORS not set at all. + os.Unsetenv(GoogleChromeIgnoreCertificateErrorsEnvVar) + // GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS not set at all. expected = DefaultConfig() - expected.urlIgnoreCertificateErrors = false + expected.googleChromeIgnoreCertificateErrors = false result, err = FromEnv() assert.Nil(t, err) assert.Equal(t, expected, result) @@ -431,5 +431,5 @@ func TestGetters(t *testing.T) { assert.Equal(t, result.rootPath, result.RootPath()) assert.Equal(t, result.maximumGoogleChromeRpccBufferSize, result.MaximumGoogleChromeRpccBufferSize()) assert.Equal(t, result.defaultGoogleChromeRpccBufferSize, result.DefaultGoogleChromeRpccBufferSize()) - assert.Equal(t, result.urlIgnoreCertificateErrors, result.IgnoreCertificateErrors()) + assert.Equal(t, result.googleChromeIgnoreCertificateErrors, result.GoogleChromeIgnoreCertificateErrors()) } diff --git a/test/cmd/chrome.go b/test/cmd/chrome.go index ad5e5e7c..82234f3e 100644 --- a/test/cmd/chrome.go +++ b/test/cmd/chrome.go @@ -14,7 +14,7 @@ func main() { systemLogger.FatalOp(op, err) } // start Google Chrome headless. - if err := chrome.Start(systemLogger, config.IgnoreCertificateErrors()); err != nil { + if err := chrome.Start(systemLogger, config.GoogleChromeIgnoreCertificateErrors()); err != nil { systemLogger.FatalOp(op, err) } } From 0b86d38517ec999dd5db8a6fd62150fad8f2235e Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Mon, 8 Jun 2020 09:44:37 +0200 Subject: [PATCH 13/16] go fmt and regenerating documentation --- docs/index.html | 24 +++++++++-------- internal/pkg/conf/conf.go | 56 +++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/docs/index.html b/docs/index.html index 8e1889e7..536fa28d 100755 --- a/docs/index.html +++ b/docs/index.html @@ -167,14 +167,14 @@ $ make publish GOTENBERG_USER_GID=You may also add it in your Docker Compose stack:

-
version: '3'
+
version: '3'
 
-services:
+services:
 
   # your other services
 
-  gotenberg:
-    image: thecodingmachine/gotenberg:6
+  gotenberg:
+    image: thecodingmachine/gotenberg:6
 
@@ -332,11 +332,13 @@ The hard limit is 100 MB and is defined by Google Chrome itself.

See the rpcc buffer size section.

-

Ignore certificate errors

+Google Chrome ignore certificate errors

-

By default the chrome instance will not accept certificate errors when using the URL print method. Setting this environment variable to "1" will allow insecure connections to be used. In dev environment for example. Be careful with this! Do not use in production.

+

When performing a URL conversion, Google Chrome will not accept certificate errors .

+ +

You may allow insecure connections by setting GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS variable to "1". You should be careful with this feature and only enable it in your development environment.

rpcc buffer size section.

When performing a URL conversion, Google Chrome will not accept certificate errors .

-

You may allow insecure connections by setting GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS variable to "1". You should be careful with this feature and only enable it in your development environment.

+

You may allow insecure connections by setting the GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS environment variable to "1". +You should be careful with this feature and only enable it in your development environment.

rpcc buffer size section.

Google Chrome ignore certificate errors

-

When performing a URL conversion, Google Chrome will not accept certificate errors .

+

When performing a URL conversion, Google Chrome will not accept certificate errors.

-

You may allow insecure connections by setting the GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS environment variable to "1". -You should be careful with this feature and only enable it in your development environment.

+

You may allow insecure connections by setting the GOOGLE_CHROME_IGNORE_CERTIFICATE_ERRORS environment variable to "1".

+ +

You should be careful with this feature and only enable it in your development environment.

Custom HTTP headers

@@ -1791,4 +1791,4 @@ restart your Gotenberg instances from time to time to ensure a nominal behaviour - + \ No newline at end of file