Commit 9e1ec4e1 authored by Andrew Bitson's avatar Andrew Bitson

Merge branch 'Experimental'

parents 1dff44ef e9c21571
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "# Set the build number to the count of Git commits&#10;cd ${PROJECT_DIR}&#10;buildNumber=$(git rev-list HEAD | wc -l | tr -d &apos; &apos;)&#10;/usr/libexec/PlistBuddy -c &quot;Set :CFBundleVersion $buildNumber&quot; &quot;${PROJECT_DIR}/${INFOPLIST_FILE}&quot;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84CC67DA1D30A18A00115C76"
BuildableName = "NoMAD.app"
BlueprintName = "NoMAD"
ReferencedContainer = "container:NoMAD.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "# Set the build number to &quot;DEVELOPMENT&quot;&#10;/usr/libexec/PlistBuddy -c &quot;Set :CFBundleVersion DEVELOPMENT&quot; &quot;${PROJECT_DIR}/${INFOPLIST_FILE}&quot;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84CC67DA1D30A18A00115C76"
BuildableName = "NoMAD.app"
BlueprintName = "NoMAD"
ReferencedContainer = "container:NoMAD.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
......@@ -72,6 +108,12 @@
ReferencedContainer = "container:NoMAD.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-v"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
......
......@@ -58,11 +58,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "NoMAD/NoMADMenuController.swift"
timestampString = "499803535.822901"
timestampString = "514159644.35557"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "406"
endingLineNumber = "406"
startingLineNumber = "442"
endingLineNumber = "442"
landmarkName = "NoMADMenuClickGetCertificate(_:)"
landmarkType = "7">
</BreakpointContent>
......
......@@ -16,12 +16,13 @@ let updateNotification = Notification(name: Notification.Name(rawValue: "updateN
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
class AppDelegate: NSObject, NSApplicationDelegate {
var refreshTimer: Timer?
var refreshActivity: NSBackgroundActivityScheduler?
func applicationDidFinishLaunching(_ aNotification: Notification) {
myLogger.logit(.base, message:"---NoMAD Initialized---")
let version = String(describing: Bundle.main.infoDictionary!["CFBundleShortVersionString"]!)
let build = String(describing: Bundle.main.infoDictionary!["CFBundleVersion"]!)
......@@ -33,6 +34,21 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
myLogger.logit(.base, message: "State change, checking things.")
NotificationQueue.default.enqueue(updateNotification, postingStyle: .now)
if #available(OSX 10.12, *) {
Timer.scheduledTimer(withTimeInterval: 5, repeats: false, block: {_ in
myLogger.logit(.base, message: "State change, checking things again.")
NotificationQueue.default.enqueue(updateNotification, postingStyle: .now)
})
} else {
// wait a few seconds
let now = Date()
while abs(now.timeIntervalSinceNow) < 5 {
RunLoop.current.run(mode: RunLoopMode.defaultRunLoopMode, before: Date.distantFuture)
}
myLogger.logit(.base, message: "State change, checking things again.")
NotificationQueue.default.enqueue(updateNotification, postingStyle: .now)
}
if (defaults.string(forKey: Preferences.stateChangeAction) != "" ) {
myLogger.logit(.base, message: "Firing State Change Action")
cliTask(defaults.string(forKey: Preferences.stateChangeAction)! + " &")
......
......@@ -3,61 +3,61 @@
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "16x16.png",
"filename" : "icon_16x16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "16x16-1.png",
"filename" : "icon_16x16@2x.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "32x32.png",
"filename" : "icon_32x32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "32x32-1.png",
"filename" : "icon_32x32@2x.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "128x128.png",
"filename" : "icon_128x128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "128x128-1.png",
"filename" : "icon_128x128@2x.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "256x256.png",
"filename" : "icon_256x256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "256x256-1.png",
"filename" : "icon_256x256@2x.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "512x512.png",
"filename" : "icon_512x512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "512x512-1.png",
"filename" : "icon_512x512@2x.png",
"scale" : "2x"
}
],
......
......@@ -7,6 +7,7 @@
//
import Foundation
import SystemConfiguration
// site information
......@@ -41,8 +42,6 @@ public func setDefaults() {
defaults.set("", forKey: Preferences.autoConfigure)
default:
// see if we're on AD
getADSettings()
break
}
}
......@@ -62,15 +61,13 @@ public func setDefaults() {
private func getADSettings() {
// TODO: do this programatically? Although may need to be root to see AD prefs
let net_config = SCDynamicStoreCreate(nil, "net" as CFString, nil, nil)
let ad_info = [ SCDynamicStoreCopyValue(net_config, "com.apple.opendirectoryd.ActiveDirectory" as CFString)]
if ad_info[0] != nil {
let myADConfig = cliTask("/usr/sbin/dsconfigad -show").components(separatedBy: "\n")
if myADConfig.count > 0 {
for line in myADConfig {
if line.contains("Active Directory Domain") {
let adDict = ad_info[0]! as! NSDictionary
let myDomain = adDict["DomainNameDns"] as! String
myLogger.logit(.base, message: "Setting AD Domain to the domain the machine is currently bound to.")
let myDomain = (line as NSString).substring(from: 35)
defaults.set(myDomain, forKey: Preferences.aDDomain)
defaults.set(myDomain.uppercased(), forKey: Preferences.kerberosRealm)
defaults.set(false, forKey: Preferences.verbose)
......@@ -79,11 +76,7 @@ private func getADSettings() {
defaults.set("", forKey: Preferences.userCommandTask1)
defaults.set(7200, forKey: Preferences.secondsToRenew)
defaults.set(1, forKey: Preferences.renewTickets)
break
}
}
}
}
private func addToLoginItems() {
......
/* (No Commment) */
"CFBundleName" = "NoMAD";
/* (No Commment) */
"NSHumanReadableCopyright" = "Copyright 2016 Trusource Labs. All rights reserved.";
......@@ -9,7 +9,7 @@
<key>comment</key>
<string>Menu Item to Lock the Screen</string>
</dict>
<key>NoMADMenuController-LogIn</key>
<key>SignIn</key>
<dict>
<key>value</key>
<string>Sign In</string>
......@@ -42,9 +42,231 @@
<key>value</key>
<string>User Name</string>
<key>comment</key>
<string>Users&apos;s full name.</string>
<string>User&apos;s full name</string>
</dict>
<key>NoMADMenuController-GetSoftware</key>
<dict>
<key>comment</key>
<string>Menu item to open software portal.</string>
<key>value</key>
<string>Get Software</string>
</dict>
<key>NoMADMenuController-GetHelp</key>
<dict>
<key>value</key>
<string>Get Help</string>
<key>comment</key>
<string>Menu item to open up the support options.</string>
</dict>
<key>NoMADMenuController-Preferences</key>
<dict>
<key>value</key>
<string>Preferences</string>
<key>comment</key>
<string>Menu item to open Preferences window.</string>
</dict>
<key>NoMADMenuController-Quit</key>
<dict>
<key>value</key>
<string>Quit</string>
<key>comment</key>
<string>Menu item to quit NoMAD.</string>
</dict>
<key>NoMADMenuController-RenewTickets</key>
<dict>
<key>comment</key>
<string>Menu item to renew Kerberos tickets</string>
<key>value</key>
<string>Renew Tickets</string>
</dict>
<key>NoMADMenuController-PasswordExpiresInDays</key>
<dict>
<key>comment</key>
<string>Long text for how many days until your password expires</string>
<key>value</key>
<string>Password expires in: %@ days</string>
</dict>
<key>PasswordDoesNotExpire</key>
<dict>
<key>value</key>
<string>Password does not expire</string>
<key>comment</key>
<string>menu item for when the password has no expiration date</string>
</dict>
<key>PasswordChangeSuccessful</key>
<dict>
<key>value</key>
<string>Password changed successfully. Note: it may take up to an hour for your password expiration time to be updated.</string>
<key>comment</key>
<string>message to let user know password changed successfully</string>
</dict>
<key>InvalidPassword</key>
<dict>
<key>value</key>
<string>Invalid password. Please try again.</string>
<key>comment</key>
<string>error when password is wrong</string>
</dict>
<key>InvalidUsername</key>
<dict>
<key>value</key>
<string>Invalid username. Please try again.</string>
<key>comment</key>
<string>error when username is wrong</string>
</dict>
<key>PasswordExpire</key>
<dict>
<key>value</key>
<string>Your password has expired. Please reset your password now.</string>
<key>comment</key>
<string>error when password has expired</string>
</dict>
<key>PasswordAboutToExpire</key>
<dict>
<key>value</key>
<string>Password about to expire!</string>
<key>comment</key>
<string>message when password is about to expire</string>
</dict>
<key>PasswordExpiresOn</key>
<dict>
<key>value</key>
<string>Your network password is about to expire on </string>
<key>comment</key>
<string>Your network password is about to expire on &lt;date&gt;</string>
</dict>
<key>PasswordMismatch</key>
<dict>
<key>value</key>
<string>New passwords don&apos;t match.</string>
<key>comment</key>
<string>error when new passwords don&apos;t match</string>
</dict>
<key>NetworkLocalMismatch</key>
<dict>
<key>value</key>
<string>Your network and local passwords are not the same. Please enter the password for your Mac.</string>
<key>comment</key>
<string>error when network and local passwords do not match</string>
</dict>
<key>ValidCertificate</key>
<dict>
<key>value</key>
<string>You already have a valid certificate.</string>
<key>comment</key>
<string>user already has a valid certificate</string>
</dict>
<key>Cancel</key>
<dict>
<key>value</key>
<string>Cancel</string>
<key>comment</key>
<string>button for cancelling actions</string>
</dict>
<key>RequestAnyway</key>
<dict>
<key>value</key>
<string>Request Anyway</string>
<key>comment</key>
<string>button to request anyway</string>
</dict>
<key>CertConnectionError</key>
<dict>
<key>value</key>
<string>Connection error. Please ensure SSL certificates are trusted and the URL is correct for your X509 CA.</string>
<key>comment</key>
<string>message when Certificate Authority can&apos;t be reached</string>
</dict>
<key>CAConfigError</key>
<dict>
<key>value</key>
<string>Please ensure your Certificate Authority settings are correct.</string>
<key>comment</key>
<string>error when CA can&apos;t be found</string>
</dict>
<key>d</key>
<dict>
<key>value</key>
<string>d</string>
<key>comment</key>
<string>short form of days</string>
</dict>
<key>HomeSharepoint</key>
<dict>
<key>value</key>
<string>Home Sharepoint</string>
<key>comment</key>
<string>Menu item for opening up a user&apos;s home sharepoint from their AD profile</string>
</dict>
<key>LoginWindow-OldPasswordLabel</key>
<dict>
<key>value</key>
<string>Old Password</string>
<key>comment</key>
<string>Label for old password</string>
</dict>
<key>LoginWindow-PasswordLabel</key>
<dict>
<key>value</key>
<string>Password</string>
<key>comment</key>
<string>Label for password</string>
</dict>
<key>NoMADMenuController-SmartcardSignIn</key>
<dict>
<key>value</key>
<string>Smartcard Sign In</string>
<key>comment</key>
<string>PKINIT smartcard menu sign in</string>
</dict>
<key>NoMADMenuController-SignInWithSmartcard</key>
<dict>
<key>value</key>
<string>Sign in with a Smartcard.</string>
<key>comment</key>
<string>PKINIT smartcard menu sign in tool tip</string>
</dict>
<key>NoMADMenuController-NotLoggedIn</key>
<dict>
<key>value</key>
<string>Not logged in.</string>
<key>comment</key>
<string>User info for ticket life when not signed in</string>
</dict>
<key>NoMADMenuController-NotSignedIn</key>
<dict>
<key>value</key>
<string>Not Signed In</string>
<key>comment</key>
<string>User info when not signed in</string>
</dict>
<key>NoMADMenuController-NoUser</key>
<dict>
<key>value</key>
<string>No User</string>
<key>comment</key>
<string>User info when no user is available</string>
</dict>
<key>UserInformation-PasswordChanged</key>
<dict>
<key>value</key>
<string>Password Changed</string>
<key>comment</key>
<string>Notification title when password changed</string>
</dict>
<key>UserInformation-PwdChangedSignInAgain</key>
<dict>
<key>value</key>
<string>Your password was changed, please re-sign into NoMAD to update your password.</string>
<key>comment</key>
<string>Notification text asking to sign in again</string>
</dict>
<key>UserInformation-Ignore</key>
<dict>
<key>value</key>
<string>Ignore</string>
<key>comment</key>
<string>Password change notification ignore button</string>
</dict>
<key>New item</key>
<string></string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16C48b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D12b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
......@@ -24,14 +24,14 @@
<menuItem title="ticket life" alternate="YES" toolTip="Time until your Kerberos ticket expires." id="QYf-mL-9ta">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="7uv-39-xiX"/>
<menuItem title="Log In 2" toolTip="Log in." id="XL2-b8-IwM">
<menuItem isSeparatorItem="YES" title="Ticket Info" id="7uv-39-xiX"/>
<menuItem title="Log In 2" toolTip="Sign in with your network account." id="XL2-b8-IwM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="NoMADMenuClickLogIn:" target="Gp4-Xp-pEc" id="wVm-5I-piH"/>
</connections>
</menuItem>
<menuItem title="Sign In" alternate="YES" id="Wa6-S1-lXm">
<menuItem title="Sign In" alternate="YES" toolTip="Sign in with your network account." id="Wa6-S1-lXm">
<modifierMask key="keyEquivalentModifierMask" control="YES" option="YES"/>
<connections>
<action selector="NoMADMenuClickLogInAlternate:" target="Gp4-Xp-pEc" id="Ght-9J-Q4Q"/>
......@@ -43,13 +43,13 @@
<action selector="NoMADMenuClickChangePassword:" target="Gp4-Xp-pEc" id="lgn-ZO-gUO"/>
</connections>
</menuItem>
<menuItem title="Sign Out" id="w1A-iF-wAU">
<menuItem title="Sign Out" toolTip="Sign out of your network account." id="w1A-iF-wAU">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="NoMADMenuClickLogOut:" target="Gp4-Xp-pEc" id="DXe-en-Xqw"/>
</connections>
</menuItem>
<menuItem title="Lock Screen" id="3Pf-2O-qR7">
<menuItem title="Lock Screen" toolTip="Lock your screen." id="3Pf-2O-qR7">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="NoMADMenuClickLockScreen:" target="Gp4-Xp-pEc" id="1Up-40-AIC"/>
......@@ -62,10 +62,10 @@
<action selector="NoMADMenuClickGetCertificate:" target="Gp4-Xp-pEc" id="Ux3-1h-v3f"/>
</connections>
</menuItem>
<menuItem title="CertificateDate" alternate="YES" toolTip="Certificate expire date." id="A9U-v2-LiT">
<menuItem title="CertificateDate" alternate="YES" toolTip="Certificate expiration date." id="A9U-v2-LiT">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="wcV-DA-kNE"/>
<menuItem isSeparatorItem="YES" title="Software and Help" id="wcV-DA-kNE"/>
<menuItem title="Get Software" id="fuo-5h-NuR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
......@@ -122,6 +122,8 @@
<outlet property="NoMADMenuPasswordExpires" destination="CUr-ED-n29" id="n6a-qc-0L0"/>
<outlet property="NoMADMenuPreferences" destination="3yQ-ft-CVW" id="iix-dH-1bd"/>
<outlet property="NoMADMenuQuit" destination="gM7-FQ-f0l" id="N9U-ev-u6J"/>
<outlet property="NoMADMenuSeperatorSoftwareAndHelp" destination="wcV-DA-kNE" id="1kw-r7-9Qm"/>
<outlet property="NoMADMenuSeperatorTicketLife" destination="7uv-39-xiX" id="AAH-Cu-ppa"/>
<outlet property="NoMADMenuSpewLogs" destination="pC8-5a-Aec" id="trl-C0-H9J"/>
<outlet property="NoMADMenuTicketLife" destination="QYf-mL-9ta" id="o7R-O3-Ea9"/>
<outlet property="NoMADMenuUserName" destination="uQI-ol-UUw" id="yMX-60-SOW"/>
......
......@@ -28,6 +28,7 @@
-(void)startQuery;
-(void)stopQuery;
-(void)stopQueryWithError:(NSError *)error;
@end
......
......@@ -82,6 +82,7 @@
DNSServiceErrorType err;
const char * dnsNameCStr;
int socketProtocol;
int flags;
// version (always 0), info (self because it's easy to reference?), retain, release, copyDescription
CFSocketContext context = { 0, (__bridge void *) self, NULL, NULL, NULL };
......@@ -102,10 +103,18 @@
//uint32_t interfaceIndex = if_nametoindex("utun1");
// check for .local
if ( [self.queryValue hasSuffix:@".local"]) {
flags = (kDNSServiceFlagsReturnIntermediates + kDNSServiceFlagsTimeout);
} else {
flags = kDNSServiceFlagsReturnIntermediates;
}
// Create the DNS Query and reference it in self->_dnsService
err = DNSServiceQueryRecord(
&self->_dnsService,
kDNSServiceFlagsReturnIntermediates,
flags,
0, // query on all interfaces.
dnsNameCStr,
recordType,
......
//
// HistoryAndThanks.swift
// NoMAD
//
// Created by Joel Rennich on 4/10/17.
// Copyright © 2017 Trusource Labs. All rights reserved.
//
import Foundation
class HistoryAndThanks {
init() {
// in the beginning....
// NoMAD wouldn't be here without the help of many people before me and projects that inspired it's development
// Many thanks go out, in no particular order:
// Ben Toms, Phillip Boushy, Peter Bukowinski, Francois Levaux-Tiffreau, Owen Pragel, Michael Lynn, Kyle Crawshaw and the rest of the #secretgroup Slack Channel
let thanks = "👏👏👏👏👏👏👏👏👏👏"
print(thanks)
}
func getHistory() -> URL {
// Ben did a great job of summing up a lot of the history and the people involved in his post
// you should read it if you have any interest in how a lot of projects and people are connected
return URL.init(string: "https://macmule.com/2017/04/01/adpassmon-is-dead-long-live-nomad/")!
}
func firstPublicPosting() -> URL {
// this was the first public posting about NoMAD as a product that wasn't just some chatter in a Slack channel - August 2, 2016
return URL.init(string: "https://maclovin.org/blog-native/2016/nomad-get-ad-features-without-binding-your-mac")!
}
func projectsBeforeNoMAD() -> [String] {
var existingWork = [String]()
existingWork.append("ADPassMon")
existingWork.append("ShareMounter")
existingWork.append("KerbMinder")
existingWork.append("AD Password Monitor")
existingWork.append("Gala")
return existingWork
}
func thingsYouMayNotKnow() -> String {
// putting this here for possible future Easter Eggs on the MacAdmins podcast, we'll see if Charles or Tom find it. I bet Charles does, but then he'll forget he found it.