Skip to content

Commit

Permalink
changed version back to 3.1; added better about window with history; …
Browse files Browse the repository at this point in the history
…changed override script requirments to be owned by _securityagent and be 700
  • Loading branch information
twocanoes committed Jun 28, 2023
1 parent fac2af9 commit 2f8dd4e
Show file tree
Hide file tree
Showing 35 changed files with 705 additions and 417 deletions.
6 changes: 3 additions & 3 deletions DefaultsOverride.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public class DefaultsOverride: UserDefaults {
return

}
if ownerID.uintValue != 0 {
TCSLogErrorWithMark("override script is not owned by root. not running: \(ownerID.debugDescription)")
if ownerID.uintValue != 92 {
TCSLogErrorWithMark("override script is not owned by _securityagent. not running: \(ownerID.debugDescription)")
return
}

let unixPermissions = permission.int16Value

if unixPermissions & 0x3f != 0 {
TCSLogErrorWithMark("override script cannot be accessible by anyone besides root. not running: \(unixPermissions)")
TCSLogErrorWithMark("override script cannot be accessible by anyone besides _securityagent. not running: \(unixPermissions)")
return

}
Expand Down
9 changes: 7 additions & 2 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ When app is first launched and there is a keychain item with a AD account and lo
Most preferences can now be overwritten by specifying a script at the path defined by "settingsOverrideScriptPath". This script, if it exists, owned by root, and has permissions 755 (writable only by root, readable and executable by all) must return a valid plist that defines the key/value pairs to override in preferences. This allows for basing preferences based on the local state of the machine. It is important for the "localAdminUserName" and "localAdminPassword" keys. See Reset Keychain for more information on this. The overide script can also be used for querying the local state and setting preferences. For example, to randomly set the background image, a sample script "settingsOverrideScriptPath" defines a script:


!/bin/sh
#!/bin/sh
dir="/System/Library/Desktop Pictures"
desktoppicture=`/bin/ls -1 "$dir"/*.heic | sort --random-sort | head -1`
Expand Down Expand Up @@ -56,7 +56,7 @@ An example of an override script to return username and password are as follows:

Override Script:

` !/bin/sh`
` #!/bin/sh`
` dir="/System/Library/Desktop Pictures"`
` desktoppicture=/bin/ls -1 "$dir"/*.heic | sort --random-sort | head -1`
` `
Expand All @@ -82,6 +82,9 @@ plist:

### Others
* added shake to password field
* added dialog over login window when in an error state
* improved code when local password policy does not allow setting password from cloud.
* Added about menu with history

## New Keys

Expand Down Expand Up @@ -130,6 +133,8 @@ Determine if the mac login window or the cloud login window is shown by default

Show the Mac Login Window button in XCreds Login

**shouldShowTokenUpdateStatus**
Show the time when the password will be checked. True by default.

## Version 3.0 Build 3607 ##

Expand Down
4 changes: 2 additions & 2 deletions NomadLogin/UI/SignIn.xib
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="F0z-JX-Cv5" customClass="NoLoWindow" customModule="XCredsLoginPlugin" customModuleProvider="target">
<rect key="contentRect" x="276" y="219" width="521" height="511"/>
<rect key="screenRect" x="0.0" y="0.0" width="1496" height="933"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="521" height="511"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down Expand Up @@ -216,7 +216,7 @@ DQ
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hasShadow="NO" releasedWhenClosed="NO" frameAutosaveName="" animationBehavior="default" titlebarAppearsTransparent="YES" id="fMw-MO-1g7">
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="457" y="200" width="1000" height="16"/>
<rect key="screenRect" x="0.0" y="0.0" width="1496" height="933"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<view key="contentView" id="Mnu-l1-Giw">
<rect key="frame" x="0.0" y="0.0" width="1000" height="16"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
2 changes: 1 addition & 1 deletion NomadLogin/UI/SignInWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ class SignInWindowController: NSWindowController, DSQueryable {

case .deny:
TCSLogWithMark("Complete login process with deny")
delegate?.denyLogin()
delegate?.denyLogin(message:"Login Denied")

// window?.close()

Expand Down
4 changes: 2 additions & 2 deletions XCreds Login Overlay/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@
<windowStyleMask key="styleMask" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="25" y="25" width="872" height="109"/>
<rect key="screenRect" x="0.0" y="0.0" width="1496" height="933"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<view key="contentView" id="1nr-Jh-HO9">
<rect key="frame" x="0.0" y="0.0" width="872" height="109"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -729,7 +729,7 @@
<windowStyleMask key="styleMask" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="144" y="174" width="362" height="190"/>
<rect key="screenRect" x="0.0" y="0.0" width="1496" height="933"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<view key="contentView" id="MiV-8U-Ioy">
<rect key="frame" x="0.0" y="0.0" width="362" height="190"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
36 changes: 0 additions & 36 deletions XCreds/AboutMenuItem.swift

This file was deleted.

91 changes: 91 additions & 0 deletions XCreds/AboutWindow.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AboutWindowController" customModule="XCreds" customModuleProvider="target">
<connections>
<outlet property="aboutTextView" destination="HTA-3B-1DF" id="19t-VL-p6y"/>
<outlet property="window" destination="e3r-XM-xJP" id="3Kl-qd-Sux"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<userDefaultsController representsSharedInstance="YES" id="5Ar-2a-lNk"/>
<window title="About" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="e3r-XM-xJP">
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="560" y="551" width="915" height="564"/>
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
<view key="contentView" wantsLayer="YES" id="ZbF-tC-vpZ">
<rect key="frame" x="0.0" y="0.0" width="915" height="564"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bSr-fP-G7u">
<rect key="frame" x="20" y="20" width="875" height="524"/>
<clipView key="contentView" drawsBackground="NO" id="ca1-PV-x7f">
<rect key="frame" x="0.0" y="0.0" width="875" height="524"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView wantsLayer="YES" editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="HTA-3B-1DF">
<rect key="frame" x="0.0" y="0.0" width="875" height="524"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="875" height="524"/>
<size key="maxSize" width="875" height="10000000"/>
<attributedString key="textStorage">
<fragment content="asdffd">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="13" name="CourierNewPSMT"/>
<font key="NSOriginalFont" size="12" name="Helvetica"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
</attributedString>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
</clipView>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="358" id="3lx-YV-0rq"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="673" id="ttd-79-b3Y"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="YH2-jc-few">
<rect key="frame" x="-100" y="-100" width="240" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Nxp-18-SHh">
<rect key="frame" x="859" y="0.0" width="16" height="524"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="bSr-fP-G7u" secondAttribute="bottom" constant="20" id="MQN-fC-UsZ"/>
<constraint firstItem="bSr-fP-G7u" firstAttribute="top" secondItem="ZbF-tC-vpZ" secondAttribute="top" constant="20" id="WLh-Sx-3YW"/>
<constraint firstAttribute="trailing" secondItem="bSr-fP-G7u" secondAttribute="trailing" constant="20" id="swY-up-ZR5"/>
<constraint firstItem="bSr-fP-G7u" firstAttribute="leading" secondItem="ZbF-tC-vpZ" secondAttribute="leading" constant="20" id="w0d-4V-3Nc"/>
</constraints>
</view>
<connections>
<outlet property="delegate" destination="-2" id="gvt-4q-n77"/>
</connections>
<point key="canvasLocation" x="401.5" y="387"/>
</window>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="dXE-Xt-nIV">
<rect key="frame" x="0.0" y="0.0" width="90" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="DiscoveryURL" id="1hp-g2-T6a">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<point key="canvasLocation" x="49" y="340"/>
</textField>
</objects>
</document>
49 changes: 49 additions & 0 deletions XCreds/AboutWindowController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// AboutWindowController.swift
// xCreds
//
// Created by Timothy Perfitt on 4/5/22.
//

import Foundation
import Cocoa

class AboutWindowController: NSWindowController {


@IBOutlet weak var aboutTextView:NSTextView!
@objc override var windowNibName: NSNib.Name {
return NSNib.Name("AboutWindow")
}

override func awakeFromNib() {

let infoPlist = Bundle.main.infoDictionary
if let infoPlist = infoPlist {
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String

let build = infoPlist["CFBundleVersion"] as? String

let historyPath = Bundle.main.path(forResource: "History", ofType: "md")
let creditsPath = Bundle.main.path(forResource: "Credits", ofType: "txt")
if let historyPath = historyPath, let historyString = try? String(contentsOfFile: historyPath, encoding: .utf8), let creditsPath = creditsPath ,let creditsString = try? String(contentsOfFile: creditsPath, encoding: .utf8), let build = build, let appVersion = appVersion {

aboutTextView.string="XCreds\nCopyright Twocanoes Software, Inc.\nVersion \(appVersion) (\(build))\n\n"+creditsString + historyString

}
}

}

// @IBAction func clearTokensClicked(_ sender: Any) {
// let keychainUtil = KeychainUtil()
// let _ = keychainUtil.findAndDelete(serviceName:"xcreds",accountName:PrefKeys.accessToken.rawValue)
// let _ = keychainUtil.findAndDelete(serviceName:"xcreds",accountName:PrefKeys.idToken.rawValue)
// let _ = keychainUtil.findAndDelete(serviceName:"xcreds",accountName:PrefKeys.refreshToken.rawValue)
//
//
// mainMenu.signedIn=false
// mainMenu.buildMenu()
// }

}
39 changes: 0 additions & 39 deletions XCreds/ChangePasswordMenuItem.swift

This file was deleted.

55 changes: 0 additions & 55 deletions XCreds/CheckTokenMenuItem.swift

This file was deleted.

21 changes: 0 additions & 21 deletions XCreds/Credits.rtf

This file was deleted.

0 comments on commit 2f8dd4e

Please sign in to comment.