Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 12:09:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 12:09:06 +0300
commit7e8278c0f46cf6058efad5afd0aef177977bd663 (patch)
tree7ac46710921145bb782bcb208ea896e1548b168b /doc
parentbbf6581214128ae12a6ff32f66a0d03ee57a2e91 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc')
-rw-r--r--doc/administration/gitaly/praefect.md25
-rw-r--r--doc/administration/index.md1
-rw-r--r--doc/administration/troubleshooting/ssl.md112
-rw-r--r--doc/development/i18n/externalization.md68
4 files changed, 195 insertions, 11 deletions
diff --git a/doc/administration/gitaly/praefect.md b/doc/administration/gitaly/praefect.md
index 6a1fb0cde2b..73a020b87d0 100644
--- a/doc/administration/gitaly/praefect.md
+++ b/doc/administration/gitaly/praefect.md
@@ -72,9 +72,11 @@ We need to manage the following secrets and make them match across hosts:
1. `PRAEFECT_SQL_PASSWORD`: this password is used by Praefect to connect to
PostgreSQL.
+We will note in the instructions below where these secrets are required.
+
#### Network addresses
-1. `POSTGRESQL_SERVER`: the host name or IP address of your PostgreSQL server
+1. `POSTGRESQL_SERVER_ADDRESS`: the host name or IP address of your PostgreSQL server
#### PostgreSQL
@@ -91,7 +93,7 @@ Below we assume that you have administrative access as the `postgres`
user. First open a `psql` session as the `postgres` user:
```shell
-/opt/gitlab/embedded/bin/psql -h POSTGRESQL_SERVER -U postgres -d template1
+/opt/gitlab/embedded/bin/psql -h POSTGRESQL_SERVER_ADDRESS -U postgres -d template1
```
Once you are connected, run the following command. Replace
@@ -107,7 +109,7 @@ Now connect as the `praefect` user to create the database. This has
the side effect of verifying that you have access:
```shell
-/opt/gitlab/embedded/bin/psql -h POSTGRESQL_SERVER -U praefect -d template1
+/opt/gitlab/embedded/bin/psql -h POSTGRESQL_SERVER_ADDRESS -U praefect -d template1
```
Once you have connected as the `praefect` user, run:
@@ -125,6 +127,12 @@ Gitaly node that will be connected to Praefect as members of the `praefect` hash
In the example below, the Gitaly nodes are named `gitaly-N`. Note that one
node is designated as primary by setting the primary to `true`.
+If you are using an uncrypted connection to Postgres, set `praefect['database_sslmode']` to false.
+
+If you are using an encrypted connection with a client certificate,
+`praefect['database_sslcert']` and `praefect['database_sslkey']` will need to be set.
+If you are using a custom CA, also set `praefect['database_sslrootcert']`:
+
```ruby
# /etc/gitlab/gitlab.rb on praefect server
@@ -174,7 +182,7 @@ praefect['virtual_storages'] = {
}
# Replace POSTGRESQL_SERVER below with a real IP/host address of the database.
-praefect['database_host'] = 'POSTGRESQL_SERVER'
+praefect['database_host'] = 'POSTGRESQL_SERVER_ADDRESS'
praefect['database_port'] = 5432
praefect['database_user'] = 'praefect'
# Replace PRAEFECT_SQL_PASSWORD below with a real password of the database.
@@ -195,6 +203,9 @@ praefect['database_dbname'] = 'praefect_production'
# praefect['database_sslrootcert'] = '/path/to/rootcert'
```
+Replace `POSTGRESQL_SERVER_ADDRESS`, `PRAEFECT_EXTERNAL_TOKEN`, `PRAEFECT_INTERNAL_TOKEN`,
+and `PRAEFECT_SQL_PASSWORD` with their respective values.
+
Save the file and [reconfigure Praefect](../restart_gitlab.md#omnibus-gitlab-reconfigure).
After you reconfigure, verify that Praefect can reach PostgreSQL:
@@ -260,6 +271,9 @@ git_data_dirs({
})
```
+Replace `GITLAB_SHELL_SECRET_TOKEN` and `PRAEFECT_INTERNAL_TOKEN`
+with their respective values.
+
For more information on Gitaly server configuration, see our [Gitaly documentation](index.md#3-gitaly-server-configuration).
When finished editing the configuration file for each Gitaly server, run the
@@ -302,6 +316,9 @@ git_data_dirs({
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN'
```
+Replace `GITLAB_SHELL_SECRET_TOKEN` and `PRAEFECT_EXTERNAL_TOKEN`
+with their respective values.
+
Note that the storage name used is the same as the `praefect['virtual_storage_name']` set
on the Praefect node.
diff --git a/doc/administration/index.md b/doc/administration/index.md
index 35fe066d866..dbe4a351dce 100644
--- a/doc/administration/index.md
+++ b/doc/administration/index.md
@@ -222,6 +222,7 @@ who are aware of the risks.
- [Troubleshooting PostgreSQL](troubleshooting/postgresql.md)
- [Guide to test environments](troubleshooting/test_environments.md) (for Support Engineers)
- [GitLab Rails console commands](troubleshooting/gitlab_rails_cheat_sheet.md) (for Support Engineers)
+- [Troubleshooting SSL](troubleshooting/ssl.md)
- Useful links:
- [GitLab Developer Docs](../development/README.md)
- [Repairing and recovering broken Git repositories](https://git.seveas.net/repairing-and-recovering-broken-git-repositories.html)
diff --git a/doc/administration/troubleshooting/ssl.md b/doc/administration/troubleshooting/ssl.md
new file mode 100644
index 00000000000..dcda4fbb7a9
--- /dev/null
+++ b/doc/administration/troubleshooting/ssl.md
@@ -0,0 +1,112 @@
+---
+type: reference
+---
+
+# Troubleshooting SSL
+
+This page contains a list of common SSL-related errors and scenarios that you may face while working with GitLab.
+It should serve as an addition to the main SSL docs available here:
+
+- [Omniibus SSL Configuration](https://docs.gitlab.com/omnibus/settings/ssl.html)
+- [Self-signed certificates or custom Certification Authorities for GitLab Runner](https://docs.gitlab.com/runner/configuration/tls-self-signed.html)
+- [Manually configuring HTTPS](https://docs.gitlab.com/omnibus/settings/nginx.html#manually-configuring-https)
+
+## Using an internal CA certificate with GitLab
+
+After configuring a GitLab instance with an internal CA certificate, you might not be able to access it via various CLI tools. You may see the following symptoms:
+
+- `curl` fails:
+
+ ```shell
+ curl https://gitlab.domain.tld
+ curl: (60) SSL certificate problem: unable to get local issuer certificate
+ More details here: https://curl.haxx.se/docs/sslcerts.html
+ ```
+
+- Testing via the [rails console](https://docs.gitlab.com/omnibus/maintenance/#starting-a-rails-console-session) also fails:
+
+ ```ruby
+ uri = URI.parse("https://gitlab.domain.tld")
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.use_ssl = true
+ http.verify_mode = 1
+ response = http.request(Net::HTTP::Get.new(uri.request_uri))
+ ...
+ Traceback (most recent call last):
+ 1: from (irb):5
+ OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate))
+ ```
+
+- The error `SSL certificate problem: unable to get local issuer certificate` is shown when setting up a [mirror](../../user/project/repository/repository_mirroring.md#repository-mirroring) from this GitLab instance.
+- `openssl` works when specifying the path to the certificate:
+
+ ```shell
+ /opt/gitlab/embedded/bin/openssl s_client -CAfile /root/my-cert.crt -connect gitlab.domain.tld:443
+ ```
+
+If you have the problems listed above, add your certificate to `/etc/gitlab/trusted-certs` and run `sudo gitlab-ctl reconfigure`.
+
+## Mirroring a remote GitLab repository that uses a self-signed SSL certificate
+
+**Scenario:** When configuring a local GitLab instance to [mirror a repository](../../user/project/repository/repository_mirroring.md) from a remote GitLab instance that uses a self-signed certificate, you may see the `SSL certificate problem: self signed certificate` error in the UI.
+
+The cause of the issue can be confirmed by checking if:
+
+- `curl` fails:
+
+ ```shell
+ $ curl https://gitlab.domain.tld
+ curl: (60) SSL certificate problem: self signed certificate
+ More details here: https://curl.haxx.se/docs/sslcerts.html
+ ```
+
+- Testing via the Rails console also fails:
+
+ ```ruby
+ uri = URI.parse("https://gitlab.domain.tld")
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.use_ssl = true
+ http.verify_mode = 1
+ response = http.request(Net::HTTP::Get.new(uri.request_uri))
+ ...
+ Traceback (most recent call last):
+ 1: from (irb):5
+ OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate))
+ ```
+
+To fix this problem:
+
+- Add the self-signed certificate from the remote GitLab instance to the `/etc/gitlab/trusted-certs` directory on the local GitLab instance and run `sudo gitlab-ctl reconfigure` as per the instructions for [installing custom public certificates](https://docs.gitlab.com/omnibus/settings/ssl.html#install-custom-public-certificates).
+- If your local GitLab instance was installed using the Helm Charts, you can [add your self-signed certificate to your GitLab instance](https://docs.gitlab.com/runner/install/kubernetes.html#providing-a-custom-certificate-for-accessing-gitlab).
+
+## Unable to perform Git operations due to an internal or self-signed certificate
+
+If your GitLab instance is using a self-signed certificate, or the certificate is signed by an internal certificate authority (CA), you might run into the following errors when attempting to perform Git operations:
+
+```bash
+$ git clone https://gitlab.domain.tld/group/project.git
+Cloning into 'project'...
+fatal: unable to access 'https://gitlab.domain.tld/group/project.git/': SSL certificate problem: self signed certificate
+```
+
+```bash
+$ git clone https://gitlab.domain.tld/group/project.git
+Cloning into 'project'...
+fatal: unable to access 'https://gitlab.domain.tld/group/project.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
+```
+
+To fix this problem:
+
+- If possible, use SSH remotes for all Git operations. This is considered more secure and convenient to use.
+- If you must use HTTPS remotes, you can try the following:
+ - Copy the self signed certificate or the internal root CA certificate to a local directory (for example, `~/.ssl`) and configure Git to trust your certificate:
+
+ ```shell
+ git config --global http.sslCAInfo ~/.ssl/gitlab.domain.tld.crt
+ ```
+
+ - Disable SSL verification in your Git client. Note that this intended as a temporary measure as it could be considered a **security risk**.
+
+ ```bash
+ git config --global http.sslVerify false
+ ```
diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md
index 86ac70ecef6..b9ab5f4e8ff 100644
--- a/doc/development/i18n/externalization.md
+++ b/doc/development/i18n/externalization.md
@@ -161,7 +161,11 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript. Make s
_("Hello %{name}") % { name: 'Joe' } => 'Hello Joe'
```
-- In JavaScript:
+- In Vue:
+
+ See the section on [Vue component interpolation](#vue-components-interpolation).
+
+- In JavaScript (when Vue cannot be used):
```js
import { __, sprintf } from '~/locale';
@@ -169,14 +173,30 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript. Make s
sprintf(__('Hello %{username}'), { username: 'Joe' }); // => 'Hello Joe'
```
- By default, `sprintf` escapes the placeholder values.
- If you want to take care of that yourself, you can pass `false` as third argument.
+ If you want to use markup within the translation and are using Vue, you
+ **must** use the [`gl-sprintf`](#vue-components-interpolation) component. If
+ for some reason you cannot use Vue, use `sprintf` and stop it from escaping
+ placeholder values by passing `false` as its third argument. You **must**
+ escape any interpolated dynamic values yourself, for instance using
+ `escape` from `lodash`.
```js
+ import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
- sprintf(__('This is %{value}'), { value: '<strong>bold</strong>' }); // => 'This is &lt;strong&gt;bold&lt;/strong&gt;'
- sprintf(__('This is %{value}'), { value: '<strong>bold</strong>' }, false); // => 'This is <strong>bold</strong>'
+ let someDynamicValue = '<script>alert("evil")</script>';
+
+ // Dangerous:
+ sprintf(__('This is %{value}'), { value: `<strong>${someDynamicValue}</strong>`, false);
+ // => 'This is <strong><script>alert('evil')</script></strong>'
+
+ // Incorrect:
+ sprintf(__('This is %{value}'), { value: `<strong>${someDynamicValue}</strong>` });
+ // => 'This is &lt;strong&gt;&lt;script&gt;alert(&#x27;evil&#x27;)&lt;/script&gt;&lt;/strong&gt;'
+
+ // OK:
+ sprintf(__('This is %{value}'), { value: `<strong>${escape(someDynamicValue)}</strong>`, false);
+ // => 'This is <strong>&lt;script&gt;alert(&#x27;evil&#x27;)&lt;/script&gt;</strong>'
```
### Plurals
@@ -326,7 +346,41 @@ This also applies when using links in between translated sentences, otherwise th
= s_('ClusterIntegration|Learn more about %{zones_link_start}zones%{zones_link_end}').html_safe % { zones_link_start: zones_link_start, zones_link_end: '</a>'.html_safe }
```
-- In JavaScript, instead of:
+- In Vue, instead of:
+
+ ```html
+ <template>
+ <div>
+ <gl-sprintf :message="s__('ClusterIntegration|Learn more about %{link}')">
+ <template #link>
+ <gl-link
+ href="https://cloud.google.com/compute/docs/regions-zones/regions-zones"
+ target="_blank"
+ >zones</gl-link>
+ </template>
+ </gl-sprintf>
+ </div>
+ </template>
+ ```
+
+ Set the link starting and ending HTML fragments as placeholders like so:
+
+ ```html
+ <template>
+ <div>
+ <gl-sprintf :message="s__('ClusterIntegration|Learn more about %{linkStart}zones%{linkEnd}')">
+ <template #link="{ content }">
+ <gl-link
+ href="https://cloud.google.com/compute/docs/regions-zones/regions-zones"
+ target="_blank"
+ >{{ content }}</gl-link>
+ </template>
+ </gl-sprintf>
+ </div>
+ </template>
+ ```
+
+- In JavaScript (when Vue cannot be used), instead of:
```js
{{
@@ -336,7 +390,7 @@ This also applies when using links in between translated sentences, otherwise th
}}
```
- Set the link starting and ending HTML fragments as variables like so:
+ Set the link starting and ending HTML fragments as placeholders like so:
```js
{{