Updating for Keylime release v7.8.0

This commit is contained in:
Sergio Correia 2023-12-05 15:32:37 +00:00
parent ddfaa1e3f1
commit 50ddc5f8cf
No known key found for this signature in database
GPG Key ID: D0D219ED1F7E762C
4 changed files with 3 additions and 78 deletions

1
.gitignore vendored
View File

@ -31,3 +31,4 @@
/keylime-selinux-38.1.0.tar.gz
/v7.6.0.tar.gz
/v7.7.0.tar.gz
/v7.8.0.tar.gz

View File

@ -1,74 +0,0 @@
diff --git a/keylime/cmd/convert_config.py b/keylime/cmd/convert_config.py
index ab51332..3db8092 100755
--- a/keylime/cmd/convert_config.py
+++ b/keylime/cmd/convert_config.py
@@ -84,13 +84,33 @@ import importlib.util
import itertools
import json
import os
+import re
import shutil
from configparser import RawConfigParser
-from typing import List, Optional, Tuple
+from typing import List, Optional, Tuple, Union
from jinja2 import Template
-from keylime.common.version import str_to_version
+
+def str_to_version(v_str: str) -> Union[Tuple[int, int], None]:
+ """
+ Validates the string format and converts the provided string to a tuple of
+ ints which can be sorted and compared.
+
+ :returns: Tuple with version number parts converted to int. In case of
+ invalid version string, returns None
+ """
+
+ # Strip to remove eventual quotes and spaces
+ v_str = v_str.strip('" ')
+
+ m = re.match(r"^(\d+)\.(\d+)$", v_str)
+
+ if not m:
+ return None
+
+ return (int(m.group(1)), int(m.group(2)))
+
COMPONENTS = ["agent", "verifier", "tenant", "registrar", "ca", "logging"]
diff --git a/templates/2.0/adjust.py b/templates/2.0/adjust.py
index 312b790..c1e582a 100644
--- a/templates/2.0/adjust.py
+++ b/templates/2.0/adjust.py
@@ -2,9 +2,27 @@ import ast
import configparser
import re
from configparser import RawConfigParser
-from typing import Dict, List, Optional, Tuple
+from typing import Dict, List, Optional, Tuple, Union
-from keylime.common.version import str_to_version
+
+def str_to_version(v_str: str) -> Union[Tuple[int, int], None]:
+ """
+ Validates the string format and converts the provided string to a tuple of
+ ints which can be sorted and compared.
+
+ :returns: Tuple with version number parts converted to int. In case of
+ invalid version string, returns None
+ """
+
+ # Strip to remove eventual quotes and spaces
+ v_str = v_str.strip('" ')
+
+ m = re.match(r"^(\d+)\.(\d+)$", v_str)
+
+ if not m:
+ return None
+
+ return (int(m.group(1)), int(m.group(2)))
def adjust(config: RawConfigParser, mapping: Dict) -> None: # pylint: disable=unused-argument

View File

@ -8,7 +8,7 @@
%global selinuxtype targeted
Name: keylime
Version: 7.7.0
Version: 7.8.0
Release: %autorelease
Summary: Open source TPM software for Bootstrapping and Maintaining Trust
@ -18,8 +18,6 @@ Source1: %{srcname}.sysusers
# The selinux policy for keylime is distributed via this repo: https://github.com/RedHat-SP-Security/keylime-selinux
Source2: https://github.com/RedHat-SP-Security/%{name}-selinux/archive/v%{policy_version}/keylime-selinux-%{policy_version}.tar.gz
Patch: 01-duplicate-str-to-version.patch
# Main program: BSD
# Icons: MIT
License: Apache-2.0 AND MIT

View File

@ -1,2 +1,2 @@
SHA512 (v7.7.0.tar.gz) = cbec8c93c161ae8578a5c14520f6e49cf6d4f91c206b7aa7c41ba5bc6e10018801a3a4372377911caf0c6531ed3bdadf0c61dec3892ed32c292119c83991c912
SHA512 (v7.8.0.tar.gz) = 225610458c310b0af339e3ce0a2dd5635b333dc2cfd2de8a2d9be9518947ebf7dab2265e42a6d187cbc6decc5c746df33d7a91ce28879a4fa2173ae2fd1a9242
SHA512 (keylime-selinux-38.1.0.tar.gz) = cbb54511b14a0352e1c2679909b0dcbc00924bacf8f783b230a782d0fae6e3b0168704ea4896c273199163e04a26bcb6217cf30dc480fc300e1fdcb7e39d00a8