Skip to content

Commit

Permalink
fix: upstream changes
Browse files Browse the repository at this point in the history
1. certutilpath.patch patched file changed. Removed bc/ is not used anymore
   due to the autofirma-setup removal.
2. etc_config.patch patched file changed. A class name and also the line
   endings mutated to windows CRLF *sigh*.
3. Autofirma.jar has been renamed to autofirma.jar (*double sigh*.)
4. Autofirma now expects the cer file to be named Autofirma_ROOT.cer
  • Loading branch information
nilp0inter committed Feb 14, 2025
1 parent db0cc74 commit e3f31a3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 deletions.
2 changes: 1 addition & 1 deletion nix/autofirma/create-autofirma-cert
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [[ "$1" == '--verbose' ]]; then
fi

_autofirma_dir="$1"
_autofirma_ca="${_autofirma_dir}/AutoFirma_ROOT.cer"
_autofirma_ca="${_autofirma_dir}/Autofirma_ROOT.cer"
_autofirma_pfx="${_autofirma_dir}/autofirma.pfx"
_cert_days="3650"
_cert_cn="AutoFirma ROOT"
Expand Down
8 changes: 2 additions & 6 deletions nix/autofirma/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
patches =
[
./patches/clienteafirma/pr-367.patch
./patches/clienteafirma/certutilpath.patch
./patches/clienteafirma/etc_config.patch
./patches/clienteafirma/aarch64_elf.patch # Until https://github.com/ctt-gob-es/clienteafirma/pull/435 gets merged
]
Expand Down Expand Up @@ -63,8 +62,6 @@
reset-project-build-timestamp
substituteInPlace afirma-ui-simple-configurator/src/main/java/es/gob/afirma/standalone/configurator/ConfiguratorFirefoxLinux.java \
--replace-fail '@certutilpath' '${nss.tools}/bin/certutil'
'';

dontFixup = true;
Expand Down Expand Up @@ -158,8 +155,7 @@
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib/AutoFirma
install -Dm644 afirma-simple/target/Autofirma.jar $out/lib/AutoFirma
install -Dm644 afirma-ui-simple-configurator/target/AutofirmaConfigurador.jar $out/lib/AutoFirma
install -Dm644 afirma-simple/target/autofirma.jar $out/lib/AutoFirma
runHook postInstall
'';
Expand Down Expand Up @@ -198,7 +194,7 @@
--add-flags "-Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel" \
--add-flags "-Dawt.useSystemAAFontSettings=lcd" \
--add-flags "-Dswing.aatext=true" \
--add-flags "-jar ${autofirma-jar}/lib/AutoFirma/Autofirma.jar"
--add-flags "-jar ${autofirma-jar}/lib/AutoFirma/autofirma.jar"
substituteInPlace $out/etc/firefox/pref/AutoFirma.js \
--replace-fail /usr/bin/autofirma $out/bin/autofirma
Expand Down
2 changes: 1 addition & 1 deletion nix/autofirma/hm-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ in {
home.packages = [cfg.finalPackage];
programs.firefox.policies.Certificates = mkIf anyFirefoxIntegrationProfileIsEnabled {
ImportEnterpriseRoots = true;
Install = [ "${config.home.homeDirectory}/.afirma/Autofirma/AutoFirma_ROOT.cer" ];
Install = [ "${config.home.homeDirectory}/.afirma/Autofirma/Autofirma_ROOT.cer" ];
};
programs.firefox.profiles = flip mapAttrs cfg.firefoxIntegration.profiles (name: {enable, ...}: {
settings = mkIf enable {
Expand Down
2 changes: 1 addition & 1 deletion nix/autofirma/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ in {
"${cfg.finalPackage}/etc/firefox/pref/AutoFirma.js"
];
policies.Certificates.ImportEnterpriseRoots = true;
policies.Certificates.Install = [ "/etc/Autofirma/AutoFirma_ROOT.cer" ];
policies.Certificates.Install = [ "/etc/Autofirma/Autofirma_ROOT.cer" ];
};
};

Expand Down
15 changes: 0 additions & 15 deletions nix/autofirma/patches/clienteafirma/certutilpath.patch

This file was deleted.

20 changes: 10 additions & 10 deletions nix/autofirma/patches/clienteafirma/etc_config.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
diff --git a/afirma-simple/src/main/java/es/gob/afirma/standalone/protocol/SecureSocketUtils.java b/afirma-simple/src/main/java/es/gob/afirma/standalone/protocol/SecureSocketUtils.java
index 4485c27aa..6e96cb830 100644
index e925ac3ff..fd5838557 100644
--- a/afirma-simple/src/main/java/es/gob/afirma/standalone/protocol/SecureSocketUtils.java
+++ b/afirma-simple/src/main/java/es/gob/afirma/standalone/protocol/SecureSocketUtils.java
@@ -65,7 +65,8 @@ class SecureSocketUtils {
* @return Almacén de claves o {@code null} si no se encontró. */
private static File getKeyStoreFile() {

- File appDir = AutoFirmaUtil.getApplicationDirectory();
+ // Check first in /etc for the KeyStoreFile
+ File appDir = new File("/etc/Autofirma");

if (appDir != null && new File(appDir, KEYSTORE_NAME).exists()
&& new File(appDir, CA_ROOT_NAME).exists()) {
* @return Almacén de claves o {@code null} si no se encontró. */
private static File getKeyStoreFile() {

- File appDir = DesktopUtil.getApplicationDirectory();
+ // Check first in /etc for the KeyStoreFile
+ File appDir = new File("/etc/Autofirma");

if (appDir != null && new File(appDir, KEYSTORE_NAME).exists()
&& new File(appDir, CA_ROOT_NAME).exists()) {

0 comments on commit e3f31a3

Please sign in to comment.