MESSAGE_TYPE_INFO:0,
MESSAGE_TYPE_WARNING:1,
MESSAGE_TYPE_ERROR:2,
-
/**
* Check whether the WebDAV connection works.
*
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
- if(!data.dataDirectoryProtected) {
- messages.push({
- msg: t('core', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.'),
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
- });
- }
if(!data.isMemcacheConfigured) {
messages.push({
msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}),
return deferred.promise();
},
+ checkDataProtected: function() {
+ var deferred = $.Deferred();
+ if(oc_dataURL === false){
+ return deferred.resolve([]);
+ }
+ var afterCall = function(xhr) {
+ var messages = [];
+ if (xhr.status !== 403 && xhr.status !== 307 && xhr.status !== 301) {
+ messages.push({
+ msg: t('core', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.'),
+ type: OC.SetupChecks.MESSAGE_TYPE_ERROR
+ });
+ }
+ deferred.resolve(messages);
+ };
+
+ $.ajax({
+ type: 'GET',
+ url: OC.linkTo('', oc_dataURL+'/.ocdata'),
+ complete: afterCall
+ });
+ return deferred.promise();
+ },
+
/**
* Runs check for some generic security headers on the server side
*
});
});
+ describe('checkDataProtected', function() {
+
+ oc_dataURL = "data";
+
+ it('should return an error if data directory is not protected', function(done) {
+ var async = OC.SetupChecks.checkDataProtected();
+
+ suite.server.requests[0].respond(200);
+
+ async.done(function( data, s, x ){
+ expect(data).toEqual([
+ {
+ msg: 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.',
+ type: OC.SetupChecks.MESSAGE_TYPE_ERROR
+ }]);
+ done();
+ });
+ });
+
+ it('should not return an error if data directory is protected', function(done) {
+ var async = OC.SetupChecks.checkDataProtected();
+
+ suite.server.requests[0].respond(403);
+
+ async.done(function( data, s, x ){
+ expect(data).toEqual([]);
+ done();
+ });
+ });
+
+ it('should return an error if data directory is a boolean', function(done) {
+
+ oc_dataURL = false;
+
+ var async = OC.SetupChecks.checkDataProtected();
+
+ async.done(function( data, s, x ){
+ expect(data).toEqual([]);
+ done();
+ });
+ });
+ });
+
describe('checkSetup', function() {
it('should return an error if server has no internet connection', function(done) {
var async = OC.SetupChecks.checkSetup();
{
msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- }, {
- msg: 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.',
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
}, {
msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.',
type: OC.SetupChecks.MESSAGE_TYPE_INFO
JSON.stringify({
isUrandomAvailable: true,
serverHasInternetConnection: false,
- dataDirectoryProtected: false,
memcacheDocs: 'https://doc.owncloud.org/server/go.php?to=admin-performance',
forwardedForHeadersWorking: true,
isCorrectMemcachedPHPModuleInstalled: true,
msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
},
- {
- msg: 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.',
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
- },
{
msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.',
type: OC.SetupChecks.MESSAGE_TYPE_INFO
JSON.stringify({
isUrandomAvailable: true,
serverHasInternetConnection: false,
- dataDirectoryProtected: false,
isMemcacheConfigured: true,
forwardedForHeadersWorking: true,
isCorrectMemcachedPHPModuleInstalled: true,
{
msg: 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- },
- {
- msg: 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.',
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
- }]);
+ }
+ ]);
done();
});
});
isUrandomAvailable: false,
securityDocs: 'https://docs.owncloud.org/myDocs.html',
serverHasInternetConnection: true,
- dataDirectoryProtected: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: true,
isCorrectMemcachedPHPModuleInstalled: true,
isUrandomAvailable: true,
securityDocs: 'https://docs.owncloud.org/myDocs.html',
serverHasInternetConnection: true,
- dataDirectoryProtected: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: true,
isCorrectMemcachedPHPModuleInstalled: false,
JSON.stringify({
isUrandomAvailable: true,
serverHasInternetConnection: true,
- dataDirectoryProtected: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: false,
reverseProxyDocs: 'https://docs.owncloud.org/foo/bar.html',
{
'Content-Type': 'application/json'
},
- JSON.stringify({data: {serverHasInternetConnection: false, dataDirectoryProtected: false}})
+ JSON.stringify({data: {serverHasInternetConnection: false}})
);
async.done(function( data, s, x ){
isUrandomAvailable: true,
securityDocs: 'https://docs.owncloud.org/myDocs.html',
serverHasInternetConnection: true,
- dataDirectoryProtected: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: true,
phpSupported: {eol: true, version: '5.4.0'},
{
'Content-Type': 'application/json'
},
- JSON.stringify({data: {serverHasInternetConnection: false, dataDirectoryProtected: false}})
+ JSON.stringify({data: {serverHasInternetConnection: false}})
);
async.done(function( data, s, x ){
expect(data).toEqual([{
OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === 'true'),
OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav/', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === 'true'),
OC.SetupChecks.checkSetup(),
- OC.SetupChecks.checkGeneric()
- ).then(function(check1, check2, check3, check4, check5) {
- var messages = [].concat(check1, check2, check3, check4, check5);
+ OC.SetupChecks.checkGeneric(),
+ OC.SetupChecks.checkDataProtected()
+ ).then(function(check1, check2, check3, check4, check5, check6) {
+ var messages = [].concat(check1, check2, check3, check4, check5, check6);
var $el = $('#postsetupchecks');
$el.find('.loading').addClass('hidden');