Commit Graph

202 Commits (master)

Author SHA1 Message Date
Christoph Wurst 6a5d89c1ac
Merge pull request #26758 from J0WI/more-strict
Some more strict_types
3 years ago
Joas Schilling 167efa19d7
Fix psalm errors
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
J0WI d1f23b0428 core: add more strict_types
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
3 years ago
Morris Jobke ab48d5e8cb
Cleanup unneeded code around database.xml
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
3 years ago
Morris Jobke 268acd301d
Merge pull request #25529 from nextcloud/fix-non-lgc-glyphs-in-avatars-and-txt-file-previews
Fix non LGC glyphs in avatars and txt file previews
3 years ago
Robin Appelman 9e3775618b
log full expection during repair step
Signed-off-by: Robin Appelman <robin@icewind.nl>
3 years ago
Daniel Calviño Sánchez 9f96a47125 Add OCC command to reset rendered texts
The command is meant to be used when the fonts used to render texts
("core/fonts/NotoSans-Regular.ttf" and "core/fonts/NotoSans-Bold.ttf")
are changed (for example, to add support for other scripts). The avatar
and text file previews will be removed, so they will be generated again
with the updated font when needed.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
3 years ago
Johannes Leuker 2796ef80ff Show group backends in occ group:list --info and group:info
Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
3 years ago
Christoph Wurst 8b64e92b92
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
3 years ago
Sean Molenaar 40595f3ee0
Command: Add app password generation
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
3 years ago
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
MichaIng 7224db548d
Register new command db:add-missing-primary-keys
Introduced with: d5df033ede

Signed-off-by: MichaIng <micha@dietpi.com>
4 years ago
Morris Jobke dc479aae2d
Improve CertificateManager to not be user context dependent
* removes the ability for users to import their own certificates (for external storage)
* reliably returns the same certificate bundles system wide (and not depending on the user context and available sessions)

The user specific certificates were broken in some cases anyways, as they are only loaded if the specific user is logged in and thus causing unexpected behavior for background jobs and other non-user triggered code paths.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
4 years ago
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Roeland Jago Douma 987f621173
Merge pull request #22331 from nextcloud/bugfix/noid/dont-use-deprecated-inigetwrapper
Don't use deprecated getIniWrapper() anymore
4 years ago
Morris Jobke 567e99abe2
Use the DI container also for the Install command registration
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
4 years ago
Roeland Jago Douma 5340ab3a75
New SSE key format
* Encrypt the keys with the instance secret
* Store them as json (so we can add other things if needed)

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
4 years ago
Morris Jobke 7506cbb1c4
Show disabled user count in occ user:report
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
4 years ago
Morris Jobke d7f66c36ac
Fix "misplaced variables" warning of Psalm in PHPDoc statements
Ref #21787

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
4 years ago
Morris Jobke d8734b3b93
Add occ preview:migrate to migrate previews from the old flat structure to a subfolder structure
* `php occ preview:repair` - a preview migration tool that moves existing previews into the new location introduced with #19214
* moves `appdata_INSTANCEID/previews/FILEID` to `appdata_INSTANCEID/previews/0/5/8/4/c/e/5/FILEID`
* migration tool can be stopped during migration via `CTRL+C` - it then finishes the current folder (with the previews of one file) and stops gracefully
* if a PHP memory limit is set in the `php.ini` then it will stop automatically once it has less than 25 MiB memory left (this is to avoid hard crashes in the middle of a migration)
* the tool can be used during operation - possible drawbacks:
    * there is the chance of a race condition that a new preview is generated in the moment the folder is already migrated away - so the old folder with the newly cached preview is deleted and one cached preview needs to be re-generated
    * there is the chance of a race condition during access of a preview while it is migrated to the other folder - then no preview can be shown and results in a 404 (as of now this is an accepted risk)

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
4 years ago
Morris Jobke e57bca31ad
Merge pull request #20005 from joeried/occ-remove-bruteforce-attempts-by-ip
Implement occ command to reset bruteforce attemps from a given IP address
4 years ago
Joas Schilling 720dc4e93d
Add optional column oc_comments.reference_id
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 years ago
Johannes Riedel 0c38569c83 Implement occ command security:bruteforceattemps:reset-for-ip
Signed-off-by: Johannes Riedel <joeried@users.noreply.github.com>
4 years ago
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Christoph Wurst d180a98714
Make it possible to broadcast events to (web) clients
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
John Molakvoæ (skjnldsv) 5d01850dce
Add detailed users listing in occ user:info command
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
5 years ago
Ruben Homs 98047e8c1c
Stop decryption when maintenance mode is enabled, fixes #8311
Signed-off-by: Ruben Homs <ruben@homs.codes>
5 years ago
Daniel Kesselberg 08907ee3e9
Enable multiple apps at once
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
5 years ago
Daniel Kesselberg 0b58b0faf3
Do not run getRepairSteps in register_commands
getRepairSteps is quite expensive (because every repair step is
initialized and their dependencies are injected). Should not
call it during register.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
5 years ago
Michael Gerber 020a9add07
Add occ app:update command
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
6 years ago
Patrik Kernstock 1973556346 Log exception using ILogger
Signed-off-by: Patrik Kernstock <info@pkern.at>
6 years ago
Patrik Kernstock f27ce6b5a0 Inject AppManager and Installer, check for shipped app prior removing
Signed-off-by: Patrik Kernstock <info@pkern.at>
6 years ago
Patrik Kernstock d9469a6b72 Add occ app:remove CLI command
Signed-off-by: Patrik Kernstock <info@pkern.at>
6 years ago
Christoph Wurst 259c0ce11d
Add mandatory 2FA service/class
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Christoph Wurst 7586b19e52
Only allow 2FA state changs if providers support the operation
Ref https://github.com/nextcloud/server/issues/11019.

Add `twofactorauth:cleanup` command

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Denis Mosolov 0b18e2c75d Add an options to create and remove groups via occ
Signed-off-by: Denis Mosolov <denismosolov@gmail.com>
6 years ago
Christoph Wurst 13d93f5b25
Make 2FA providers stateful
This adds persistence to the Nextcloud server 2FA logic so that the server
knows which 2FA providers are enabled for a specific user at any time, even
when the provider is not available.

The `IStatefulProvider` interface was added as tagging interface for providers
that are compatible with this new API.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Roeland Jago Douma 80cc8d0028
Emit event when running ./occ db:add-missing-indices
This allows apps to listen to this event in order to also update
indecies there.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Joas Schilling f772b7b4dd
Add autocomplete to migration commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
6 years ago
Joas Schilling 17a26dfcc1
Validate the info.xml against the appstore schema file
Signed-off-by: Joas Schilling <coding@schilljs.com>
6 years ago
Bjoern Schiessle 41ee23a054
make occ command more generic
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
7 years ago
Bjoern Schiessle fda98ee917
add occ command to add a index to share_with at the share table
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
7 years ago
Morris Jobke 0e2f00ec59
Get the Installer via DI
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke dd192e5df9
Use proper DI for repair command
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Joas Schilling e2ec6b33ea
Add a command to manually migrate to big ints
Signed-off-by: Joas Schilling <coding@schilljs.com>
7 years ago
sualko 3e62a25155 add occ app:install command
Signed-off-by: Klaus Herberth <klaus@jsxc.org>
7 years ago
Joas Schilling 0a0dbbdf15
Remove generate change script which doesnt work with migrations anymore
Signed-off-by: Joas Schilling <coding@schilljs.com>
7 years ago
Joas Schilling f6c48b1548
Add a script to generate a migration from database.xml
Signed-off-by: Joas Schilling <coding@schilljs.com>
7 years ago
Joas Schilling 8c39e66619 Do not allow to go back on productive systems
Signed-off-by: Joas Schilling <coding@schilljs.com>
7 years ago
Joas Schilling 15eec7b83c Start migrations
Fixme:
- Install and update of apps
- No revert on live systems (debug only)
- Service adjustment to our interface
- Loading via autoloader

Signed-off-by: Joas Schilling <coding@schilljs.com>
7 years ago
Julius Härtl 2e47210d6f Add command to apply updates to custom themes
Signed-off-by: Julius Härtl <jus@bitgrid.net>
7 years ago
Morris Jobke 713f684a8b
Adding tests for 4 byte unicode characters
* success on SQLite and Postgres
* failure on MySQL due to the limited charset that only supports up to 3 bytes

Add config option to update charset of mysql to utf8mb4

* fully optional
* requires additional options set in the database

only disable unicode test on mysql

Fixing ctor call

Adding docker based unit test execution for mysql utf8mb4

Add mysqlmb4 test configuration to Jenkinsfile

fix collation on utf8mb4

Properly setup charset and collation in the doctrine connection

Allow files containing 4-byte chars in case the database supports it

During setup of a mysql database we try to detect if charset 'utf8mb4' can be used

Fix mysql settings

Add console command to migrate the charset

Set ROW_FORMAT before setting collation to mb4

Also select tables with wrong collation

Faster MySQL docker

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke edd55b0ea9
Use SystemConfig instead of AllConfig for DB stuff
* preparation for followup PRs to clean up the DB bootstrapping

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 9533f4e5ed
Clean up single user mode
Single user mode basically disables WebDAV, OCS and cron execution. Since
we heavily rely on WebDAV and OCS also in the web UI it's basically useless.
An admin only sees a broken interface and can't even change any settings nor
sees any files. Also sharing is not possible.

As this is at least the case since Nextcloud 9 and we haven't received any
reports for this it seems that this feature is not used at all so I removed it.

The encryption commands now rely on the well tested maintenance mode.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Jörn Friedrich Dreyer 817729dc3f
add upgrade command before repair, handle NeedsUpgradeExcaption better 8 years ago
Thomas Müller a7245ea082
Fixing ctor call 8 years ago
Morris Jobke cc28f82b36
Add config option to update charset of mysql to utf8mb4
* fully optional
* requires additional options set in the database
8 years ago
Thomas Müller 67d3574bdf
Don't parse info.xml but reuse already cached app infos - fixes #25603 (#25968)
* Don't parse info.xml but reuse already cached app infos - fixes #25603

* Use === in InfoParser. Fixes test

* InfoParser should not depend on UrlGenerator - fixes issue with session being closed too early
8 years ago
Joas Schilling 5551c63110 Register the auto completion basic
Signed-off-by: Joas Schilling <coding@schilljs.com>
8 years ago
Thomas Pulzer ba3f4f118e Changed logtype to file instead of owncloud.
- Updated the config sample to point to log_type='file'
- Renamed the Class for logfile logging to File in namespace 'OC\Log\'.
  Changed the occurrences of 'OC\Log\Owncloud' to 'OC\Log\File'.
- Renamed the Class for log:file command to File in namespace 'OC\Core\Command\Log\File'.
  Changed registration of the command to use 'OC\Core\Command\Log\File'.
- Changed default Syslog tag to Nextcloud
- Retained backwards compatibility for configs with 'logtype' => 'owncloud'

- Adjusted tests for the new file log.

Closes #490.
8 years ago
Joas Schilling 0215b004da
Update with robin 8 years ago
Joas Schilling ba87db3fcc
Fix others 8 years ago
Robin Appelman 586c58efa7
add occ command to show user information 8 years ago
Robin Appelman 3d874c407d
Add commands to add/remove users to/from groups 8 years ago
Robin Appelman 413d577b29
add command to list groups 8 years ago
Robin Appelman b44d439010
add occ command to list users 8 years ago
Joas Schilling b96f0c99b0
Add a occ command to list/get user preferences 8 years ago
Lukas Reschke aba539703c
Update license headers 8 years ago
Christoph Wurst 847bbc51b6
add OCC command to enable/disable 2FA for a user 8 years ago
Lukas Reschke 52add798d4 Do not automatically try to enable index.php-less URLs (#24539)
The current logic for mod_rewrite relies on the fact that people have properly configured ownCloud, basically it reads from the `overwrite.cli.ur
l` entry and then derives the `RewriteBase` from it.

This usually works. However, since the ownCloud packages seem to install themselves at `/owncloud` (because subfolders are cool or so…) _a lot_ of people have just created a new Virtual Host for it or have simply symlinked the path etc.

This means that `overwrite.cli.url` is wrong, which fails hard if it is used as RewriteBase since Apache does not know where it should serve files from. In the end the ownCloud instance will not be accessible anymore and users will be frustrated. Also some shared hosters like 1&1 (because using shared hosters is so awesome… ;-)) have somewhat dubious Apache configurations or use versions of mod_rewrite from the mediveal age. (because updating is money or so…)

Anyhow. This makes this explicitly an opt-in configuration flag. If `htaccess.RewriteBase` is set then it will configure index.php-less URLs, if
admins set that after installation and don't want to wait until the next ownCloud version they can run `occ maintenance:update:htaccess`.

For ownCloud 9.0 we also have to add a repair step to make sure that instances that already have a RewriteBase configured continue to use it by copying it into the config file. That way all existing URLs stay valid. That one is not in this PR since this is unneccessary in master.

Effectively this reduces another risk of breakage when updating from ownCloud 8 to ownCloud 9.

Fixes https://github.com/owncloud/core/issues/24525, https://github.com/owncloud/core/issues/24426 and probably some more.
8 years ago
Thomas Müller 9c9fec36dd
Add occ commands to enable and disable a user + a disabled user can no longer login - fixes #23838 8 years ago
Thomas Müller cdcd49b473
Adding progress to occ maintenance:repair 8 years ago
Thomas Müller d0030aad6c
Remove deprecated HTTPHelper from InfoParser 8 years ago
Roeland Jago Douma a2c8597b00
Add occ command for updating the data-fingerprint 8 years ago
Lukas Reschke 933f60e314 Update author information
Probably nice for the people that contributed to 9.0 to see themselves in the AUTHORS file :)
8 years ago
Victor Dubiniuk fef7fc1248 CLI commands to check app and core signatures 8 years ago
Lukas Reschke ea367b598a Use path instead of app id
This change requires the usage of a path instead of the App ID when signing code. This has the advantage that developers can also sign code under a different location to make it easier. (e.g. remove `.git`, …)

Also it adds an example command usage as well as a link to the documentation
8 years ago
Joas Schilling 56184f799e Make it possible to enable apps for groups only via occ 8 years ago
Joas Schilling 78a02d1b2f Make it possible to disable apps via the console, which are not enabled for the current user 8 years ago
Joas Schilling d2285113a8 Make sure to list "group enabled" apps as enabled
also when they are not enabled for the current user
8 years ago
Robin Appelman c67a09112b Add occ commands to manager trusted certificates 9 years ago
Thomas Müller 682821c71e Happy new year! 9 years ago
Victor Dubiniuk b59285d0d0 Add occ command to get app path 9 years ago
Lukas Reschke 4971015544 Add code integrity check
This PR implements the base foundation of the code signing and integrity check. In this PR implemented is the signing and verification logic, as well as commands to sign single apps or the core repository.

Furthermore, there is a basic implementation to display problems with the code integrity on the update screen.

Code signing basically happens the following way:

- There is a ownCloud Root Certificate authority stored `resources/codesigning/root.crt` (in this PR I also ship the private key which we obviously need to change before a release 😉). This certificate is not intended to be used for signing directly and only is used to sign new certificates.
- Using the `integrity:sign-core` and `integrity:sign-app` commands developers can sign either the core release or a single app. The core release needs to be signed with a certificate that has a CN of `core`,  apps need to be signed with a certificate that either has a CN of `core` (shipped apps!)  or the AppID.
- The command generates a signature.json file of the following format:
```json
{
    "hashes": {
        "/filename.php": "2401fed2eea6f2c1027c482a633e8e25cd46701f811e2d2c10dc213fd95fa60e350bccbbebdccc73a042b1a2799f673fbabadc783284cc288e4f1a1eacb74e3d",
        "/lib/base.php": "55548cc16b457cd74241990cc9d3b72b6335f2e5f45eee95171da024087d114fcbc2effc3d5818a6d5d55f2ae960ab39fd0414d0c542b72a3b9e08eb21206dd9"
    },
    "certificate": "-----BEGIN CERTIFICATE-----MIIBvTCCASagAwIBAgIUPvawyqJwCwYazcv7iz16TWxfeUMwDQYJKoZIhvcNAQEF\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTAx\nNDEzMTcxMFoXDTE2MTAxNDEzMTcxMFowEzERMA8GA1UEAwwIY29udGFjdHMwgZ8w\nDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANoQesGdCW0L2L+a2xITYipixkScrIpB\nkX5Snu3fs45MscDb61xByjBSlFgR4QI6McoCipPw4SUr28EaExVvgPSvqUjYLGps\nfiv0Cvgquzbx/X3mUcdk9LcFo1uWGtrTfkuXSKX41PnJGTr6RQWGIBd1V52q1qbC\nJKkfzyeMeuQfAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAvF/KIhRMQ3tYTmgHWsiM\nwDMgIDb7iaHF0fS+/Nvo4PzoTO/trev6tMyjLbJ7hgdCpz/1sNzE11Cibf6V6dsz\njCE9invP368Xv0bTRObRqeSNsGogGl5ceAvR0c9BG+NRIKHcly3At3gLkS2791bC\niG+UxI/MNcWV0uJg9S63LF8=\n-----END CERTIFICATE-----",
    "signature": "U29tZVNpZ25lZERhdGFFeGFtcGxl"
}
```
`hashes` is an array of all files in the folder with their corresponding SHA512 hashes (this is actually quite cheap to calculate), the `certificate` is the  certificate used for signing. It has to be issued by the ownCloud Root Authority and it's CN needs to be permitted to perform the required action. The `signature` is then a signature of the `hashes` which can be verified using the `certificate`.

Steps to do in other PRs, this is already a quite huge one:
- Add nag screen in case the code check fails to ensure that administrators are aware of this.
- Add code verification also to OCC upgrade and unify display code more.
- Add enforced code verification to apps shipped from the appstore with a level of "official"
- Add enfocrced code verification to apps shipped from the appstore that were already signed in a previous release
- Add some developer documentation on how devs can request their own certificate
- Check when installing ownCloud
- Add support for CRLs to allow revoking certificates

**Note:** The upgrade checks are only run when the instance has a defined release channel of `stable` (defined in `version.php`). If you want to test this, you need to change the channel thus and then generate the core signature:

```
➜  master git:(add-integrity-checker) ✗ ./occ integrity:sign-core --privateKey=resources/codesigning/core.key --certificate=resources/codesigning/core.crt
Successfully signed "core"
```

Then increase the version and you should see something like the following:

![2015-11-04_12-02-57](https://cloud.githubusercontent.com/assets/878997/10936336/6adb1d14-82ec-11e5-8f06-9a74801c9abf.png)

As you can see a failed code check will not prevent the further update. It will instead just be a notice to the admin. In a next step we will add some nag screen.

For packaging stable releases this requires the following additional steps as a last action before zipping:
1. Run `./occ integrity:sign-core` once
2. Run `./occ integrity:sign-app` _for each_ app. However, this can be simply automated using a simple foreach on the apps folder.
9 years ago
Thomas Müller 4cb5970947 Always pass in ILogger 9 years ago
Morris Jobke 8366ce2767 deduplicate @xenopathic 9 years ago
Morris Jobke b945d71384 update licence headers via script 9 years ago
Morris Jobke 9b652ed5d5 [App Code Check] add check for version and mandatory fields
* ref #17598
* including unit tests for mandatory fields/versions
9 years ago
Bjoern Schiessle 9bd4f2d41e occ script to disable encryption and to decrypt all files again 9 years ago
Robin McCorkell 19830e6c24 Introduce mimetype DB update occ command 9 years ago
Robin McCorkell 79fceeff33 Move maintenance:mimetypesjs to sublocation, cleanup code 9 years ago
Bjoern Schiessle 289e9130f3 make system root of key storage configurable 9 years ago
Björn Schießle 6e210d960c Merge pull request #18423 from owncloud/occ_encrypt_all
occ command line tool to encrypt all files
9 years ago
Bjoern Schiessle 8c08dd0ac2 occ tool to encrypt all files 9 years ago
Robin McCorkell 07e119a3f8 Introduce occ command to manage owncloud log backend
log:owncloud can set/display the log filename and log file rotation size
9 years ago
Robin McCorkell 67536e71aa Introduce occ command for logging management
log:manage can set/display the log backend, log level and log timezone
9 years ago
Morris Jobke 08afce3d7e [command] single user mode - use config object & add tests 9 years ago
Joas Schilling 2b86eb0b29 Add commands to get, set and delete app config values 9 years ago
Joas Schilling 86952f88cb Add a command to import an json array into the config 9 years ago