...
 
Commits (2)
/* 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;
}
#MFAVerificationPage {
display: flex;
flex-direction: column;
height: 100vh;
justify-content: center;
align-items: center;
}
#MFAVerificationText {
text-align: center;
font-size: 15px;
margin-bottom: 15px;
margin-left: 12px;
margin-right: 12px;
}
#MFAVerificationButton {
align-self: center;
background-color: #007833;
border-radius: 8px;
width: 50vw;
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);
}
#MFAVerificationButton:hover {
background-color: Gray;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Smart Card Verification</title>
<link rel="stylesheet" href="./MFAVerification.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="./MFAVerification.js"></script>
</head>
<body>
<div id="MFAVerificationPage">
<div id="MFAVerificationText">
Please ensure that there is one smart card inserted before clicking 'Verify'
</div>
<span title="Click 'Verify' to see if the currently inserted smart card has an entry in the digest mapping.">
<input type="submit" value="Verify" style="color:white" id="MFAVerificationButton" onclick="MFAVerification()">
</span>
</div>
</body>
</html>
const electron = require('electron')
const execSync = require('child_process').execSync
const ipcRenderer = require('electron').ipcRenderer
//Checks if the Yubikey is locked and alerts the user accordingly
function MFAVerification() {
ipcRenderer.send('log', 'ORNL Toolbox: Submitted MFA verification 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 inDigest = execSync(`grep $(pkcs15-tool -r 1 --rfc4716 2>/dev/null | openssl x509 -noout -fingerprint -sha1 -inform pem | grep -Po '(?<==).*(?=$)') /etc/pam_pkcs11/digest_mapping`, (error, stdout, stderr) => {})
} catch(error) {
error = error.toString()
if(error.includes('unable to load certificate')) { //Extra safety for no smartcard inserted scenario
alert('No smart card inserted')
ipcRenderer.send('log', 'ORNL Toolbox: No smart card inserted - request aborted', 'err')
return
} else {
inDigest = ""
}
}
if(inDigest == "") { //Tell user the if the smart card has an entry or not
//Not in digest mapping
alert('Inserted smart card absent from diggest mapping and will not function')
ipcRenderer.send('log', 'ORNL Toolbox: Inserted smart card was not found in /etc/pam_pkcs11/digest_mapping', 'info')
} else {
//In digest mapping
alert('Inserted smart card present in digest mapping and should function unless locked')
ipcRenderer.send('log', 'ORNL Toolbox: Inserted smart card has an entry in /etc/pam_pkcs11/digest_mapping', 'info')
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed MFA verification request', 'info')
}
......@@ -88,6 +88,12 @@ input[type=submit] {
background-color: White;
}
#badgeManagementHiddenbuttons {
width: 32vh;
height: 20vh;
padding: 4px 4px;
margin: 30px 30px;
}
.backContent {
display: flex;
......
......@@ -10,12 +10,15 @@
<script src="../miscjs/openURL.js"></script>
<script src="../miscjs/launchBomgar.js"></script>
<script src="../softwareManagement/openSoftware/openSoftware.js"></script>
<script src="../softwareManagement/softwareCheckpoint/softwareCheckpoint.js"></script>
<script src="../miscjs/menuFunctionCalls.js"></script>
<script src="./yubiBadgeCheckpoint/yubiBadgeCheckpoint.js"></script>
<script src="./badgeMinder/badgeInstallCheckpoint/badgeInstallCheckpoint.js"></script>
<script src="../fileSystemManagement/localDriveUsage/localDriveUsage.js"></script>
<script src="../fileSystemManagement/addPassphrase/addPassphrase.js"></script>
<script src="../fileSystemManagement/removePassphrase/removePassphrase.js"></script>
<script src="../fileSystemManagement/driveHealthCheck/driveHealthCheck.js"></script>
<script src="../fileSystemManagement/baobabCheckpoint/baobabCheckpoint.js"></script>
<script src="../miscjs/installedCheck.js"></script>
</head>
<body>
......@@ -36,7 +39,7 @@
</div>
<div class="content">
<span title="Opens an application page for changing Badge Minder settings.">
<div id="buttons" onclick="addWinMain('./badgeManagement/badgeMinder/badgeMinder.html', 'Badge Minder', 450, 360)"><font color="white">Badge Minder</font></div>
<div id="buttons" onclick="badgeInstallCheckpoint()"><font color="white">Badge Minder</font></div>
</span>
<span title="Opens an application page for checking if the inserted Yubikey is locked.">
<div id="buttons" onclick="yubiBadgeCheckpoint(0)"><font color="white">Yubikey Lock Checker</font></div>
......@@ -44,9 +47,16 @@
<span title="Opens an application page for changing the PIN on the inserted Yubikey.">
<div id="buttons" onclick="yubiBadgeCheckpoint(1)"><font color="white">Yubikey PIN Changer</font></div>
</span>
<span title="Opens an application page for verifying that a smart card is in the digest mapping file.">
<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="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>
<span title="Opens an application page for submitting feedback regarding ORNL Toolbox.">
<div class="feedbackContainer" onclick="addWinMain('./feedback/feedback.html', 'Give Feedback', 500, 300)">
<div class="feedbackContainer" onclick="addWinMain('./feedback/feedback.html', 'Feedback', 500, 300)">
<div class="feedbackImage">
<img src="../images/comment-white-oval-bubble-shape.png" alt="White Chat Bubble">
</div>
......@@ -54,12 +64,13 @@
</div>
</span>
<span title="Opens an application page for seeking help regarding your system.">
<div class="helpContainer" onclick="addWinMain('./help/help.html', 'Email to Support', 500, 400)">
<div class="helpContainer" onclick="addWinMain('./help/help.html', 'Help', 500, 400)">
<div class="helpImage">
<img src="../images/help-web-button-white.png" alt="Question Mark">
</div>
<div class="helpText"><font color="white">Help</font></div>
</div>
</span>
</body>
</html>
//Loads the badgeManagement major page and closes minor windows
function badgeManWin() {
ipcRenderer.send('log', 'ORNL Toolbox: Opened Badge Management', 'info')
//Destroying any minor windows that were opened from the main window
ipcRenderer.send('close minor window')
// Change main window to badge management window
......
/* 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;
}
#badgeInstallCheckpointPage {
display: flex;
height: 100vh;
flex-direction: column;
justify-content: center;
align-items: center;
}
#badgeInstallCheckpointText {
font-size: 16px;
text-align: center;
margin-bottom: 25px;
margin-left: 12px;
margin-right: 12px;
}
.badgeInstallCheckpointButtonsContent {
width: 100vw;
height: 10vh;
display: flex;
flex-direction: row;
justify-content: center;
}
.badgeInstallCheckpointButtons {
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;
}
.badgeInstallCheckpointButtons:hover {
background-color: Gray !important;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Badge Minder Checkpoint</title>
<link rel="stylesheet" href="./badgeInstallCheckpoint.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="../../../miscjs/addWindow.js"></script>
<script src="../badgeMinderClose.js"></script>
<script src="./badgeInstallCheckpointConfirm.js"></script>
</head>
<body>
<div id="badgeInstallCheckpointPage">
<div id="badgeInstallCheckpointText">
Gnome-Screensaver is not currently installed. Badge Minder requires
Gnome-Screensaver to function. Would you like to install it?
</div>
<div class="badgeInstallCheckpointButtonsContent">
<span title="Click 'Install' to install gnome-screensaver, which is required for Badge Minder">
<input type="submit" class="badgeInstallCheckpointButtons" value="Install" onclick="badgeInstallCheckpointConfirm()">
</span>
<span title="Click 'Close' to close this current window and decline the installation.">
<input type="submit" class="badgeInstallCheckpointButtons" value="Close" onclick="badgeMinderClose()">
</span>
</div>
</div>
</body>
</html>
function badgeInstallCheckpoint() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
if(!execSync) var execSync = require('child_process').execSync
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Badge Install 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-screensaver`)
} else {
package = execSync(`yum list installed gnome-screensaver | grep gnome-screensaver`)
}
} 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-screensaver - request aborted', 'err')
return
}
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed Badge Install Checkpoint request', 'info')
if(package == "") {
addWinMain('./badgeManagement/badgeMinder/badgeInstallCheckpoint/badgeInstallCheckpoint.html', 'Badge Minder Checkpoint', 400, 175)
} else {
addWinMain('./badgeManagement/badgeMinder/badgeMinder.html', 'Badge Minder', 450, 360)
}
}
function badgeInstallCheckpointConfirm() {
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-screensaver', '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-screensaver
if(os == "Ubuntu") {
execSync(`pkexec apt install gnome-screensaver`)
} else {
execSync(`pkexec yum -y install gnome-screensaver`)
}
} catch(error) {
error = error.toString()
if(error.includes("Request dismissed")) {
ipcRenderer.send('log', 'ORNL Toolbox: Request canceled by user', 'err')
badgeMinderClose()
return
} else {
ipcRenderer.send('log', 'ORNL Toolbox: Failed to install gnome-screensaver - request aborted', 'err')
console.error(error)
alert(error)
badgeMinderClose()
}
}
alert('Gnome Screensaver successfully installed')
ipcRenderer.send('log', 'ORNL Toolbox: Completed install request for gnome-screensaver', 'info')
//Open Badge Minder window
addWinMain('./badgeManagement/badgeMinder/badgeMinder.html', 'Badge Minder', 450, 360)
}
......@@ -61,22 +61,6 @@
</div>
<select id="badgeMinderCarrier">
<option value="0" disabled selected>Carrier:</option>
<option value="1">AT&T</option>
<option value="2">Verizon</option>
<option value="3">U.S. Cellular</option>
<option value="4">Sprint</option>
<option value="5">Virgin Mobile</option>
<option value="6">T-Mobile</option>
<option value="7">Tracfone</option>
<option value="8">Metro PCS</option>
<option value="9">Boost Mobile</option>
<option value="10">Cricket</option>
<option value="11">Nextel</option>
<option value="12">Alltel</option>
<option value="13">Ptel</option>
<option value="14">Suncom</option>
<option value="15">Qwest</option>
<option value="16">Ting</option>
</select>
</div>
</div>
......
......@@ -8,6 +8,8 @@ const ipcRenderer = require('electron').ipcRenderer
const fs = require('fs')
function badgeConfig() {
ipcRenderer.send('log', `ORNL Toolbox: Submitted Badge Minder apply settings request`, 'info')
//For checking if the user chose beep, phone, both, or neither reminders
var enableBeeps = document.getElementById('badgeMinderBeepCheckBox').checked
var enableTxtmsg = document.getElementById('badgeMinderTextCheckBox').checked
......@@ -24,6 +26,7 @@ function badgeConfig() {
var regex = /^\d*(?:\.\d+)?$/ //Checks for 0 or more nums, a decimal, then 1 or more nums
if(! regex.test(beepTime)) {
alert('Invalid beepTime duration')
ipcRenderer.send('log', `ORNL Toolbox: Invalid Beep Reminder duration - request aborted`, 'err')
return
} else if(beepTime == "") {
/* Since there are 2.5 seconds between each beep, time is measured
......@@ -33,7 +36,17 @@ function badgeConfig() {
beepTime = beepTime * 24.0
}
beepTime = beepTime.toPrecision(7)
var logBeepTime = beepTime / 24.0
logBeepTime = logBeepTime.toPrecision(7)
ipcRenderer.send('log', `ORNL Toolbox: Beep Reminder is enabled`, 'info')
if(logBeepTime == 1.0) {
ipcRenderer.send('log', `ORNL Toolbox: Duration of Beeps is set to 1 minute`, 'info')
} else {
ipcRenderer.send('log', `ORNL Toolbox: Duration of Beeps is set to ${logBeepTime} minutes`, 'info')
}
} else {
ipcRenderer.send('log', `ORNL Toolbox: Beep Reminder is disabled`, 'info')
beepTime = 0
}
var beepTimeRounded = Math.round(beepTime)
......@@ -50,75 +63,48 @@ function badgeConfig() {
//Check if any of the phone number fields are invalid
if(parseInt(phoneNum1) == NaN || parseInt(phoneNum1) < 0 || /^[0-9]+$/.test(phoneNum1) == false || phoneNum1.length < 3) {
alert('Invalid 1st phone number field')
ipcRenderer.send('log', `ORNL Toolbox: Invalid 1st phone number field - request aborted`, 'err')
return
}
if(parseInt(phoneNum2) == NaN || parseInt(phoneNum2) < 0 || /^[0-9]+$/.test(phoneNum2) == false || phoneNum2.length < 3) {
alert('Invalid 2nd phone number field')
ipcRenderer.send('log', `ORNL Toolbox: Invalid 2nd phone number field - request aborted`, 'err')
return
}
if(parseInt(phoneNum3) == NaN || parseInt(phoneNum3) < 0 || /^[0-9]+$/.test(phoneNum3) == false || phoneNum3.length < 4) {
alert('Invalid 3rd phone number field')
ipcRenderer.send('log', `ORNL Toolbox: Invalid 3rd phone number field - request aborted`, 'err')
return
}
//Assigning a domain string to the carrier
switch(parseInt(carrier)) {
case 0:
alert('Invalid carrier') //No carrier is selected
return
break
case 1:
carrier = "@txt.att.net" //AT&T
break
case 2:
carrier = "@vtext.com" //Verizon
break
case 3:
carrier = "@email.uscc.net" //U.S. Cellular
break
case 4:
carrier = "@messaging.sprintpcs.com" //Sprint
break
case 5:
carrier = "@vmobl.com" //Virgin Mobile
break
case 6:
carrier = "@tmomail.net" //T-Mobile
break
case 7:
carrier = "@mmst5.tracfone.co" //Tracfone
break
case 8:
carrier = "@mymetropcs.com" //Metro PCS
break
case 9:
carrier = "@myboostmobile.com" //Boost Mobile
break
case 10:
carrier = "@sms.mycricket.com" //Cricket
break
case 11:
carrier = "@messaging.nextel.com" //Nextel
break
case 12:
carrier = "@message.alltel.com" //Alltel
break
case 13:
carrier = "@ptel.com" //Ptel
break
case 14:
carrier = "@tms.suncom.com" //Suncom
break
case 15:
carrier = "@qwestmp.com" //Qwest
carrier = parseInt(carrier)
//Grabs carriers.csv for list of carriers
var carriersPath = remote.app.getPath('exe') //Grabs the path to the executable
carriersPath = carriersPath.substring(0, carriersPath.length - 11) + 'resources/app/badgeManagement/badgeMinder/carriers.csv'
var carriers = fs.readFileSync(carriersPath, 'utf-8', () => {})
carriers = carriers.split(/,|\n/)
if(carrier == 0) { //No carrier is selected
alert('Invalid carrier')
ipcRenderer.send('log', `ORNL Toolbox: Invalid carrier - request aborted`, 'err')
return
}
for(i = 1; i < carriers.length; i+=2) {
if(i == carrier) {
carrier = carriers[parseInt(i / 2) + 1]
break
case 16:
carrier = "@mailmymobile.net" //Ting
}
}
//Combining the three phone number entries into one string
phone = `${phoneNum1}${phoneNum2}${phoneNum3}`
ipcRenderer.send('log', `ORNL Toolbox: Text Message Reminder is enabled`, 'info')
ipcRenderer.send('log', `ORNL Toolbox: Phone number is set to ${phone}`, 'info')
ipcRenderer.send('log', `ORNL Toolbox: Carrier is set to ${carrier}`, 'info')
} else {
ipcRenderer.send('log', `ORNL Toolbox: Text Message Reminder is disabled`, 'info')
//Text reminder is not enabled
phone = "none"
carrier = "none"
......@@ -140,6 +126,9 @@ function badgeConfig() {
fs.writeFile(path, `beepTime=${beepTime}\nbeepTimeRounded=${beepTimeRounded}\nphone=\"${phone}\"\ncarrier=\"${carrier}\"\n`, (error) => {
if(error) {
console.log(error)
ipcRenderer.send('log', `ORNL Toolbox: Error saving Badge Minder config file`, 'err')
} else {
ipcRenderer.send('log', `ORNL Toolbox: Badge Minder config file saved`, 'info')
}
//Block for killing old script and starting new one
......@@ -147,6 +136,7 @@ function badgeConfig() {
scriptStart = 'bash ' + scriptStart.substring(0, scriptStart.length - 11) + 'resources/app/badgeManagement/badgeMinder/badgeMinder.bash &'
try { //Kill the old reminder script if it exists
execSync('pkill -f badgeMinder.bash', () => {})
ipcRenderer.send('log', `ORNL Toolbox: Previous Badge Minder script killed`, 'info')
} catch(err) {
//Ignore that a process that doesn't exist can't be killed
}
......@@ -161,7 +151,9 @@ function badgeConfig() {
} catch(err) {
console.log(err)
console.log("Cannot start badgeMinder.bash")
ipcRenderer.send('log', `ORNL Toolbox: Failed to start Badge Minder script`, 'err')
}
ipcRenderer.send('log', `ORNL Toolbox: Badge Minder script started`, 'info')
//Block for writing in .xprofile startup script
try {
......
function badgeMinderClose() {
console.log('close')
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('close minor window')
ipcRenderer.send('log', `ORNL Toolbox: Badge Minder closed`, 'info')
}
......@@ -22,6 +22,7 @@ function configLoad() {
var phone3
var carrier
//Grabs saved settings for Badge Minder
var contents = fs.readFileSync(remote.app.getPath('home') + '/.config/ornltoolbox/badgeMinder.config', 'utf-8', () => {})
contents = contents.split('\n')
......@@ -54,56 +55,26 @@ function configLoad() {
document.getElementById('badgeMinderPhoneTextBox2').value = phone2
document.getElementById('badgeMinderPhoneTextBox3').value = phone3
//Assigning a carrier number to the domain string
switch(carrier) {
case "@txt.att.net":
carrier = 1 //AT&T
break
case "@vtext.com":
carrier = 2 //Verizon
break
case "@email.uscc.net":
carrier = 3 //U.S. Cellular
break
case "@messaging.sprintpcs.com":
carrier = 4 //Sprint
break
case "@vmobl.com":
carrier = 5 //Virgin Mobile
break
case "@tmomail.net":
carrier = 6 //T-Mobile
break
case "@mmst5.tracfone.co":
carrier = 7 //Tracfone
break
case "@mymetropcs.com":
carrier = 8 //Metro PCS
break
case "@myboostmobile.com":
carrier = 9 //Boost Mobile
break
case "@sms.mycricket.com":
carrier = 10 //Cricket
break
case "@messaging.nextel.com":
carrier = 11 //Nextel
break
case "@message.alltel.com":
carrier = 12 //Alltel
break
case "@ptel.com":
carrier = 13 //Ptel
break
case "@tms.suncom.com":
carrier = 14 //Suncom
break
case "@qwestmp.com":
carrier = 15 //Qwest
break
case "@mailmymobile.net":
carrier = 16 //Ting
//Grabs carriers.csv for list of carriers
var carriersPath = remote.app.getPath('exe') //Grabs the path to the executable
carriersPath = carriersPath.substring(0, carriersPath.length - 11) + 'resources/app/badgeManagement/badgeMinder/carriers.csv'
var carriers = fs.readFileSync(carriersPath, 'utf-8', () => {})
carriers = carriers.split(/,|\n/)
//Retrieve the dropdown for carriers in Badge Minder
var carrierDropdown = document.getElementById('badgeMinderCarrier')
//Loop for assigning a carrier number to the domain string
for(i = 1; i < carriers.length; i+=2) {
if(carriers[i] == carrier) { //Correct carrier found, assign number
carrier = parseInt(i / 2) + 1
}
var option = document.createElement('option') //Create new dropdown option
option.text = carriers[i - 1] //Assign correct carrier name to option
option.value = parseInt(i / 2) + 1 //Assign correct number to option
carrierDropdown.add(option) //Add dropdown option
}
//Assign previously selected value onto the initial page
document.getElementById('badgeMinderCarrier').value = carrier
} catch(error) {
//No config file
......
......@@ -9,4 +9,5 @@ function badgeMinderTest() {
console.log(err)
console.log("Error with badgeMinderTest.bash")
}
ipcRenderer.send('log', `ORNL Toolbox: Badge Minder tested`, 'info')
}
AT&T,@txt.att.net
Verizon,@vtext.com
U.S. Cellular,@email.uscc.net
Sprint,@messaging.sprintpcs.com
Virgin Mobile,@vmobl.com
T-Mobile,@tmomail.net
Tracfone,@mmst5.tracfone.com
Metro PCS,@mymetropcs.com
Boost Mobile,@myboostmobile.com
Cricket,@sms.mycricket.com
Nextel,@messaging.nextel.com
Alltel,@message.alltel.com
Ptel,@ptel.com
Suncom,@tms.suncom.com
Qwest,@qwestmp.com
Ting,@mailmymobile.net
/* 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;
}
#tempMFARegistrationUserSelect {
margin-bottom: 4.5vh;
width: 25vw;
}
.tempMFARegistrationLine {
display: flex;
flex-direction: row;
height: 15vh;
}
<!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 onload="tempMFARegistrationLoad()">
<div id="tempMFARegistrationPage">
<div class="tempMFARegistrationLine">
<div id="tempMFARegistrationText">
Select a user:
</div>
<select id="tempMFARegistrationUserSelect">
</select>
</div>
<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')
dropdown = document.getElementById('tempMFARegistrationUserSelect')
uid = dropdown.options[dropdown.selectedIndex].text
if(uid == "User") {
alert('Please select a user')
ipcRenderer.send('log', 'ORNL Toolbox: No user selected - request aborted', 'err')
return
}
try { //Check for entry in digest mapping file
alert('Please insert an unregistered smart card before proceeding. Ensure it is the only smart card plugged in.')
if(!checkSmartCard()) return
//Grab the unregistered smart card mapping to be added
var entry = execSync(`echo "$(pkcs15-tool -r 1 --rfc4716 2>/dev/null | openssl x509 -noout -fingerprint -sha1 -inform pem | grep -Po '(?<==).*(?=$)') -> ${uid}"`, (error, stdout, stderr) => {})
alert('Please remove the unregistered smart card and then insert a registered smart card. Ensure it is the only smart card plugged in.')
if(!checkSmartCard()) return
execSync(`pkexec bash -c 'echo "${entry}" >> /etc/pam_pkcs11/digest_mapping'`, () => {})
} catch(error) {
error = error.toString()
console.log(error)
alert('An error occured during the registration process')
ipcRenderer.send('log', 'ORNL Toolbox: An error occured during the registration process - request aborted', 'err')
return
}
alert('Initally inserted smart card is now temporarily registered')
ipcRenderer.send('log', 'ORNL Toolbox: Completed MFA temporary registration request', 'info')
}
function checkSmartCard() {
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 false
} 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 false
} else {
ipcRenderer.send('log', 'ORNL Toolbox: 1 smart card found inserted', 'info')
return true
}
}
function tempMFARegistrationLoad() { //Loading the users
if(!execSync) var execSync = require('child_process').execSync
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
//Adding the options of the dropdown menu
var optionValue = 1
var dropdownString = '<option value="0" disabled selected>User</option>'
var users = execSync('ls /home', () => {})
users = users.toString()
userArray = users.split('\n')
for(i = 0; i < userArray.length; i++) {
//Skip blanks and users that are not UIDs
if(userArray[i].trim() == "" || (userArray[i].trim()).length != 3) continue
dropdownString = dropdownString + '\n' + `<option value="${optionValue}">${userArray[i]}</option>`
optionValue++
}
document.getElementById('tempMFARegistrationUserSelect').innerHTML = dropdownString;
ipcRenderer.send('log', `ORNL Toolbox: List of users loaded`, 'info')
}
const execSync = require('child_process').execSync
function yubiBadgeCheckpoint(whichPage) {
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Yubikey/Badge Checkpoint request', 'info')
if(whichPage == 0) {
addWinMain('./badgeManagement/yubiBadgeCheckpoint/yubiBadgeCheckpoint.html', 'Yubikey/Badge Checkpoint', 225, 180)
} else if(whichPage == 1) {
......@@ -12,6 +14,7 @@ function yubiBadgeCheckpoint(whichPage) {
if(checkBadge) { //Badge inserted
alert('Please remove your badge')
ipcRenderer.send('close minor window')
ipcRenderer.send('log', `ORNL Toolbox: Badge inserted - request aborted`, 'err')
return
}
} catch(err) {
......@@ -23,10 +26,13 @@ function yubiBadgeCheckpoint(whichPage) {
if(! checkYubi) { //No Yubikey inserted
alert('Please insert a Yubikey')
ipcRenderer.send('close minor window')
ipcRenderer.send('log', `ORNL Toolbox: No Yubikey inserted - request aborted`, 'err')
return
}
}
ipcRenderer.send('log', 'ORNL Toolbox: Yubikey/Badge Checkpoint passed - request completed', 'info')
//Load either yubiChecker or yubiChanger
if(whichPage == 0) {
addWinMain('./badgeManagement/yubiChecker/yubiChecker.html', 'Yubikey Lock Checker', 225, 180)
......
const electron = require('electron')
const exec = require('child_process').exec
const execSync = require('child_process').execSync
const ipcRenderer = require('electron').ipcRenderer
//If the entered current PIN matches the registed current PIN, allow the user to create a new PIN that is 6 to 8 digits
function yubiChanger() {
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Yubikey PIN change request', 'info')
var currentPIN = document.getElementById("yubikeyChangeEnterPIN1").value
var newPIN = document.getElementById("yubikeyChangeEnterPIN2").value
var confirmNewPIN = document.getElementById("yubikeyChangeEnterPIN3").value
......@@ -12,9 +15,11 @@ function yubiChanger() {
//Throw error if either PIN doesn't match the requirements
if((! numeric.test(currentPIN)) || (! numeric.test(newPIN)) || (! numeric.test(confirmNewPIN))) {
alert('Each PIN must consist of 6 to 8 digits')
ipcRenderer.send('log', `ORNL Toolbox: Invalid PIN entered - request aborted`, 'err')
return
} else if(newPIN != confirmNewPIN) {
alert('New PIN and confirmation of new PIN must match')
ipcRenderer.send('log', `ORNL Toolbox: New PIN and confirmation PIN do not match - request aborted`, 'err')
return
} else {
try { //PINs meet requirements - check with registered PIN and try to change
......@@ -23,20 +28,25 @@ function yubiChanger() {
error = error.toString()
if(error.includes('Failed verifying pin code')) {
alert('The current PIN entered does not match the registered PIN')
ipcRenderer.send('log', `ORNL Toolbox: Entered PIN does not match the registered PIN - request aborted`, 'err')
return
} else if(error.includes('The pin code is blocked')) {
alert('The current Yubikey is blocked. Please go to the Solution Center to unblock it')
ipcRenderer.send('log', `ORNL Toolbox: Yubikey is locked - request aborted`, 'err')
return
} else if(error.includes('Failed to connect')) {
alert('No Yubikey inserted')
ipcRenderer.send('log', `ORNL Toolbox: No Yubikey inserted - request aborted`, 'err')
return
} else { //For uncaught/unconsidered errors
alert('Error changing PIN')
ipcRenderer.send('log', `ORNL Toolbox: Error with PIN change - request aborted`, 'err')
return
}
}
//Pin should be changed if this is reached
alert("PIN changed successfully.")
ipcRenderer.send('log', `ORNL Toolbox: Yubikey PIN changed successfully`, 'info')
}
}
const electron = require('electron')
const execSync = require('child_process').execSync
const ipcRenderer = require('electron').ipcRenderer
//Checks if the Yubikey is locked and alerts the user accordingly
function yubiChecker() {
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Yubikey check request', 'info')
var checkLock = execSync('pkcs11-tool -I -l | grep \"\"', (error, stdout, stderr) => {})
checkLock = checkLock.toString()
if(checkLock.includes("WARNING:")) {
alert('Yubikey is locked')
ipcRenderer.send('log', `ORNL Toolbox: Inserted Yubikey is locked`, 'info')
} else if(checkLock.includes("Logging")) {
alert('Yubikey is not locked')
ipcRenderer.send('log', `ORNL Toolbox: Inserted Yubikey is not locked`, 'info')
} else {
alert('No Yubikey inserted') //If Yubikey is unplugged, will get this
ipcRenderer.send('log', `ORNL Toolbox: No Yubikey inserted`, 'info')
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed Yubikey check request', 'info')
}
......@@ -6,7 +6,7 @@ if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then
else
BRANCH="-${CI_COMMIT_REF_NAME}"
fi
VERSION_NUMBER='1.0.11'
VERSION_NUMBER='1.3.7'
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
......@@ -16,6 +16,6 @@ npm install electron-packager
sed -i "s/VERSION_NUMBER/$VERSION_NUMBER/" ./about/about.html
npm run build
mv ./Releases/ornltoolbox-linux-x64 ./ornltoolbox
sudo /usr/local/bin/fpm -s dir -f -n ornltoolbox${BRANCH} --provides ornltoolbox --deb-no-default-config-files -v $VERSION_NUMBER --description "A collection of ORNL Linux tools" -t deb -p /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}.deb --prefix /opt --after-install ./packages/packagePostInstall.bash --after-remove ./packages/packagePostRemove.bash --before-upgrade ./packages/packagePostRemove.bash --after-upgrade ./packages/packagePostInstall.bash -d 'libgconf-2-4' -d 'gnome-screensaver' -d 'yubico-piv-tool' -d 'sox' -d 'smartmontools' -d 'policykit-1-gnome' -d 'desktop-file-utils' ./ornltoolbox
sudo /usr/local/bin/fpm -s dir -f -n ornltoolbox${BRANCH} --provides ornltoolbox --deb-no-default-config-files -v $VERSION_NUMBER --description "A collection of ORNL Linux tools" -t rpm -p /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}.rpm --prefix /opt --after-install ./packages/packagePostInstall.bash --after-remove ./packages/packagePostRemove.bash --before-upgrade ./packages/packagePostRemove.bash --after-upgrade ./packages/packagePostInstall.bash -d 'libXScrnSaver' -d 'gnome-screensaver' -d 'yubico-piv-tool' -d 'sox' -d 'smartmontools' -d 'polkit-gnome' ./ornltoolbox
sudo /usr/local/bin/fpm -s dir -f -n ornltoolbox${BRANCH} --provides ornltoolbox --deb-no-default-config-files -v $VERSION_NUMBER --description "A collection of ORNL Linux tools" -t deb -p /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}.deb --prefix /opt --after-install ./packages/packagePostInstall.bash --after-remove ./packages/packagePostRemove.bash --before-upgrade ./packages/packagePostRemove.bash --after-upgrade ./packages/packagePostInstall.bash -d 'libgconf-2-4' -d 'yubico-piv-tool' -d 'sox' -d 'smartmontools' -d 'policykit-1-gnome' -d 'desktop-file-utils' ./ornltoolbox
sudo /usr/local/bin/fpm -s dir -f -n ornltoolbox${BRANCH} --provides ornltoolbox --deb-no-default-config-files -v $VERSION_NUMBER --description "A collection of ORNL Linux tools" -t rpm -p /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}.rpm --prefix /opt --after-install ./packages/packagePostInstall.bash --after-remove ./packages/packagePostRemove.bash --before-upgrade ./packages/packagePostRemove.bash --after-upgrade ./packages/packagePostInstall.bash -d 'libXScrnSaver' -d 'yubico-piv-tool' -d 'sox' -d 'smartmontools' -d 'polkit-gnome' ./ornltoolbox
cp /opt/ornltoolbox${BRANCH}-${VERSION_NUMBER}* .
......@@ -6,6 +6,9 @@ const ipc = require('electron').ipcRenderer
//Send feedback email
function sendFeedback() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('log', 'ORNL Toolbox: Submitted request to send feedback email', 'info')
var cat = document.getElementById('feedbackCategory').value
var body = document.getElementById('feedbackTextBox').value
var subject
......@@ -18,6 +21,7 @@ function sendFeedback() {
case 0:
subject = ""
alert('Please choose a category')
ipcRenderer.send('log', 'ORNL Toolbox: No feedback email category selected - request aborted', 'err')
return
case 1:
subject = "Bug Report"
......@@ -38,19 +42,27 @@ function sendFeedback() {
if(body == "") {
alert('Please explain the issue')
ipcRenderer.send('log', 'ORNL Toolbox: Email body is blank - request aborted', 'err')
return
}
command = `bash /opt/ornltoolbox/resources/app/feedback/feedback-emailer.sh "ORNL Toolbox Feedback: ${subject}" "${body}"`
//Send the feedback email
execSync(command, (error, stdout, stderr) => {
var result = execSync(command, (error, stdout, stderr) => {
if(stderr) {
alert(`${stderr}`)
return 1
}
})
if(result == 1) {
ipcRenderer.send('log', 'ORNL Toolbox: Failed to send the feedback email - request aborted', 'err')
return
}
alert('Feedback sent')
ipcRenderer.send('log', 'ORNL Toolbox: Completed feedback email request', 'info')
let feedWin = remote.getGlobal('addWindow')
feedWin.destroy()
if(feedWin) {
......
function addPassphrase() {
if(!execSync) var execSync = require('child_process').execSync
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Add Passphrase request', 'info')
//Check for encrypted partitions
var encrypted = execSync('lsblk --fs -l | grep "crypto_LUKS" | cut -f 1 -d " " || true', () => {})
encrypted = (encrypted.toString()).trim()
if(encrypted == "") {
alert("This device has no encrypted partitions")
ipcRenderer.send('log', 'ORNL Toolbox: No encrypted partitions detected - request aborted', 'err')
return
}
......@@ -14,6 +18,7 @@ function addPassphrase() {
partition = partition.toString()
if(partition == "") { //Exiting if an encrypted partition is not found
alert('No encrypted partition found')
ipcRenderer.send('log', 'ORNL Toolbox: No encrypted partitions detected - request aborted', 'err')
return
}
......@@ -24,10 +29,12 @@ function addPassphrase() {
//Each field must have something in it
if(pass1 == "" || pass2 == "" || pass3 == "") {
alert('Please fill in all fields')
ipcRenderer.send('log', 'ORNL Toolbox: All fields not filled in - request aborted', 'err')
return
}
if(pass2 != pass3) {
alert('The new passphrase and its confirmation do not match')
ipcRenderer.send('log', 'ORNL Toolbox: New passphrase and its confirmation do not match - request aborted', 'err')
return
}
......@@ -37,16 +44,21 @@ function addPassphrase() {
error = error.toString()
if(error.includes("No key available with this passphrase")) { //Entered passphrase does not exist
alert('The entered passphrase does not exist')
ipcRenderer.send('log', 'ORNL Toolbox: Entered passphrase does not exist - request aborted', 'err')
} else if(error.includes("Request dismissed")) { //pkexec canceled
//Do nothing
ipcRenderer.send('log', 'ORNL Toolbox: Request canceled by user', 'info')
} else if(error.includes("All key slots full")) { //8 passphrases already exist, can't add more
alert('Maximum number of passphrases reached - please delete a passphrase first')
ipcRenderer.send('log', 'ORNL Toolbox: 8 passphrases already exist (maximum) - request aborted', 'err')
} else { //Catch any unconsidered errors
alert(error)
ipcRenderer.send('log', 'ORNL Toolbox: Failed to complete Add Passphrase request', 'err')
}
return
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed Add Passphrase request', 'info')
alert('Passphrase added')
//Load a fresh Add Passphrase page
addWinMain('./fileSystemManagement/addPassphrase/addPassphrase.html', 'Add Passphrase Reset', 300, 300)
......
/* 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;
}
#baobabCheckpointPage {
display: flex;
height: 100vh;
flex-direction: column;
justify-content: center;
align-items: center;
}
#baobabCheckpointText {
font-size: 16px;
text-align: center;
margin-bottom: 25px;
margin-left: 12px;
margin-right: 12px;
}
.baobabCheckpointButtonsContent {
width: 100vw;
height: 10vh;
display: flex;
flex-direction: row;
justify-content: center;
}
.baobabCheckpointButtons {
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;
}
.baobabCheckpointButtons:hover {
background-color: Gray !important;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Baobab Checkpoint</title>
<link rel="stylesheet" href="./baobabCheckpoint.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="../../miscjs/addWindow.js"></script>
<script src="../localDriveUsage/localDriveUsage.js"></script>
<script src="./baobabCheckpointConfirm.js"></script>
<script src="../../miscjs/installedCheck.js"></script>
</head>
<body>
<div id="baobabCheckpointPage">
<div id="baobabCheckpointText">
Baobab is not currently installed. 'Local Drive Usage' opens
the Disk Usage Analyzer which requires baobab. Would you like to
install it?
</div>
<div class="baobabCheckpointButtonsContent">
<span title="Click 'Install' to install baobab, which is required for 'Local Drive Usage'">
<input type="submit" class="baobabCheckpointButtons" value="Install" onclick="baobabCheckpointConfirm()">
</span>
<span title="Click 'Close' to close this current window and decline the installation.">
<input type="submit" class="baobabCheckpointButtons" value="Close" onclick="baobabClose()">
</span>
</div>
</div>
</body>
</html>
function baobabCheckpoint() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
if(!execSync) var execSync = require('child_process').execSync
ipcRenderer.send('log', 'ORNL Toolbox: Submitted baobab 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 baobab`)
} else {
package = execSync(`yum list installed baobab | grep baobab`)
}
} 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 baobab - request aborted', 'err')
return
}
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed baobab checkpoint request', 'info')
if(package == "") {
addWinMain('./fileSystemManagement/baobabCheckpoint/baobabCheckpoint.html', 'Baobab Checkpoint', 400, 175)
} else {
openDiskUsageAnalyzer()
}
}
function baobabCheckpointConfirm() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
if(!execSync) var execSync = require('child_process').execSync
ipcRenderer.send('log', 'ORNL Toolbox: Submitted install request for baobab', '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 baobab
if(os == "Ubuntu") {
execSync(`pkexec apt install baobab`)
} else {
execSync(`pkexec yum -y install baobab`)
}
} catch(error) {
error = error.toString()
if(error.includes("Request dismissed")) {
ipcRenderer.send('log', 'ORNL Toolbox: Request canceled by user', 'err')
baobabClose()
return
} else {
ipcRenderer.send('log', 'ORNL Toolbox: Failed to install baobab - request aborted', 'err')
console.error(error)
alert(error)
baobabClose()
}
}
alert('Baobab successfully installed')
ipcRenderer.send('log', 'ORNL Toolbox: Completed install request for baobab', 'info')
//Open baobab
openDiskUsageAnalyzer()
baobabClose()
}
function baobabClose() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('close minor window')
ipcRenderer.send('log', `ORNL Toolbox: Baobab checkpoint closed`, 'info')
}
function driveHealthCheck() {
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Drive Health Check request', 'info')
//Get SCSI drives excluding read-only memory drives
var drives = execSync(`lsblk -S | grep -v 'rom' | grep -v 'NAME HCTL'`, (error, stdout, stderr) => {
if(error) {
alert(error)
ipcRenderer.send('log', 'ORNL Toolbox: Error detecting drives - request aborted', 'err')
}
return
})
......@@ -33,6 +38,7 @@ function driveHealthCheck() {
})
output = output.toString()
if(output == "") { //Request dismissed
ipcRenderer.send('log', 'ORNL Toolbox: Request canceled by user', 'info')
return
}
......@@ -47,8 +53,12 @@ function driveHealthCheck() {
error = error.toString()
if(error.includes("Error executing command as another")) {
console.log("Request dismissed")
ipcRenderer.send('log', 'ORNL Toolbox: Request canceled by user', 'info')
} else {
console.error(error)
ipcRenderer.send('log', 'ORNL Toolbox: Failed to complete Drive Health Check request', 'err')
return
}
}
ipcRenderer.send('log', 'ORNL Toolbox: Completed Drive Health Check request', 'info')
}
......@@ -10,9 +10,12 @@
<script src="../miscjs/openURL.js"></script>
<script src="../miscjs/launchBomgar.js"></script>
<script src="../softwareManagement/openSoftware/openSoftware.js"></script>
<script src="../softwareManagement/softwareCheckpoint/softwareCheckpoint.js"></script>
<script src="../miscjs/menuFunctionCalls.js"></script>
<script src="../badgeManagement/yubiBadgeCheckpoint/yubiBadgeCheckpoint.js"></script>
<script src="../badgeManagement/badgeMinder/badgeInstallCheckpoint/badgeInstallCheckpoint.js"></script>
<script src="./localDriveUsage/localDriveUsage.js"></script>
<script src="./baobabCheckpoint/baobabCheckpoint.js"></script>
<script src="./addPassphrase/addPassphrase.js"></script>
<script src="./removePassphrase/removePassphrase.js"></script>
<script src="../miscjs/notImplemented.js"></script>
......@@ -46,7 +49,7 @@
<div id="buttons" onclick="addWinMain('./fileSystemManagement/registerRecoveryKey/registerRecoveryKey.html', 'Register Recovery Key', 325, 180)"><font color="white">Register Recovery Key</font></div>
</span>
<span title="Opens the Disk Usage Analyzer application for seeing the current contents of system drives">
<div id="buttons" onclick="openDiskUsageAnalyzer()"><font color="white">Local Drive Usage</font></div>
<div id="buttons" onclick="baobabCheckpoint()"><font color="white">Local Drive Usage</font></div>
</span>
<span title="">
<div id="buttons" onclick="driveHealthCheck()"><font color="white">Drive Health Check</font></div>
......@@ -54,7 +57,7 @@
<div id="fileSystemManagementHiddenbuttons"></div>
</div>
<span title="Opens an application page for submitting feedback regarding ORNL Toolbox.">
<div class="feedbackContainer" onclick="addWinMain('./feedback/feedback.html', 'Give Feedback', 500, 300)">
<div class="feedbackContainer" onclick="addWinMain('./feedback/feedback.html', 'Feedback', 500, 300)">
<div class="feedbackImage">
<img src="../images/comment-white-oval-bubble-shape.png" alt="White Chat Bubble">
</div>
......@@ -62,7 +65,7 @@
</div>
</span>
<span title="Opens an application page for seeking help regarding your system.">
<div class="helpContainer" onclick="addWinMain('./help/help.html', 'Email to Support', 500, 400)">
<div class="helpContainer" onclick="addWinMain('./help/help.html', 'Help', 500, 400)">
<div class="helpImage">
<img src="../images/help-web-button-white.png" alt="Question Mark">
</div>
......
//Change to file system management page after closing the minor window
function fileSysWin() {
ipcRenderer.send('log', 'ORNL Toolbox: Opened File System Management', 'info')
//Destroying any minor windows that were opened from the main window
ipcRenderer.send('close minor window')
// Change main window to file system management window
......
function openDiskUsageAnalyzer() { //Open Disk Usage Analyzer application
if(!ipcRenderer) var ipcRenderer = require('electron').ipcRenderer
if(!exec) var exec = require('child_process').exec
ipcRenderer.send('log', 'ORNL Toolbox: Submitted Local Drive Usage request', 'info')
if(! installedCheck("baobab")) {
alert('This feature is not installed on this system - click the help button or contact the Solution Center for assistance')
ipcRenderer.send('log', 'ORNL Toolbox: baobab not installed - request aborted', 'err')
return
}
exec('pkexec baobab', (error, stdout, stderr) => {
if(error) {
console.error(`exec error: ${error}`)
ipcRenderer.send('log', 'ORNL Toolbox: Failed to launch Disk Usage Analyzer', 'err')
return
}<