Перейти к содержанию

Навигация

CryptodevATECCx08 Auth/en: различия между версиями

Новая страница: «Getting messages from the "test" topic on the example.com server»
(Новая страница: «Now let's make http requests from WB controller pass this check. For simplicity, we will use nginx on the client side. This will give the opportunity to work with…»)
(Новая страница: «Getting messages from the "test" topic on the example.com server»)
 
(не показано 26 промежуточных версий этого же участника)
Строка 226: Строка 226:
with secure servers for clients who can't make SSL connections.
with secure servers for clients who can't make SSL connections.


Для начала создадим на неиспользуемом локальном порту http сервер, который будет делать
First, we will create a server on the unused local http port, which will do the following
всю https "магию" за нас:
all https "magic" for us:


<pre>
<pre>
Строка 242: Строка 242:
</pre>
</pre>


Добавим пользователя www-data в группу i2c для доступа к криптоустройству:
Add the www-data user to the i2c group to access the crypto device:
<pre>
<pre>
usermod -G www-data
usermod -G www-data
</pre>
</pre>


Выполним команду '''service nginx restart''' для обновления конфигурации.
Run the command '''service nginx restart''' to update the configuration.


Теперь при обращении по http на локальный порт 8080 зашифрованные запросы с аутентификационной
Now, when you access http on the local port 8080, encrypted requests with authentication  information will be sent to the server example.com
информацией будут отправлятся на сервер example.com.


<pre>
<pre>
Строка 261: Строка 260:
</pre>
</pre>


== Настройка openvpn ==
== Openvpn configuration ==


Для начала установим пакет:
First, install the package:


<pre>
<pre>
Строка 269: Строка 268:
</pre>
</pre>


Cоздадим файл req.cnf - он нам потребуется для создания сертификата сервера.  
Create file named req.cnf - we need it to make a server certificate.
<pre>
<pre>
[ v3_req ]
[ v3_req ]
Строка 277: Строка 276:
</pre>
</pre>


Серверу openvpn также требуется файл с параметрами DH, сделаем его.
The openvpn server also needs a file with DH parameters, let's make it.
<pre>
<pre>
openssl dhparam -out dh2048.pem 2048
openssl dhparam -out dh2048.pem 2048
</pre>
</pre>


Создание данного файла может потребовать несколько минут.  
It may take a few minutes to create this file.  


Далее сделаем приватный ключ нашего сервера и запрос на сертификат. Предполагаем, для примера, что
Next, make a private key of our server and request a certificate. We assume, for example, that
сервер имеет имя example.com:
server has name example.com:


<pre>  
<pre>  
Строка 293: Строка 292:
</pre>
</pre>


Подписываем запрос в нашем центре сертификации:
Sign the request in our certification authority:


<pre>
<pre>
Строка 299: Строка 298:
</pre>
</pre>


Теперь приступим к настройке openvpn сервера на машине example.com.
Now let's start setting up openvpn server on the machine example.com


Копируем файлы '''ca.crt''', '''example.crt''', '''example.key''' и '''dh2048.pem''' и редактируем файл конфигурации openvpn сервера.
Copy the file '''ca.crt''', '''example.crt''', '''example.key''' and '''dh2048.pem''' and edit the openvpn server configuration file.
По умолчанию конфигурационный файл лежит в файле /etc/openvpn/server.conf
By default, the configuration file is in /etc/openvpn/server.conf


<pre>
<pre>
Строка 328: Строка 327:
</pre>
</pre>


Добавим пользователя openvpn в группу i2c для доступа к криптоустройству:
Add the openvpn user to the i2c group to access the crypto device:


<pre>
<pre>
Строка 334: Строка 333:
</pre>
</pre>


после этого запускаем сервер командой
after that, start the server with the command
service openvpn start.
service openvpn start.


Далее на контроллере создаем файл конфигурации клиента:
Next, create a client configuration file on the controller:
client.ovpn:
client.ovpn:
<pre>
<pre>
Строка 359: Строка 358:
-------------------------------------------------------------------------
-------------------------------------------------------------------------
</pre>
</pre>
Обратите внимание на строчку group i2c. Она необходима для работы с криптоустройством.
Note the line group i2c. It is necessary to work with the crypto device.


После этого запускаем клиента:
Then run the client:


<pre>
<pre>
Строка 367: Строка 366:
</pre>
</pre>


Если все хорошо, то в системе должен появиться интерфейс tun0 с адресом из подсети 10.8.0.0/24:
If all is well, then the system should appear tun0 interface with the address from the subnet 10.8.0.0/24:


<pre>
<pre>
Строка 380: Строка 379:
</pre>
</pre>


Для проверки работоспособности запускаем ping:
To check the performance run ping:


<pre>
<pre>
Строка 389: Строка 388:
</pre>
</pre>


== Настройка mosquitto ==
== Mosquitto settings ==


UPD:
UPD:
Строка 469: Строка 468:




Генерируем приватный ключ и запрос на сертификат:
Generate a private key and certificate request:


<pre>
<pre>
Строка 481: Строка 480:
</pre>
</pre>


Копируем файлы '''ca.crt''', '''mosquitto.crt''', '''mosquitto.key''' на сервер и редактируем файл конфигурации '''/etc/mosquitto/conf.d/server.conf'''
Copy the file '''ca.crt''', '''mosquitto.crt''', '''mosquitto.key''' to the server and edit the configuration file '''/etc/mosquito/conf.d/server.conf'''


<pre>
<pre>
Строка 491: Строка 490:
</pre>
</pre>


Запускаем серис:
Start service:
<pre>
<pre>
service mosquitto start
service mosquitto start
</pre>
</pre>


Также, если требуется, можно сделать чтобы локальный mosquitto сервер на контроллере
Also, if required, you can make the local mosquitto server on the controller
форвардил некоторые топики на удаленный сервер. Для этого создаем файл бриджа: '''/etc/mosquitto/bridge.conf'''
forwarder some topics on a remote server. To do this, create a bridge file: '''/etc/mosquitto/bridge.conf'''


<pre>
<pre>
Строка 509: Строка 508:
</pre>
</pre>


После перезапуска локального сервиса mosquitto топики /test/.. будут отправлятся на удаленный сервер example.com
After restarting the local service mosquito topics /test/.. will be sent to the remote server example.com
по защищенному ssl каналу.
secure ssl channel.


Примеры клиентских команд mosquitto.
Examples of client mosquitto commands.
Отправка сообщения "message" в топик "test" на сервере example.com  
Sending a message to the "test" topic on the  example.com server


<pre>
<pre>
Строка 519: Строка 518:
</pre>
</pre>


Получение сообщений из топика "test" на сервере example.com
Getting messages from the "test" topic on the example.com server


<pre>
<pre>
mosquitto_sub -h example.com --cert device_AP6V5MDG.crt --key 'engine:ateccx08:ATECCx08:00:04:C0:00' -t "test" --cafile ca.crt
mosquitto_sub -h example.com --cert device_AP6V5MDG.crt --key 'engine:ateccx08:ATECCx08:00:04:C0:00' -t "test" --cafile ca.crt
</pre>
</pre>
12 063

правки