├── .github
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug.yml
│ ├── config.yml
│ └── feature.yml
├── SECURITY.md
├── SUPPORT.md
└── workflows
│ ├── build-linux.yml
│ ├── build-mac.yml
│ ├── build-win.yml
│ ├── build.yml
│ └── post-publish.yml
├── .gitignore
├── .mvn
└── wrapper
│ └── maven-wrapper.properties
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── build_linux.sh
├── build_mac.sh
├── build_win.ps1
├── dist
├── jlink.args
├── jpackage.args
└── mac
│ └── cryptomator-cli.entitlements
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
└── main
├── java
├── module-info.java
└── org
│ └── cryptomator
│ └── cli
│ ├── CryptomatorCli.java
│ ├── ListMounters.java
│ ├── LogbackConfigurator.java
│ ├── LoggingMixin.java
│ ├── MountSetup.java
│ ├── PasswordSource.java
│ └── Unlock.java
└── resources
└── META-INF
└── services
└── ch.qos.logback.classic.spi.Configurator
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexual language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies within all project spaces, and it also applies when
49 | an individual is representing the project or its community in public spaces.
50 | Examples of representing a project or community include using an official
51 | project e-mail address, posting via an official social media account, or acting
52 | as an appointed representative at an online or offline event. Representation of
53 | a project may be further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at support@cryptomator.org. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Cryptomator CLI
2 |
3 | ## Did you find a bug?
4 |
5 | - Ensure you're running the latest version of Cryptomator CLI.
6 | - Ensure the bug is related to the CLI version of Cryptomator. Bugs concerning the Cryptomator desktop, iOS and Android app can be reported on the [Cryptomator issues list](https://github.com/cryptomator/cryptomator/issues), [Cryptomator for iOS issues list](https://github.com/cryptomator/ios/issues) and [Cryptomator for Android issues list](https://github.com/cryptomator/android/issues) respectively.
7 | - Ensure the bug was not [already reported](https://github.com/cryptomator/cli/issues). You can also check out our [FAQ](https://community.cryptomator.org/c/kb/faq).
8 | - If you're unable to find an open issue addressing the problem, [submit a new one](https://github.com/cryptomator/cli/issues/new/choose).
9 |
10 | ## Did you write a patch that fixes a bug?
11 |
12 | - Open a new pull request with the patch.
13 | - Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
14 |
15 | ## Do you intend to add a new feature or change an existing one?
16 |
17 | - Suggest your change by [submitting a new issue](https://github.com/cryptomator/cli/issues/new/choose) and start writing code.
18 |
19 | ## Code of Conduct
20 |
21 | Help us keep Cryptomator open and inclusive. Please read and follow our [Code of Conduct](https://github.com/cryptomator/cli/blob/develop/.github/CODE_OF_CONDUCT.md).
22 |
23 | ## Above all, thank you for your contributions
24 |
25 | Thank you for taking the time to contribute to the project! :+1:
26 |
27 | Cryptomator Team
28 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [cryptomator] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | custom: https://cryptomator.org/sponsors/
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: Create a report to help us improve
3 | labels: ["type:bug"]
4 | body:
5 | - type: checkboxes
6 | id: terms
7 | attributes:
8 | label: Please agree to the following
9 | options:
10 | - label: I have searched [existing issues](https://github.com/cryptomator/cli/issues?q=) for duplicates
11 | required: true
12 | - label: I agree to follow this project's [Code of Conduct](https://github.com/cryptomator/cli/blob/develop/.github/CODE_OF_CONDUCT.md)
13 | required: true
14 | - type: input
15 | id: summary
16 | attributes:
17 | label: Summary
18 | placeholder: Please summarize your problem.
19 | validations:
20 | required: true
21 | - type: textarea
22 | id: software-versions
23 | attributes:
24 | label: What software is involved?
25 | description: |
26 | Examples:
27 | - Operating System: Windows 10
28 | - Cryptomator CLI: 1.5.16
29 | - OneDrive: 23.226
30 | - LibreOffice: 7.1.4
31 | value: |
32 | - Operating System:
33 | - Cryptomator CLI:
34 | - …
35 | validations:
36 | required: true
37 | - type: dropdown
38 | id: volume-type
39 | attributes:
40 | label: Volume Type
41 | description: What volume type is selected under Settings → Virtual Drive?
42 | options:
43 | - WinFsp
44 | - WinFsp (Local Drive)
45 | - FUSE-T
46 | - macFUSE
47 | - FUSE
48 | - WebDAV (Windows Explorer)
49 | - WebDAV (AppleScript)
50 | - WebDAV (gio)
51 | - WebDAV (HTTP Address)
52 | - Dokany (1.5)
53 | validations:
54 | required: false
55 | - type: textarea
56 | id: reproduction-steps
57 | attributes:
58 | label: Steps to Reproduce
59 | value: |
60 | 1. [First Step]
61 | 2. [Second Step]
62 | 3. …
63 | validations:
64 | required: true
65 | - type: textarea
66 | id: expected-behaviour
67 | attributes:
68 | label: Expected Behavior
69 | placeholder: What you expect to happen.
70 | validations:
71 | required: true
72 | - type: textarea
73 | id: actual-behaviour
74 | attributes:
75 | label: Actual Behavior
76 | placeholder: What actually happens.
77 | validations:
78 | required: true
79 | - type: dropdown
80 | id: reproducibility
81 | attributes:
82 | label: Reproducibility
83 | description: How often does the described behaviour occur?
84 | options:
85 | - Always
86 | - Intermittent
87 | - Only once
88 | validations:
89 | required: true
90 | - type: textarea
91 | id: logs
92 | attributes:
93 | label: Relevant Log Output
94 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
95 | render: shell
96 | - type: textarea
97 | id: further-info
98 | attributes:
99 | label: Anything else?
100 | description: Links? References? Screenshots? Configurations? Any data that might be necessary to reproduce the issue?
101 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Help & Support
4 | url: https://community.cryptomator.org/
5 | about: You will find answers in our community forum
6 | - name: User Manual
7 | url: https://docs.cryptomator.org/
8 | about: Read the Cryptomator documentation here
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature.yml:
--------------------------------------------------------------------------------
1 | name: Feature Request
2 | description: Suggest an idea for this project
3 | labels: ["type:feature-request"]
4 | body:
5 | - type: checkboxes
6 | id: terms
7 | attributes:
8 | label: Please agree to the following
9 | options:
10 | - label: I have searched [existing issues](https://github.com/cryptomator/cli/issues?q=) for duplicates
11 | required: true
12 | - label: I agree to follow this project's [Code of Conduct](https://github.com/cryptomator/cli/blob/develop/.github/CODE_OF_CONDUCT.md)
13 | required: true
14 | - type: input
15 | id: summary
16 | attributes:
17 | label: Summary
18 | placeholder: Please summarize your feature request.
19 | validations:
20 | required: true
21 | - type: textarea
22 | id: motivation
23 | attributes:
24 | label: Motivation
25 | description: Who requires this feature? What problem does the user face? How would this feature solve the problem?
26 | validations:
27 | required: true
28 | - type: textarea
29 | id: alternatives
30 | attributes:
31 | label: Considered Alternatives
32 | description: What current alternatives or workarounds have you considered? Is there a different way to solve the same problem?
33 | - type: textarea
34 | id: context
35 | attributes:
36 | label: Anything else?
37 | description: Any context, suggestions, screenshots, or concepts you want to share?
--------------------------------------------------------------------------------
/.github/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Reporting a Vulnerability
4 |
5 | We take security seriously at Cryptomator. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
6 |
7 | To report a security vulnerability, please use the [GitHub Security Advisory feature](https://github.com/cryptomator/cli/security/advisories). This feature allows you to privately discuss, fix, and publish information about security vulnerabilities.
8 |
9 | If you prefer to report the vulnerability via email, please send an email to security@cryptomator.org.
10 |
11 | PGP key fingerprint: `3647 9903 B23A E0A5 9359 9A3E 23B5 DBEF 94D4 D81D` ([public key](https://gist.github.com/cryptobot/864300b6b44ae2d2a15abedfe14bd040))
12 |
13 | ## Expectations
14 |
15 | When reporting a vulnerability, please provide us with a detailed report that includes:
16 |
17 | - A description of the vulnerability
18 | - Steps to reproduce the vulnerability
19 | - Possible impact of the vulnerability
20 | - Any additional information that may be helpful
21 |
22 | We ask that you do not publicly disclose the vulnerability until we have had a chance to address it.
23 |
24 | ## Thank You
25 |
26 | We appreciate your help in keeping Cryptomator secure. Thank you for your contributions to the security of our project.
27 |
--------------------------------------------------------------------------------
/.github/SUPPORT.md:
--------------------------------------------------------------------------------
1 | # Support for Cryptomator
2 |
3 | For development-related topics, GitHub is the right place.
4 |
5 | For _everything else_, please visit our official [Cryptomator Community](https://community.cryptomator.org) (we are there, too :wink:). Amongst others, you will find:
6 |
7 | - [Knowledge Base](https://community.cryptomator.org/c/kb)
8 | - Installation manuals
9 | - Usage guides
10 | - FAQ
11 | - [Help with problems](https://community.cryptomator.org/c/help)
12 | - Assistance with the setup
13 | - Known issues and workarounds
14 | - Discussions about the apps
15 | - [Development discussions](https://community.cryptomator.org/c/development)
16 | - General questions
17 | - Discussions regarding our design decisions
18 | - Our roadmap
19 |
--------------------------------------------------------------------------------
/.github/workflows/build-linux.yml:
--------------------------------------------------------------------------------
1 | name: Java app image Linux
2 |
3 | on:
4 | release:
5 | types: [published]
6 | workflow_dispatch:
7 | inputs:
8 | sem-version:
9 | description: 'Version'
10 | required: true
11 |
12 | permissions:
13 | contents: write
14 |
15 | env:
16 | JAVA_DIST: 'zulu'
17 | JAVA_VERSION: '24.0.0+36'
18 |
19 | defaults:
20 | run:
21 | shell: bash
22 |
23 | jobs:
24 | prepare:
25 | name: Determines the versions strings for the binaries
26 | runs-on: [ubuntu-latest]
27 | outputs:
28 | semVerStr: ${{ steps.determine-version.outputs.version }}
29 | semVerNum: ${{steps.determine-number.outputs.number}}
30 | steps:
31 | - id: determine-version
32 | shell: pwsh
33 | run: |
34 | if ( '${{github.event_name}}' -eq 'release') {
35 | echo 'version=${{ github.event.release.tag_name}}' >> "$env:GITHUB_OUTPUT"
36 | exit 0
37 | } elseif ('${{inputs.sem-version}}') {
38 | echo 'version=${{ inputs.sem-version}}' >> "$env:GITHUB_OUTPUT"
39 | exit 0
40 | }
41 | Write-Error "Version neither via input nor by tag specified. Aborting"
42 | exit 1
43 | - id: determine-number
44 | run: |
45 | SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
46 | echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT"
47 |
48 | build-binary:
49 | name: Build java app image
50 | needs: [prepare]
51 | strategy:
52 | fail-fast: false
53 | matrix:
54 | include:
55 | - os: ubuntu-latest
56 | architecture: x64
57 | native-access-lib: 'org.cryptomator.jfuse.linux.amd64'
58 | artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-linux-x64.zip
59 | - os: ubuntu-24.04-arm
60 | architecture: aarch64
61 | native-access-lib: 'org.cryptomator.jfuse.linux.aarch64'
62 | artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-linux-aarch64.zip
63 | runs-on: ${{ matrix.os }}
64 | steps:
65 | - uses: actions/checkout@v4
66 | - uses: actions/setup-java@v4
67 | with:
68 | java-version: ${{ env.JAVA_VERSION }}
69 | distribution: ${{ env.JAVA_DIST }}
70 | - name: Set version
71 | run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
72 | - name: Run maven
73 | run: mvn -B clean package -DskipTests
74 | - name: Patch target dir
75 | run: |
76 | cp target/cryptomator-*.jar target/mods
77 | - name: Run jlink
78 | run: |
79 | envsubst < dist/jlink.args > target/jlink.args
80 | "${JAVA_HOME}/bin/jlink" '@./target/jlink.args'
81 | - name: Run jpackage
82 | run: |
83 | envsubst < dist/jpackage.args > target/jpackage.args
84 | "${JAVA_HOME}/bin/jpackage" '@./target/jpackage.args'
85 | env:
86 | JP_APP_VERSION: ${{ needs.prepare.outputs.semVerNum }}
87 | APP_VERSION: ${{ needs.prepare.outputs.semVerStr }}
88 | NATIVE_ACCESS_PACKAGE: ${{ matrix.native-access-lib }}
89 | - name: Update app dir
90 | run: |
91 | cp LICENSE.txt target/cryptomator-cli
92 | cp target/cryptomator-cli_completion.sh target/cryptomator-cli
93 | - uses: actions/upload-artifact@v4
94 | with:
95 | name: cryptomator-cli-linux-${{ matrix.architecture }}
96 | path: ./target/cryptomator-cli
97 | if-no-files-found: error
98 | - name: Zip binary for release
99 | run: |
100 | zip -r ./${{ matrix.artifact-name}} ./cryptomator-cli
101 | mv ./${{ matrix.artifact-name }} ..
102 | working-directory: target
103 | - name: Create detached GPG signature with key 615D449FE6E6A235
104 | run: |
105 | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
106 | echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ matrix.artifact-name }}
107 | env:
108 | GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
109 | GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
110 | - name: Publish artefact on GitHub Releases
111 | if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
112 | uses: softprops/action-gh-release@v2
113 | with:
114 | fail_on_unmatched_files: true
115 | token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
116 | files: |
117 | ${{ matrix.artifact-name }}
118 | cryptomator-cli-*.asc
119 |
120 |
--------------------------------------------------------------------------------
/.github/workflows/build-mac.yml:
--------------------------------------------------------------------------------
1 | name: Java app image macOS
2 |
3 | on:
4 | release:
5 | types: [published]
6 | workflow_dispatch:
7 | inputs:
8 | sem-version:
9 | description: 'Version'
10 | required: true
11 | notarize:
12 | description: 'Notarize app'
13 | required: false
14 | type: boolean
15 |
16 | permissions:
17 | contents: write
18 |
19 | env:
20 | JAVA_DIST: 'zulu'
21 | JAVA_VERSION: '24.0.0+36'
22 |
23 | defaults:
24 | run:
25 | shell: bash
26 |
27 | jobs:
28 | prepare:
29 | name: Determines the versions strings for the binaries
30 | runs-on: [ubuntu-latest]
31 | outputs:
32 | semVerStr: ${{ steps.determine-version.outputs.version }}
33 | semVerNum: ${{steps.determine-number.outputs.number}}
34 | revisionNum: ${{steps.determine-number.outputs.revision}}
35 | steps:
36 | - uses: actions/checkout@v4
37 | with:
38 | fetch-depth: 0
39 | - id: determine-version
40 | shell: pwsh
41 | run: |
42 | if ( '${{github.event_name}}' -eq 'release') {
43 | echo 'version=${{ github.event.release.tag_name}}' >> "$env:GITHUB_OUTPUT"
44 | exit 0
45 | } elseif ('${{inputs.sem-version}}') {
46 | echo 'version=${{ inputs.sem-version}}' >> "$env:GITHUB_OUTPUT"
47 | exit 0
48 | }
49 | Write-Error "Version neither via input nor by tag specified. Aborting"
50 | exit 1
51 | - id: determine-number
52 | run: |
53 | SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
54 | echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT"
55 | REVISION_NUM=`git rev-list --count HEAD`
56 | echo "revision=${REVISION_NUM}" >> "$GITHUB_OUTPUT"
57 |
58 | build-binary:
59 | name: Build java app image
60 | needs: [prepare]
61 | strategy:
62 | fail-fast: false
63 | matrix:
64 | include:
65 | - os: macos-latest
66 | architecture: arm64
67 | artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-mac-arm64.zip
68 | xcode-path: /Applications/Xcode_16.app
69 | - os: macos-13
70 | architecture: x64
71 | artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-mac-x64.zip
72 | xcode-path: /Applications/Xcode_15.2.app
73 | runs-on: ${{ matrix.os }}
74 | steps:
75 | - uses: actions/checkout@v4
76 | - uses: actions/setup-java@v4
77 | with:
78 | java-version: ${{ env.JAVA_VERSION }}
79 | distribution: ${{ env.JAVA_DIST }}
80 | - name: Set version
81 | run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
82 | - name: Run maven
83 | run: mvn -B clean package -DskipTests
84 | - name: Patch target dir
85 | run: |
86 | cp target/cryptomator-*.jar target/mods
87 | - name: Run jlink
88 | run: |
89 | envsubst < dist/jlink.args > target/jlink.args
90 | "${JAVA_HOME}/bin/jlink" '@./target/jlink.args'
91 | - name: Run jpackage
92 | run: |
93 | envsubst < dist/jpackage.args > target/jpackage.args
94 | "${JAVA_HOME}/bin/jpackage" '@./target/jpackage.args'
95 | env:
96 | JP_APP_VERSION: '1.0.0' # see https://github.com/cryptomator/cli/issues/72
97 | APP_VERSION: ${{ needs.prepare.outputs.semVerStr }}
98 | NATIVE_ACCESS_PACKAGE: org.cryptomator.jfuse.mac
99 | - name: Patch .app dir
100 | run: |
101 | cp ../LICENSE.txt cryptomator-cli.app/Contents
102 | cp cryptomator-cli_completion.sh cryptomator-cli.app/Contents
103 | sed -i '' "s|###BUNDLE_SHORT_VERSION_STRING###|${VERSION_NO}|g" cryptomator-cli.app/Contents/Info.plist
104 | sed -i '' "s|###BUNDLE_VERSION###|${REVISION_NO}|g" cryptomator-cli.app/Contents/Info.plist
105 | echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode -o "cryptomator-cli.app/Contents/embedded.provisionprofile"
106 | working-directory: target
107 | env:
108 | VERSION_NO: ${{ needs.prepare.outputs.semVerNum }}
109 | REVISION_NO: ${{ needs.prepare.outputs.revisionNum }}
110 | PROVISIONING_PROFILE_BASE64: ${{ secrets.MACOS_PROVISIONING_PROFILE_BASE64 }}
111 | - name: Install codesign certificate
112 | run: |
113 | # create variables
114 | CERTIFICATE_PATH=$RUNNER_TEMP/codesign.p12
115 | KEYCHAIN_PATH=$RUNNER_TEMP/codesign.keychain-db
116 |
117 | # import certificate and provisioning profile from secrets
118 | echo -n "$CODESIGN_P12_BASE64" | base64 --decode -o $CERTIFICATE_PATH
119 |
120 | # create temporary keychain
121 | security create-keychain -p "$CODESIGN_TMP_KEYCHAIN_PW" $KEYCHAIN_PATH
122 | security set-keychain-settings -lut 900 $KEYCHAIN_PATH
123 | security unlock-keychain -p "$CODESIGN_TMP_KEYCHAIN_PW" $KEYCHAIN_PATH
124 |
125 | # import certificate to keychain
126 | security import $CERTIFICATE_PATH -P "$CODESIGN_P12_PW" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
127 | security list-keychain -d user -s $KEYCHAIN_PATH
128 | env:
129 | CODESIGN_P12_BASE64: ${{ secrets.MACOS_CODESIGN_P12_BASE64 }}
130 | CODESIGN_P12_PW: ${{ secrets.MACOS_CODESIGN_P12_PW }}
131 | CODESIGN_TMP_KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_TMP_KEYCHAIN_PW }}
132 | - name: Codesign
133 | run: |
134 | echo "Codesigning jdk files..."
135 | find cryptomator-cli.app/Contents/runtime/Contents/Home/lib/ -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
136 | find cryptomator-cli.app/Contents/runtime/Contents/Home/lib/ \( -name 'jspawnhelper' -o -name 'pauseengine' -o -name 'simengine' \) -exec codesign --force -o runtime -s ${CODESIGN_IDENTITY} {} \;
137 | echo "Codesigning jar contents..."
138 | find cryptomator-cli.app/Contents/runtime/Contents/MacOS -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
139 | for JAR_PATH in `find cryptomator-cli.app -name "*.jar"`; do
140 | if [[ `unzip -l ${JAR_PATH} | grep '.dylib\|.jnilib'` ]]; then
141 | JAR_FILENAME=$(basename ${JAR_PATH})
142 | OUTPUT_PATH=${JAR_PATH%.*}
143 | echo "Codesigning libs in ${JAR_FILENAME}..."
144 | unzip -q ${JAR_PATH} -d ${OUTPUT_PATH}
145 | find ${OUTPUT_PATH} -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
146 | find ${OUTPUT_PATH} -name '*.jnilib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \;
147 | rm ${JAR_PATH}
148 | pushd ${OUTPUT_PATH} > /dev/null
149 | zip -qr ../${JAR_FILENAME} *
150 | popd > /dev/null
151 | rm -r ${OUTPUT_PATH}
152 | fi
153 | done
154 | echo "Codesigning Cryptomator-cli.app..."
155 | sed -i '' "s|###APP_IDENTIFIER_PREFIX###|${TEAM_IDENTIFIER}.|g" ../dist/mac/cryptomator-cli.entitlements
156 | sed -i '' "s|###TEAM_IDENTIFIER###|${TEAM_IDENTIFIER}|g" ../dist/mac/cryptomator-cli.entitlements
157 | codesign --force --deep --entitlements ../dist/mac/cryptomator-cli.entitlements -o runtime -s ${CODESIGN_IDENTITY} cryptomator-cli.app
158 | env:
159 | CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }}
160 | TEAM_IDENTIFIER: ${{ secrets.MACOS_TEAM_IDENTIFIER }}
161 | working-directory: target
162 | # ditto must be used, see https://developer.apple.com/documentation/xcode/packaging-mac-software-for-distribution#Build-a-zip-archive
163 | - name: Zip binary for notarization
164 | if: (startsWith(github.ref, 'refs/tags/') && github.event.action == 'published') || inputs.notarize
165 | run: ditto -c -k --keepParent ./target/cryptomator-cli.app ./${{ matrix.artifact-name}}
166 | - name: Setup Xcode
167 | if: (startsWith(github.ref, 'refs/tags/') && github.event.action == 'published') || inputs.notarize
168 | run: sudo xcode-select -s ${{ matrix.xcode-path}}
169 | shell: bash
170 | #would like to uses cocoalibs/xcode-notarization-action@v1, but blocked due to https://github.com/cocoalibs/xcode-notarization-action/issues/1
171 | - name: Prepare Notarization Credentials
172 | if: (startsWith(github.ref, 'refs/tags/') && github.event.action == 'published') || inputs.notarize
173 | run: |
174 | # create temporary keychain
175 | KEYCHAIN_PATH=$RUNNER_TEMP/notarization.keychain-db
176 | KEYCHAIN_PASS=$(uuidgen)
177 | security create-keychain -p "${KEYCHAIN_PASS}" ${KEYCHAIN_PATH}
178 | security set-keychain-settings -lut 900 ${KEYCHAIN_PATH}
179 | security unlock-keychain -p "${KEYCHAIN_PASS}" ${KEYCHAIN_PATH}
180 | # import credentials from secrets
181 | xcrun notarytool store-credentials "notary" --apple-id "${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}" --password "${{ secrets.MACOS_NOTARIZATION_PW }}" --team-id "${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}" --keychain "${KEYCHAIN_PATH}"
182 | shell: bash
183 | - name: Notarize
184 | if: (startsWith(github.ref, 'refs/tags/') && github.event.action == 'published') || inputs.notarize
185 | run: |
186 | KEYCHAIN_PATH=$RUNNER_TEMP/notarization.keychain-db
187 | xcrun notarytool submit ${{ matrix.artifact-name }} --keychain-profile "notary" --keychain "${KEYCHAIN_PATH}" --wait
188 | shell: bash
189 | - name: Staple
190 | if: (startsWith(github.ref, 'refs/tags/') && github.event.action == 'published') || inputs.notarize
191 | run: xcrun stapler staple ./target/cryptomator-cli.app
192 | shell: bash
193 | - name: Cleanup
194 | if: ${{ always() }}
195 | run: |
196 | rm -f ./${{ matrix.artifact-name}}
197 | security delete-keychain $RUNNER_TEMP/notarization.keychain-db
198 | shell: bash
199 | continue-on-error: true
200 | - name: Zip app for distribution
201 | run: ditto -c -k --keepParent ./target/cryptomator-cli.app ./${{ matrix.artifact-name}}
202 | - name: Create detached GPG signature with key 615D449FE6E6A235
203 | run: |
204 | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
205 | echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ matrix.artifact-name }}
206 | env:
207 | GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
208 | GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
209 | - uses: actions/upload-artifact@v4
210 | with:
211 | name: cryptomator-cli-mac-${{ matrix.architecture }}
212 | path: |
213 | ${{ matrix.artifact-name}}
214 | *.asc
215 | if-no-files-found: error
216 | - name: Publish artefact on GitHub Releases
217 | if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
218 | uses: softprops/action-gh-release@v2
219 | with:
220 | fail_on_unmatched_files: true
221 | token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
222 | files: |
223 | ${{ matrix.artifact-name }}
224 | cryptomator-cli-*.asc
--------------------------------------------------------------------------------
/.github/workflows/build-win.yml:
--------------------------------------------------------------------------------
1 | name: Java app image Windows
2 |
3 | on:
4 | release:
5 | types: [published]
6 | workflow_dispatch:
7 | inputs:
8 | sem-version:
9 | description: 'Version'
10 | required: true
11 |
12 | permissions:
13 | contents: write
14 |
15 | env:
16 | JAVA_DIST: 'zulu'
17 | JAVA_VERSION: '24.0.0+36'
18 |
19 | defaults:
20 | run:
21 | shell: bash
22 |
23 | jobs:
24 | prepare:
25 | name: Determines the versions strings for the binaries
26 | runs-on: [ubuntu-latest]
27 | outputs:
28 | semVerStr: ${{ steps.determine-version.outputs.version }}
29 | semVerNum: ${{steps.determine-number.outputs.number}}
30 | steps:
31 | - id: determine-version
32 | shell: pwsh
33 | run: |
34 | if ( '${{github.event_name}}' -eq 'release') {
35 | echo 'version=${{ github.event.release.tag_name}}' >> "$env:GITHUB_OUTPUT"
36 | exit 0
37 | } elseif ('${{inputs.sem-version}}') {
38 | echo 'version=${{ inputs.sem-version}}' >> "$env:GITHUB_OUTPUT"
39 | exit 0
40 | }
41 | Write-Error "Version neither via input nor by tag specified. Aborting"
42 | exit 1
43 | - id: determine-number
44 | run: |
45 | SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
46 | echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT"
47 |
48 | build-binary:
49 | name: Build java app image
50 | needs: [prepare]
51 | runs-on: windows-latest
52 | env:
53 | artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-win-x64.zip
54 | steps:
55 | - uses: actions/checkout@v4
56 | - uses: actions/setup-java@v4
57 | with:
58 | java-version: ${{ env.JAVA_VERSION }}
59 | distribution: ${{ env.JAVA_DIST }}
60 | - name: Set version
61 | run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
62 | - name: Run maven
63 | run: mvn -B clean package -DskipTests
64 | - name: Patch target dir
65 | run: |
66 | cp LICENSE.txt target
67 | cp target/cryptomator-*.jar target/mods
68 | - name: Run jlink
69 | run: |
70 | envsubst < dist/jlink.args > target/jlink.args
71 | "${JAVA_HOME}/bin/jlink" '@./target/jlink.args'
72 | - name: Run jpackage
73 | run: |
74 | envsubst < dist/jpackage.args > target/jpackage.args
75 | "${JAVA_HOME}/bin/jpackage" '@./target/jpackage.args' --win-console
76 | env:
77 | JP_APP_VERSION: ${{ needs.prepare.outputs.semVerNum }}
78 | APP_VERSION: ${{ needs.prepare.outputs.semVerStr }}
79 | NATIVE_ACCESS_PACKAGE: org.cryptomator.jfuse.win
80 | - name: Update app dir
81 | run: |
82 | cp LICENSE.txt target/cryptomator-cli
83 | cp target/cryptomator-cli_completion.sh target/cryptomator-cli
84 | - name: Fix permissions
85 | run: attrib -r target/cryptomator-cli/cryptomator-cli.exe
86 | shell: pwsh
87 | - name: Extract jars with DLLs for Codesigning
88 | shell: pwsh
89 | run: |
90 | Add-Type -AssemblyName "System.io.compression.filesystem"
91 | $jarFolder = Resolve-Path ".\target\Cryptomator-cli\app\mods"
92 | $jarExtractDir = New-Item -Path ".\target\jar-extract" -ItemType Directory
93 |
94 | #for all jars inspect
95 | Get-ChildItem -Path $jarFolder -Filter "*.jar" | ForEach-Object {
96 | $jar = [Io.compression.zipfile]::OpenRead($_.FullName)
97 | if (@($jar.Entries | Where-Object {$_.Name.ToString().EndsWith(".dll")} | Select-Object -First 1).Count -gt 0) {
98 | #jars containing dlls extract
99 | Set-Location $jarExtractDir
100 | Expand-Archive -Path $_.FullName
101 | }
102 | $jar.Dispose()
103 | }
104 | - name: Codesign
105 | uses: skymatic/code-sign-action@v3
106 | with:
107 | certificate: ${{ secrets.WIN_CODESIGN_P12_BASE64 }}
108 | password: ${{ secrets.WIN_CODESIGN_P12_PW }}
109 | certificatesha1: ${{ vars.WIN_CODESIGN_CERT_SHA1 }}
110 | description: Cryptomator
111 | timestampUrl: 'http://timestamp.digicert.com'
112 | folder: target
113 | recursive: true
114 | - name: Replace DLLs inside jars with signed ones
115 | shell: pwsh
116 | run: |
117 | $jarExtractDir = Resolve-Path ".\target\jar-extract"
118 | $jarFolder = Resolve-Path ".\target\cryptomator-cli\app\mods"
119 | Get-ChildItem -Path $jarExtractDir | ForEach-Object {
120 | $jarName = $_.Name
121 | $jarFile = "${jarFolder}\${jarName}.jar"
122 | Set-Location $_
123 | Get-ChildItem -Path $_ -Recurse -File "*.dll" | ForEach-Object {
124 | # update jar with signed dll
125 | jar --file="$jarFile" --update $(Resolve-Path -Relative -Path $_)
126 | }
127 | }
128 | - name: Zip binary for release
129 | shell: pwsh
130 | run: Compress-Archive -Path .\target\cryptomator-cli -DestinationPath .\${{ env.artifact-name}}
131 | - name: Create detached GPG signature with key 615D449FE6E6A235
132 | run: |
133 | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
134 | echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ env.artifact-name}}
135 | env:
136 | GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
137 | GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
138 | - uses: actions/upload-artifact@v4
139 | with:
140 | name: cryptomator-cli-win-x64
141 | path: |
142 | ${{ env.artifact-name}}
143 | *.asc
144 | if-no-files-found: error
145 | - name: Publish artefact on GitHub Releases
146 | if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
147 | uses: softprops/action-gh-release@v2
148 | with:
149 | fail_on_unmatched_files: true
150 | token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
151 | files: |
152 | ${{ env.artifact-name}}
153 | cryptomator-cli-*.asc
154 |
155 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | pull_request_target:
6 | types: [labeled]
7 |
8 | jobs:
9 | build:
10 | name: Build and Test
11 | runs-on: ubuntu-latest
12 | outputs:
13 | artifactVersion: ${{ steps.setversion.outputs.version }}
14 | steps:
15 | - uses: actions/checkout@v4
16 | - uses: actions/setup-java@v4
17 | with:
18 | java-version: '24'
19 | distribution: 'temurin'
20 | - name: Ensure to use tagged version
21 | run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
22 | if: startsWith(github.ref, 'refs/tags/')
23 | - name: Output project version
24 | id: setversion
25 | run: |
26 | BUILD_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
27 | echo "version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT"
28 | - name: Build and Test
29 | run: mvn -B install
30 | - name: Upload artifact cryptomator-cli-${{ steps.setversion.outputs.version }}.jar
31 | uses: actions/upload-artifact@v4
32 | with:
33 | name: cryptomator-cli-${{ steps.setversion.outputs.version }}.jar
34 | path: target/cryptomator-cli-*.jar
35 | - name: Create release
36 | if: startsWith(github.ref, 'refs/tags/')
37 | uses: softprops/action-gh-release@v2
38 | with:
39 | token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
40 | generate_release_notes: true
41 | draft: true
--------------------------------------------------------------------------------
/.github/workflows/post-publish.yml:
--------------------------------------------------------------------------------
1 | name: Post Release Publish Tasks
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | permissions:
8 | contents: write
9 |
10 | defaults:
11 | run:
12 | shell: bash
13 |
14 | jobs:
15 | get-version:
16 | runs-on: ubuntu-latest
17 | env:
18 | ARCHIVE_NAME: cryptomator-cli-${{ github.event.release.tag_name }}.tar.gz
19 | steps:
20 | - name: Download source tarball
21 | run: |
22 | curl -L -H "Accept: application/vnd.github+json" https://github.com/cryptomator/cli/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz --output ${{ env.ARCHIVE_NAME }}
23 | - name: Sign source tarball with key 615D449FE6E6A235
24 | run: |
25 | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
26 | echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ${{ env.ARCHIVE_NAME }}
27 | env:
28 | GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
29 | GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
30 | - name: Publish asc on GitHub Releases
31 | uses: softprops/action-gh-release@v2
32 | with:
33 | fail_on_unmatched_files: true
34 | token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
35 | files: |
36 | ${{ env.ARCHIVE_NAME }}.asc
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Package Files #
4 | *.jar
5 | *.war
6 | *.ear
7 |
8 | # Eclipse Settings Files #
9 | .settings
10 | .project
11 | .classpath
12 | target/
13 | test-output/
14 |
15 | # IntelliJ Settings Files #
16 | .idea/
17 | out/
18 | .idea_modules/
19 | *.iws
20 |
21 | *.iml
22 |
23 | #mvn shade plugin artifact
24 | dependency-reduced-pom.xml
25 |
26 | # mvn versions:set backup
27 | pom.xml.versionsBackup
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 | wrapperVersion=3.3.2
18 | distributionType=only-script
19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
20 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | The changelog starts with version 0.6.2.
9 | Changes to prior versions can be found on the [Github release page](https://github.com/cryptomator/cli/releases).
10 |
11 | ## [0.6.2] - 2025-04-10
12 |
13 | ### Changed
14 |
15 | * Update org.cryptomator:cryptofs from 2.7.1 to 2.8.0
16 | * Update org.cryptomator:webdav-nio-adapter from 2.0.7 to 2.0.10
17 | * Update org.cryptomator:fuse-nio-adapter from 5.0.4 to 5.0.5
18 | * Update org.slf4j:slf4j-api from 2.0.16 to 2.0.17
19 | * Update ch.qos.logback:logback-* from 1.5.13 to 1.5.18
20 | * Update build JDK from 23 to 24.0.0+36
21 |
22 | ### Fixed
23 |
24 | * Mount fails with libfuse3.17.1 ([#87](https://github.com/cryptomator/cli/issues/87))
25 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published by
637 | the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/cryptomator/cli/actions?query=workflow%3ABuild)
2 | [](https://github.com/cryptomator/cli/releases/latest)
3 |
4 | # Cryptomator CLI
5 |
6 | This is a minimal command-line application that unlocks a single vault of vault format 8 and mounts it into the system.
7 |
8 | ## Download and Usage
9 |
10 | Download the zip file via [GitHub Releases](https://github.com/cryptomator/cli/releases) and unzip it to your desired directory, e.g.
11 |
12 | ```shell
13 | curl -L https://github.com/cryptomator/cli/releases/download/0.7.0/cryptomator-cli-0.7.0-mac-arm64.zip --output cryptomator-cli.zip
14 | unzip cryptomator-cli.zip
15 | ```
16 |
17 | Afterward, you can directly run Cryptomator-CLI by calling the binary from a terminal, e.g. on Linux:
18 | ```shell
19 | ./cryptomator-cli/cryptomator-cli unlock \
20 | --password:stdin \
21 | --mounter=org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider \
22 | --mountPoint=/path/to/empty/dir \
23 | /home/user/myVault
24 | ```
25 | > [!NOTE]
26 | > On macOS, the path to the binary is `cryptomator-cli.app/Contents/MacOS/cryptomator-cli`
27 |
28 | To unmount, send a SIGINT signal to the process, e.g. by pressing CTRL+C in the terminal.
29 |
30 | For a complete list of options, use the `--help` option.
31 | ```shell
32 | cryptomator-cli --help
33 | ```
34 |
35 | ## Filesystem Integration
36 |
37 | To integrate the unlocked vault into the filesystem, cryptomator-cli relies on third party libraries which must be installed separately.
38 | These are:
39 | * [WinFsp](https://winfsp.dev/) for Windows
40 | * [macFUSE](https://osxfuse.github.io/) or [FUSE-T](https://www.fuse-t.org/) for macOS
41 | * and [libfuse](https://github.com/libfuse/libfuse) for Linux/BSD systems (normally provided by a fuse3 package of your distro, e.g. [ubuntu](https://packages.ubuntu.com/noble/fuse3))
42 |
43 | As a fallback, you can [skip filesystem integration](README.md#skip-filesystem-integration) by using WebDAV.
44 |
45 | ### Selecting the Mounter
46 |
47 | To list all available mounters, use the `list-mounters` subcommand:
48 | ```shell
49 | cryptomator-cli list-mounters
50 | ```
51 | Pick one from the printed list and use it as input for the `--mounter` option.
52 |
53 | ### Skip Filesystem Integration
54 |
55 | If you don't want a direct integration in the OS, choose `org.cryptomator.frontend.webdav.mount.FallbackMounter` for `--mounter`.
56 | It starts a local WebDAV server, where you can access the vault with any WebDAV client or mounting it into your filesystem manually.
57 |
58 | > [!NOTE]
59 | > The WebDAV protocol is supported by all major OSses. Hence, if other mounters fail or show errors when accessing the vault content, you can always use the legacy WebDAV option.
60 | > WebDAV is not the default, because it has a low performance and might have OS dependent restrictions (e.g. maximum file size of 4GB on Windows)
61 |
62 | #### Windows via Windows Explorer
63 |
64 | Open the File Explorer, right click on "This PC" and click on the menu item "Map network drive...".
65 |
66 | 1. In the Drive list, select a drive letter. (Any available letter will do.)
67 | 2. In the Folder box, enter the URL logged by the Cryptomator CLI application.
68 | 3. Select Finish.
69 |
70 | #### Linux via davfs2
71 |
72 | First, you need to create a mount point for your vault:
73 |
74 | ```sh
75 | sudo mkdir /media/your/mounted/folder
76 | ```
77 |
78 | Then you can mount the vault:
79 |
80 | ```sh
81 | echo | sudo mount -t davfs -o username=,user,gid=1000,uid=1000 http://localhost:8080/demoVault/ /media/your/mounted/folder
82 | # Replace gid/uid with your gid/uid. The echo is used to skip over the password query from davfs
83 | ```
84 |
85 | To unmount the vault, run:
86 |
87 | ```sh
88 | sudo umount /media/your/mounted/folder
89 | ```
90 |
91 | #### macOS via AppleScript
92 |
93 | Mount the vault with:
94 | ```sh
95 | osascript -e 'mount volume "http://localhost:8080/demoVault/"'
96 | ```
97 |
98 | ## Manual Cleanup
99 |
100 | If a handle to a resource inside the unlocked vault is still open, a graceful unmount is not possible and cryptomator-cli just terminates without executing possible cleanup tasks.
101 | In that case the message "GRACEFUL UNMOUNT FAILED" is printed to the console/stdout.
102 |
103 | On a linux OS with the `LinuxFuseMountProvider`, the manual cleanup task is to unmount and free the mountpoint:
104 | ```
105 | fusermount -u /path/to/former/mountpoint
106 | ```
107 |
108 | For other OSs, there is no cleanup necessary.
109 |
110 | ## License
111 |
112 | This project is dual-licensed under the AGPLv3 for FOSS projects as well as a commercial license derived from the LGPL for independent software vendors and resellers. If you want to use this library in applications, that are *not* licensed under the AGPL, feel free to contact our [support team](https://cryptomator.org/help/).
113 |
--------------------------------------------------------------------------------
/build_linux.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euxo pipefail
3 |
4 | echo "Building cryptomator cli..."
5 |
6 | export APP_VERSION='0.1.0-local'
7 |
8 | # Check if Maven is installed
9 | if ! command -v mvn &> /dev/null; then
10 | echo "Maven is not installed. Please install Maven to proceed."
11 | exit 1
12 | fi
13 |
14 | # Check if JAVA_HOME is set
15 | if [ -z "$JAVA_HOME" ]; then
16 | echo "Environment variable JAVA_HOME not defined"
17 | exit 1
18 | fi
19 |
20 | # Check Java version
21 | MIN_JAVA_VERSION=$(mvn help:evaluate "-Dexpression=jdk.version" -q -DforceStdout)
22 | JAVA_VERSION=$("$JAVA_HOME/bin/java" -version | head -n1 | cut -d' ' -f2 | cut -d'.' -f1)
23 | if [ "$JAVA_VERSION" -lt "$MIN_JAVA_VERSION" ]; then
24 | echo "Java version $JAVA_VERSION is too old. Minimum required version is $MIN_JAVA_VERSION"
25 | exit 1
26 | fi
27 |
28 | echo "Building java app with maven..."
29 | mvn -B clean package
30 | cp ./LICENSE.txt ./target/
31 | mv ./target/cryptomator-cli-*.jar ./target/mods
32 |
33 | echo "Creating JRE with jlink..."
34 | envsubst < dist/jlink.args > target/jlink.args
35 | "$JAVA_HOME/bin/jlink" '@./target/jlink.args'
36 |
37 | if [ $? -ne 0 ] || [ ! -d ./target/runtime ]; then
38 | echo "JRE creation with jlink failed."
39 | exit 1
40 | fi
41 |
42 | export NATIVE_ACCESS_PACKAGE="no.native.access.available"
43 | _OS=$(uname -s)
44 | if (echo "$_OS" | grep -q "Linux.*") ; then
45 | _ARCH=$(uname -m)
46 | if [ "$_ARCH" = "x86_64" ]; then
47 | NATIVE_ACCESS_PACKAGE="org.cryptomator.jfuse.linux.amd64"
48 | elif [ "$_ARCH" = "aarch64" ]; then
49 | NATIVE_ACCESS_PACKAGE="org.cryptomator.jfuse.linux.aarch64"
50 | else
51 | echo "Warning: Unsupported Linux architecture for FUSE mounter: $_ARCH"
52 | echo "FUSE supported architectures: x86_64, aarch64"
53 | fi
54 | fi
55 |
56 | export JP_APP_VERSION='99.9.9'
57 | envsubst < dist/jpackage.args > target/jpackage.args
58 |
59 | echo "Creating app binary with jpackage..."
60 | "$JAVA_HOME/bin/jpackage" '@./target/jpackage.args'
61 |
62 | if [ $? -ne 0 ] || [ ! -d ./target/cryptomator-cli ]; then
63 | echo "Binary creation with jpackage failed."
64 | exit 1
65 | fi
66 |
--------------------------------------------------------------------------------
/build_mac.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "Building cryptomator cli..."
4 |
5 | export APP_VERSION='0.1.0-local'
6 |
7 | # Check if Maven is installed
8 | if ! command -v mvn &> /dev/null; then
9 | echo "Maven is not installed. Please install Maven to proceed."
10 | exit 1
11 | fi
12 |
13 | # Check if JAVA_HOME is set
14 | if [ -z "$JAVA_HOME" ]; then
15 | echo "Environment variable JAVA_HOME not defined"
16 | exit 1
17 | fi
18 |
19 | # Check Java version
20 | MIN_JAVA_VERSION=$(mvn help:evaluate "-Dexpression=jdk.version" -q -DforceStdout)
21 | JAVA_VERSION=$("$JAVA_HOME/bin/java" -version | head -n1 | cut -d' ' -f2 | cut -d'.' -f1)
22 | if [ "$JAVA_VERSION" -lt "$MIN_JAVA_VERSION" ]; then
23 | echo "Java version $JAVA_VERSION is too old. Minimum required version is $MIN_JAVA_VERSION"
24 | exit 1
25 | fi
26 |
27 | echo "Building java app with maven..."
28 | mvn -B clean package
29 | cp ./LICENSE.txt ./target/
30 | mv ./target/cryptomator-cli-*.jar ./target/mods
31 |
32 | echo "Creating JRE with jlink..."
33 | envsubst < dist/jlink.args > target/jlink.args
34 | "$JAVA_HOME/bin/jlink" '@./target/jlink.args'
35 |
36 | if [ $? -ne 0 ] || [ ! -d ./target/runtime ]; then
37 | echo "JRE creation with jlink failed."
38 | exit 1
39 | fi
40 |
41 | export JP_APP_VERSION='99.9.9'
42 | export NATIVE_ACCESS_PACKAGE="org.cryptomator.jfuse.mac"
43 | envsubst < dist/jpackage.args > target/jpackage.args
44 |
45 | echo "Creating app binary with jpackage..."
46 | "$JAVA_HOME/bin/jpackage" '@./target/jpackage.args'
47 |
48 | if [ $? -ne 0 ] || [ ! -d ./target/cryptomator-cli.app ]; then
49 | echo "Binary creation with jpackage failed."
50 | exit 1
51 | fi
52 |
--------------------------------------------------------------------------------
/build_win.ps1:
--------------------------------------------------------------------------------
1 | "Building cryptomator cli..."
2 |
3 | $appVersion='0.1.0-local'
4 |
5 | # Check if maven is installed
6 | $commands = 'mvn'
7 | foreach ($cmd in $commands) {
8 | Invoke-Expression -Command "${cmd} --version" -ErrorAction Stop
9 | }
10 |
11 | # Check if JAVA_HOME is set
12 | if(-not $env:JAVA_HOME) {
13 | throw "Environment variable JAVA_HOME not defined"
14 | }
15 |
16 | # Check Java version
17 | $minJavaVersion=[int]$(mvn help:evaluate "-Dexpression=jdk.version" -q -DforceStdout)
18 | $javaVersion = $(& "$env:JAVA_HOME\bin\java" --version) -split ' ' | Select-Object -Index 1
19 | if( ([int] ($javaVersion.Split('.') | Select-Object -First 1)) -lt $minJavaVersion) {
20 | throw "Java version $javaVersion is too old. Minimum required version is $minJavaVersion"
21 | }
22 |
23 | Write-Host "Building java app with maven..."
24 | mvn -B clean package
25 | Copy-Item ./LICENSE.txt -Destination ./target -ErrorAction Stop
26 | Move-Item ./target/cryptomator-cli-*.jar ./target/mods -ErrorAction Stop
27 |
28 | Write-Host "Creating JRE with jlink..."
29 | Get-Content -Path './dist/jlink.args' | ForEach-Object { $_.Replace('${JAVA_HOME}', "$env:JAVA_HOME")} | Out-File -FilePath './target/jlink.args'
30 | & $env:JAVA_HOME/bin/jlink `@./target/jlink.args
31 |
32 | if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path ./target/runtime))) {
33 | throw "JRE creation with jLink failed with exit code $LASTEXITCODE."
34 | }
35 |
36 | ## powershell does not have envsubst
37 | $jpAppVersion='99.9.9'
38 | Get-Content -Path './dist/jpackage.args' | ForEach-Object {
39 | $_.Replace('${APP_VERSION}', $appVersion).
40 | Replace('${JP_APP_VERSION}', $jpAppVersion).
41 | Replace('${NATIVE_ACCESS_PACKAGE}', 'org.cryptomator.jfuse.win')
42 | } | Out-File -FilePath './target/jpackage.args'
43 |
44 | # jpackage
45 | Write-Host "Creating app binary with jpackage..."
46 | & $env:JAVA_HOME/bin/jpackage `@./target/jpackage.args --win-console
47 |
48 | if ( ($LASTEXITCODE -ne 0) -or (-not (Test-Path ./target/cryptomator-cli))) {
49 | throw "Binary creation with jpackage failed with exit code $LASTEXITCODE."
50 | }
--------------------------------------------------------------------------------
/dist/jlink.args:
--------------------------------------------------------------------------------
1 | --verbose
2 | --module-path "${JAVA_HOME}/jmods"
3 | --output target/runtime
4 | --add-modules java.base,java.compiler,java.naming,java.xml
5 | --strip-native-commands
6 | --no-header-files
7 | --no-man-pages
8 | --strip-debug
9 | --compress zip-6
--------------------------------------------------------------------------------
/dist/jpackage.args:
--------------------------------------------------------------------------------
1 | # Contains three env vars:
2 | # JP_APP_VERSION: The version needed for jpackage. This version _must_ follow the scheme Y.X.X, where Y >= 1 and X >=0
3 | # APP_VERSION: The actual, semantic version displayed in the cli app
4 | # NATIVE_ACCESS_PACKAGE: The java package containing the fuse bindings for the system
5 | --verbose
6 | --type app-image
7 | --runtime-image target/runtime
8 | --input target/libs
9 | --module-path target/mods
10 | --module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
11 | --dest target
12 | --name cryptomator-cli
13 | --vendor "Skymatic GmbH"
14 | --copyright "(C) 2016 - 2025 Skymatic GmbH"
15 | --app-version "${JP_APP_VERSION}"
16 | --java-options "-Dorg.cryptomator.cli.version=${APP_VERSION}"
17 | --java-options "--enable-native-access=${NATIVE_ACCESS_PACKAGE},org.fusesource.jansi"
18 | --java-options "-Xss5m"
19 | --java-options "-Xmx256m"
20 | --java-options "-Dfile.encoding=\"utf-8\""
21 |
--------------------------------------------------------------------------------
/dist/mac/cryptomator-cli.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.application-identifier
6 | ###APP_IDENTIFIER_PREFIX###org.cryptomator.cli
7 | com.apple.developer.team-identifier
8 | ###TEAM_IDENTIFIER###
9 | com.apple.security.cs.allow-jit
10 |
11 | com.apple.security.cs.allow-unsigned-executable-memory
12 |
13 | com.apple.security.cs.disable-executable-page-protection
14 |
15 | com.apple.security.cs.disable-library-validation
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Apache Maven Wrapper startup batch script, version 3.3.2
23 | #
24 | # Optional ENV vars
25 | # -----------------
26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source
27 | # MVNW_REPOURL - repo url base for downloading maven distribution
28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
30 | # ----------------------------------------------------------------------------
31 |
32 | set -euf
33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x
34 |
35 | # OS specific support.
36 | native_path() { printf %s\\n "$1"; }
37 | case "$(uname)" in
38 | CYGWIN* | MINGW*)
39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
40 | native_path() { cygpath --path --windows "$1"; }
41 | ;;
42 | esac
43 |
44 | # set JAVACMD and JAVACCMD
45 | set_java_home() {
46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
47 | if [ -n "${JAVA_HOME-}" ]; then
48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then
49 | # IBM's JDK on AIX uses strange locations for the executables
50 | JAVACMD="$JAVA_HOME/jre/sh/java"
51 | JAVACCMD="$JAVA_HOME/jre/sh/javac"
52 | else
53 | JAVACMD="$JAVA_HOME/bin/java"
54 | JAVACCMD="$JAVA_HOME/bin/javac"
55 |
56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
59 | return 1
60 | fi
61 | fi
62 | else
63 | JAVACMD="$(
64 | 'set' +e
65 | 'unset' -f command 2>/dev/null
66 | 'command' -v java
67 | )" || :
68 | JAVACCMD="$(
69 | 'set' +e
70 | 'unset' -f command 2>/dev/null
71 | 'command' -v javac
72 | )" || :
73 |
74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
76 | return 1
77 | fi
78 | fi
79 | }
80 |
81 | # hash string like Java String::hashCode
82 | hash_string() {
83 | str="${1:-}" h=0
84 | while [ -n "$str" ]; do
85 | char="${str%"${str#?}"}"
86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
87 | str="${str#?}"
88 | done
89 | printf %x\\n $h
90 | }
91 |
92 | verbose() { :; }
93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
94 |
95 | die() {
96 | printf %s\\n "$1" >&2
97 | exit 1
98 | }
99 |
100 | trim() {
101 | # MWRAPPER-139:
102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
103 | # Needed for removing poorly interpreted newline sequences when running in more
104 | # exotic environments such as mingw bash on Windows.
105 | printf "%s" "${1}" | tr -d '[:space:]'
106 | }
107 |
108 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
109 | while IFS="=" read -r key value; do
110 | case "${key-}" in
111 | distributionUrl) distributionUrl=$(trim "${value-}") ;;
112 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
113 | esac
114 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
115 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
116 |
117 | case "${distributionUrl##*/}" in
118 | maven-mvnd-*bin.*)
119 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
120 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
121 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
122 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
123 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
124 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
125 | *)
126 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
127 | distributionPlatform=linux-amd64
128 | ;;
129 | esac
130 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
131 | ;;
132 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
133 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
134 | esac
135 |
136 | # apply MVNW_REPOURL and calculate MAVEN_HOME
137 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
138 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
139 | distributionUrlName="${distributionUrl##*/}"
140 | distributionUrlNameMain="${distributionUrlName%.*}"
141 | distributionUrlNameMain="${distributionUrlNameMain%-bin}"
142 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
143 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
144 |
145 | exec_maven() {
146 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
147 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
148 | }
149 |
150 | if [ -d "$MAVEN_HOME" ]; then
151 | verbose "found existing MAVEN_HOME at $MAVEN_HOME"
152 | exec_maven "$@"
153 | fi
154 |
155 | case "${distributionUrl-}" in
156 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
157 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
158 | esac
159 |
160 | # prepare tmp dir
161 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
162 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
163 | trap clean HUP INT TERM EXIT
164 | else
165 | die "cannot create temp dir"
166 | fi
167 |
168 | mkdir -p -- "${MAVEN_HOME%/*}"
169 |
170 | # Download and Install Apache Maven
171 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
172 | verbose "Downloading from: $distributionUrl"
173 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
174 |
175 | # select .zip or .tar.gz
176 | if ! command -v unzip >/dev/null; then
177 | distributionUrl="${distributionUrl%.zip}.tar.gz"
178 | distributionUrlName="${distributionUrl##*/}"
179 | fi
180 |
181 | # verbose opt
182 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
183 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
184 |
185 | # normalize http auth
186 | case "${MVNW_PASSWORD:+has-password}" in
187 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
188 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
189 | esac
190 |
191 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
192 | verbose "Found wget ... using wget"
193 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
194 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
195 | verbose "Found curl ... using curl"
196 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
197 | elif set_java_home; then
198 | verbose "Falling back to use Java to download"
199 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
200 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
201 | cat >"$javaSource" <<-END
202 | public class Downloader extends java.net.Authenticator
203 | {
204 | protected java.net.PasswordAuthentication getPasswordAuthentication()
205 | {
206 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
207 | }
208 | public static void main( String[] args ) throws Exception
209 | {
210 | setDefault( new Downloader() );
211 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
212 | }
213 | }
214 | END
215 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java
216 | verbose " - Compiling Downloader.java ..."
217 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
218 | verbose " - Running Downloader.java ..."
219 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
220 | fi
221 |
222 | # If specified, validate the SHA-256 sum of the Maven distribution zip file
223 | if [ -n "${distributionSha256Sum-}" ]; then
224 | distributionSha256Result=false
225 | if [ "$MVN_CMD" = mvnd.sh ]; then
226 | echo "Checksum validation is not supported for maven-mvnd." >&2
227 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
228 | exit 1
229 | elif command -v sha256sum >/dev/null; then
230 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
231 | distributionSha256Result=true
232 | fi
233 | elif command -v shasum >/dev/null; then
234 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
235 | distributionSha256Result=true
236 | fi
237 | else
238 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
239 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
240 | exit 1
241 | fi
242 | if [ $distributionSha256Result = false ]; then
243 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
244 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
245 | exit 1
246 | fi
247 | fi
248 |
249 | # unzip and move
250 | if command -v unzip >/dev/null; then
251 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
252 | else
253 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
254 | fi
255 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
256 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
257 |
258 | clean || :
259 | exec_maven "$@"
260 |
--------------------------------------------------------------------------------
/mvnw.cmd:
--------------------------------------------------------------------------------
1 | <# : batch portion
2 | @REM ----------------------------------------------------------------------------
3 | @REM Licensed to the Apache Software Foundation (ASF) under one
4 | @REM or more contributor license agreements. See the NOTICE file
5 | @REM distributed with this work for additional information
6 | @REM regarding copyright ownership. The ASF licenses this file
7 | @REM to you under the Apache License, Version 2.0 (the
8 | @REM "License"); you may not use this file except in compliance
9 | @REM with the License. You may obtain a copy of the License at
10 | @REM
11 | @REM http://www.apache.org/licenses/LICENSE-2.0
12 | @REM
13 | @REM Unless required by applicable law or agreed to in writing,
14 | @REM software distributed under the License is distributed on an
15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | @REM KIND, either express or implied. See the License for the
17 | @REM specific language governing permissions and limitations
18 | @REM under the License.
19 | @REM ----------------------------------------------------------------------------
20 |
21 | @REM ----------------------------------------------------------------------------
22 | @REM Apache Maven Wrapper startup batch script, version 3.3.2
23 | @REM
24 | @REM Optional ENV vars
25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution
26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
28 | @REM ----------------------------------------------------------------------------
29 |
30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
31 | @SET __MVNW_CMD__=
32 | @SET __MVNW_ERROR__=
33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
34 | @SET PSModulePath=
35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
37 | )
38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
39 | @SET __MVNW_PSMODULEP_SAVE=
40 | @SET __MVNW_ARG0_NAME__=
41 | @SET MVNW_USERNAME=
42 | @SET MVNW_PASSWORD=
43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
44 | @echo Cannot start maven from wrapper >&2 && exit /b 1
45 | @GOTO :EOF
46 | : end batch / begin powershell #>
47 |
48 | $ErrorActionPreference = "Stop"
49 | if ($env:MVNW_VERBOSE -eq "true") {
50 | $VerbosePreference = "Continue"
51 | }
52 |
53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
55 | if (!$distributionUrl) {
56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
57 | }
58 |
59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
60 | "maven-mvnd-*" {
61 | $USE_MVND = $true
62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
63 | $MVN_CMD = "mvnd.cmd"
64 | break
65 | }
66 | default {
67 | $USE_MVND = $false
68 | $MVN_CMD = $script -replace '^mvnw','mvn'
69 | break
70 | }
71 | }
72 |
73 | # apply MVNW_REPOURL and calculate MAVEN_HOME
74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
75 | if ($env:MVNW_REPOURL) {
76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
78 | }
79 | $distributionUrlName = $distributionUrl -replace '^.*/',''
80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
82 | if ($env:MAVEN_USER_HOME) {
83 | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain"
84 | }
85 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
86 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
87 |
88 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
89 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
90 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
91 | exit $?
92 | }
93 |
94 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
95 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
96 | }
97 |
98 | # prepare tmp dir
99 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
100 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
101 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
102 | trap {
103 | if ($TMP_DOWNLOAD_DIR.Exists) {
104 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
105 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
106 | }
107 | }
108 |
109 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
110 |
111 | # Download and Install Apache Maven
112 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
113 | Write-Verbose "Downloading from: $distributionUrl"
114 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
115 |
116 | $webclient = New-Object System.Net.WebClient
117 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
118 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
119 | }
120 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
121 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
122 |
123 | # If specified, validate the SHA-256 sum of the Maven distribution zip file
124 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
125 | if ($distributionSha256Sum) {
126 | if ($USE_MVND) {
127 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
128 | }
129 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
130 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
131 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
132 | }
133 | }
134 |
135 | # unzip and move
136 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
137 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
138 | try {
139 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
140 | } catch {
141 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
142 | Write-Error "fail to move MAVEN_HOME"
143 | }
144 | } finally {
145 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
146 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
147 | }
148 |
149 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
150 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | org.cryptomator
5 | cli
6 | 0.7.0-SNAPSHOT
7 | Cryptomator CLI
8 | Command line program to access encrypted files via WebDAV.
9 | https://github.com/cryptomator/cli
10 |
11 |
12 | UTF-8
13 | UTF-8
14 | 24
15 |
16 |
17 |
19 | org.ow2.asm,org.apache.jackrabbit,org.apache.httpcomponents
20 | org.cryptomator.cli.CryptomatorCli
21 |
22 |
23 | 2.8.0
24 | 2.0.10
25 | 5.0.5
26 | 1.5.18
27 | 2.0.17
28 |
29 |
30 | 4.7.6
31 |
32 |
33 | 3.14.0
34 | 3.4.2
35 | 3.8.1
36 | 3.6.0
37 | 3.5.0
38 |
39 |
40 |
41 |
42 | GNU Affero General Public License (AGPL) version 3.0
43 | https://www.gnu.org/licenses/agpl.txt
44 | repo
45 |
46 |
47 |
48 |
49 |
50 | Sebastian Stenzel
51 | sebastian.stenzel@gmail.com
52 | +1
53 | cryptomator.org
54 | http://cryptomator.org
55 |
56 |
57 | Armin Schrenk
58 | armin.schrenk@skymatic.de
59 | +1
60 | Skymatic GmbH
61 | https://skymatic.de
62 |
63 |
64 |
65 |
66 |
67 | org.cryptomator
68 | cryptofs
69 | ${cryptofs.version}
70 |
71 |
72 | org.cryptomator
73 | webdav-nio-adapter
74 | ${webdav-nio.version}
75 |
76 |
77 | org.cryptomator
78 | fuse-nio-adapter
79 | ${fuse-nio.version}
80 |
81 |
82 |
83 | info.picocli
84 | picocli
85 | ${picocli.version}
86 |
87 |
88 |
89 |
90 | org.slf4j
91 | slf4j-api
92 | ${slf4j.version}
93 |
94 |
95 | ch.qos.logback
96 | logback-core
97 | ${logback.version}
98 |
99 |
100 | ch.qos.logback
101 | logback-classic
102 | ${logback.version}
103 |
104 |
105 | org.fusesource.jansi
106 | jansi
107 | 2.4.1
108 |
109 |
110 |
111 |
112 | cryptomator-cli-${project.version}
113 |
114 |
115 | maven-compiler-plugin
116 | ${maven-compiler.version}
117 |
118 | ${jdk.version}
119 | true
120 |
121 |
122 | info.picocli
123 | picocli-codegen
124 | ${picocli.version}
125 |
126 |
127 |
128 | -Aproject=${project.groupId}/${project.artifactId}
129 |
130 |
131 |
132 |
133 | org.apache.maven.plugins
134 | maven-jar-plugin
135 | ${maven-jar.version}
136 |
137 |
138 |
139 | true
140 | ${mainClass}
141 |
142 |
143 |
144 |
145 |
146 | org.apache.maven.plugins
147 | maven-dependency-plugin
148 | ${maven-dependency.version}
149 |
150 |
151 |
152 | copy-mods
153 | prepare-package
154 |
155 | copy-dependencies
156 |
157 |
158 | runtime
159 | ${project.build.directory}/mods
160 | ${nonModularGroupIds}
161 |
162 |
163 |
164 | copy-libs
165 | prepare-package
166 |
167 | copy-dependencies
168 |
169 |
170 | runtime
171 | ${project.build.directory}/libs
172 | ${nonModularGroupIds}
173 |
174 |
175 |
176 |
177 |
178 | org.codehaus.mojo
179 | exec-maven-plugin
180 | ${maven-exec.version}
181 |
182 |
183 | generate-autocompletion-script
184 | package
185 |
186 | exec
187 |
188 |
189 |
190 |
191 | java
192 |
193 | -Dpicocli.autocomplete.systemExitOnError
194 | -cp
195 |
196 | picocli.AutoComplete
197 | --force
198 | --completionScript
199 | ${project.build.directory}/cryptomator-cli_completion.sh
200 | ${mainClass}
201 |
202 |
203 |
204 |
224 |
225 |
226 |
227 |
--------------------------------------------------------------------------------
/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | import ch.qos.logback.classic.spi.Configurator;
2 | import org.cryptomator.cli.LogbackConfigurator;
3 |
4 | open module org.cryptomator.cli {
5 | requires org.cryptomator.cryptofs;
6 | requires org.cryptomator.frontend.fuse;
7 | requires info.picocli;
8 | requires org.slf4j;
9 | requires org.cryptomator.integrations.api;
10 | requires org.fusesource.jansi;
11 | requires ch.qos.logback.core;
12 | requires ch.qos.logback.classic;
13 |
14 | provides Configurator with LogbackConfigurator;
15 | }
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/CryptomatorCli.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import picocli.CommandLine;
6 | import picocli.CommandLine.Command;
7 | import picocli.CommandLine.Mixin;
8 | import picocli.CommandLine.ParseResult;
9 | import picocli.CommandLine.RunLast;
10 |
11 | @Command(name = "cryptomator-cli",
12 | mixinStandardHelpOptions = true,
13 | version = "${org.cryptomator.cli.version}",
14 | description = "Unlocks a cryptomator vault and mounts it into the system.",
15 | subcommands = { Unlock.class, ListMounters.class, CommandLine.HelpCommand.class})
16 | public class CryptomatorCli {
17 |
18 | private static final Logger LOG = LoggerFactory.getLogger(CryptomatorCli.class);
19 |
20 | static {
21 | System.getProperties().putIfAbsent("org.cryptomator.cli.version", "SNAPSHOT");
22 | }
23 |
24 | @Mixin
25 | LoggingMixin loggingMixin;
26 |
27 | private int executionStrategy(ParseResult parseResult) {
28 | if (loggingMixin.isVerbose) {
29 | activateVerboseMode();
30 | }
31 | return new RunLast().execute(parseResult); // default execution strategy
32 | }
33 |
34 | private void activateVerboseMode() {
35 | var logConfigurator = LogbackConfigurator.INSTANCE.get();
36 | if (logConfigurator == null) {
37 | throw new IllegalStateException("Logging is not configured.");
38 | }
39 | logConfigurator.switchToDebug();
40 | LOG.debug("Activated debug logging");
41 | }
42 |
43 |
44 | public static void main(String... args) {
45 | var app = new CryptomatorCli();
46 | int exitCode = new CommandLine(app)
47 | .setPosixClusteredShortOptionsAllowed(false)
48 | .setExecutionStrategy(app::executionStrategy)
49 | .execute(args);
50 | System.exit(exitCode);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/ListMounters.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import org.cryptomator.integrations.common.IntegrationsLoader;
4 | import org.cryptomator.integrations.mount.MountService;
5 | import picocli.CommandLine;
6 |
7 | import java.util.concurrent.Callable;
8 |
9 | @CommandLine.Command(name = "list-mounters",
10 | headerHeading = "Usage:%n%n",
11 | synopsisHeading = "%n",
12 | descriptionHeading = "%nDescription:%n%n",
13 | optionListHeading = "%nOptions:%n",
14 | header = "Lists available mounters",
15 | description = "Prints a list of available mounters to STDIN. A mounter is is the object to mount/integrate the unlocked vault into the local filesystem. In the GUI app, mounter is named \"volume type\".",
16 | mixinStandardHelpOptions = true)
17 | public class ListMounters implements Callable {
18 |
19 | @CommandLine.Option(names = {"--withDisplayName"}, description = "Prints also the display name of each mounter, as used in the GUI app.")
20 | boolean withDisplayName = false;
21 |
22 | @Override
23 | public Integer call() throws Exception {
24 | IntegrationsLoader.loadAll(MountService.class)
25 | .forEach(s -> System.out.println(s.getClass().getName() + (withDisplayName? " | " + s.displayName():"")));
26 | return 0;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/LogbackConfigurator.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import ch.qos.logback.classic.Level;
4 | import ch.qos.logback.classic.Logger;
5 | import ch.qos.logback.classic.LoggerContext;
6 | import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
7 | import ch.qos.logback.classic.spi.Configurator;
8 | import ch.qos.logback.classic.spi.ConfiguratorRank;
9 | import ch.qos.logback.classic.spi.ILoggingEvent;
10 | import ch.qos.logback.core.ConsoleAppender;
11 | import ch.qos.logback.core.spi.ContextAwareBase;
12 |
13 | import java.util.Map;
14 | import java.util.concurrent.atomic.AtomicReference;
15 |
16 | @ConfiguratorRank(ConfiguratorRank.CUSTOM_HIGH_PRIORITY)
17 | public class LogbackConfigurator extends ContextAwareBase implements Configurator {
18 |
19 | public static final AtomicReference INSTANCE = new AtomicReference<>();
20 |
21 | private static final Map DEFAULT_LOG_LEVELS = Map.of( //
22 | Logger.ROOT_LOGGER_NAME, Level.INFO, //
23 | "org.cryptomator", Level.INFO, //
24 | "org.cryptomator.frontend.fuse.locks", Level.OFF
25 | );
26 |
27 | private static final Map DEBUG_LOG_LEVELS = Map.of( //
28 | Logger.ROOT_LOGGER_NAME, Level.DEBUG, //
29 | "org.cryptomator", Level.TRACE, //
30 | "org.cryptomator.frontend.fuse.locks", Level.OFF
31 | );
32 |
33 | @Override
34 | public ExecutionStatus configure(LoggerContext context) {
35 | var encoder = new PatternLayoutEncoder();
36 | encoder.setContext(context);
37 | encoder.setPattern("[%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n");
38 | encoder.start();
39 |
40 | var stdout = new ConsoleAppender();
41 | stdout.setWithJansi(true);
42 | stdout.setContext(context);
43 | stdout.setName("STDOUT");
44 | stdout.setEncoder(encoder);
45 | stdout.start();
46 |
47 | // configure loggers:
48 | for (var loglevel : DEFAULT_LOG_LEVELS.entrySet()) {
49 | Logger logger = context.getLogger(loglevel.getKey());
50 | logger.setLevel(loglevel.getValue());
51 | logger.setAdditive(false);
52 | logger.addAppender(stdout);
53 | }
54 |
55 | //make instance accessible
56 | INSTANCE.compareAndSet(null, this);
57 | return ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY;
58 | }
59 |
60 | void switchToDebug() {
61 | setLogLevels(DEBUG_LOG_LEVELS);
62 | }
63 |
64 | /**
65 | * Adjust the log levels
66 | *
67 | * @param logLevels new log levels to use
68 | */
69 | private void setLogLevels(Map logLevels) {
70 | if (context instanceof LoggerContext lc) {
71 | for (var loglevel : logLevels.entrySet()) {
72 | Logger logger = lc.getLogger(loglevel.getKey());
73 | logger.setLevel(loglevel.getValue());
74 | }
75 | }
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/LoggingMixin.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import picocli.CommandLine.Spec;
4 | import picocli.CommandLine.Model;
5 | import picocli.CommandLine.Option;
6 |
7 | public class LoggingMixin {
8 |
9 | @Spec(Spec.Target.MIXEE)
10 | private Model.CommandSpec mixee;
11 |
12 | boolean isVerbose;
13 |
14 | /**
15 | * Sets a verbose logging leven on the LoggingMixin of the top-level command.
16 | * @param isVerbose boolean flag to activate verbose mode
17 | */
18 | @Option(names = {"-v", "--verbose"}, description = {
19 | "Activate verbose mode"})
20 | public void setVerbose(boolean isVerbose) {
21 | // Each subcommand that mixes in the LoggingMixin has its own instance
22 | // of this class, so there may be many LoggingMixin instances.
23 | // We want to store the verbosity value in a single, central place,
24 | // so we find the top-level command,
25 | // and store the verbosity level on our top-level command's LoggingMixin.
26 | ((CryptomatorCli) mixee.root().userObject()).loggingMixin.isVerbose = isVerbose;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/MountSetup.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import org.cryptomator.integrations.common.IntegrationsLoader;
4 | import org.cryptomator.integrations.mount.*;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 | import picocli.CommandLine;
8 |
9 | import java.nio.file.FileSystem;
10 | import java.nio.file.Path;
11 | import java.util.*;
12 | import java.util.stream.Collectors;
13 |
14 | import static org.cryptomator.integrations.mount.MountCapability.*;
15 |
16 | public class MountSetup {
17 |
18 | private static final Logger LOG = LoggerFactory.getLogger(MountSetup.class);
19 |
20 | @CommandLine.Spec
21 | CommandLine.Model.CommandSpec spec;
22 |
23 | @CommandLine.Option(names = {"--mounter"}, paramLabel = "fully.qualified.ClassName", description = "Name of the mounter to use", required = true)
24 | void setMountService(String value) {
25 | var services = IntegrationsLoader.loadAll(MountService.class).toList();
26 | var service = services.stream().filter(s -> s.getClass().getName().equals(value)).findFirst();
27 | if (service.isEmpty()) {
28 | var availableServices = services.stream().map(s -> s.getClass().getName()).collect(Collectors.joining(","));
29 | var errorMessage = String.format("Invalid value '%s' for option '--mounter': Available mounters are [%s].", value, availableServices);
30 | throw new CommandLine.ParameterException(spec.commandLine(), errorMessage);
31 | }
32 | this.mountService = service.get();
33 | }
34 |
35 | private MountService mountService;
36 |
37 | @CommandLine.Option(names = {"--mountPoint"}, paramLabel = "/path/to/mount/point", description = "Path to the mount point. Requirements for mount point depend on the chosen mount service")
38 | Optional mountPoint;
39 |
40 | @CommandLine.Option(names = {"--volumeName"}, description = "Name of the virtual volume.")
41 | Optional volumeName;
42 |
43 | @CommandLine.Option(names = {"--volumeId"}, description = "Id of the virtual volume.")
44 | String volumeId = UUID.randomUUID().toString();
45 |
46 | @CommandLine.Option(names = {"--mountOption", "-mop"}, description = "Additional mount option. For a list of mount options, see the WinFsp, macFUSE, FUSE-T and libfuse documentation.")
47 | List mountOptions = new ArrayList<>();
48 |
49 | @CommandLine.Option(names = {"--loopbackHostName"}, description = "Name of the loopback address.")
50 | Optional loopbackHostName;
51 |
52 | @CommandLine.Option(names = {"--loopbackPort"}, description = "Port used at the loopback address.")
53 | Optional loopbackPort;
54 |
55 |
56 | MountBuilder prepareMountBuilder(FileSystem fs) {
57 | var specifiedMOPs = listSpecifiedMountOptions();
58 | var builder = mountService.forFileSystem(fs.getPath("/"));
59 | for (var capability : mountService.capabilities()) {
60 | switch (capability) {
61 | case FILE_SYSTEM_NAME -> builder.setFileSystemName("cryptoFs");
62 | case LOOPBACK_PORT -> {
63 | loopbackPort.ifPresent(builder::setLoopbackPort);
64 | specifiedMOPs.put(LOOPBACK_PORT, false);
65 | }
66 | case LOOPBACK_HOST_NAME -> {
67 | loopbackHostName.ifPresent(builder::setLoopbackHostName);
68 | specifiedMOPs.put(LOOPBACK_HOST_NAME, false);
69 | }
70 | //TODO: case READ_ONLY -> builder.setReadOnly(vaultSettings.usesReadOnlyMode.get());
71 | case MOUNT_FLAGS -> {
72 | specifiedMOPs.put(MOUNT_FLAGS, false);
73 | if (mountOptions.isEmpty()) {
74 | var defaultFlags = mountService.getDefaultMountFlags();
75 | LOG.debug("Using default mount options {}", defaultFlags);
76 | builder.setMountFlags(defaultFlags);
77 | } else {
78 | builder.setMountFlags(String.join(" ", mountOptions));
79 | }
80 | }
81 | case VOLUME_ID -> {
82 | builder.setVolumeId(volumeId);
83 | }
84 | case VOLUME_NAME -> {
85 | volumeName.ifPresent(builder::setVolumeName);
86 | specifiedMOPs.put(VOLUME_NAME, false);
87 | }
88 | default -> {
89 | //NO-OP
90 | }
91 | }
92 | }
93 |
94 | var ignoredMOPs = specifiedMOPs.entrySet().stream().filter(Map.Entry::getValue).map(e -> e.getKey().name()).collect(Collectors.joining(","));
95 | if (!ignoredMOPs.isEmpty()) {
96 | LOG.info("Ignoring unsupported options: {}", ignoredMOPs);
97 | }
98 | return builder;
99 | }
100 |
101 | private Map listSpecifiedMountOptions() {
102 | var map = new HashMap();
103 | loopbackPort.ifPresent(_ -> map.put(LOOPBACK_PORT, true));
104 | loopbackHostName.ifPresent(_ -> map.put(LOOPBACK_HOST_NAME, true));
105 | volumeName.ifPresent(_ -> map.put(VOLUME_NAME, true));
106 | if (!mountOptions.isEmpty()) {
107 | map.put(MOUNT_FLAGS, true);
108 | }
109 | return map;
110 | }
111 |
112 | Mount mount(FileSystem fs) throws MountFailedException {
113 | boolean requiresMountPoint = Set.of(MOUNT_TO_EXISTING_DIR, //
114 | MOUNT_WITHIN_EXISTING_PARENT, //
115 | MOUNT_AS_DRIVE_LETTER)
116 | .stream().anyMatch(mountService::hasCapability);
117 | if( requiresMountPoint && mountPoint.isEmpty()){
118 | throw new RuntimeException("Unsupported configuration: Mounter %s requires a mount point. Use --mountPoint /path/to/mount/point to specify it.".formatted(mountService.getClass().getName()));
119 | }
120 |
121 | var builder = prepareMountBuilder(fs);
122 |
123 | try {
124 | mountPoint.ifPresent(builder::setMountpoint);
125 | } catch (UnsupportedOperationException e) {
126 | var errorMessage = String.format("Unsupported configuration: Mounter '%s' does not support flag --mountpoint", mountService.getClass().getName());
127 | throw new RuntimeException(errorMessage);
128 | }
129 | LOG.debug("Mounting vault using {} to {}.", mountService.displayName(), mountPoint.isPresent() ? mountPoint.get() : "system chosen location");
130 | return builder.mount();
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/PasswordSource.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 | import picocli.CommandLine;
6 |
7 | import java.io.IOException;
8 | import java.nio.ByteBuffer;
9 | import java.nio.CharBuffer;
10 | import java.nio.charset.StandardCharsets;
11 | import java.nio.file.Files;
12 | import java.nio.file.Path;
13 | import java.util.Arrays;
14 |
15 | public class PasswordSource {
16 |
17 | public static final Logger LOG = LoggerFactory.getLogger(PasswordSource.class);
18 | private static final int MAX_PASSPHRASE_FILE_SIZE = 5_000; //5KB
19 |
20 | @CommandLine.Option(names = {"--password:stdin"}, paramLabel = "Passphrase", description = "Passphrase, read from STDIN", interactive = true)
21 | char[] passphraseStdin = null;
22 |
23 | @CommandLine.Option(names = "--password:env", description = "Name of the environment variable containing the passphrase")
24 | String passphraseEnvironmentVariable = null;
25 |
26 | @CommandLine.Option(names = "--password:file", description = "Path of the file containing the passphrase. The password file must be utf-8 encoded")
27 | Path passphraseFile = null;
28 |
29 | Passphrase readPassphrase() throws IOException {
30 | if (passphraseStdin != null) {
31 | System.out.println("\n"); //otherwise other output might not be clearly separated on the console
32 | return new Passphrase(passphraseStdin);
33 | } else if (passphraseEnvironmentVariable != null) {
34 | return readPassphraseFromEnvironment();
35 | } else if (passphraseFile != null) {
36 | return readPassphraseFromFile();
37 | }
38 | throw new IllegalStateException("Passphrase source not specified, but required.");
39 | }
40 |
41 | private Passphrase readPassphraseFromEnvironment() {
42 | LOG.debug("Reading passphrase from env variable '{}'", passphraseEnvironmentVariable);
43 | var tmp = System.getenv(passphraseEnvironmentVariable);
44 | if (tmp == null) {
45 | throw new ReadingEnvironmentVariableFailedException("Environment variable " + passphraseEnvironmentVariable + " is not defined.");
46 | }
47 | char[] result = new char[tmp.length()];
48 | tmp.getChars(0, tmp.length(), result, 0);
49 | return new Passphrase(result);
50 | }
51 |
52 | private Passphrase readPassphraseFromFile() throws ReadingFileFailedException {
53 | LOG.debug("Reading passphrase from file '{}'.", passphraseFile);
54 | byte[] fileContent = null;
55 | CharBuffer charWrapper = null;
56 | try {
57 | if (Files.size(passphraseFile) > MAX_PASSPHRASE_FILE_SIZE) {
58 | throw new ReadingFileFailedException("Password file is too big. Max supported size is " + MAX_PASSPHRASE_FILE_SIZE + " bytes.");
59 | }
60 | fileContent = Files.readAllBytes(passphraseFile);
61 | charWrapper = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(fileContent));
62 | //strips newline, since most files on linux end with a new line
63 | var length = charWrapper.limit();
64 | if(charWrapper.get(length - 1) == '\n') {
65 | length--;
66 | }
67 | char[] content = new char[length];
68 | charWrapper.get(content);
69 | return new Passphrase(content);
70 | } catch (IOException e) {
71 | throw new ReadingFileFailedException(e);
72 | } finally {
73 | if (fileContent != null) {
74 | Arrays.fill(fileContent, (byte) 0);
75 | }
76 | if (charWrapper != null) {
77 | Arrays.fill(charWrapper.array(), (char) 0x00);
78 | }
79 | }
80 | }
81 |
82 | static class PasswordSourceException extends RuntimeException {
83 | PasswordSourceException(String msg) {
84 | super(msg);
85 | }
86 |
87 | PasswordSourceException(Throwable cause) {
88 | super(cause);
89 | }
90 | }
91 |
92 | static class ReadingFileFailedException extends PasswordSourceException {
93 | ReadingFileFailedException(Throwable e) {
94 | super(e);
95 |
96 | }
97 |
98 | public ReadingFileFailedException(String s) {
99 | super(s);
100 | }
101 | }
102 |
103 | static class ReadingEnvironmentVariableFailedException extends PasswordSourceException {
104 | ReadingEnvironmentVariableFailedException(String msg) {
105 | super(msg);
106 | }
107 | }
108 |
109 | record Passphrase(char[] content) implements AutoCloseable {
110 |
111 | @Override
112 | public void close() {
113 | Arrays.fill(content, (char) 0);
114 | }
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/src/main/java/org/cryptomator/cli/Unlock.java:
--------------------------------------------------------------------------------
1 | package org.cryptomator.cli;
2 |
3 | import org.cryptomator.cryptofs.CryptoFileSystemProperties;
4 | import org.cryptomator.cryptofs.CryptoFileSystemProvider;
5 | import org.cryptomator.cryptofs.VaultConfig;
6 | import org.cryptomator.cryptolib.api.Masterkey;
7 | import org.cryptomator.cryptolib.api.MasterkeyLoadingFailedException;
8 | import org.cryptomator.cryptolib.common.MasterkeyFileAccess;
9 | import org.cryptomator.integrations.mount.Mount;
10 | import org.cryptomator.integrations.mount.UnmountFailedException;
11 | import org.slf4j.Logger;
12 | import org.slf4j.LoggerFactory;
13 | import picocli.CommandLine;
14 | import picocli.CommandLine.*;
15 |
16 | import java.io.IOException;
17 | import java.net.URI;
18 | import java.nio.CharBuffer;
19 | import java.nio.charset.StandardCharsets;
20 | import java.nio.file.Files;
21 | import java.nio.file.Path;
22 | import java.security.SecureRandom;
23 | import java.util.concurrent.Callable;
24 |
25 | @Command(name = "unlock",
26 | header = "Unlocks a vault",
27 | description = "Unlocks and mounts the given cryptomator vault, identified by the path to the vault directory." +
28 | "The unlocked vault is mounted into the local filesystem by the specified mounter." +
29 | "For a list of available mounters, use the `list-mounters` subcommand.",
30 | parameterListHeading = "%nParameters:%n",
31 | headerHeading = "Usage:%n%n",
32 | synopsisHeading = "%n",
33 | descriptionHeading = "%nDescription:%n%n",
34 | optionListHeading = "%nOptions:%n",
35 |
36 | mixinStandardHelpOptions = true)
37 | public class Unlock implements Callable {
38 |
39 | private static final Logger LOG = LoggerFactory.getLogger(Unlock.class);
40 | private static final byte[] PEPPER = new byte[0];
41 | private static final String CONFIG_FILE_NAME = "vault.cryptomator";
42 | private static final String MASTERKEY_FILE_NAME = "masterkey.cryptomator";
43 | private static final String FORCED_UNMOUNT_MSG = "GRACEFUL UNMOUNT FAILED. Please check if manual cleanups are necessary";
44 |
45 | @Spec
46 | Model.CommandSpec spec;
47 | @Mixin
48 | LoggingMixin loggingMixin;
49 |
50 | @Parameters(index = "0", paramLabel = "/path/to/vaultDirectory", description = "Path to the vault directory")
51 | Path pathToVault;
52 |
53 | @ArgGroup(multiplicity = "1")
54 | PasswordSource passwordSource;
55 |
56 | @ArgGroup(exclusive = false, multiplicity = "1")
57 | MountSetup mountSetup;
58 |
59 | @Option(names = {"--maxCleartextNameLength"}, description = "Maximum cleartext filename length limit of created files. Remark: If this limit is greater than the shortening threshold, it does not have any effect.")
60 | void setMaxCleartextNameLength(int input) {
61 | if (input <= 0) {
62 | throw new CommandLine.ParameterException(spec.commandLine(),
63 | String.format("Invalid value '%d' for option '--maxCleartextNameLength': " +
64 | "value must be a positive Number between 1 and %d.", input, Integer.MAX_VALUE));
65 | }
66 | maxCleartextNameLength = input;
67 | }
68 |
69 | private int maxCleartextNameLength = 0;
70 |
71 | private SecureRandom csprng = null;
72 |
73 | @Override
74 | public Integer call() throws Exception {
75 | csprng = SecureRandom.getInstanceStrong();
76 |
77 | var unverifiedConfig = readConfigFromStorage(pathToVault);
78 | var fsPropsBuilder = CryptoFileSystemProperties.cryptoFileSystemProperties() //
79 | .withKeyLoader(this::loadMasterkey) //
80 | .withShorteningThreshold(unverifiedConfig.allegedShorteningThreshold()); //cryptofs checks, if config is signed with masterkey
81 | if (maxCleartextNameLength > 0) {
82 | fsPropsBuilder.withMaxCleartextNameLength(maxCleartextNameLength);
83 | }
84 |
85 | try (var fs = CryptoFileSystemProvider.newFileSystem(pathToVault, fsPropsBuilder.build());
86 | var mount = mountSetup.mount(fs)) {
87 | LOG.info("Unlocked and mounted vault successfully to {}", mount.getMountpoint().uri());
88 | Runtime.getRuntime().addShutdownHook(new Thread(() -> teardown(mount)));
89 | Thread.currentThread().join();
90 | }
91 |
92 | throw new IllegalStateException("Application exited without error or receiving shutdown signal.");
93 | }
94 |
95 | private void teardown(Mount m) {
96 | try {
97 | m.close();
98 | } catch (IOException | UnmountFailedException e) {
99 | LOG.error(FORCED_UNMOUNT_MSG, e);
100 | }
101 | }
102 |
103 | private Masterkey loadMasterkey(URI keyId) {
104 | Path filePath = pathToVault.resolve(MASTERKEY_FILE_NAME);
105 | try (var passphraseContainer = passwordSource.readPassphrase()) {
106 | return new MasterkeyFileAccess(PEPPER, csprng)
107 | .load(filePath, CharBuffer.wrap(passphraseContainer.content()));
108 | } catch (IOException e) {
109 | LOG.error("Reading {} failed.", filePath, e);
110 | throw new MasterkeyLoadingFailedException("Unable to load key from file " + filePath + ": " + e.getMessage());
111 | }
112 | }
113 |
114 | /**
115 | * Attempts to read the vault config file and parse it without verifying its integrity.
116 | *
117 | * @throws IOException if reading the file fails
118 | */
119 | static VaultConfig.UnverifiedVaultConfig readConfigFromStorage(Path vaultPath) throws IOException {
120 | Path configPath = vaultPath.resolve(CONFIG_FILE_NAME);
121 | LOG.debug("Reading vault config from file {}.", configPath);
122 | String token = Files.readString(configPath, StandardCharsets.US_ASCII);
123 | return VaultConfig.decode(token);
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/src/main/resources/META-INF/services/ch.qos.logback.classic.spi.Configurator:
--------------------------------------------------------------------------------
1 | org.cryptomator.cli.LogbackConfigurator
--------------------------------------------------------------------------------