Commit 3dc172e1 authored by Joel Rennich's avatar Joel Rennich

files added

parent ffeefa7d
Pipeline #31981187 failed with stage
in 32 seconds
......@@ -20,3 +20,7 @@ let enableFDELog = OSLog(subsystem: "menu.nomad.login.ad", category: "EnableFDEL
let sierraFixesLog = OSLog(subsystem: "menu.nomad.login.ad", category: "SierraFixesLog")
let keychainAddLog = OSLog(subsystem: "menu.nomad.login.ad", category: "KeychainAdd")
let eulaLog = OSLog(subsystem: "menu.nomad.login.ad", category: "EULA")
let runScriptLog = OSLog(subsystem: "menu.nomad.login", category: "RunScript")
let notifyLog = OSLog(subsystem: "menu.nomad.login", category: "Notify")
let settingsLog = OSLog(subsystem: "menu.nomad.login", category: "Settings")
let userinputLog = OSLog(subsystem: "menu.nomad.login", category: "UserInput")
......@@ -51,10 +51,24 @@ enum Preferences: String {
case LoginLogoData
/// Should NoLo display a macOS-style login screen instead of a window? Set as a `Bool`,
case LoginScreen
/// If Notify should add additional logging
case NotifyLogStyle
/// Path to script to run, currently only one script path can be used, if you want to run this multiple times, keep the logic in your script
case ScriptPath
/// Arguments for the script, if any
case ScriptArgs
/// A string to show as the placeholder in the Username textfield
case UsernameFieldPlaceholder
/// A filesystem path to an image to set the user profile image to as a `String`
case UserProfileImage
//UserInput bits
case UserInputOutputPath
case UserInputUI
case UserInputLogo
case UserInputTitle
case UserInputMainText
}
......
......@@ -30,7 +30,7 @@ class EULAUI : NSWindowController {
override func windowDidLoad() {
os_log("Calling super.windowDidLoad", log: uiLog, type: .debug)
os_log("Calling super.windowDidLoad", log: uiLog, type: .default)
super.windowDidLoad()
let scrollNotification = NSNotification.Name.init(rawValue: "NSScrollViewDidLiveScroll")
......@@ -47,17 +47,17 @@ class EULAUI : NSWindowController {
// set the text
if let titleTextPref = getManagedPreference(key: .EULATitle) as? String {
os_log("Setting title text", log: eulaLog, type: .debug )
os_log("Setting title text", log: eulaLog, type: .default )
titleText.stringValue = titleTextPref
}
if let subTitleTextPref = getManagedPreference(key: .EULASubTitle) as? String {
os_log("Setting subtitle text", log: eulaLog, type: .debug )
os_log("Setting subtitle text", log: eulaLog, type: .default )
subTitleText.stringValue = subTitleTextPref
}
if let text = getManagedPreference(key: .EULAText) as? String {
os_log("Setting eula text", log: eulaLog, type: .debug )
os_log("Setting eula text", log: eulaLog, type: .default )
// We may need to do some line break things here
textView.string = text.replacingOccurrences(of: "***", with: "\n")
......@@ -67,10 +67,10 @@ class EULAUI : NSWindowController {
completeLogin(authResult: .allow)
}
os_log("Configure EULA window", log: eulaLog, type: .debug)
os_log("Configure EULA window", log: eulaLog, type: .default)
loginApperance()
os_log("create background windows", log: eulaLog, type: .debug)
os_log("create background windows", log: eulaLog, type: .default)
createBackgroundWindow()
}
......@@ -173,7 +173,7 @@ class EULAUI : NSWindowController {
///
/// - Parameter authResult:`Authorizationresult` enum value that indicates if login should proceed.
fileprivate func completeLogin(authResult: AuthorizationResult) {
os_log("Complete login process", log: uiLog, type: .debug)
os_log("Complete login process", log: uiLog, type: .default)
let error = mech?.fPlugin.pointee.fCallbacks.pointee.SetResult((mech?.fEngine)!, authResult)
if error != noErr {
os_log("Got error setting authentication result", log: uiLog, type: .error)
......@@ -183,7 +183,7 @@ class EULAUI : NSWindowController {
}
fileprivate func loginApperance() {
os_log("Setting window level", log: uiLog, type: .debug)
os_log("Setting window level", log: uiLog, type: .default)
self.window?.level = .screenSaver
self.window?.orderFrontRegardless()
self.window?.titlebarAppearsTransparent = true
......@@ -196,7 +196,7 @@ class EULAUI : NSWindowController {
var image: NSImage?
// Is a background image path set? If not just use gray.
if let backgroundImage = getManagedPreference(key: .BackgroundImage) as? String {
os_log("BackgroundImage preferences found.", log: uiLog, type: .debug)
os_log("BackgroundImage preferences found.", log: uiLog, type: .default)
image = NSImage(contentsOf: URL(fileURLWithPath: backgroundImage))
}
for screen in NSScreen.screens {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<capability name="system font weights other than Regular or Bold" minToolsVersion="7.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="EULAUI" customModule="NoMADLoginAD" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner" customClass="EULAUI" customModule="NoMADLoginOkta" customModuleProvider="target">
<connections>
<outlet property="agreeButton" destination="13t-aQ-b6g" id="DVj-cc-VMI"/>
<outlet property="cancelButton" destination="Y1Q-h7-aun" id="rJl-yC-Hhq"/>
......@@ -22,10 +20,10 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="QvC-M9-y7g">
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES"/>
<rect key="contentRect" x="196" y="240" width="706" height="449"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="706" height="449"/>
<autoresizingMask key="autoresizingMask"/>
......@@ -33,14 +31,15 @@
<scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rhH-jO-XbW">
<rect key="frame" x="20" y="48" width="666" height="327"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" ambiguous="YES" id="C09-Oc-zUj">
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="C09-Oc-zUj">
<rect key="frame" x="1" y="1" width="664" height="325"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView ambiguous="YES" editable="NO" selectable="NO" importsGraphics="NO" verticallyResizable="YES" baseWritingDirection="leftToRight" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsCharacterPickerTouchBarItem="NO" usesRuler="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" textCompletion="NO" spellingCorrection="YES" smartInsertDelete="YES" id="W9R-pJ-Y3v">
<rect key="frame" x="0.0" y="0.0" width="664" height="336"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="664" height="325"/>
<size key="maxSize" width="671" height="10000000"/>
<attributedString key="textStorage">
......@@ -51,6 +50,7 @@ Aenean orci tellus, rutrum ut vulputate eu, efficitur et lorem. Mauris sodales i
Proin odio elit, sollicitudin lacinia iaculis vel, pellentesque sed elit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque finibus libero lorem, et blandit dolor porta at. Nulla ullamcorper ut enim at pulvinar. Vestibulum consequat, ex at aliquam laoreet, ante nisi vestibulum urna, in varius purus justo a libero. Cras sed felis iaculis, sodales mi at, venenatis enim. Donec nunc neque, elementum a viverra eget, vehicula et elit. Mauris euismod est mattis nulla sodales, et faucibus magna sollicitudin. Vestibulum non erat a urna ornare aliquet. Donec dapibus scelerisque nibh nec fringilla. Curabitur ultrices ligula sit amet neque varius, sit amet sagittis velit facilisis. Integer et dui a magna euismod elementum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</mutableString>
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="12" name="Helvetica"/>
<real key="NSKern" value="0.0"/>
<paragraphStyle key="NSParagraphStyle" alignment="justified" lineBreakMode="wordWrapping" baseWritingDirection="leftToRight" defaultTabInterval="36" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO">
......@@ -59,10 +59,9 @@ Proin odio elit, sollicitudin lacinia iaculis vel, pellentesque sed elit. Orci v
</attributes>
</fragment>
</attributedString>
<color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="P9H-8W-Hem">
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
......
......@@ -55,7 +55,7 @@ class DeMobilize : NoLoMechanism {
}
os_log("DeMobilize mech starting", log: demobilizeLog, type: .debug)
guard let shortName = nomadUser else {
guard let shortName = usernameContext else {
os_log("Something went wrong, there is no user here at all", log: demobilizeLog, type: .error)
_ = allowLogin()
return
......@@ -63,7 +63,7 @@ class DeMobilize : NoLoMechanism {
// sanity check to ensure we have valid information and a local user
os_log("Checking for password", log: demobilizeLog, type: .debug)
if nomadPass == nil {
if passwordContext == nil {
os_log("Something went wrong, there is no password in user data", log: demobilizeLog, type: .error)
// nothing to see here, most likely auth failed earlier on
// we're just here for auditing purposes
......@@ -150,7 +150,17 @@ class DeMobilize : NoLoMechanism {
let authAuthority = try userRecord.values(forAttribute: kAuthAuthority) as! [String]
os_log("Found user AuthAuthority: %{public}@", log: demobilizeLog, type: .debug, authAuthority.debugDescription)
os_log("Looking for an Active Directory attribute on the account", log: demobilizeLog, type: .debug)
return authAuthority.contains(where: {$0.contains(";LocalCachedUser;/Active Directory")})
if authAuthority.contains(where: {$0.contains(";LocalCachedUser;/Active Directory")}) {
os_log("User is AD mobile account", log: demobilizeLog, type: .default)
return true
}
if authAuthority.contains(where: {$0.contains(";LocalCachedUser;/CentrifyDC")}) {
os_log("User is AD mobile account", log: demobilizeLog, type: .default)
return true
}
return false
} catch {
// No Auth Authorities, strange place, but we'll let other mechs decide
os_log("No Auth Authorities, strange place, but we'll let other mechs decide. Allow login. Error: %{public}@", log: demobilizeLog, type: .error, error.localizedDescription)
......@@ -186,14 +196,28 @@ class DeMobilize : NoLoMechanism {
var authAuthority = try userRecord.values(forAttribute: kAuthAuthority) as! [String]
os_log("Found user AuthAuthority: %{public}@", log: demobilizeLog, type: .debug, authAuthority.debugDescription)
os_log("Looking for an Active Directory attribute on the account", log: demobilizeLog, type: .debug)
var changedAuthAuthority = false
if let adAuthority = authAuthority.index(where: {$0.contains(";LocalCachedUser;/Active Directory")}) {
authAuthority.remove(at: adAuthority)
} else {
os_log("Could not remove AD from the AuthAuthority. Bail out and allow login.", log: demobilizeLog, type: .error)
changedAuthAuthority = true
}
os_log("Looking for a Centrify attribute on the account", log: demobilizeLog, type: .debug)
if let centrifyAuthority = authAuthority.index(where: {$0.contains(";LocalCachedUser;/CentrifyDC")}) {
authAuthority.remove(at: centrifyAuthority)
changedAuthAuthority = true
}
if !changedAuthAuthority {
os_log("No change to AuthAuthority! Stopping De-mobilizing process.", log: demobilizeLog, type: .default)
return false
} else {
os_log("Write back the cleansed AuthAuthority", log: demobilizeLog, type: .debug)
try userRecord.setValue(authAuthority, forAttribute: kAuthAuthority)
}
os_log("Write back the cleansed AuthAuthority", log: demobilizeLog, type: .debug)
try userRecord.setValue(authAuthority, forAttribute: kAuthAuthority)
} catch {
// No Auth Authorities, strange place, but we'll let other mechs decide
os_log("Ran into a problem modifying the AuthAuthority. Allow login. Error: %{public}@", log: demobilizeLog, type: .error, error.localizedDescription)
......
//
// Notify.swift
// NoMADLogin-AD
//
// Created by Joel Rennich on 3/30/18.
// Copyright © 2018 Orchard & Grove. All rights reserved.
//
import Foundation
import Cocoa
class Notify : NoLoMechanism {
// class to launch the NoMAD Login Notify screen
@objc func run() {
NSApp.activate(ignoringOtherApps: true)
let notifyWindow = NoLoNotify(windowNibName: NSNib.Name(rawValue: "NoLoNotify"))
notifyWindow.mech = mech
let windowTest = notifyWindow.window
if windowTest == nil {
NSLog("No dice on the window")
}
NSLog("Setting up window")
let modalSession = NSApp.beginModalSession(for: notifyWindow.window!)
while NSApp.runModalSession(modalSession) == .continue {
// let things run for a 1/2 second before going back
RunLoop.main.run(until: Date().addingTimeInterval(0.5))
}
NSLog("Stopping modal window")
NSApp.endModalSession(modalSession)
}
}
//
// RunScript.swift
// NoMADLoginAD
//
// Created by Joel Rennich on 3/30/18.
// Copyright © 2018 Orchard & Grove. All rights reserved.
//
import Foundation
class RunScript : NoLoMechanism {
let kArgError = "ERROR"
@objc func run() {
os_log("RunScript mech starting", log: runScriptLog, type: .default)
if let scriptPath = getManagedPreference(key: .ScriptPath) as? String {
let task = Process.init()
// check to make sure the path is there
let fm = FileManager.default
if fm.isExecutableFile(atPath: scriptPath) {
task.launchPath = scriptPath
if let args = getManagedPreference(key: .ScriptArgs) as? [String] {
task.arguments = args
}
do {
if #available(OSX 10.13, *) {
try task.run()
} else {
task.launch()
}
// snooze for a second before we hit the next mechanism to let things start
sleep(1)
} catch {
os_log("Unable to run script.", log: runScriptLog, type: .default)
}
} else {
// ScriptPath isn't executable
os_log("Script path is not executable.", log: runScriptLog, type: .default)
}
} else {
os_log("Unable to get path to script, allowing login.", log: runScriptLog, type: .default)
}
// always let login proceed
_ = allowLogin()
}
}
//
// UserInput.swift
// NoMADLoginAD
//
// Created by Joel Rennich on 9/29/18.
// Copyright © 2018 Orchard & Grove. All rights reserved.
//
import Foundation
import Cocoa
@objc class UserInput : NoLoMechanism {
@objc func run() {
// run the UI if we have the settings
if let inputSettings = getManagedPreference(key: .UserInputUI) as? [ String : AnyObject ] {
os_log("Activating app", log: userinputLog, type: .default)
NSApp.activate(ignoringOtherApps: true)
os_log("Loading XIB", log: userinputLog, type: .default)
let userInput = UserInputUI(windowNibName: NSNib.Name(rawValue: "UserInputUI"))
userInput.mech = mech
userInput.inputSettings = inputSettings
let windowTest = userInput.window
if windowTest == nil {
os_log("Could not create User Input window UI", log: userinputLog, type: .default)
}
os_log("Displaying window", log: userinputLog, type: .default)
//NSApp.runModal(for: eula.window!)
let modalSession = NSApp.beginModalSession(for: userInput.window!)
while NSApp.runModalSession(modalSession) == .continue {
// let things run for a 1/10 second before going back
RunLoop.main.run(until: Date().addingTimeInterval(0.1))
}
NSApp.endModalSession(modalSession)
} else {
_ = allowLogin()
return
}
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "depnotify_512.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "depnotify_1024.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "depnotify_1536.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.2.0-Beta</string>
<key>CFBundleVersion</key>
<string>300</string>
<string>305</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Orchard &amp; Grove. All rights reserved.</string>
<key>NSPrincipalClass</key>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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