Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow absolute path in <directory> config #103

Closed
marakiis opened this issue Sep 10, 2021 · 4 comments · Fixed by #101
Closed

Allow absolute path in <directory> config #103

marakiis opened this issue Sep 10, 2021 · 4 comments · Fixed by #101

Comments

@marakiis
Copy link

Currently paths in the directory group of the config files are used as follow:
serverhome + value (value among in, out, work, arch, conf)
This prevent the use of absolute path in the value part of the configuration.
A solution would be to modify the getters of the configuration java like this:

public String getConfigPath() {
  File conf = new File(configPath);
  if (conf.isAbsolute()) {
    return configPath;
  }
  return getBaseDirectory() + configPath;
}

@fredericBregier what do you think ?

@fredericBregier
Copy link
Collaborator

Might lead to "chroot defect" if you apply this: one can specify another root path than the software based directory said.
Note that on Linux:

  • Nothing prevents to mount specific FS for each directory (which is almost recommended indeed), giving the ability to separate each of them and manage them accordingly
  • Nothing prevents too to make a symbolic link to the real directory (the right to do so is on adminsys responsability, in order to give the read/write access to the application user to them), so not giving issue such as "chroot defect"

On windows, the first is (as far as I know) not really possible (not simply at least), but the second works too.

WDYT?

@marakiis
Copy link
Author

I understand and but what about preventing absolute path when loading the configuration ?
Just a check an throwing a BadConfigurationException if a "sub path" is absolute.

@fredericBregier
Copy link
Collaborator

OK, I got it.
I propose you to integrate this in 3.6.1 too (BadConfigurationException).
There will be several cases:

  • Global configuration (where in, out, work...) are globally configured (xml information at startup)
  • Rule configuration:
    • When defined (created or modified) (during admin intervention)
    • When used (if already defined) (during transfer initialization)

The first and second are ok for me. But perhaps the third (during transfer initialization) is too much?
I can imagine a scenario that will lead to an issue (a DBA change manually the rule directly in the database, so no control from the server OR the rule was already there before updating and therefore not changed but badly defined). But perhaps too much?
What I think, is that we can introduce a bad configuration during startup (global conf) or creation/modification of a rule through the server, but introducing such an exception during transfer could lead to ascending compatibility issue.

WDYT if I check only the 2 first cases, not the third one?

fredericBregier added a commit to fredericBregier/Waarp-All that referenced this issue Sep 13, 2021
This shall not be to prevent "CHROOT defect".

- Configuration is checked
- Rule creation or modification through DAO will checked

Also includes fix and optimization of LongUuid

Fix issue waarp#103
@fredericBregier fredericBregier linked a pull request Sep 13, 2021 that will close this issue
fredericBregier added a commit that referenced this issue Oct 14, 2021
This shall not be to prevent "CHROOT defect".

- Configuration is checked
- Rule creation or modification through DAO will checked

Also includes fix and optimization of LongUuid

Fix issue #103
@fredericBregier
Copy link
Collaborator

@marakiis Done as requested (checks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants