Статус: Участник
Группы: Участники
Зарегистрирован: 20.05.2022(UTC) Сообщений: 18
Сказал(а) «Спасибо»: 1 раз
|
Добрый день. Необходимо перенаправить трафик из внутренней сети на внешний хост с применением ГОСТ. Вот настройки nginx Цитата:server { #встречаю сообщения на 4443 порту, которые необходимо перенаправить далее. Встречаю обычным RSA сертификатом listen 4443 ssl; server_name proxy01.domain.local proxy01; ssl_certificate /opt/nginx/ssl/proxy01.cer; ssl_certificate_key /opt/nginx/ssl/proxy01.key; ssl_session_timeout 10m; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1.2; ssl_prefer_server_ciphers on; #далее перенаправляю на внешний хост location / { proxy_pass https://service.internet.ru:443; proxy_ssl_protocols TLSv1.2; proxy_http_version 1.1; proxy_sspi on; proxy_ssl_verify on; proxy_ssl_certificate 0x086E9C00D3ADDB8449C6BBBBBBBBBBB; proxy_ssl_trusted_certificate Root; } } Но при при отправке на внешний хост получаю вот эту ошибку: Цитата:SSPI not initialized while connecting to upstream, client: 192.168.0.50, server: , request: "POST /ping/pong HTTP/1.1", upstream: "https://x.x.x.x:443/ping/pong", host: "proxy01:4443" Как можно подебажить проблему? За основу брал вот эту инструкцию
|
|
|
|
Статус: Участник
Группы: Участники
Зарегистрирован: 20.05.2022(UTC) Сообщений: 18
Сказал(а) «Спасибо»: 1 раз
|
забыл еще указать лицензию криптопро csp License validity: 5050010037ELQF5H28KM8E6BA Expires: 39 day(s) License type: Demo.
|
|
|
|
Статус: Сотрудник
Группы: Участники
Зарегистрирован: 17.10.2010(UTC) Сообщений: 128 Откуда: КРИПТО-ПРО Сказал «Спасибо»: 2 раз Поблагодарили: 9 раз в 8 постах
|
Причин может быть масса:
1. Сертификата 0x086E9C00D3ADDB8449C6BBBBBBBBBBB нет 2. Нет контейнера для этого сертификата 3. Контейнер есть, но с паролем (его надо снять) 4. Хранилища Root нет (хотя это и странно)
Для диагностики - включите debug log в nginx - там всё будет написано.
|
|
|
|
Статус: Сотрудник
Группы: Участники
Зарегистрирован: 17.10.2010(UTC) Сообщений: 128 Откуда: КРИПТО-ПРО Сказал «Спасибо»: 2 раз Поблагодарили: 9 раз в 8 постах
|
Автор: blacksm Но при при отправке на внешний хост получаю вот эту ошибку: Цитата:SSPI not initialized while connecting to upstream, client: 192.168.0.50, server: , request: "POST /ping/pong HTTP/1.1", upstream: "https://x.x.x.x:443/ping/pong", host: "proxy01:4443" Как можно подебажить проблему? За основу брал вот эту инструкцию Взлетело? Удалось победить?
|
|
|
|
Статус: Участник
Группы: Участники
Зарегистрирован: 20.05.2022(UTC) Сообщений: 18
Сказал(а) «Спасибо»: 1 раз
|
Автор: Андрей Куликов Автор: blacksm Но при при отправке на внешний хост получаю вот эту ошибку: Цитата:SSPI not initialized while connecting to upstream, client: 192.168.0.50, server: , request: "POST /ping/pong HTTP/1.1", upstream: "https://x.x.x.x:443/ping/pong", host: "proxy01:4443" Как можно подебажить проблему? За основу брал вот эту инструкцию Взлетело? Удалось победить? Вчера было предположение что нет доступа к одному из списков отзыва, но не помог вариант. при рестарте nginx вижу вот это в логах Цитата:ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: 09:58:32.210665 support_an_fopen:90 p:25024 t:0x0x7fc2866c72b0 support_an_fopen("/var/opt/cprocsp/users/global.ini", "rb") = 0x(nil) fail Permission denied(13) ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: 09:58:32.210776 support_an_fopen:90 p:25024 t:0x0x7fc2866c72b0 support_an_fopen("/etc/opt/cprocsp/policies.ini", "rb") = 0x(nil) fail No such file or directory(2) ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: 09:58:32.210856 support_an_fopen:90 p:25024 t:0x0x7fc2866c72b0 support_an_fopen("/etc/opt/cprocsp/policies.ini", "rb") = 0x(nil) fail No such file or directory(2) ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: 09:58:32.214848 support_an_fopen:90 p:25025 t:0x0x7fc2866c72b0 support_an_fopen("/var/opt/cprocsp/users/global.ini", "rb") = 0x(nil) fail Permission denied(13) ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: 09:58:32.214945 support_an_fopen:90 p:25025 t:0x0x7fc2866c72b0 support_an_fopen("/etc/opt/cprocsp/policies.ini", "rb") = 0x(nil) fail No such file or directory(2) ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: 09:58:32.215025 support_an_fopen:90 p:25025 t:0x0x7fc2866c72b0 support_an_fopen("/etc/opt/cprocsp/policies.ini", "rb") = 0x(nil) fail No such file or directory(2) ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: <capi20>CertOpenStore!failed: LastError = 0x2 ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: <capi20>CertOpenStore!failed: LastError = 0x2 ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: <capi20>CertOpenStore!failed: LastError = 0x2 ter process /usr/sbin/nginx -c /etc/nginx/nginx.conf: <capi20>CertOpenStore!failed: LastError = 0x2 Вот права на каталог, nginx запущен под nginx Цитата:ls -laR /var/opt/cprocsp/users/ /var/opt/cprocsp/users/: total 0 drwxrwxrwt 6 root root 69 Jun 23 14:37 . drwxr-xr-x 7 root root 65 Jun 23 14:37 .. -rw------- 1 root root 0 Jun 21 2021 global.ini drwxr-xr-x 3 nginx nginx 35 Jul 15 10:08 nginx drwxr-xr-x 3 root root 35 Jun 24 16:19 root drwxr-xr-x 2 root root 79 Jun 21 2021 stores
/var/opt/cprocsp/users/nginx: total 4 drwxr-xr-x 3 nginx nginx 35 Jul 15 10:08 . drwxrwxrwt 6 root root 69 Jun 23 14:37 .. -rw------- 1 nginx nginx 296 Jul 15 10:08 local.ini drwxr-xr-x 2 nginx nginx 84 Jun 24 10:11 stores
/var/opt/cprocsp/users/nginx/stores: total 8 drwxr-xr-x 2 nginx nginx 84 Jun 24 10:11 . drwxr-xr-x 3 nginx nginx 35 Jul 15 10:08 .. -rw------- 1 nginx nginx 0 Jun 23 15:32 ca.sto -rw------- 1 nginx nginx 0 Jun 24 10:05 hdimage.sto -rw------- 1 nginx nginx 3415 Jul 1 17:01 my.sto -rw------- 1 nginx nginx 724 Jun 23 17:35 my.sto..orig -rw------- 1 nginx nginx 0 Jun 21 14:00 root.sto
/var/opt/cprocsp/users/root: total 4 drwxr-xr-x 3 root root 35 Jun 24 16:19 . drwxrwxrwt 6 root root 69 Jun 23 14:37 .. -rw------- 1 root root 296 Jun 24 16:19 local.ini drwxr-xr-x 2 root root 63 Jun 24 16:18 stores
/var/opt/cprocsp/users/root/stores: total 4 drwxr-xr-x 2 root root 63 Jun 24 16:18 . drwxr-xr-x 3 root root 35 Jun 24 16:19 .. -rw------- 1 root root 0 Jun 24 16:18 cache.sto -rw------- 1 root root 0 Jun 24 16:18 ca.sto -rw------- 1 root root 1230 Jun 29 18:57 my.sto -rw------- 1 root root 0 Jun 21 14:02 root.sto
/var/opt/cprocsp/users/stores: total 24 drwxr-xr-x 2 root root 79 Jun 21 2021 . drwxrwxrwt 6 root root 69 Jun 23 14:37 .. -rw-r--r-- 1 root root 12875 Jun 23 14:37 ca.sto -rw-r--r-- 1 root root 0 May 19 10:13 cryptoprotrustedstore.sto -rw-r--r-- 1 root root 0 May 19 10:13 my.sto -rw-r--r-- 1 root root 4405 Jun 23 14:37 root.sto А файла /etc/opt/cprocsp/policies.ini не существует Цитата:ls -la /etc/opt/cprocsp/ total 40 drwxr-xr-x 3 root root 120 Jul 13 16:04 . drwxr-xr-x. 3 root root 20 May 19 10:12 .. drwxr-xr-x 4 root root 57 Jun 23 14:37 apparmor.d -rw-r--r-- 1 root root 15388 Jun 23 14:37 config64.ini -rw-r--r-- 1 root root 11161 Jun 23 14:37 config64.ini.rpmsave -rw-r--r-- 1 root root 251 Jul 13 16:04 license.ini -rw-r--r-- 1 root root 34 Jun 21 2021 release -rw-r--r-- 1 root root 1206 Jun 21 2021 stunnel.conf
|
|
|
|
Статус: Сотрудник
Группы: Участники
Зарегистрирован: 17.10.2010(UTC) Сообщений: 128 Откуда: КРИПТО-ПРО Сказал «Спасибо»: 2 раз Поблагодарили: 9 раз в 8 постах
|
Это к дешлу не отностися. Необходимо смотреть в debug-log nginx
Пропишите в конфиг nginx:
error_log /var/log/nginx/error.log debug
И перезапустите nginx.
|
|
|
|
Статус: Участник
Группы: Участники
Зарегистрирован: 20.05.2022(UTC) Сообщений: 18
Сказал(а) «Спасибо»: 1 раз
|
Автор: Андрей Куликов Это к дешлу не отностися. Необходимо смотреть в debug-log nginx
Пропишите в конфиг nginx:
error_log /var/log/nginx/error.log debug
И перезапустите nginx. Дополнительных логов, которые бы помогли понять причину - нет. дебаг включен. Цитата:[pfx@proxy01 conf.d]$ sudo tail -f /var/log/nginx/error.log 2022/07/18 10:01:35 [notice] 10314#0: OS: Linux 3.10.0-1160.53.1.el7.x86_64 2022/07/18 10:01:35 [notice] 10314#0: getrlimit(RLIMIT_NOFILE): 1024:4096 2022/07/18 10:01:35 [notice] 10315#0: start worker processes 2022/07/18 10:01:35 [notice] 10315#0: start worker process 10316 2022/07/18 10:01:35 [notice] 10315#0: start worker process 10317 2022/07/18 10:01:35 [notice] 10316#0: signal 17 (SIGCHLD) received from 10319 2022/07/18 10:01:35 [notice] 10316#0: unknown process 10319 exited with code 1 2022/07/18 10:01:35 [notice] 10317#0: signal 17 (SIGCHLD) received from 10324 2022/07/18 10:01:35 [notice] 10317#0: unknown process 10324 exited with code 1 2022/07/18 10:01:50 [error] 10317#0: *3 SSPI not initialized while connecting to upstream, client: 192.168.0.50, server: proxy01, request: "POST /ping/pong HTTP/1.1", upstream: "https://x.x.x.x:443/ping/pong", host: "proxy01:4443"
|
|
|
|
Статус: Участник
Группы: Участники
Зарегистрирован: 20.05.2022(UTC) Сообщений: 18
Сказал(а) «Спасибо»: 1 раз
|
еще понял что nginx резолвит доменное имя, указанное в proxy_pass в ip-адрес. нашел в составе криптопро утилиту curl (видимо она модифицирована) и вот результат вызова доменного имени и ip-адреса *адреса подменяю. Цитата:/opt/cprocsp/bin/amd64/curl https://gost-service.ru:443 -vv * Trying х.х.х.х:443... * TCP_NODELAY set * Connected to gost-service.ru (х.х.х.х) port 443 (#0) > GET / HTTP/1.1 > Host: gost-service.ru:443 > User-Agent: curl/7.65.3-DEV > Accept: */* > * schannel: server closed the connection * Mark bundle as not supporting multiuse < HTTP/1.1 400 Bad Request < Server: nginx/1.18.0 < Date: Mon, 18 Jul 2022 12:39:50 GMT < Content-Type: text/html < Content-Length: 237 < Connection: close < <html> <head><title>400 No required SSL certificate was sent</title></head> <body> <center><h1>400 Bad Request</h1></center> <center>No required SSL certificate was sent</center> <hr><center>nginx/1.18.0</center> </body> </html> * Closing connection 0 * schannel: shutting down SSL/TLS connection with gost-service.ru port 443 теперь указываю ip-адрес Цитата:/opt/cprocsp/bin/amd64/curl https://х.х.х.х:443 -vv * Trying х.х.х.х:443... * TCP_NODELAY set * Connected to х.х.х.х (х.х.х.х) port 443 (#0) * schannel: using IP address, SNI is not supported by OS. * schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect. * Closing connection 0 * schannel: shutting down SSL/TLS connection with х.х.х.х port 443 curl: (60) schannel: SNI or certificate check failed: SEC_E_WRONG_PRINCIPAL (0x80090322) - The target principal name is incorrect. More details here: https://curl.haxx.se/docs/sslcerts.htmlcurl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
|
|
|
|
Статус: Сотрудник
Группы: Участники
Зарегистрирован: 17.10.2010(UTC) Сообщений: 128 Откуда: КРИПТО-ПРО Сказал «Спасибо»: 2 раз Поблагодарили: 9 раз в 8 постах
|
Автор: blacksm Дополнительных логов, которые бы помогли понять причину - нет. дебаг включен.
Причин тому может быть несколько: 1. nginx скомпилировен без опции . Убедитесь что в выводе Код:nginx -V | grep with-debug
присутствует данная опция. Если её нет - перекомпилирууйте nginx с ней. 2. Директива должна быть только в одном месте - в глобальной секции (до ) Поставьте Код:error_log /var/log/nginx/error.log debug
ближе к началу конфиг-файла.
|
|
|
|
Статус: Участник
Группы: Участники
Зарегистрирован: 20.05.2022(UTC) Сообщений: 18
Сказал(а) «Спасибо»: 1 раз
|
если все верно сделал, то выбрал логи между worker cycle Цитата:2022/07/19 09:35:25 [debug] 17386#0: worker cycle 2022/07/19 09:35:25 [debug] 17386#0: epoll timer: 36906 2022/07/19 09:35:25 [debug] 17386#0: epoll: fd:28 ev:0004 d:00007FB0ECFF45B0 2022/07/19 09:35:25 [debug] 17386#0: *3 http upstream request: "/ping/pong?" 2022/07/19 09:35:25 [debug] 17386#0: *3 http upstream send request handler 2022/07/19 09:35:25 [error] 17386#0: *3 SSPI not initialized while connecting to upstream, client: 192.168.0.50, server: proxy01, request: "POST /ping/pong HTTP/1.1", upstream: "https://x.x.x.x:9443/ping/pong", host: "proxy01:11443" 2022/07/19 09:35:25 [debug] 17386#0: *3 finalize http upstream request: 503 2022/07/19 09:35:25 [debug] 17386#0: *3 finalize http proxy request 2022/07/19 09:35:25 [debug] 17386#0: *3 free rr peer 1 0 2022/07/19 09:35:25 [debug] 17386#0: *3 close http upstream connection: 28 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A259CC0, unused: 48 2022/07/19 09:35:25 [debug] 17386#0: *3 event timer del: 28: 14396758454 2022/07/19 09:35:25 [debug] 17386#0: *3 reusable connection: 0 2022/07/19 09:35:25 [debug] 17386#0: *3 http finalize request: 503, "/ping/pong?" a:1, c:1 2022/07/19 09:35:25 [debug] 17386#0: *3 http special response: 503, "/ping/pong?" 2022/07/19 09:35:25 [debug] 17386#0: *3 HTTP/1.1 503 Service Temporarily Unavailable Server: nginx/1.20.2 Date: Tue, 19 Jul 2022 04:35:25 GMT Content-Type: text/html Content-Length: 197 Connection: keep-alive
2022/07/19 09:35:25 [debug] 17386#0: *3 write new buf t:1 f:0 000055A44A1EB7E0, pos 000055A44A1EB7E0, size: 177 file: 0, size: 0 2022/07/19 09:35:25 [debug] 17386#0: *3 http write filter: l:0 f:0 s:177 2022/07/19 09:35:25 [debug] 17386#0: *3 http output filter "/ping/pong?" 2022/07/19 09:35:25 [debug] 17386#0: *3 http copy filter: "/ping/pong?" 2022/07/19 09:35:25 [debug] 17386#0: *3 http postpone filter "/ping/pong?" 000055A44A1EB9C0 2022/07/19 09:35:25 [debug] 17386#0: *3 write old buf t:1 f:0 000055A44A1EB7E0, pos 000055A44A1EB7E0, size: 177 file: 0, size: 0 2022/07/19 09:35:25 [debug] 17386#0: *3 write new buf t:0 f:0 0000000000000000, pos 000055A4497F0A40, size: 144 file: 0, size: 0 2022/07/19 09:35:25 [debug] 17386#0: *3 write new buf t:0 f:0 0000000000000000, pos 000055A4497F1D80, size: 53 file: 0, size: 0 2022/07/19 09:35:25 [debug] 17386#0: *3 http write filter: l:1 f:0 s:374 2022/07/19 09:35:25 [debug] 17386#0: *3 http write filter limit 0 2022/07/19 09:35:25 [debug] 17386#0: *3 posix_memalign: 000055A44A206F10:512 @16 2022/07/19 09:35:25 [debug] 17386#0: *3 malloc: 000055A44A1C54C0:16384 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL buf copy: 177 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL buf copy: 144 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL buf copy: 53 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL to write: 374 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL_write: 374 2022/07/19 09:35:25 [debug] 17386#0: *3 http write filter 0000000000000000 2022/07/19 09:35:25 [debug] 17386#0: *3 http copy filter: 0 "/ping/pong?" 2022/07/19 09:35:25 [debug] 17386#0: *3 http finalize request: 0, "/ping/pong?" a:1, c:1 2022/07/19 09:35:25 [debug] 17386#0: *3 set http keepalive handler 2022/07/19 09:35:25 [debug] 17386#0: *3 http close request 2022/07/19 09:35:25 [debug] 17386#0: *3 http log handler 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A1FA280, unused: 8 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A1EABB0, unused: 284 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A1EBBC0, unused: 431 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A1DF470 2022/07/19 09:35:25 [debug] 17386#0: *3 hc free: 0000000000000000 2022/07/19 09:35:25 [debug] 17386#0: *3 hc busy: 0000000000000000 0 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A1C54C0 2022/07/19 09:35:25 [debug] 17386#0: *3 reusable connection: 1 2022/07/19 09:35:25 [debug] 17386#0: *3 event timer add: 27: 65000:14396763484 2022/07/19 09:35:25 [debug] 17386#0: *3 post event 000055A44A1259C0 2022/07/19 09:35:25 [debug] 17386#0: timer delta: 28 2022/07/19 09:35:25 [debug] 17386#0: posted event 000055A44A1259C0 2022/07/19 09:35:25 [debug] 17386#0: *3 delete posted event 000055A44A1259C0 2022/07/19 09:35:25 [debug] 17386#0: *3 http keepalive handler 2022/07/19 09:35:25 [debug] 17386#0: *3 malloc: 000055A44A1DF470:1024 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL_read: -1 2022/07/19 09:35:25 [debug] 17386#0: *3 SSL_get_error: 2 2022/07/19 09:35:25 [debug] 17386#0: *3 free: 000055A44A1DF470 2022/07/19 09:35:25 [debug] 17386#0: worker cycle 2022/07/19 09:35:25 [debug] 17386#0: epoll timer: 36878 2022/07/19 09:36:01 [debug] 17386#0: timer delta: 36905 2022/07/19 09:36:01 [debug] 17386#0: *1 event timer del: 26: 14396735362 2022/07/19 09:36:01 [debug] 17386#0: *1 http keepalive handler 2022/07/19 09:36:01 [debug] 17386#0: *1 close http connection: 26 2022/07/19 09:36:01 [debug] 17386#0: *1 SSL_shutdown: 1 2022/07/19 09:36:01 [debug] 17386#0: *1 reusable connection: 0 2022/07/19 09:36:01 [debug] 17386#0: *1 free: 0000000000000000 2022/07/19 09:36:01 [debug] 17386#0: *1 free: 0000000000000000 2022/07/19 09:36:01 [debug] 17386#0: *1 free: 000055A44A2594D0, unused: 8 2022/07/19 09:36:01 [debug] 17386#0: *1 free: 000055A44A205E80, unused: 384 2022/07/19 09:36:01 [debug] 17386#0: worker cycle 2022/07/19 09:36:01 [debug] 17386#0: epoll timer: 28095 2022/07/19 09:36:30 [debug] 17386#0: timer delta: 28118 2022/07/19 09:36:30 [debug] 17386#0: *3 event timer del: 27: 14396763484 2022/07/19 09:36:30 [debug] 17386#0: *3 http keepalive handler 2022/07/19 09:36:30 [debug] 17386#0: *3 close http connection: 27 2022/07/19 09:36:30 [debug] 17386#0: *3 SSL_shutdown: 1 2022/07/19 09:36:30 [debug] 17386#0: *3 reusable connection: 0 2022/07/19 09:36:30 [debug] 17386#0: *3 free: 0000000000000000 2022/07/19 09:36:30 [debug] 17386#0: *3 free: 0000000000000000 2022/07/19 09:36:30 [debug] 17386#0: *3 free: 000055A44A2055F0, unused: 8 2022/07/19 09:36:30 [debug] 17386#0: *3 free: 000055A44A206F10, unused: 384 2022/07/19 09:36:30 [debug] 17386#0: worker cycle
|
|
|
|
Быстрый переход
Вы не можете создавать новые темы в этом форуме.
Вы не можете отвечать в этом форуме.
Вы не можете удалять Ваши сообщения в этом форуме.
Вы не можете редактировать Ваши сообщения в этом форуме.
Вы не можете создавать опросы в этом форуме.
Вы не можете голосовать в этом форуме.
Important Information:
The Форум КриптоПро uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close