[java-identity-provider] branch master updated: IDP-1499 Change unix setmodes

Rod Widdowson rdw at steadingsoftware.com
Tue Feb 4 11:29:56 EST 2020


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=1e612b06b6032404e26ad499c209c4302491da10

The following commit(s) were added to refs/heads/master by this push:
       new  1e612b0   IDP-1499 Change unix setmodes
1e612b0 is described below

commit 1e612b06b6032404e26ad499c209c4302491da10
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Feb 4 16:02:27 2020 +0000

    IDP-1499 Change unix setmodes
    
    https://issues.shibboleth.net/jira/browse/IDP-1499
    
    * Always set dist and system readonly (windows)
    
    On unix by default /if idp.conf.setmode is TRUE
    * Always 755 for bin (to capture new files)
    * Always 444 for system
    * Always 444 for dist
    * Nothing for conf - the files are either right now or non sensitive in new installs
    * if new install
    	idp.credentials.filemode/600 for credentials/* (not just keys)
    * if idp.credentials.group is specified setgrp on crendentials/*
---
 .../shibboleth/idp/installer/InstallerProperties.java  |  9 ++-------
 .../idp/installer/InstallerPropertiesImpl.java         | 18 ++----------------
 .../java/net/shibboleth/idp/installer/V4Install.java   | 16 ++++++++--------
 3 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
index a8ec348..f118dfe 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
@@ -40,12 +40,7 @@ public interface InstallerProperties extends InitializableComponent {
      * @return do we not tidy up?*/
     public boolean isNoTidy();
 
-    /** Mode to set all files in conf.
-    * @return the mode
-    */
-    @Nonnull public String getConfFileMode();
-
-    /** Mode to set on key files in credentials.
+    /** Mode to set on all files in credentials.
     * @return the mode
     */
     @Nonnull public String getCredentialsKeyFileMode();
@@ -53,7 +48,7 @@ public interface InstallerProperties extends InitializableComponent {
     /** Group to set on all files in credentials and conf.
     * @return the mode or null if none to be set
     */
-    @Nullable public String getConfCredentialsGroup();
+    @Nullable public String getCredentialsGroup();
 
     /** Do we set the mode?
     * @return do we the mode
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
index 02a763c..2ea5363 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
@@ -101,14 +101,11 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
     /** The the key size to generate.  */
     public static final String KEY_SIZE = "idp.keysize";
 
-    /** Mode to set on conf files. */
-    public static final String MODE_CONF = "idp.conf.filemode";
-
     /** Mode to set on credential *key files. */
     public static final String MODE_CREDENTIAL_KEYS = "idp.conf.credentials.filemode";
 
     /** Group to set on files in the credential and conf directories. */
-    public static final String GROUP_CONF_CREDENTIALS = "idp.conf.group";
+    public static final String GROUP_CONF_CREDENTIALS = "idp.conf.credentials.group";
 
     /** Do we do any chgrp/chmod work? */
     public static final String PERFORM_SET_MODE = "idp.conf.setmode";
@@ -167,9 +164,6 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
     /** whether to tidy up. */
     private boolean setGroupAndMode = true;
 
-    /** conf all file mode. */
-    private String confFileMode;
-
     /** credentials key file mode. */
     private String credentialsKeyFileMode;
 
@@ -445,14 +439,6 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
     }
 
     /** {@inheritDoc} */
-    @Override @Nonnull public String getConfFileMode() {
-        if (confFileMode ==null) {
-            confFileMode = installerProperties.getProperty(MODE_CONF, "600");
-        }
-        return confFileMode;
-    }
-
-    /** {@inheritDoc} */
     @Override @Nonnull public String getCredentialsKeyFileMode() {
         if (credentialsKeyFileMode == null) {
             credentialsKeyFileMode = installerProperties.getProperty(MODE_CREDENTIAL_KEYS, "600");
@@ -461,7 +447,7 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
     }
 
     /** {@inheritDoc} */
-    @Override @Nullable public String getConfCredentialsGroup() {
+    @Override @Nullable public String getCredentialsGroup() {
         return installerProperties.getProperty(GROUP_CONF_CREDENTIALS);
     }
 
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
index ba2a6c7..a7f57b8 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/V4Install.java
@@ -430,14 +430,14 @@ public class V4Install extends AbstractInitializableComponent {
         if (installerProps.isSetGroupAndMode()) {
             InstallerSupport.setMode(installerProps.getTargetDir().resolve("bin"), "755", "**/*.sh");
             InstallerSupport.setMode(installerProps.getTargetDir().resolve("system"), "444", "**/*");
-            InstallerSupport.setMode(installerProps.getTargetDir().resolve("credentials"),
-                    installerProps.getCredentialsKeyFileMode(), "**/*.key");
-            InstallerSupport.setMode(installerProps.getTargetDir().resolve("conf"),
-                    installerProps.getConfFileMode(), "**/*");
-            final String group = installerProps.getConfCredentialsGroup();
-            if (group != null) {
-                InstallerSupport.setGroup(installerProps.getTargetDir().resolve("credentials"), group, "**/*");
-                InstallerSupport.setGroup(installerProps.getTargetDir().resolve("conf"), group, "**/*");
+            InstallerSupport.setMode(installerProps.getTargetDir().resolve("dist"), "444", "**/*");
+            if (currentState.getInstalledVersion() == null) {
+                InstallerSupport.setMode(installerProps.getTargetDir().resolve("credentials"),
+                        installerProps.getCredentialsKeyFileMode(), "**/*");
+                final String group = installerProps.getCredentialsGroup();
+                if (group != null) {
+                    InstallerSupport.setGroup(installerProps.getTargetDir().resolve("credentials"), group, "**/*");
+                }
             }
         }
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list