-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homeui-auth: check for cert at connectivity setup #194
base: feature/SOFT-4801-https
Are you sure you want to change the base?
Conversation
cat > /etc/nginx/ssl/auth.conf <<EOL | ||
|
||
server_name $DOMAIN; | ||
listen 80; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
чо сертбот делал, все то я и скопипастил
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не надо это писать комментами к PR, надо это писать комментами в коде
trap cleanup_on_exit EXIT | ||
|
||
make_request_cert() { | ||
awk -v "req_part=2" '/BEGIN CERT/{c++} c == req_part { print }' < "$DEVICE_ORIGINAL_CERT" > "$CERT_FOR_REQUEST" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а это из облака
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и тут
#!/bin/bash | ||
set -e | ||
|
||
ping -W 2 -c 1 8.8.8.8 || exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
стрёмно, не надо так. У клиента может быть закрытая сеть и он проколет дырку исключительно для сервера выдачи сертификатов.
Ещё молча вываливаться без отладки в логи - плохая идея.
У нас же есть определение наличия интернета в другом месте, можно его переиспользовать. А можно сделать так, чтобы скрипт просто нормально себя вёл, если дальше упадёт.
@@ -38,6 +38,8 @@ server { | |||
# Make site accessible from http://localhost/ | |||
server_name localhost; | |||
|
|||
include /etc/nginx/ssl/*.conf; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
потенциально проблемное место, надо проверить, как оно ведёт себя у клиентов при всяких обновления. Это же конффайл, а в этот default мы явно много раз просили клиентов самим лазить.
Плюс проверить надо на клиентских сборках, как там обновление поведёт себя.
#/bin/sh | ||
|
||
if [ "$2" = "connectivity-change" ]; then | ||
/usr/lib/wb-homeui-auth/check-ssl.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а это точно хорошая идея? Там не лучше это через какие-нибудь юниты сделать, и зависимости от таймеров и сети или что-то такое?
Ну типа дёргать надо раз в три месяца, а мы дёргаем каждый раз, когда вайфай мигает. Не критично, но подумать стоит имхо.
SSL_CERT_KEY_PATH="/etc/ssl/sslip.key" | ||
DHPARAM_PATH="/etc/ssl/dhparam.pem" | ||
CSR=/tmp/csr.pem | ||
KEYSPEC="ATECCx08:00:02:C0:00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это, к сожалению, зависит от модели WB, в клауде есть выбиралка. Можно куда-нибудь в общее её вытащить.
Плюс у нас есть всякие WB5 и старше, на которые homeui всё ещё ставится, и тут они поломаются. Надо как-нибудь, чтобы поломались с понятным сообщением, без спецэффектов - просто чтобы вот этого сертификата выписано не было и всё.
CERT_FOR_REQUEST=/var/run/shm/device_bundle.crt.pem | ||
|
||
openssl x509 -checkend $((60*60*24*15)) -noout -in $SSL_CERT_PATH && { | ||
echo "The certificate won't expire soon, exiting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
попадает в лог journald?
@evgeny-boger выкатил инфраструктуру для выдачи сертификатов и скрипт-клиент
я взял скрипт-клиент и дергаю его при изменении connectivity у NM для того, чтобы заиметь сертификат при появлении инета
все то же самое сейчас в тестовых fit-ах