Skip to content

Commit

Permalink
Fix config file owners and permissions for containers
Browse files Browse the repository at this point in the history
The container startup scripts have been modified to update
the owners and permissions after the configuration is done
such that the config files will have the proper owners and
permissions.

Note: Some files created at runtime (e.g. log files) still
have inconsistent owners/permissions. These files will be
fixed separately later.
  • Loading branch information
edewata committed May 29, 2024
1 parent 90154c7 commit c870ba2
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 36 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ca-container-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,17 @@ jobs:
# TODO: review owners/permissions
cat > expected << EOF
drwxrwxrwx 17 root Catalina
drwxrwx--- 17 root alias
drwxrwxrwx 17 root alias
drwxrwxrwx 17 root ca
-rw-rw-rw- 17 root catalina.policy
lrwxrwxrwx 17 root catalina.properties -> /usr/share/pki/server/conf/catalina.properties
drwxrwxrwx 17 root certs
lrwxrwxrwx 17 root context.xml -> /etc/tomcat/context.xml
-rw-rw-rw- 17 root jss.conf
lrwxrwxrwx 17 root logging.properties -> /usr/share/pki/server/conf/logging.properties
-rw-rw---- 17 root password.conf
-rw-rw-rw- 17 root password.conf
-rw-rw-rw- 17 root server.xml
-rw-rw---- 17 root serverCertNick.conf
-rw-rw-rw- 17 root serverCertNick.conf
-rw-rw-rw- 17 root tomcat.conf
lrwxrwxrwx 17 root web.xml -> /etc/tomcat/web.xml
EOF
Expand All @@ -283,18 +283,18 @@ jobs:
# TODO: review owners/permissions
cat > expected << EOF
-rw-rw-rw- 17 root CS.cfg
-rw-rw---- 17 root adminCert.profile
-rw-rw-rw- 17 root adminCert.profile
drwxrwxrwx 17 root archives
-rw-rw---- 17 root caAuditSigningCert.profile
-rw-rw---- 17 root caCert.profile
-rw-rw---- 17 root caOCSPCert.profile
drwxrwx--- 17 root emails
-rw-rw---- 17 root flatfile.txt
drwxrwx--- 17 root profiles
-rw-rw---- 17 root proxy.conf
-rw-rw-rw- 17 root caAuditSigningCert.profile
-rw-rw-rw- 17 root caCert.profile
-rw-rw-rw- 17 root caOCSPCert.profile
drwxrwxrwx 17 root emails
-rw-rw-rw- 17 root flatfile.txt
drwxrwxrwx 17 root profiles
-rw-rw-rw- 17 root proxy.conf
-rw-rw-rw- 17 root registry.cfg
-rw-rw---- 17 root serverCert.profile
-rw-rw---- 17 root subsystemCert.profile
-rw-rw-rw- 17 root serverCert.profile
-rw-rw-rw- 17 root subsystemCert.profile
EOF
diff expected output
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/kra-container-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,17 @@ jobs:
# TODO: review owners/permissions
cat > expected << EOF
drwxrwxrwx 17 root Catalina
drwxrwx--- 17 root alias
drwxrwxrwx 17 root alias
-rw-rw-rw- 17 root catalina.policy
lrwxrwxrwx 17 root catalina.properties -> /usr/share/pki/server/conf/catalina.properties
drwxrwxrwx 17 root certs
lrwxrwxrwx 17 root context.xml -> /etc/tomcat/context.xml
-rw-rw-rw- 17 root jss.conf
drwxrwxrwx 17 root kra
lrwxrwxrwx 17 root logging.properties -> /usr/share/pki/server/conf/logging.properties
-rw-rw---- 17 root password.conf
-rw-rw-rw- 17 root password.conf
-rw-rw-rw- 17 root server.xml
-rw-rw---- 17 root serverCertNick.conf
-rw-rw-rw- 17 root serverCertNick.conf
-rw-rw-rw- 17 root tomcat.conf
lrwxrwxrwx 17 root web.xml -> /etc/tomcat/web.xml
EOF
Expand All @@ -400,7 +400,7 @@ jobs:
cat > expected << EOF
-rw-rw-rw- 17 root CS.cfg
drwxrwxrwx 17 root archives
-rw-rw-r-- 17 root registry.cfg
-rw-rw-rw- 17 root registry.cfg
EOF
diff expected output
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ocsp-container-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,17 @@ jobs:
# TODO: review owners/permissions
cat > expected << EOF
drwxrwxrwx 17 root Catalina
drwxrwx--- 17 root alias
drwxrwxrwx 17 root alias
-rw-rw-rw- 17 root catalina.policy
lrwxrwxrwx 17 root catalina.properties -> /usr/share/pki/server/conf/catalina.properties
drwxrwxrwx 17 root certs
lrwxrwxrwx 17 root context.xml -> /etc/tomcat/context.xml
-rw-rw-rw- 17 root jss.conf
lrwxrwxrwx 17 root logging.properties -> /usr/share/pki/server/conf/logging.properties
drwxrwxrwx 17 root ocsp
-rw-rw---- 17 root password.conf
-rw-rw-rw- 17 root password.conf
-rw-rw-rw- 17 root server.xml
-rw-rw---- 17 root serverCertNick.conf
-rw-rw-rw- 17 root serverCertNick.conf
-rw-rw-rw- 17 root tomcat.conf
lrwxrwxrwx 17 root web.xml -> /etc/tomcat/web.xml
EOF
Expand All @@ -386,7 +386,7 @@ jobs:
cat > expected << EOF
-rw-rw-rw- 17 root CS.cfg
drwxrwxrwx 17 root archives
-rw-rw-r-- 17 root registry.cfg
-rw-rw-rw- 17 root registry.cfg
EOF
diff expected output
Expand Down
3 changes: 0 additions & 3 deletions base/acme/bin/pki-acme-run
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ then
else
echo "INFO: Creating /data/conf"
cp -r /var/lib/pki/pki-tomcat/conf.default /data/conf
chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +
fi

echo "################################################################################"
Expand Down
10 changes: 7 additions & 3 deletions base/ca/bin/pki-ca-run
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
else
echo "INFO: Creating /data/conf"
cp -r /var/lib/pki/pki-tomcat/conf.default /data/conf
chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +
fi

echo "################################################################################"
Expand Down Expand Up @@ -386,6 +383,13 @@ echo "INFO: Configuring PKI CA"
pki-server ca-config-set internaldb.minConns 0
pki-server ca-config-set ca.authorityMonitor.enable false

echo "################################################################################"
echo "INFO: Updating owners and permissions"

chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +

echo "################################################################################"
echo "INFO: Starting PKI CA"

Expand Down
10 changes: 7 additions & 3 deletions base/kra/bin/pki-kra-run
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
else
echo "INFO: Creating /data/conf"
cp -r /var/lib/pki/pki-tomcat/conf.default /data/conf
chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +
fi

echo "################################################################################"
Expand Down Expand Up @@ -162,6 +159,13 @@ echo "INFO: Configuring PKI KRA"

pki-server kra-config-set internaldb.minConns 0

echo "################################################################################"
echo "INFO: Updating owners and permissions"

chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +

echo "################################################################################"
echo "INFO: Starting PKI KRA"

Expand Down
10 changes: 7 additions & 3 deletions base/ocsp/bin/pki-ocsp-run
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
else
echo "INFO: Creating /data/conf"
cp -r /var/lib/pki/pki-tomcat/conf.default /data/conf
chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +
fi

echo "################################################################################"
Expand Down Expand Up @@ -159,6 +156,13 @@ echo "INFO: Configuring OCSP Responder"

pki-server ocsp-config-set internaldb.minConns 0

echo "################################################################################"
echo "INFO: Updating owners and permissions"

chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +

echo "################################################################################"
echo "INFO: Starting OCSP Responder"

Expand Down
10 changes: 7 additions & 3 deletions base/server/bin/pki-server-run
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ then
else
echo "INFO: Creating /data/conf"
cp -r /var/lib/pki/pki-tomcat/conf.default /data/conf
chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +
fi

echo "################################################################################"
Expand Down Expand Up @@ -193,6 +190,13 @@ then
ca_signing
fi

echo "################################################################################"
echo "INFO: Updating owners and permissions"

chown -Rf pkiuser:root /data/conf
find /data/conf -type f -exec chmod +rw -- {} +
find /data/conf -type d -exec chmod +rwx -- {} +

echo "################################################################################"
echo "INFO: Starting PKI server"

Expand Down

0 comments on commit c870ba2

Please sign in to comment.