diff --git a/Dockerfile b/Dockerfile index 931c99fc..f8091145 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,11 +37,24 @@ FROM ruby:3.3.1-alpine3.18 as app ENV RAILS_ENV=production ENV BUNDLE_WITHOUT="development:test" ENV LD_PRELOAD=/lib/libgcompat.so.0 +ENV OPENSSL_CONF=/app/openssl_legacy.cnf WORKDIR /app RUN apk add --no-cache sqlite-dev libpq-dev mariadb-dev vips-dev vips-poppler poppler-utils vips-heif gcompat ttf-freefont && mkdir /fonts && rm /usr/share/fonts/freefont/FreeSans.otf +RUN echo $'.include = /etc/ssl/openssl.cnf\n\ +\n\ +[provider_sect]\n\ +default = default_sect\n\ +legacy = legacy_sect\n\ +\n\ +[default_sect]\n\ +activate = 1\n\ +\n\ +[legacy_sect]\n\ +activate = 1' >> /app/openssl_legacy.cnf + COPY ./Gemfile ./Gemfile.lock ./ RUN apk add --no-cache build-base && bundle install && apk del build-base && rm -rf ~/.bundle /usr/local/bundle/cache && ruby -e "puts Dir['/usr/local/bundle/**/{spec,rdoc,resources/shared,resources/collation,resources/locales}']" | xargs rm -rf diff --git a/app/controllers/esign_settings_controller.rb b/app/controllers/esign_settings_controller.rb index 1b87df45..022f5dc8 100644 --- a/app/controllers/esign_settings_controller.rb +++ b/app/controllers/esign_settings_controller.rb @@ -57,8 +57,8 @@ class EsignSettingsController < ApplicationController save_new_cert!(@encrypted_config, @cert_record) redirect_to settings_esign_path, notice: 'Certificate has been successfully added!' - rescue OpenSSL::PKCS12::PKCS12Error - @cert_record.errors.add(:password, "is invalid. Make sure you're uploading a valid .p12 file") + rescue OpenSSL::PKCS12::PKCS12Error => e + @cert_record.errors.add(:password, e.message) render turbo_stream: turbo_stream.replace(:modal, template: 'esign_settings/new'), status: :unprocessable_entity end