Commit 3ca6dfe7 authored by Tristan A Spakes's avatar Tristan A Spakes

ver. 1.3.1 Progress on temporarily adding entry to digest_mapping

parent 8f6b5ddd
Pipeline #25927 passed with stages
in 1 minute and 5 seconds
......@@ -11,16 +11,22 @@ function MFAVerification() {
cardCheck = cardCheck.toString()
} catch(error) {
error = error.toString()
alert(error)
ipcRenderer.send('log', 'ORNL Toolbox: Error checking for smart card - request aborted', 'err')
return
if(error.includes("No slots")) {
alert('No smart card inserted')
ipcRenderer.send('log', 'ORNL Toolbox: No smart card inserted - request aborted', 'err')
return
} else {
alert(error)
ipcRenderer.send('log', 'ORNL Toolbox: Error checking for smart card - request aborted', 'err')
return
}
}
//Check for the number of smart card slots
var count = (cardCheck.match(/Slot/g) || []).length;
if(count > 1) { //More than one slot found
alert('Please ensure only one smart card is inserted')
ipcRenderer.send('log', 'ORNL Toolbox: No smart card inserted - request aborted', 'err')
ipcRenderer.send('log', 'ORNL Toolbox: More than one smart card inserted - request aborted', 'err')
return
} else if(count < 1) { //No slots found
alert('No smart card inserted')
......
......@@ -49,7 +49,7 @@
<div id="buttons" onclick="addWinMain('./badgeManagement/MFAVerification/MFAVerification.html', 'Smart Card Verification', 225, 180)"><font color="white">Smart Card Verification</font></div>
</span>
<span title="Opens an application page for temporarily registering a smart card in the digest mapping file.">
<div id="buttons" onclick=""><font color="white">Temporary Smart Card Registration</font></div>
<div id="buttons" onclick="addWinMain('./badgeManagement/tempMFARegistration/tempMFARegistration.html', 'Temporary Smart Card Registration', 225, 180)"><font color="white">Temporary Smart Card Registration</font></div>
</span>
<div id="badgeManagementHiddenbuttons"></div>
</div>
......
function badgeMinderClose() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
console.log('close')
ipcRenderer.send('close minor window')
ipcRenderer.send('log', `ORNL Toolbox: Clicked 'Close' - Badge Minder closed`, 'info')
ipcRenderer.send('log', `ORNL Toolbox: Badge Minder closed`, 'info')
}
#!/bin/bash
echo "$(pkcs15-tool -r 1 --rfc4716 2>/dev/null | openssl x509 -noout \
-fingerprint -sha1 -inform pem | grep -Po '(?<==).*(?=$)') -> t0y" \
>> /etc/pam_pkcs11/digest_mapping
/* Prevents highlighting of text, dragging of images, etc. */
*, *::after, *::before {
margin: 0;
padding: 0;
-webkit-user-select: none;
-webkit-user-drag: none;
-webkit-app-region: no-drag;
font-family: 'Montserrat', sans-serif;
}
div {
-webkit-user-select: none;
-webkit-user-drag: none;
-webkit-app-region: no-drag;
font-family: 'Montserrat', sans-serif;
}
/* Horizontal line formatting */
hr {
display: block;
margin-top: 0.15em;
margin-bottom: 0.15em;
}
/* For submission buttons */
input[type=submit] {
padding: 0;
border: none;
background: none;
font-size: 21px;
}
#tempMFARegistrationPage {
display: flex;
flex-direction: column;
height: 100vh;
justify-content: center;
align-items: center;
}
#tempMFARegistrationText {
text-align: center;
font-size: 15px;
margin-bottom: 15px;
margin-left: 12px;
margin-right: 12px;
}
#tempMFARegistrationButton {
align-self: center;
background-color: #007833;
border-radius: 8px;
width: 68vw;
height: 30vh;
text-align: center;
font-size: 30px;
box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2), 0 4px 8px 0 rgba(0,0,0,0.19);
}
#tempMFARegistrationButton:hover {
background-color: Gray;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Temporary SC Registration</title>
<link rel="stylesheet" href="./tempMFARegistration.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="./tempMFARegistration.js"></script>
</head>
<body>
<div id="tempMFARegistrationPage">
<div id="tempMFARegistrationText">
Please ensure that there is one smart card inserted before clicking 'Register'
</div>
<span title="Click 'Register' to temporarily register the inserted smart card in the digest mapping.">
<input type="submit" value="Register" style="color:white" id="tempMFARegistrationButton" onclick="tempMFARegistration()">
</span>
</div>
</body>
</html>
const electron = require('electron')
const execSync = require('child_process').execSync
const ipcRenderer = require('electron').ipcRenderer
const remote = require('electron').remote
//Checks if the Yubikey is locked and alerts the user accordingly
function tempMFARegistration() {
ipcRenderer.send('log', 'ORNL Toolbox: Submitted MFA temporary registration request', 'info')
try { //Scan for active smart card slots for inserted smart cards
var cardCheck = execSync(`pkcs11-tool -T | grep "Slot"`, (error, stdout, stderr) => {})
cardCheck = cardCheck.toString()
} catch(error) {
error = error.toString()
if(error.includes("No slots")) {
alert('No smart card inserted')
ipcRenderer.send('log', 'ORNL Toolbox: No smart card inserted - request aborted', 'err')
return
} else {
alert(error)
ipcRenderer.send('log', 'ORNL Toolbox: Error checking for smart card - request aborted', 'err')
return
}
}
//Check for the number of smart card slots
var count = (cardCheck.match(/Slot/g) || []).length;
if(count > 1) { //More than one slot found
alert('Please ensure only one smart card is inserted')
ipcRenderer.send('log', 'ORNL Toolbox: More than one smart card inserted - request aborted', 'err')
return
} else if(count < 1) { //No slots found
alert('No smart card inserted')
ipcRenderer.send('log', 'ORNL Toolbox: No smart card inserted - request aborted', 'err')
return
} else {
ipcRenderer.send('log', 'ORNL Toolbox: 1 smart card found inserted', 'info')
}
try { //Check for entry in digest mapping file
var path = remote.app.getPath('exe') //Grabs the path to the executable
path = path.substring(0, path.length - 11) + 'resources/app/badgeManagement/tempMFARegistration/tempMFARegistration.bash'
var inDigest = execSync(`cat ${path} | pkexec bash`, (error, stdout, stderr) => {
alert('test')
})
} catch(error) {
error = error.toString()
alert(error)
return
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed MFA temporary registration request', 'info')
}
......@@ -6,7 +6,7 @@ if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then
else
BRANCH="-${CI_COMMIT_REF_NAME}"
fi
VERSION_NUMBER='1.3.0'
VERSION_NUMBER='1.3.1'
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum -y install nodejs npm ruby-devel gcc make rpm-build rubygems
......
/* Prevents highlighting of text, dragging of images, etc. */
*, *::after, *::before {
margin: 0;
padding: 0;
-webkit-user-select: none;
-webkit-user-drag: none;
-webkit-app-region: no-drag;
font-family: 'Montserrat', sans-serif;
}
div {
-webkit-user-select: none;
-webkit-user-drag: none;
-webkit-app-region: no-drag;
font-family: 'Montserrat', sans-serif;
}
/* Horizontal line formatting */
hr {
display: block;
margin-top: 0.15em;
margin-bottom: 0.15em;
}
/* For submission buttons */
input[type=submit] {
padding: 0;
border: none;
background: none;
font-size: 21px;
}
#softwareCheckpointPage {
display: flex;
height: 100vh;
flex-direction: column;
justify-content: center;
align-items: center;
}
#softwareCheckpointText {
font-size: 16px;
text-align: center;
margin-bottom: 25px;
margin-left: 12px;
margin-right: 12px;
}
.softwareCheckpointButtonsContent {
width: 100vw;
height: 10vh;
display: flex;
flex-direction: row;
justify-content: center;
}
.softwareCheckpointButtons {
text-align: center;
align-items: center;
width: 22vw;
height: 18vh;
margin-right: 12.5px;
margin-left: 12.5px;
background-color: #007833 !important;
border-radius: 8px;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2), 0 4px 8px 0 rgba(0,0,0,0.19);
color: White;
}
.softwareCheckpointButtons:hover {
background-color: Gray !important;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Badge Minder Checkpoint</title>
<link rel="stylesheet" href="./softwareCheckpoint.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="../../miscjs/addWindow.js"></script>
<script src="../openSoftware/openSoftware.js"></script>
<script src="./softwareCheckpointConfirm.js"></script>
<script src="../../miscjs/installedCheck.js"></script>
</head>
<body>
<div id="softwareCheckpointPage">
<div id="softwareCheckpointText">
Gnome-Software is not currently installed. 'Install Software' opens
Gnome-Software. Would you like to install it?
</div>
<div class="softwareCheckpointButtonsContent">
<span title="Click 'Install' to install gnome-screensaver, which is required for Badge Minder">
<input type="submit" class="softwareCheckpointButtons" value="Install" onclick="softwareCheckpointConfirm()">
</span>
<span title="Click 'Close' to close this current window and decline the installation.">
<input type="submit" class="softwareCheckpointButtons" value="Close" onclick="softwareClose()">
</span>
</div>
</div>
</body>
</html>
function softwareCheckpoint() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
if(!execSync) var execSync = require('child_process').execSync
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Software Checkpoint request', 'info')
var os
try { //Detect OS
execSync('grep Ubuntu /etc/os-release')
os = "Ubuntu"
ipcRenderer.send('log', 'ORNL Toolbox: OS determined to be Ubuntu', 'info')
} catch(error) {
//"Ubuntu" not found in file
os = "RHEL"
ipcRenderer.send('log', 'ORNL Toolbox: OS determined to be RHEL', 'info')
}
try {
if(os == "Ubuntu") {
package = execSync(`apt -qq list --installed gnome-software`)
} else {
package = execSync(`yum list installed gnome-software | grep gnome-software`)
}
} catch(error) {
error = error.toString()
if(os != "Ubuntu" && error.includes("No matching Packages to list")) {
package = ""
} else {
alert(error)
ipcRenderer.send('log', 'ORNL Toolbox: Failed while checking for gnome-software - request aborted', 'err')
return
}
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed Software Checkpoint request', 'info')
if(package == "") {
addWinMain('./softwareManagement/softwareCheckpoint/softwareCheckpoint.html', 'Software Checkpoint', 400, 175)
} else {
openSoftware(0)
}
}
function softwareCheckpointConfirm() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
if(!execSync) var execSync = require('child_process').execSync
ipcRenderer.send('log', 'ORNL Toolbox: Submitted install request for gnome-software', 'info')
var os
try { //Detect OS
execSync('grep Ubuntu /etc/os-release')
os = "Ubuntu"
ipcRenderer.send('log', 'ORNL Toolbox: OS determined to be Ubuntu', 'info')
} catch(error) {
//"Ubuntu" not found in file
os = "RHEL"
ipcRenderer.send('log', 'ORNL Toolbox: OS determined to be RHEL', 'info')
}
try { //Install gnome-software
if(os == "Ubuntu") {
execSync(`pkexec apt install gnome-software`)
} else {
execSync(`pkexec yum -y install gnome-software`)
}
} catch(error) {
error = error.toString()
if(error.includes("Request dismissed")) {
ipcRenderer.send('log', 'ORNL Toolbox: Request canceled by user', 'err')
softwareClose()
return
} else {
ipcRenderer.send('log', 'ORNL Toolbox: Failed to install gnome-software - request aborted', 'err')
console.error(error)
alert(error)
softwareClose()
}
}
alert('Gnome Software successfully installed')
ipcRenderer.send('log', 'ORNL Toolbox: Completed install request for gnome-software', 'info')
//Open Gnome Software
openSoftware(0)
softwareClose()
}
function softwareClose() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('close minor window')
ipcRenderer.send('log', `ORNL Toolbox: Software checkpoint closed`, 'info')
}
......@@ -10,6 +10,7 @@
<script src="../miscjs/openURL.js"></script>
<script src="../miscjs/launchBomgar.js"></script>
<script src="./openSoftware/openSoftware.js"></script>
<script src="./softwareCheckpoint/softwareCheckpoint.js"></script>
<script src="../miscjs/menuFunctionCalls.js"></script>
<script src="../miscjs/loadSoftwareBadges.js"></script>
<script src="../badgeManagement/yubiBadgeCheckpoint/yubiBadgeCheckpoint.js"></script>
......@@ -39,7 +40,7 @@
</div>
<div class="content">
<span title="Opens a new window for the system's software installer (Gnome).">
<div id="buttons" onclick="openSoftware(0)"><font color="white">Install Software</font></div>
<div id="buttons" onclick="softwareCheckpoint()"><font color="white">Install Software</font></div>
</span>
<span title="Opens a new window for the system's package manager, dependent on the OS.">
<div id="buttons" onclick="openSoftware(1)"><font color="white">Update Software</font></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment