Skip to content

Commit 1f12e7c

Browse files
committed
Add snippet to update the Root CA (bsc#1194792)
Read the root CA from the mounted secret and use its content in an autoyast script to set it in the client machine.
1 parent 88b40f1 commit 1f12e7c

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

java/conf/cobbler/snippets/root_ca

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#import uyuni_cobbler_helper
2+
3+
<script>
4+
<filename>root-ca-update.sh</filename>
5+
<source>
6+
<![CDATA[
7+
cat <<EOF >/etc/pki/trust/anchors/RHN-ORG-TRUSTED-SSL-CERT
8+
$uyuni_cobbler_helper.get_ssl_ca_cert()
9+
EOF
10+
/usr/sbin/update-ca-certificates
11+
]]>
12+
</source>
13+
</script>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add snippet to set the SSL root CA (bsc#1194792)

java/spacewalk-java.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ install -m 644 conf/cobbler/snippets/minion_script %{buildroot}%{spacewalksni
582582
install -m 644 conf/cobbler/snippets/sles_no_signature_checks %{buildroot}%{spacewalksnippetsdir}/sles_no_signature_checks
583583
install -m 644 conf/cobbler/snippets/wait_for_networkmanager_script %{buildroot}%{spacewalksnippetsdir}/wait_for_networkmanager_script
584584
install -m 644 conf/cobbler/snippets/autoyast_channels %{buildroot}%{spacewalksnippetsdir}/autoyast_channels
585+
install -m 644 conf/cobbler/snippets/root_ca %{buildroot}%{spacewalksnippetsdir}/root_ca
585586

586587
# special links for rhn-search
587588
RHN_SEARCH_BUILD_DIR=%{_datadir}/rhn/search/lib
@@ -749,6 +750,7 @@ fi
749750
%config %{spacewalksnippetsdir}/sles_no_signature_checks
750751
%config %{spacewalksnippetsdir}/wait_for_networkmanager_script
751752
%config %{spacewalksnippetsdir}/autoyast_channels
753+
%config %{spacewalksnippetsdir}/root_ca
752754
%if 0%{?suse_version}
753755
%config(noreplace) %{serverdir}/tomcat/webapps/rhn/META-INF/context.xml
754756
%else
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add snippet helper reading the SSL root CA (bsc#1194792)

python/uyuni-cobbler-helper/uyuni_cobbler_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,11 @@ def _connect_db():
4242
dbname=config.get("default", "db_name"),
4343
port=int(config.get("default", "db_port")),
4444
)
45+
46+
47+
def get_ssl_ca_cert():
48+
with open(
49+
"/etc/pki/trust/anchors/LOCAL-RHN-ORG-TRUSTED-SSL-CERT", "r", encoding="utf-8"
50+
) as fd:
51+
content = fd.read()
52+
return content

0 commit comments

Comments
 (0)