From a77abdbc4fc9fbc846d6827e28e0d3fb4eb81fe0 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Jul 16 2019 15:40:46 +0000 Subject: Issue 50325 - Add Security tab to UI Description: This updates the CLI and UI to handle a majority of the security configuration. It also adds support for PF dual list selection even though I ended up not using it. Relates: https://pagure.io/389-ds-base/issue/50325 Reviewed by: spichugi, and mhonek (Thanks!!) Fixed Simon's issues Fix issue with listing certs with spaces in the name Fix npm vulnerabilities Fix selinux port labeling, and add 'saving' spinners Use a regex for parsing certutil output --- diff --git a/src/cockpit/389-console/.babelrc b/src/cockpit/389-console/.babelrc index d0ef093..23c75c5 100644 --- a/src/cockpit/389-console/.babelrc +++ b/src/cockpit/389-console/.babelrc @@ -1,4 +1,7 @@ { "presets": ["@babel/env", - "@babel/preset-react"] + "@babel/preset-react"], + "plugins": [ + "@babel/plugin-proposal-class-properties" + ] } diff --git a/src/cockpit/389-console/package-lock.json b/src/cockpit/389-console/package-lock.json index 67f170c..9fec71c 100644 --- a/src/cockpit/389-console/package-lock.json +++ b/src/cockpit/389-console/package-lock.json @@ -104,6 +104,105 @@ "@babel/types": "^7.0.0" } }, + "@babel/helper-create-class-features-plugin": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.4.tgz", + "integrity": "sha512-UbBHIa2qeAGgyiNR9RszVF7bUHEdgS4JAUNT8SiqrAN6YJVxlOxeLr5pBzb5kan302dejJ9nla4RyKcR1XT6XA==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-member-expression-to-functions": "^7.0.0", + "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-replace-supers": "^7.4.4", + "@babel/helper-split-export-declaration": "^7.4.4" + }, + "dependencies": { + "@babel/generator": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", + "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", + "dev": true, + "requires": { + "@babel/types": "^7.4.4", + "jsesc": "^2.5.1", + "lodash": "^4.17.11", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + } + }, + "@babel/helper-replace-supers": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz", + "integrity": "sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.0.0", + "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/traverse": "^7.4.4", + "@babel/types": "^7.4.4" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", + "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", + "dev": true, + "requires": { + "@babel/types": "^7.4.4" + } + }, + "@babel/parser": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.5.tgz", + "integrity": "sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew==", + "dev": true + }, + "@babel/traverse": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.5.tgz", + "integrity": "sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.4.4", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/parser": "^7.4.5", + "@babel/types": "^7.4.4", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.11" + } + }, + "@babel/types": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", + "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.11", + "to-fast-properties": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, "@babel/helper-define-map": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz", @@ -336,6 +435,16 @@ "@babel/plugin-syntax-async-generators": "^7.0.0" } }, + "@babel/plugin-proposal-class-properties": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.4.tgz", + "integrity": "sha512-WjKTI8g8d5w1Bc9zgwSz2nfrsNQsXcCf9J9cdCvrJV6RF56yztwm4TmJC0MgJ9tvwO9gUA/mcYe89bLdGfiXFg==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.4.4", + "@babel/helper-plugin-utils": "^7.0.0" + } + }, "@babel/plugin-proposal-json-strings": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.0.0.tgz", @@ -7202,6 +7311,14 @@ "warning": "^3.0.0" } }, + "react-switch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/react-switch/-/react-switch-5.0.0.tgz", + "integrity": "sha512-+zxY9xj9dMc8Y4gv/kkqQrirfEiIQ+SlQfJDW1Wi81L3xoh1fcbBYyJyh0TnhM/U/b6HxuBmkmU4Ooxgtuoavw==", + "requires": { + "prop-types": "^15.6.2" + } + }, "react-transition-group": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.5.1.tgz", diff --git a/src/cockpit/389-console/package.json b/src/cockpit/389-console/package.json index 7d6fb4e..ddf44b5 100644 --- a/src/cockpit/389-console/package.json +++ b/src/cockpit/389-console/package.json @@ -19,6 +19,7 @@ "@babel/core": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", "ajv": "^6.0.0", "audit-ci": "^1.7.0", "babel-eslint": "^9.0.0", @@ -57,6 +58,7 @@ "react-bootstrap": "0.32.4", "react-bootstrap-typeahead": "3.2.4", "react-dom": "16.6.1", + "react-switch": "^5.0.0", "recompose": "0.30.0", "table-resolver": "4.1.1" } diff --git a/src/cockpit/389-console/src/css/ds.css b/src/cockpit/389-console/src/css/ds.css index 1ad8d5c..f8945bf 100644 --- a/src/cockpit/389-console/src/css/ds.css +++ b/src/cockpit/389-console/src/css/ds.css @@ -44,7 +44,7 @@ /* Main nav page index.html */ .ds-content { padding: 0; - padding-top: 115px; + padding-top: 115px; /* this pushes the content below fixed nav bar */ padding-bottom: 50px; margin-top: 0; margin-left: 25px; @@ -672,6 +672,11 @@ td { padding-bottom: 10px; } +.ds-cipher-width { + max-width: 350px !important; + min-width: 350px !important; +} + /* * Popup modal stuff */ @@ -1637,8 +1642,8 @@ option { font-size: 16px; } -.ds-no-padding () { - padding: 0 !imporant; +.ds-no-padding { + padding-right: 0 !important; } .alert { @@ -1650,6 +1655,10 @@ option { margin-top: 5%; } +.ds-select { + width: 120px; +} + .treeview .list-group-item { /* remove focus border */ outline: none; @@ -1680,3 +1689,174 @@ input { .ds-width-auto { width: 100%; } + +/* Dual List CSS */ +.dual-list-pf-arrows { + display: inline-block; + margin: auto; + position: relative; + bottom: 170px; + font-size: 23px; + color: #bbb; +} +@media only screen and (max-width: 600px) { + .dual-list-pf-arrows { + display: block; + position: inherit; + margin: 5px 0; + padding-left: 79px; + } +} + +.dual-list-pf-arrows span { + display: block; + margin: 25px; + cursor: pointer; + transition: color 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); + transform: rotate(-90deg); +} +@media only screen and (max-width: 600px) { + .dual-list-pf-arrows span { + display: inline; + margin: 0 20px 0 0; + } +} + +.dual-list-pf-arrows span:hover { + color: #8b8d8f; +} + +.dual-list-pf-body { + height: 375px; + width: 320px; + overflow-y: scroll; + overflow-x: auto; + display: inline-grid; + align-content: flex-start; +} + +.dual-list-pf-body::-webkit-scrollbar { + width: 12px; + height: 12px; + background: #fafafa; +} + +.dual-list-pf-body::-webkit-scrollbar-thumb { + background: #d1d1d1; + border-radius: 6px; + border: 3px solid transparent; + background-clip: content-box; +} + +.dual-list-pf-body::-webkit-scrollbar-thumb:hover { + background: #bbb; + border-radius: 6px; + border: 3px solid transparent; + background-clip: content-box; +} + +.dual-list-pf-filter { + margin-left: 20px; +} + +.dual-list-pf-filter input { + background-color: #f5f5f5; + border: 1px solid #ededed; + width: 145px; + padding: 0 22px 0 5px; + margin-top: 3px; + margin-bottom: 3px; +} + +.dual-list-pf-filter .search-icon { + position: relative; + right: 20px; + bottom: 1px; + color: #bbb; +} + +.dual-list-pf-filter ::-webkit-input-placeholder { + font-style: italic; +} + +.dual-list-pf-footer { + padding: 10px; + border-top: 1px solid #d1d1d1; +} + +.dual-list-pf-heading { + border-bottom: 1px solid #d1d1d1; +} + +.dual-list-pf-item { + padding: 5px 0; + margin-bottom: 0; + font-weight: 400; + transition: background 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.3s ease-out; + cursor: pointer; + white-space: nowrap; +} + +.dual-list-pf-item input[type='checkbox'] { + position: relative; + left: 10px; + vertical-align: top; + cursor: pointer; +} + +.dual-list-pf-item.selected { + background-color: #0088ce; + color: white; +} + +.dual-list-pf-item.disabled { + cursor: not-allowed; + background: #f5f5f5; + color: #8b8d8f; +} + +.dual-list-pf-item.disabled input[type='checkbox'] { + cursor: not-allowed; +} + +.dual-list-pf-item.child { + padding-left: 22px; +} + +.dual-list-pf-item:hover:not(.selected):not(.disabled) { + background-color: #bee1f4; + color: inherit; +} + +.dual-list-pf-item-label { + margin-left: 20px; +} + +.dual-list-pf-main-checkbox { + position: relative; + left: 10px; + vertical-align: text-top; + cursor: pointer; +} + +.dual-list-pf-no-items { + margin-top: 30px; + text-align: center; +} + +.dual-list-pf-selector { + display: inline-block; + border: 1px solid #d1d1d1; + user-select: none; +} + +.dual-list-pf-sort-icon { + cursor: pointer; +} + +.dropdown-kebab-pf.btn-group { + margin-left: 10px; + float: right; + margin-right: 10px; +} +/* End of dual list */ diff --git a/src/cockpit/389-console/src/ds.js b/src/cockpit/389-console/src/ds.js index ec57488..e023fdc 100644 --- a/src/cockpit/389-console/src/ds.js +++ b/src/cockpit/389-console/src/ds.js @@ -8,7 +8,7 @@ var dn_regex = new RegExp( "^([A-Za-z]+=.*)" ); * to track the loading, and once all the pages are loaded, then we can load the config */ var server_page_loaded = 0; -var security_page_loaded = 0; +var security_page_loaded = 1; var db_page_loaded = 1; var repl_page_loaded = 0; var plugin_page_loaded = 1; @@ -482,4 +482,8 @@ $(window.document).ready(function() { $(".all-pages").hide(); $("#monitor-content").show(); }); + $("#security-tab").on("click", function() { + $(".all-pages").hide(); + $("#security-content").show(); + }); }); diff --git a/src/cockpit/389-console/src/index.es6 b/src/cockpit/389-console/src/index.es6 index 0483752..71e9c5e 100644 --- a/src/cockpit/389-console/src/index.es6 +++ b/src/cockpit/389-console/src/index.es6 @@ -3,6 +3,7 @@ import ReactDOM from "react-dom"; import { Plugins } from "./plugins.jsx"; import { Database } from "./database.jsx"; import { Monitor } from "./monitor.jsx"; +import { Security } from "./security.jsx"; var serverIdElem; @@ -35,6 +36,12 @@ function renderReactDOM(clear) { , document.getElementById("monitor") ); + + // Security tab + ReactDOM.render( + , + document.getElementById("security") + ); } // We have to create the wrappers because this is no simple way diff --git a/src/cockpit/389-console/src/index.html b/src/cockpit/389-console/src/index.html index 7c5dbf8..c93f754 100644 --- a/src/cockpit/389-console/src/index.html +++ b/src/cockpit/389-console/src/index.html @@ -21,7 +21,6 @@ - @@ -80,23 +79,10 @@ -
  • + Security - -
  • @@ -501,6 +487,7 @@