diff --git a/src/setup_node_env/index.js b/src/setup_node_env/index.js index a3fe8d938ba2bf..6592fa9fd2424a 100644 --- a/src/setup_node_env/index.js +++ b/src/setup_node_env/index.js @@ -17,6 +17,5 @@ * under the License. */ -require('./root'); require('./node_version_validator'); require('./babel_register'); diff --git a/src/setup_node_env/root/force.js b/src/setup_node_env/root/force.js deleted file mode 100644 index 1c750c433ba87f..00000000000000 --- a/src/setup_node_env/root/force.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -module.exports = function (argv) { - var forceIndex = argv.indexOf('--force-root'); - var force = forceIndex >= 0; - if (force) argv.splice(forceIndex, 1); - return force; -}; diff --git a/src/setup_node_env/root/force.test.js b/src/setup_node_env/root/force.test.js deleted file mode 100644 index 70fb19fa52e2ce..00000000000000 --- a/src/setup_node_env/root/force.test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -var forceRoot = require('./force'); - -describe('forceRoot', function () { - - it('with flag', function () { - expect(forceRoot(['--force-root'])).toBeTruthy(); - }); - - it('without flag', function () { - expect(forceRoot(['--foo'])).toBeFalsy(); - - }); - - test('remove argument', function () { - var args = ['--force-root', 'foo']; - forceRoot(args); - expect(args.includes('--force-root')).toBeFalsy(); - }); - -}); diff --git a/src/setup_node_env/root/index.js b/src/setup_node_env/root/index.js deleted file mode 100644 index ebe9cc294d85cf..00000000000000 --- a/src/setup_node_env/root/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -var force = require('./force')(process.argv); -var isRoot = require('./is_root')(process.getuid()); - -if(isRoot && !force) { - console.error('Kibana should not be run as root. Use --force-root to continue.'); - process.exit(1); -} diff --git a/src/setup_node_env/root/is_root.js b/src/setup_node_env/root/is_root.js deleted file mode 100644 index e2eaaf6af51540..00000000000000 --- a/src/setup_node_env/root/is_root.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -module.exports = function (uid) { - return uid === 0; -}; diff --git a/src/setup_node_env/root/is_root.test.js b/src/setup_node_env/root/is_root.test.js deleted file mode 100644 index a976299cd5d5b4..00000000000000 --- a/src/setup_node_env/root/is_root.test.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -var isRoot = require('./is_root'); - - -describe('isRoot', function () { - - test('0 is root', function () { - expect(isRoot(0)).toBeTruthy(); - }); - - test('not 0 is not root', function () { - expect(isRoot(5)).toBeFalsy(); - }); -});