From 2d700f644b7e2933c6eb7e9145a661ec49cade8b Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 17 May 2015 19:48:21 -0700 Subject: Add signed binary build of Mac GUI wrapper. --- .../bin/ZeroTier One.app/Contents/Info.plist | 50 ++++++ .../ZeroTier One.app/Contents/MacOS/ZeroTier One | Bin 0 -> 152064 bytes .../bin/ZeroTier One.app/Contents/PkgInfo | 1 + .../Contents/Resources/ZeroTierIcon.icns | Bin 0 -> 117385 bytes .../Contents/Resources/en.lproj/Credits.rtf | 13 ++ .../Contents/Resources/en.lproj/InfoPlist.strings | Bin 0 -> 92 bytes .../Contents/Resources/en.lproj/MainMenu.nib | Bin 0 -> 25725 bytes .../Contents/Resources/en.lproj/Window.nib | Bin 0 -> 3785 bytes .../Contents/_CodeSignature/CodeResources | 187 +++++++++++++++++++++ .../src/MacGap.xcodeproj/project.pbxproj | 18 +- .../xcshareddata/MacGap.xccheckout | 4 +- .../AppIcon.appiconset/Contents.json | 63 ------- .../AppIcon.appiconset/application128x128.png | Bin 11247 -> 0 bytes .../AppIcon.appiconset/application16x16.png | Bin 715 -> 0 bytes .../AppIcon.appiconset/application256x256.png | Bin 29043 -> 0 bytes .../AppIcon.appiconset/application32x32.png | Bin 1787 -> 0 bytes .../AppIcon.appiconset/application512x512.png | Bin 57374 -> 0 bytes .../src/MacGap/MacGap-Info.plist | 2 + .../src/MacGap/en.lproj/MainMenu.xib | 2 +- ext/mac-ui-macgap1-wrapper/src/application.icns | Bin 88566 -> 0 bytes ext/mac-ui-macgap1-wrapper/src/public/index.html | 33 ---- 21 files changed, 260 insertions(+), 113 deletions(-) create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Info.plist create mode 100755 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/MacOS/ZeroTier One create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/PkgInfo create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/ZeroTierIcon.icns create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Credits.rtf create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/InfoPlist.strings create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/MainMenu.nib create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Window.nib create mode 100644 ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/_CodeSignature/CodeResources delete mode 100644 ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png delete mode 100644 ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png delete mode 100644 ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png delete mode 100644 ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png delete mode 100644 ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png delete mode 100644 ext/mac-ui-macgap1-wrapper/src/application.icns delete mode 100644 ext/mac-ui-macgap1-wrapper/src/public/index.html (limited to 'ext') diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Info.plist b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Info.plist new file mode 100644 index 00000000..15f23653 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Info.plist @@ -0,0 +1,50 @@ + + + + + BuildMachineOSBuild + 14D136 + CFBundleDevelopmentRegion + en + CFBundleExecutable + ZeroTier One + CFBundleIconFile + ZeroTierIcon + CFBundleIdentifier + com.zerotier.ZeroTier-One + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ZeroTier One + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 6D1002 + DTPlatformVersion + GM + DTSDKBuild + 14D125 + DTSDKName + macosx10.10 + DTXcode + 0631 + DTXcodeBuild + 6D1002 + LSApplicationCategoryType + public.app-category.utilities + LSMinimumSystemVersion + 10.7 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/MacOS/ZeroTier One b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/MacOS/ZeroTier One new file mode 100755 index 00000000..082bfca8 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/MacOS/ZeroTier One differ diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/PkgInfo b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/PkgInfo new file mode 100644 index 00000000..bd04210f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/ZeroTierIcon.icns b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/ZeroTierIcon.icns new file mode 100644 index 00000000..4ce98524 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/ZeroTierIcon.icns differ diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Credits.rtf b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Credits.rtf new file mode 100644 index 00000000..6f388f66 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Credits.rtf @@ -0,0 +1,13 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\vieww9600\viewh8400\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 + +\f0\b\fs24 \cf0 (c)2011-2015 ZeroTier, Inc.\ +Licensed under the GNU GPLv3\ +\ +UI Wrapper MacGap (c) Twitter, Inc.\ +Licensed under the MIT License\ +http://macgap.com/\ +} \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/InfoPlist.strings b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..5e45963c Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/InfoPlist.strings differ diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/MainMenu.nib b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/MainMenu.nib new file mode 100644 index 00000000..a94e2058 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/MainMenu.nib differ diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Window.nib b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Window.nib new file mode 100644 index 00000000..559409d9 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/Resources/en.lproj/Window.nib differ diff --git a/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/_CodeSignature/CodeResources b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/_CodeSignature/CodeResources new file mode 100644 index 00000000..4d148897 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app/Contents/_CodeSignature/CodeResources @@ -0,0 +1,187 @@ + + + + + files + + Resources/ZeroTierIcon.icns + + c0nINjNjYDIqCTiZLGdiX/EfUHY= + + Resources/en.lproj/Credits.rtf + + hash + + ePttkAH2X1GJ6OL0UhDBAktxB3Y= + + optional + + + Resources/en.lproj/InfoPlist.strings + + hash + + MiLKDDnrUKr4EmuvhS5VQwxHGK8= + + optional + + + Resources/en.lproj/MainMenu.nib + + hash + + w39AcLl09V6R06zh3yafl7/Epns= + + optional + + + Resources/en.lproj/Window.nib + + hash + + 42zB9+COYMmPW0WlnU1juN2B9SA= + + optional + + + + files2 + + Resources/ZeroTierIcon.icns + + c0nINjNjYDIqCTiZLGdiX/EfUHY= + + Resources/en.lproj/Credits.rtf + + hash + + ePttkAH2X1GJ6OL0UhDBAktxB3Y= + + optional + + + Resources/en.lproj/InfoPlist.strings + + hash + + MiLKDDnrUKr4EmuvhS5VQwxHGK8= + + optional + + + Resources/en.lproj/MainMenu.nib + + hash + + w39AcLl09V6R06zh3yafl7/Epns= + + optional + + + Resources/en.lproj/Window.nib + + hash + + 42zB9+COYMmPW0WlnU1juN2B9SA= + + optional + + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.pbxproj b/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.pbxproj index 9d71cecc..08d72d06 100644 --- a/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.pbxproj +++ b/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.pbxproj @@ -19,7 +19,7 @@ 88C0646014BDE10A00E4BCE2 /* Window.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C0645F14BDE10A00E4BCE2 /* Window.m */; }; 88C0646614BDEC5800E4BCE2 /* Window.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88C0646414BDEC5800E4BCE2 /* Window.xib */; }; 88C0646D14BDF6A600E4BCE2 /* WindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C0646C14BDF6A600E4BCE2 /* WindowController.m */; }; - C13A649D1AFB171100CB31FE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C13A649C1AFB171100CB31FE /* Images.xcassets */; }; + C14EFCA71B0986AF00894B5F /* ZeroTierIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = C14EFCA61B0986AF00894B5F /* ZeroTierIcon.icns */; }; C1C2B9911AFB0CF10060D7C2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C2B9901AFB0CF10060D7C2 /* Security.framework */; }; F2B80016179E0FC100B069A8 /* Clipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = F2B80015179E0FC100B069A8 /* Clipboard.m */; }; FA32509D14BA813600BF0781 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA32509C14BA813600BF0781 /* WebKit.framework */; }; @@ -30,8 +30,6 @@ FA3250D514BA860800BF0781 /* Dock.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250CB14BA860800BF0781 /* Dock.m */; }; FA3250D914BA860800BF0781 /* Path.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250CF14BA860800BF0781 /* Path.m */; }; FA3250DB14BA860800BF0781 /* Sound.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250D114BA860800BF0781 /* Sound.m */; }; - FA3250E514BA883A00BF0781 /* public in Resources */ = {isa = PBXBuildFile; fileRef = FA3250E414BA883A00BF0781 /* public */; }; - FA3250E714BA8BCE00BF0781 /* application.icns in Resources */ = {isa = PBXBuildFile; fileRef = FA3250E614BA8BCE00BF0781 /* application.icns */; }; FA3F7742168F70790027B324 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA3F7741168F70780027B324 /* Cocoa.framework */; }; FAE451C914BA79C600190544 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FAE451C714BA79C600190544 /* InfoPlist.strings */; }; FAE451CB14BA79C600190544 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE451CA14BA79C600190544 /* main.m */; }; @@ -75,7 +73,7 @@ 88C0646514BDEC5800E4BCE2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/Window.xib; sourceTree = ""; }; 88C0646B14BDF6A600E4BCE2 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowController.h; sourceTree = ""; }; 88C0646C14BDF6A600E4BCE2 /* WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WindowController.m; sourceTree = ""; }; - C13A649C1AFB171100CB31FE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + C14EFCA61B0986AF00894B5F /* ZeroTierIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = ZeroTierIcon.icns; path = ../../../../artwork/ZeroTierIcon.icns; sourceTree = ""; }; C1C2B9901AFB0CF10060D7C2 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; F2B80014179E0FC100B069A8 /* Clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clipboard.h; sourceTree = ""; }; F2B80015179E0FC100B069A8 /* Clipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Clipboard.m; sourceTree = ""; }; @@ -95,8 +93,6 @@ FA3250CF14BA860800BF0781 /* Path.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Path.m; path = Classes/Commands/Path.m; sourceTree = ""; }; FA3250D014BA860800BF0781 /* Sound.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Sound.h; path = Classes/Commands/Sound.h; sourceTree = ""; }; FA3250D114BA860800BF0781 /* Sound.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Sound.m; path = Classes/Commands/Sound.m; sourceTree = ""; }; - FA3250E414BA883A00BF0781 /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; }; - FA3250E614BA8BCE00BF0781 /* application.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = application.icns; sourceTree = SOURCE_ROOT; }; FA3F7741168F70780027B324 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; FAE451BA14BA79C600190544 /* ZeroTier One.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ZeroTier One.app"; sourceTree = BUILT_PRODUCTS_DIR; }; FAE451BE14BA79C600190544 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; @@ -184,7 +180,6 @@ isa = PBXGroup; children = ( FA3F7741168F70780027B324 /* Cocoa.framework */, - FA3250E414BA883A00BF0781 /* public */, FAE451C414BA79C600190544 /* MacGap */, FAE451BD14BA79C600190544 /* Frameworks */, FAE451BB14BA79C600190544 /* Products */, @@ -227,9 +222,9 @@ FA3250E014BA87B800BF0781 /* Classes */, FAE451D014BA79C600190544 /* AppDelegate.h */, FAE451D114BA79C600190544 /* AppDelegate.m */, + C14EFCA61B0986AF00894B5F /* ZeroTierIcon.icns */, FAE451D314BA79C600190544 /* MainMenu.xib */, 88C0646414BDEC5800E4BCE2 /* Window.xib */, - C13A649C1AFB171100CB31FE /* Images.xcassets */, FAE451C514BA79C600190544 /* Supporting Files */, ); path = MacGap; @@ -238,7 +233,6 @@ FAE451C514BA79C600190544 /* Supporting Files */ = { isa = PBXGroup; children = ( - FA3250E614BA8BCE00BF0781 /* application.icns */, FAE451C614BA79C600190544 /* MacGap-Info.plist */, FAE451C714BA79C600190544 /* InfoPlist.strings */, FAE451CA14BA79C600190544 /* main.m */, @@ -300,12 +294,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - FA3250E514BA883A00BF0781 /* public in Resources */, + C14EFCA71B0986AF00894B5F /* ZeroTierIcon.icns in Resources */, FAE451C914BA79C600190544 /* InfoPlist.strings in Resources */, - C13A649D1AFB171100CB31FE /* Images.xcassets in Resources */, FAE451CF14BA79C600190544 /* Credits.rtf in Resources */, FAE451D514BA79C600190544 /* MainMenu.xib in Resources */, - FA3250E714BA8BCE00BF0781 /* application.icns in Resources */, 88C0646614BDEC5800E4BCE2 /* Window.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -430,7 +422,6 @@ FAE451D914BA79C600190544 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; COMBINE_HIDPI_IMAGES = YES; @@ -452,7 +443,6 @@ FAE451DA14BA79C600190544 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; COMBINE_HIDPI_IMAGES = YES; diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout b/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout index 2a06dbc5..7fdde853 100644 --- a/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout +++ b/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout @@ -14,11 +14,11 @@ http://adam.ierymenko@git.int.zerotier.com/zerotier/zerotierone IDESourceControlProjectPath - ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj + ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary ABA3617E9F0148F844A82502F0D808DE6591AA97 - ../../../.. + ../../../../.. IDESourceControlProjectURL http://adam.ierymenko@git.int.zerotier.com/zerotier/zerotierone diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json b/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 2592eae9..00000000 --- a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "scale" : "2x", - "size" : "16x16" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "application16x16.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "application32x32.png", - "scale" : "1x" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "32x32" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "application128x128.png", - "scale" : "1x" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "128x128" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "application256x256.png", - "scale" : "1x" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "256x256" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "application512x512.png", - "scale" : "1x" - }, - { - "idiom" : "mac", - "scale" : "2x", - "size" : "512x512" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png b/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png deleted file mode 100644 index 93dd80a1..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png b/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png deleted file mode 100644 index 3aa19da6..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png b/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png deleted file mode 100644 index c30106b7..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png b/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png deleted file mode 100644 index 05ff6cb8..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png b/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png deleted file mode 100644 index b6b9da61..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/src/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/MacGap-Info.plist b/ext/mac-ui-macgap1-wrapper/src/MacGap/MacGap-Info.plist index 3730da8f..7e10a7a6 100644 --- a/ext/mac-ui-macgap1-wrapper/src/MacGap/MacGap-Info.plist +++ b/ext/mac-ui-macgap1-wrapper/src/MacGap/MacGap-Info.plist @@ -2,6 +2,8 @@ + CFBundleIconFile + ZeroTierIcon CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/ext/mac-ui-macgap1-wrapper/src/MacGap/en.lproj/MainMenu.xib b/ext/mac-ui-macgap1-wrapper/src/MacGap/en.lproj/MainMenu.xib index 998c505a..61dafbcc 100644 --- a/ext/mac-ui-macgap1-wrapper/src/MacGap/en.lproj/MainMenu.xib +++ b/ext/mac-ui-macgap1-wrapper/src/MacGap/en.lproj/MainMenu.xib @@ -1,7 +1,7 @@ - 1080 + 1070 14D136 7702 1347.57 diff --git a/ext/mac-ui-macgap1-wrapper/src/application.icns b/ext/mac-ui-macgap1-wrapper/src/application.icns deleted file mode 100644 index e4bcb281..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/src/application.icns and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/src/public/index.html b/ext/mac-ui-macgap1-wrapper/src/public/index.html deleted file mode 100644 index 9fab9325..00000000 --- a/ext/mac-ui-macgap1-wrapper/src/public/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - MacGap - - - - - - - -

MacGap

- - \ No newline at end of file -- cgit v1.2.3 From f48509d50cf62ed593ae86fb4e8ee1a0750f7690 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 17 May 2015 20:28:09 -0700 Subject: Mac script to get HTTP proxy settings -- will be used by Mac updater. --- ext/installfiles/mac/get-proxy-settings.sh | 26 ++++++++++++++++++++++++++ make-mac.mk | 21 +++------------------ 2 files changed, 29 insertions(+), 18 deletions(-) create mode 100755 ext/installfiles/mac/get-proxy-settings.sh (limited to 'ext') diff --git a/ext/installfiles/mac/get-proxy-settings.sh b/ext/installfiles/mac/get-proxy-settings.sh new file mode 100755 index 00000000..873a8558 --- /dev/null +++ b/ext/installfiles/mac/get-proxy-settings.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Outputs host and port for system HTTP proxy or zeroes if none or not +# configured. + +export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin + +enabled=`system_profiler SPNetworkDataType|grep "HTTP Proxy Enabled"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` +port=`system_profiler SPNetworkDataType|grep "HTTP Proxy Port"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` +serv=`system_profiler SPNetworkDataType|grep "HTTP Proxy Server"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` + +if [ "$enabled" = "Yes" ]; then + if [ "$serv" ]; then + if [ ! "$port" ]; then + port=80 + fi + + echo $serv $port + else + echo 0.0.0.0 0 + fi +else + echo 0.0.0.0 0 +fi + +exit 0 diff --git a/make-mac.mk b/make-mac.mk index a41445db..a52ee2d0 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -8,7 +8,6 @@ ARCH_FLAGS=-arch x86_64 include objects.mk OBJS+=osdep/OSXEthernetTap.o -#TESTNET_OBJS=testnet/SimNet.o testnet/SimNetSocketManager.o testnet/TestEthernetTap.o # Disable codesign since open source users will not have ZeroTier's certs CODESIGN=echo @@ -62,10 +61,6 @@ selftest: $(OBJS) selftest.o $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS) $(STRIP) zerotier-selftest -#testnet: $(TESTNET_OBJS) $(OBJS) testnet.o -# $(CXX) $(CXXFLAGS) -o zerotier-testnet testnet.o $(OBJS) $(TESTNET_OBJS) $(LIBS) -# $(STRIP) zerotier-testnet - # Requires that ../Qt be symlinked to the Qt root to use for UI build #mac-ui: FORCE # mkdir -p build-ZeroTierUI-release @@ -79,21 +74,11 @@ clean: rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-* # For our use -- builds official signed binary, packages in installer and download DMG -official: FORCE - make -j 4 ZT_OFFICIAL_RELEASE=1 - ./buildinstaller.sh +#official: FORCE +# make -j 4 ZT_OFFICIAL_RELEASE=1 +# ./buildinstaller.sh # make mac-dmg ZT_OFFICIAL_RELEASE=1 -#mac-dmg: FORCE -# mkdir -p build-ZeroTierOne-dmg -# cd build-ZeroTierOne-dmg ; ln -sf /Applications Applications -# cp -a "build-ZeroTierUI-release/ZeroTier One.app" build-ZeroTierOne-dmg/ -# rm -f /tmp/tmp.dmg -# hdiutil create /tmp/tmp.dmg -ov -volname "ZeroTier One" -fs HFS+ -srcfolder ./build-ZeroTierOne-dmg -# hdiutil convert /tmp/tmp.dmg -format UDZO -o "ZeroTier One.dmg" -# $(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.dmg" -# rm -f /tmp/tmp.dmg - # For those building from source -- installs signed binary tap driver in system ZT home install-mac-tap: FORCE mkdir -p /Library/Application\ Support/ZeroTier/One -- cgit v1.2.3 From 89027d78ac3734034af42bee2055df8b457a405c Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 17 May 2015 21:24:02 -0700 Subject: Mac .pkg building using Packages (third party app) instead of old bootstrapping .app and installer script. --- .gitignore | 3 - buildinstaller.sh | 27 - ext/installfiles/mac/ZeroTier One.pkgproj | 984 ++++++++++++++++++++++++++++++ ext/installfiles/mac/install.tmpl.sh | 144 ----- ext/installfiles/mac/postinst.sh | 22 + ext/installfiles/mac/preinst.sh | 14 + make-mac.mk | 19 +- 7 files changed, 1025 insertions(+), 188 deletions(-) create mode 100755 ext/installfiles/mac/ZeroTier One.pkgproj delete mode 100644 ext/installfiles/mac/install.tmpl.sh create mode 100755 ext/installfiles/mac/postinst.sh create mode 100755 ext/installfiles/mac/preinst.sh (limited to 'ext') diff --git a/.gitignore b/.gitignore index b15a5045..cceb7dd9 100755 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,10 @@ /ext/llvm-g++-Xcode4.6.2 /ext/llvm-g++-Xcode4.6.2.tar.bz2 /zerotier-* -/ZeroTierUI/*.user *.o .DS_Store .Apple* *.dSYM -/netconf-service/node_modules /ipch /windows/ZeroTierOne.sdf /windows/ZeroTierOne.v11.suo @@ -33,7 +31,6 @@ /ZeroTierOneInstaller-* .qmake.stash *.autosave -/ZeroTier One.dmg /root-topology/bin2c /root-topology/mktopology /root-topology/*.secret diff --git a/buildinstaller.sh b/buildinstaller.sh index 5b45cb84..8f252dff 100755 --- a/buildinstaller.sh +++ b/buildinstaller.sh @@ -120,33 +120,6 @@ case "$system" in ;; - Darwin) - echo "Assembling mac installer for x86/x64 (combined) version $vmajor.$vminor.$revision" - - mkdir -p 'build-installer/Applications' - cp -a 'build-ZeroTierUI-release/ZeroTier One.app' 'build-installer/Applications' - mkdir -p 'build-installer/Library/Application Support/ZeroTier/One' - cp -fp 'ext/installfiles/mac/uninstall.sh' 'build-installer/Library/Application Support/ZeroTier/One' - cp -fp 'ext/installfiles/mac/launch.sh' 'build-installer/Library/Application Support/ZeroTier/One' - cp -fp 'zerotier-one' 'build-installer/Library/Application Support/ZeroTier/One' - cp -fRp ext/bin/tap-mac/* 'build-installer/Library/Application Support/ZeroTier/One' - mkdir -p 'build-installer/Library/LaunchDaemons' - cp -fp 'ext/installfiles/mac/com.zerotier.one.plist' 'build-installer/Library/LaunchDaemons' - - targ="ZeroTierOneInstaller-mac-combined-${vmajor}_${vminor}_${revision}" - rm -f build-installer-tmp.tar.bz2 - cd build-installer - find . -type f -name .DS_Store -print0 | xargs -0 rm -f - tar -cf - * | bzip2 -9 >../build-installer-tmp.tar.bz2 - cd .. - rm -f $targ - cat ext/installfiles/mac/install.tmpl.sh build-installer-tmp.tar.bz2 >$targ - chmod 0755 $targ - rm -f build-installer-tmp.tar.bz2 - ls -l $targ - - ;; - *) echo "Unsupported platform: $system" exit 2 diff --git a/ext/installfiles/mac/ZeroTier One.pkgproj b/ext/installfiles/mac/ZeroTier One.pkgproj new file mode 100755 index 00000000..93dba714 --- /dev/null +++ b/ext/installfiles/mac/ZeroTier One.pkgproj @@ -0,0 +1,984 @@ + + + + + PROJECT + + PACKAGE_FILES + + DEFAULT_INSTALL_LOCATION + / + HIERARCHY + + CHILDREN + + + CHILDREN + + + CHILDREN + + GID + 80 + PATH + Utilities + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 80 + PATH + /Users/api/Code/ZeroTierOne/ext/mac-ui-macgap1-wrapper/bin/ZeroTier One.app + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + GID + 80 + PATH + Applications + PATH_TYPE + 0 + PERMISSIONS + 509 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + + CHILDREN + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ext/installfiles/mac/get-proxy-settings.sh + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ext/installfiles/mac/launch.sh + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ext/bin/tap-mac/tap.kext + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ui/index.html + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ui/main.js + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ui/react.min.js + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ui/simpleajax.min.js + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ui/zerotier.css + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ui/ztui.min.js + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + GID + 0 + PATH + ui + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 2 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ext/installfiles/mac/uninstall.sh + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/zerotier-one + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + GID + 80 + PATH + One + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 2 + UID + 0 + + + GID + 80 + PATH + ZeroTier + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 2 + UID + 0 + + + GID + 80 + PATH + Application Support + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Automator + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Documentation + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Filesystems + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Frameworks + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Input Methods + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Internet Plug-Ins + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + LaunchAgents + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + /Users/api/Code/ZeroTierOne/ext/installfiles/mac/com.zerotier.one.plist + PATH_TYPE + 0 + PERMISSIONS + 420 + TYPE + 3 + UID + 0 + + + GID + 0 + PATH + LaunchDaemons + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + PreferencePanes + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Preferences + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 80 + PATH + Printers + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + PrivilegedHelperTools + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + QuickLook + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + QuickTime + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Screen Savers + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Scripts + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Services + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + Widgets + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + Library + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + Library + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + System + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + Shared + PATH_TYPE + 0 + PERMISSIONS + 1023 + TYPE + 1 + UID + 0 + + + GID + 80 + PATH + Users + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + / + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + PAYLOAD_TYPE + 0 + VERSION + 3 + + PACKAGE_SCRIPTS + + POSTINSTALL_PATH + + PATH + /Users/api/Code/ZeroTierOne/ext/installfiles/mac/postinst.sh + PATH_TYPE + 0 + + PREINSTALL_PATH + + PATH + /Users/api/Code/ZeroTierOne/ext/installfiles/mac/preinst.sh + PATH_TYPE + 0 + + RESOURCES + + + PACKAGE_SETTINGS + + AUTHENTICATION + 1 + CONCLUSION_ACTION + 0 + IDENTIFIER + com.zerotier.pkg.ZeroTierOne + OVERWRITE_PERMISSIONS + + VERSION + 1.0.3 + + PROJECT_COMMENTS + + NOTES + + PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBIVE1M + IDQuMDEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvVFIvaHRtbDQv + c3RyaWN0LmR0ZCI+CjxodG1sPgo8aGVhZD4KPG1ldGEgaHR0cC1l + cXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7 + IGNoYXJzZXQ9VVRGLTgiPgo8bWV0YSBodHRwLWVxdWl2PSJDb250 + ZW50LVN0eWxlLVR5cGUiIGNvbnRlbnQ9InRleHQvY3NzIj4KPHRp + dGxlPjwvdGl0bGU+CjxtZXRhIG5hbWU9IkdlbmVyYXRvciIgY29u + dGVudD0iQ29jb2EgSFRNTCBXcml0ZXIiPgo8bWV0YSBuYW1lPSJD + b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjEzNDcuNTciPgo8c3R5bGUg + dHlwZT0idGV4dC9jc3MiPgpwLnAxIHttYXJnaW46IDAuMHB4IDAu + MHB4IDAuMHB4IDAuMHB4OyBmb250OiAxMi4wcHggSGVsdmV0aWNh + OyBjb2xvcjogIzAwMDAwMDsgLXdlYmtpdC10ZXh0LXN0cm9rZTog + IzAwMDAwMH0Kc3Bhbi5zMSB7Zm9udC1rZXJuaW5nOiBub25lfQo8 + L3N0eWxlPgo8L2hlYWQ+Cjxib2R5Pgo8cCBjbGFzcz0icDEiPjxz + cGFuIGNsYXNzPSJzMSI+WmVyb1RpZXIgT25lIC0gTmV0d29yayBW + aXJ0dWFsaXphdGlvbiBFdmVyeXdoZXJlPC9zcGFuPjwvcD4KPHAg + Y2xhc3M9InAxIj48c3BhbiBjbGFzcz0iczEiPihjKTIwMTEtMjAx + NSBaZXJvVGllciwgSW5jLjwvc3Bhbj48L3A+CjxwIGNsYXNzPSJw + MSI+PHNwYW4gY2xhc3M9InMxIj5jb250YWN0QHplcm90aWVyLmNv + bTwvc3Bhbj48L3A+CjxwIGNsYXNzPSJwMSI+PHNwYW4gY2xhc3M9 + InMxIj48YnI+Cjwvc3Bhbj48L3A+CjxwIGNsYXNzPSJwMSI+PHNw + YW4gY2xhc3M9InMxIj5UbyB1bmluc3RhbGwgbWFudWFsbHksIHR5 + cGUgdGhlIGZvbGxvd2luZyBpbiBhIHRlcm1pbmFsIHdpbmRvdzo8 + L3NwYW4+PC9wPgo8cCBjbGFzcz0icDEiPjxzcGFuIGNsYXNzPSJz + MSI+PGJyPgo8L3NwYW4+PC9wPgo8cCBjbGFzcz0icDEiPjxzcGFu + IGNsYXNzPSJzMSI+c3VkbyAiL0xpYnJhcnkvQXBwbGljYXRpb24g + U3VwcG9ydC9aZXJvVGllci9PbmUvdW5pbnN0YWxsLnNoIjwvc3Bh + bj48L3A+CjwvYm9keT4KPC9odG1sPgo= + + + PROJECT_SETTINGS + + BUILD_PATH + + PATH + ../../.. + PATH_TYPE + 1 + + EXCLUDED_FILES + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + .DS_Store + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove .DS_Store files + PROXY_TOOLTIP + Remove ".DS_Store" files created by the Finder. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + .pbdevelopment + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove .pbdevelopment files + PROXY_TOOLTIP + Remove ".pbdevelopment" files created by ProjectBuilder or Xcode. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + CVS + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .cvsignore + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + .cvspass + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + .svn + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .git + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .gitignore + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove SCM metadata + PROXY_TOOLTIP + Remove helper files and folders used by the CVS, SVN or Git Source Code Management systems. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + classes.nib + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + designable.db + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + info.nib + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Optimize nib files + PROXY_TOOLTIP + Remove "classes.nib", "info.nib" and "designable.nib" files within .nib bundles. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + Resources Disabled + TYPE + 1 + + + PROTECTED + + PROXY_NAME + Remove Resources Disabled folders + PROXY_TOOLTIP + Remove "Resources Disabled" folders. + STATE + + + + SEPARATOR + + + + NAME + ZeroTier One + + + TYPE + 1 + VERSION + 2 + + diff --git a/ext/installfiles/mac/install.tmpl.sh b/ext/installfiles/mac/install.tmpl.sh deleted file mode 100644 index d0c7efe1..00000000 --- a/ext/installfiles/mac/install.tmpl.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -export PATH=/bin:/usr/bin:/sbin:/usr/sbin -shopt -s expand_aliases - -dryRun=0 - -echo "*** ZeroTier One install/update ***" - -if [ "$UID" -ne 0 ]; then - echo "Not running as root so doing dry run (no modifications to system)..." - dryRun=1 -fi - -if [ $dryRun -gt 0 ]; then - alias ln="echo '>> dry run: ln'" - alias rm="echo '>> dry run: rm'" - alias mv="echo '>> dry run: mv'" - alias cp="echo '>> dry run: cp'" - alias chown="echo '>> dry run: chown'" - alias chgrp="echo '>> dry run: chgrp'" - alias chmod="echo '>> dry run: chmod'" - alias launchctl="echo '>> dry run: launchctl'" - alias zerotier-cli="echo '>> dry run: zerotier-cli'" -fi - -zthome="/Library/Application Support/ZeroTier/One" -ztapp="/Applications/ZeroTier One.app" -if [ ! -d "$ztapp" ]; then - ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*ZeroTier One[.]app$' | grep -v -F '/build-' | grep -v -F '/Volumes/ZeroTier' | sort | head -n 1` -fi - -scriptPath="`dirname "$0"`/`basename "$0"`" -if [ ! -r "$scriptPath" ]; then - scriptPath="$0" - if [ ! -r "$scriptPath" ]; then - echo "Installer cannot determine its own path; $scriptPath is not readable." - exit 2 - fi -fi - -endMarkerIndex=`grep -a -b -E '^################' "$scriptPath" | head -c 16 | cut -d : -f 1` -if [ "$endMarkerIndex" -le 100 ]; then - echo 'Internal error: unable to find end of script / start of binary data marker.' - exit 2 -fi -blobStart=`expr $endMarkerIndex + 17` -if [ "$blobStart" -le "$endMarkerIndex" ]; then - echo 'Internal error: unable to find end of script / start of binary data marker.' - exit 2 -fi - -echo 'Extracting files...' -if [ $dryRun -gt 0 ]; then - echo ">> dry run: tail -c +$blobStart \"$scriptPath\" | bunzip2 -c | tar -xvop -C / -f -" -else - rm -rf '/tmp/_zt1tmp' - mkdir '/tmp/_zt1tmp' - tail -c +$blobStart "$scriptPath" | bunzip2 -c | tar -xop -C '/tmp/_zt1tmp' -f - -fi - -cd '/tmp/_zt1tmp' - -if [ $dryRun -eq 0 -a ! -d './Applications/ZeroTier One.app' ]; then - echo 'Archive extraction failed, cannot find files in /tmp/_zt1tmp.' - exit 2 -fi - -echo 'Installing zerotier-one service...' - -mkdir -p "$zthome" -chown root:admin "$zthome" -chmod 0750 "$zthome" -cp -fa ./Library/Application\ Support/ZeroTier/One/* "$zthome" -chown -R root:wheel "$zthome/tap.kext" -chown -R root:wheel "$zthome/pre10.8/tap.kext" - -echo 'Installing/updating ZeroTier One.app...' - -if [ ! -z "$ztapp" -a -d "$ztapp" -a -f "$ztapp/Contents/Info.plist" ]; then - # Preserve ownership of current app across updates... that way the admin - # user who dragged it into /Applications can just trash it the way they - # would any other app. This works (due to mdfind up top) even if they put - # it somewhere non-standard on their system. - currentAppOwner=`stat -f '%u' "$ztapp"` - currentAppGroup=`stat -f '%g' "$ztapp"` - - rm -rf "$ztapp" - mv -f './Applications/ZeroTier One.app' "$ztapp" - - if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then - chown -R $currentAppOwner "$ztapp" - chgrp -R $currentAppGroup "$ztapp" - else - chown -R root "$ztapp" - chgrp -R admin "$ztapp" - fi -else - # If there is no existing app, just drop the shipped one into place - ztapp="/Applications/ZeroTier One.app" - mv -f './Applications/ZeroTier One.app' "$ztapp" - chown -R root "$ztapp" - chgrp -R admin "$ztapp" -fi - -# Set up symlink that watches for app deletion -rm -f "$zthome/shutdownIfUnreadable" -ln -sf "$ztapp/Contents/Info.plist" "$zthome/shutdownIfUnreadable" - -echo 'Installing zerotier-cli command line utility...' - -rm -f /usr/bin/zerotier-cli /usr/bin/zerotier-idtool -ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" /usr/bin/zerotier-cli -ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" /usr/bin/zerotier-idtool - -# This lets the install helper AppleScript thingy go ahead and authorize the -# user after the installer is done, skiping that step for the user who did -# the service install. -if [ ! -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then - echo 'Pre-creating authtoken.secret for ZeroTier service...' - if [ $dryRun -eq 0 ]; then - rm -f '/Library/Application Support/ZeroTier/One/authtoken.secret' - head -c 1024 /dev/urandom | md5 | head -c 24 >'/Library/Application Support/ZeroTier/One/authtoken.secret' - chmod 0600 '/Library/Application Support/ZeroTier/One/authtoken.secret' - fi -fi - -echo 'Installing and (re-)starting zerotier-one service via launchctl...' - -mv -f './Library/LaunchDaemons/com.zerotier.one.plist' '/Library/LaunchDaemons/' -launchctl load /Library/LaunchDaemons/com.zerotier.one.plist - -# launchctl will restart us after exit if this is an online auto-update - -cd /tmp -rm -rf _zt1tmp - -exit 0 - -# Do not remove the last line or add a carriage return to it! The installer -# looks for an unterminated line beginning with 16 #'s in itself to find -# the binary blob data, which is appended after it. - -################ \ No newline at end of file diff --git a/ext/installfiles/mac/postinst.sh b/ext/installfiles/mac/postinst.sh new file mode 100755 index 00000000..d41b733a --- /dev/null +++ b/ext/installfiles/mac/postinst.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +export PATH=/bin:/usr/bin:/sbin:/usr/sbin + +launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 +sleep 1 +killall zerotier-one +sleep 1 +killall -9 zerotier-one + +cd "/Library/Application Support/ZeroTier/One" +rm -rf node.log node.log.old root-topology shutdownIfUnreadable autoupdate.log updates.d +if [ ! -f authtoken.secret ]; then + head -c 1024 /dev/urandom | md5 | head -c 24 >authtoken.secret + chown root authtoken.secret + chgrp wheel authtoken.secret + chmod 0600 authtoken.secret +fi + +launchctl load /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 + +exit 0 diff --git a/ext/installfiles/mac/preinst.sh b/ext/installfiles/mac/preinst.sh new file mode 100755 index 00000000..9fa50bef --- /dev/null +++ b/ext/installfiles/mac/preinst.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +export PATH=/bin:/usr/bin:/sbin:/usr/sbin + +if [ -f /Library/LaunchDaemons/com.zerotier.one.plist ]; then + launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 + sleep 1 + killall zerotier-one + sleep 1 + killall -9 zerotier-one +fi + +cd /Applications +rm -rf "ZeroTier One.app" diff --git a/make-mac.mk b/make-mac.mk index a52ee2d0..717cbccb 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -56,29 +56,20 @@ one: $(OBJS) one.o $(STRIP) zerotier-one ln -sf zerotier-one zerotier-idtool ln -sf zerotier-one zerotier-cli + $(CODESIGN) -f -s $(CODESIGN_CERT) zerotier-one + $(CODESIGN) -vvv zerotier-one selftest: $(OBJS) selftest.o $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS) $(STRIP) zerotier-selftest -# Requires that ../Qt be symlinked to the Qt root to use for UI build -#mac-ui: FORCE -# mkdir -p build-ZeroTierUI-release -# cd build-ZeroTierUI-release ; ../../Qt/bin/qmake ../ZeroTierUI/ZeroTierUI.pro ; make -j 4 -# strip "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One" -# find "build-ZeroTierUI-release/ZeroTier One.app" -type f -name '.DS_Store' -print0 | xargs -0 rm -f -# $(CODESIGN) -f -s $(CODESIGN_CERT) "build-ZeroTierUI-release/ZeroTier One.app" -# $(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app" +sign-pkg: FORCE + $(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.pkg" + $(CODESIGN) -vvv "ZeroTier One.pkg" clean: rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-* -# For our use -- builds official signed binary, packages in installer and download DMG -#official: FORCE -# make -j 4 ZT_OFFICIAL_RELEASE=1 -# ./buildinstaller.sh -# make mac-dmg ZT_OFFICIAL_RELEASE=1 - # For those building from source -- installs signed binary tap driver in system ZT home install-mac-tap: FORCE mkdir -p /Library/Application\ Support/ZeroTier/One -- cgit v1.2.3 From ac629150ac6dca2951df77a35e8fd6fb0298f8c7 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 17 May 2015 21:26:38 -0700 Subject: Create symlinks in Mac postinst script. --- ext/installfiles/mac/postinst.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext') diff --git a/ext/installfiles/mac/postinst.sh b/ext/installfiles/mac/postinst.sh index d41b733a..094eea48 100755 --- a/ext/installfiles/mac/postinst.sh +++ b/ext/installfiles/mac/postinst.sh @@ -16,6 +16,14 @@ if [ ! -f authtoken.secret ]; then chgrp wheel authtoken.secret chmod 0600 authtoken.secret fi +rm -f zerotier-cli zerotier-idtool +ln -sf zerotier-one zerotier-cli +ln -sf zerotier-one zerotier-idtool + +cd /usr/bin +rm -f zerotier-cli zerotier-idtool +ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" zerotier-cli +ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" zerotier-idtool launchctl load /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 -- cgit v1.2.3 From 32588b3d840280eef8c0aaf6bf930412fcd2b985 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 18 May 2015 20:30:54 -0700 Subject: A visit to the Windows house of pain: (1) Yes, you *can* create a mixed 32/64 bit Windows MSI installer that installs drivers. All you have to do is... umm... create individual sub-MSI files for each driver (one for 32, one for 64) and then package those in the main MSI files as "chained" MSI installers. Each of these must only be considered a prerequisite on 32 or 64 bit machines, respectively. (2) Upgrade Advanced Installer version, add rules to uninstall NDIS6 tap device on uninstall. (3) Fix IE issue in UI code. --- .gitignore | 2 + .../x64/ZeroTierOne_NDIS6_x64.msi | Bin 0 -> 1454080 bytes ...roTier One Virtual Network Port (NDIS6_x64).aip | 156 +++++++++++++++++++++ ext/installfiles/windows/ZeroTier One.aip | 100 ++++++++----- ui/index.html | 2 +- 5 files changed, 222 insertions(+), 38 deletions(-) create mode 100644 ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi create mode 100644 ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip (limited to 'ext') diff --git a/.gitignore b/.gitignore index cceb7dd9..64bf02de 100755 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ /windows/WebUIWrapper/bin /windows/WebUIWrapper/obj node_modules +/ZeroTier One.msi +/ext/installfiles/windows/*-cache diff --git a/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi b/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi new file mode 100644 index 00000000..7e6fc426 Binary files /dev/null and b/ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi differ diff --git a/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip new file mode 100644 index 00000000..744a32c5 --- /dev/null +++ b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x64).aip @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index a5e62a24..59d58b1a 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -1,29 +1,32 @@ - + - + + + - + - + + - - + + - + @@ -48,6 +51,7 @@ + @@ -56,51 +60,64 @@ - - + + + - - + + - + - - - + + + + + + + + - - - - - - + + + + + + + - + + + + + + + - + @@ -127,6 +144,8 @@ + + @@ -169,6 +188,7 @@ + @@ -179,11 +199,13 @@ + + @@ -196,34 +218,38 @@ - - - - + + + + + + + - + - + - - - - - + + + + + + @@ -271,7 +297,7 @@ - + @@ -291,12 +317,12 @@ - + - + diff --git a/ui/index.html b/ui/index.html index a426dcdf..44edb399 100644 --- a/ui/index.html +++ b/ui/index.html @@ -38,7 +38,7 @@ if (ieVersion !== false) { } /* MacGap hacks */ -if (macgap) { +if (typeof macgap !== 'undefined') { if (macgap.menu) { var tmp = macgap.menu.getItem("Help"); if (tmp) -- cgit v1.2.3 From b4a34cc1057d799450a32f9e910dde779506ce45 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 13:01:55 -0700 Subject: Add 32-bit chained MSI for NDIS6 driver... now to go test on 32-bit Windows (clean). (And Windows 10, and Windows Server, and ...) --- .../x86/ZeroTierOne_NDIS6_x86.msi | Bin 0 -> 1070592 bytes ...roTier One Virtual Network Port (NDIS6_x86).aip | 157 +++++++++++++++++++++ ext/installfiles/windows/ZeroTier One.aip | 6 +- 3 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi create mode 100644 ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip (limited to 'ext') diff --git a/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi b/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi new file mode 100644 index 00000000..80b330a8 Binary files /dev/null and b/ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi differ diff --git a/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip new file mode 100644 index 00000000..5936875a --- /dev/null +++ b/ext/installfiles/windows/ZeroTier One Virtual Network Port (NDIS6_x86).aip @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index 59d58b1a..aef8ba5a 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -23,7 +23,7 @@ - + @@ -107,10 +107,12 @@ - + + + -- cgit v1.2.3 From 44d1bd14bd2f9c22fee6b57ac3df4018db146e1d Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 14:48:57 -0700 Subject: Enable right-click menu for copy/paste/etc. in Windows UI wrapper. --- ext/bin/win-ui-wrapper/ZeroTier One.exe | Bin 0 -> 761304 bytes ext/installfiles/windows/ZeroTier One.aip | 2 +- ext/win-ui-wrapper/ZeroTier One.exe | Bin 761304 -> 0 bytes windows/WebUIWrapper/Form1.Designer.cs | 11 ++++++----- 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 ext/bin/win-ui-wrapper/ZeroTier One.exe delete mode 100644 ext/win-ui-wrapper/ZeroTier One.exe (limited to 'ext') diff --git a/ext/bin/win-ui-wrapper/ZeroTier One.exe b/ext/bin/win-ui-wrapper/ZeroTier One.exe new file mode 100644 index 00000000..50eec7d6 Binary files /dev/null and b/ext/bin/win-ui-wrapper/ZeroTier One.exe differ diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index aef8ba5a..bab72e04 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -81,7 +81,7 @@ - + diff --git a/ext/win-ui-wrapper/ZeroTier One.exe b/ext/win-ui-wrapper/ZeroTier One.exe deleted file mode 100644 index 3e129be7..00000000 Binary files a/ext/win-ui-wrapper/ZeroTier One.exe and /dev/null differ diff --git a/windows/WebUIWrapper/Form1.Designer.cs b/windows/WebUIWrapper/Form1.Designer.cs index 8d8eb9e9..81d69cd0 100644 --- a/windows/WebUIWrapper/Form1.Designer.cs +++ b/windows/WebUIWrapper/Form1.Designer.cs @@ -36,20 +36,21 @@ // this.webContainer.AllowNavigation = false; this.webContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.webContainer.IsWebBrowserContextMenuEnabled = false; this.webContainer.Location = new System.Drawing.Point(0, 0); - this.webContainer.MinimumSize = new System.Drawing.Size(20, 20); + this.webContainer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.webContainer.MinimumSize = new System.Drawing.Size(18, 16); this.webContainer.Name = "webContainer"; - this.webContainer.Size = new System.Drawing.Size(1012, 556); + this.webContainer.Size = new System.Drawing.Size(900, 445); this.webContainer.TabIndex = 0; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1012, 556); + this.ClientSize = new System.Drawing.Size(900, 445); this.Controls.Add(this.webContainer); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "Form1"; this.Text = "ZeroTier One"; this.Load += new System.EventHandler(this.Form1_Load); -- cgit v1.2.3 From 63cea7d337a55fed8333a3aaf3d1d5bb50a03018 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 16:02:26 -0700 Subject: Try to automatically enable access to http://127.0.0.1 in web wrapper if IE is in enhanced security mode. --- ext/bin/win-ui-wrapper/ZeroTier One.exe | Bin 761304 -> 763352 bytes windows/WebUIWrapper/Program.cs | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) (limited to 'ext') diff --git a/ext/bin/win-ui-wrapper/ZeroTier One.exe b/ext/bin/win-ui-wrapper/ZeroTier One.exe index 50eec7d6..622b5b36 100644 Binary files a/ext/bin/win-ui-wrapper/ZeroTier One.exe and b/ext/bin/win-ui-wrapper/ZeroTier One.exe differ diff --git a/windows/WebUIWrapper/Program.cs b/windows/WebUIWrapper/Program.cs index 3dfdb94f..bfcdb831 100644 --- a/windows/WebUIWrapper/Program.cs +++ b/windows/WebUIWrapper/Program.cs @@ -3,17 +3,87 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.ComponentModel; namespace WebUIWrapper { + [ComImport, GuidAttribute("79EAC9EE-BAF9-11CE-8C82-00AA004BA90B"), + InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] + public interface IInternetSecurityManager + { + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int SetSecuritySite([In] IntPtr pSite); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int GetSecuritySite([Out] IntPtr pSite); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int MapUrlToZone([In, MarshalAs(UnmanagedType.LPWStr)] string pwszUrl, out UInt32 pdwZone, UInt32 dwFlags); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int GetSecurityId([MarshalAs(UnmanagedType.LPWStr)] string pwszUrl, [MarshalAs(UnmanagedType.LPArray)] byte[] pbSecurityId, ref UInt32 pcbSecurityId, uint dwReserved); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int ProcessUrlAction([In, MarshalAs(UnmanagedType.LPWStr)] string pwszUrl, UInt32 dwAction, out byte pPolicy, UInt32 cbPolicy, byte pContext, UInt32 cbContext, UInt32 dwFlags, UInt32 dwReserved); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int QueryCustomPolicy([In, MarshalAs(UnmanagedType.LPWStr)] string pwszUrl, ref Guid guidKey, ref byte ppPolicy, ref UInt32 pcbPolicy, ref byte pContext, UInt32 cbContext, UInt32 dwReserved); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int SetZoneMapping(UInt32 dwZone, [In, MarshalAs(UnmanagedType.LPWStr)] string lpszPattern, UInt32 dwFlags); + + [return: MarshalAs(UnmanagedType.I4)] + [PreserveSig] + int GetZoneMappings(UInt32 dwZone, out UCOMIEnumString ppenumString, UInt32 dwFlags); + } + static class Program { + // constants from urlmon.h + public const UInt32 URLZONE_LOCAL_MACHINE = 0; + public const UInt32 URLZONE_INTRANET = URLZONE_LOCAL_MACHINE + 1; + public const UInt32 URLZONE_TRUSTED = URLZONE_INTRANET + 1; + public const UInt32 URLZONE_INTERNET = URLZONE_TRUSTED + 1; + public const UInt32 URLZONE_UNTRUSTED = URLZONE_INTERNET + 1; + public const UInt32 URLZONE_ESC_FLAG = 0x100; + public const UInt32 SZM_CREATE = 0; + public const UInt32 SZM_DELETE = 0x1; + + public static Guid CLSID_InternetSecurityManager = new Guid("7b8a2d94-0ac9-11d1-896c-00c04fb6bfc4"); + public static Guid IID_IInternetSecurityManager = new Guid("79eac9ee-baf9-11ce-8c82-00aa004ba90b"); + /// /// The main entry point for the application. /// [STAThread] static void Main() { + try + { + Type t = Type.GetTypeFromCLSID(CLSID_InternetSecurityManager); + object securityManager = Activator.CreateInstance(t); + if (securityManager != null) + { + IInternetSecurityManager ism = (IInternetSecurityManager)securityManager; + ism.SetZoneMapping(URLZONE_TRUSTED, "http://127.0.0.1", SZM_CREATE); + ism.SetZoneMapping(URLZONE_INTRANET, "http://127.0.0.1", SZM_CREATE); + ism.SetZoneMapping(URLZONE_ESC_FLAG | URLZONE_TRUSTED, "http://127.0.0.1", SZM_CREATE); + ism.SetZoneMapping(URLZONE_ESC_FLAG | URLZONE_INTRANET, "http://127.0.0.1", SZM_CREATE); + } + } + catch + { + // Okay to continue if adding URL to trusted zone doesn't work... + } + Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); -- cgit v1.2.3 From 9682f50b152ca04543d4b87fb405e50429468eeb Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 16:26:41 -0700 Subject: Get rid of old _winPokeAHole() hack in one.cpp and use Advanced Installer to configure firewall rules (because we can now). --- ext/installfiles/windows/ZeroTier One.aip | 43 ++++++++++++++++++++++++------- one.cpp | 6 +++-- 2 files changed, 37 insertions(+), 12 deletions(-) (limited to 'ext') diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index bab72e04..9a3b83a2 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -1,7 +1,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -33,12 +33,12 @@ - + - - - + + + @@ -121,6 +121,12 @@ + + + + + + @@ -135,6 +141,11 @@ + + + + + @@ -144,6 +155,7 @@ + @@ -194,9 +206,16 @@ + + + + + + + @@ -243,8 +262,8 @@ - - + + @@ -252,6 +271,10 @@ + + + + @@ -262,8 +285,8 @@ - - + + diff --git a/one.cpp b/one.cpp index d174d48f..4a0a57e8 100644 --- a/one.cpp +++ b/one.cpp @@ -750,6 +750,7 @@ static BOOL WINAPI _winConsoleCtrlHandler(DWORD dwCtrlType) } // Pokes a hole in the Windows firewall (advfirewall) for the running program +/* -- now done by Advanced Installer static void _winPokeAHole() { char myPath[MAX_PATH]; @@ -786,6 +787,7 @@ static void _winPokeAHole() } } } +*/ // Returns true if this is running as the local administrator static BOOL IsCurrentUserLocalAdministrator(void) @@ -1121,13 +1123,13 @@ int main(int argc,char **argv) return 1; } } else { - _winPokeAHole(); + //_winPokeAHole(); } SetConsoleCtrlHandler(&_winConsoleCtrlHandler,TRUE); // continues on to ordinary command line execution code below... } else { // Running from service manager - _winPokeAHole(); + //_winPokeAHole(); ZeroTierOneService zt1Service; if (CServiceBase::Run(zt1Service) == TRUE) { return 0; -- cgit v1.2.3 From 68cb7ad4cdeac23988bc63cd65f91d8b540ff47d Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 16:31:00 -0700 Subject: Few more fixes to installer firewall rule settings. --- ext/installfiles/windows/ZeroTier One.aip | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ext') diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index 9a3b83a2..d45f306e 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -23,7 +23,7 @@ - + @@ -122,10 +122,10 @@ - - - - + + + + @@ -348,8 +348,8 @@ - - + + -- cgit v1.2.3 From c7eb5f0c81d32f26d0cca47f80d9d9d5e1307aca Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 18:13:20 -0700 Subject: Windows build warning removal, be more defensive in Windows tap driver code, and clean up service start/stop in installer. --- ext/installfiles/windows/ZeroTier One.aip | 18 +++++++----------- osdep/WindowsEthernetTap.cpp | 6 +++++- service/OneService.cpp | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'ext') diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index d45f306e..4be09951 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -1,5 +1,5 @@ - + @@ -23,7 +23,7 @@ - + @@ -123,8 +123,8 @@ - - + + @@ -205,7 +205,6 @@ - @@ -235,7 +234,6 @@ - @@ -253,7 +251,7 @@ - + @@ -262,8 +260,6 @@ - - @@ -314,8 +310,8 @@ - - + + diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp index 4a5d32a4..1cea0d96 100644 --- a/osdep/WindowsEthernetTap.cpp +++ b/osdep/WindowsEthernetTap.cpp @@ -594,7 +594,10 @@ void WindowsEthernetTap::threadMain() Utils::snprintf(tapPath,sizeof(tapPath),"\\\\.\\Global\\%s.tap",_netCfgInstanceId.c_str()); int prevTapResetStatus = _systemTapResetStatus; + bool throwOneAway = true; // "Power cycle" the network port once on startup, because Windows... while (_run) { + Sleep(500); + _tap = CreateFileA(tapPath,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_SYSTEM|FILE_FLAG_OVERLAPPED,NULL); if (_tap == INVALID_HANDLE_VALUE) { fprintf(stderr,"Error opening %s -- retrying.\r\n",tapPath); @@ -698,7 +701,8 @@ void WindowsEthernetTap::threadMain() ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead); bool writeInProgress = false; while (_run) { - if (prevTapResetStatus != _systemTapResetStatus) { + if ((prevTapResetStatus != _systemTapResetStatus)||(throwOneAway)) { + throwOneAway = false; prevTapResetStatus = _systemTapResetStatus; break; // this will cause us to close and reopen the tap } diff --git a/service/OneService.cpp b/service/OneService.cpp index fc2fba41..a566449f 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -523,7 +523,7 @@ public: { TcpConnection *tc = reinterpret_cast(*uptr); if (tc->writeBuf.length()) { - long sent = _phy.tcpSend(sock,tc->writeBuf.data(),tc->writeBuf.length(),true); + long sent = (long)_phy.tcpSend(sock,tc->writeBuf.data(),(unsigned long)tc->writeBuf.length(),true); if (sent > 0) { tc->lastActivity = OSUtils::now(); if ((unsigned long)sent == (unsigned long)tc->writeBuf.length()) { -- cgit v1.2.3 From dd701886437d654482ab454b220d41de1dbff012 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 18:40:34 -0700 Subject: Make tap driver even more defensive... seems to maybe fix the new network problem. Have to test a bit more. --- ext/installfiles/windows/ZeroTier One.aip | 2 +- osdep/WindowsEthernetTap.cpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'ext') diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index 4be09951..69c2c0b7 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -23,7 +23,7 @@ - + diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp index 1cea0d96..77e7dc9c 100644 --- a/osdep/WindowsEthernetTap.cpp +++ b/osdep/WindowsEthernetTap.cpp @@ -578,11 +578,6 @@ void WindowsEthernetTap::threadMain() HANDLE wait4[3]; char *tapReadBuf = (char *)0; - if (!_enableTapDevice()) { - _enabled = false; - return; // only happens if devcon is missing or totally fails - } - /* No idea why I did this. I did it a long time ago and there was only a * a snarky comment. But I'd never do crap like this without a reason, so * I am leaving it alone with a more descriptive snarky comment. */ @@ -596,6 +591,9 @@ void WindowsEthernetTap::threadMain() int prevTapResetStatus = _systemTapResetStatus; bool throwOneAway = true; // "Power cycle" the network port once on startup, because Windows... while (_run) { + _disableTapDevice(); + Sleep(500); + _enableTapDevice(); Sleep(500); _tap = CreateFileA(tapPath,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_SYSTEM|FILE_FLAG_OVERLAPPED,NULL); -- cgit v1.2.3 From 0caac25d28a3c08b91020ed8fa893887229c017a Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 May 2015 20:13:19 -0700 Subject: . --- attic/updater.cpp | 177 +++++++++++++++++++++++++++++++ buildinstaller.sh | 131 ----------------------- ext/installfiles/linux/buildinstaller.sh | 131 +++++++++++++++++++++++ updater.cpp | 177 ------------------------------- 4 files changed, 308 insertions(+), 308 deletions(-) create mode 100644 attic/updater.cpp delete mode 100755 buildinstaller.sh create mode 100755 ext/installfiles/linux/buildinstaller.sh delete mode 100644 updater.cpp (limited to 'ext') diff --git a/attic/updater.cpp b/attic/updater.cpp new file mode 100644 index 00000000..bc36394b --- /dev/null +++ b/attic/updater.cpp @@ -0,0 +1,177 @@ +/* + * ZeroTier One - Network Virtualization Everywhere + * Copyright (C) 2011-2015 ZeroTier, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * -- + * + * ZeroTier may be used and distributed under the terms of the GPLv3, which + * are available at: http://www.gnu.org/licenses/gpl-3.0.html + * + * If you would like to embed ZeroTier into a commercial application or + * redistribute it in a modified binary form, please contact ZeroTier Networks + * LLC. Start here: http://www.zerotier.com/ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "version.h" +#include "include/ZeroTierOne.h" +#include "node/Constants.hpp" + +#ifdef __WINDOWS__ +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#endif + +#include "node/Utils.hpp" +#include "node/Address.hpp" +#include "node/Dictionary.hpp" +#include "node/Identity.hpp" +#include "osdep/OSUtils.hpp" +#include "osdep/Http.hpp" + +using namespace ZeroTier; + +namespace { + +static std::map< Address,Identity > updateAuthorities() +{ + std::map< Address,Identity > ua; + { // 0001 + Identity id("e9bc3707b5:0:c4cef17bde99eadf9748c4fd11b9b06dc5cd8eb429227811d2c336e6b96a8d329e8abd0a4f45e47fe1bcebf878c004c822d952ff77fc2833af4c74e65985c435"); + ua[id.address()] = id; + } + { // 0002 + Identity id("56520eaf93:0:7d858b47988b34399a9a31136de07b46104d7edb4a98fa1d6da3e583d3a33e48be531532b886f0b12cd16794a66ab9220749ec5112cbe96296b18fe0cc79ca05"); + ua[id.address()] = id; + } + { // 0003 + Identity id("7c195de2e0:0:9f659071c960f9b0f0b96f9f9ecdaa27c7295feed9c79b7db6eedcc11feb705e6dd85c70fa21655204d24c897865b99eb946b753a2bbcf2be5f5e006ae618c54"); + ua[id.address()] = id; + } + { // 0004 + Identity id("415f4cfde7:0:54118e87777b0ea5d922c10b337c4f4bd1db7141845bd54004b3255551a6e356ba6b9e1e85357dbfafc45630b8faa2ebf992f31479e9005f0472685f2d8cbd6e"); + ua[id.address()] = id; + } + return ua; +} + +static bool validateUpdate( + const void *data, + unsigned int len, + const Address &signedBy, + const std::string &signature) +{ + std::map< Address,Identity > ua(updateAuthorities()); + std::map< Address,Identity >::const_iterator updateAuthority = ua.find(signedBy); + if (updateAuthority == ua.end()) + return false; + return updateAuthority->second.verify(data,len,signature.data(),(unsigned int)signature.length()); +} + +/* +static inline const char *updateUrl() +{ +#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) + if (sizeof(void *) == 8) + return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo"; + else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo"; +#define GOT_UPDATE_URL +#endif + +#ifdef __APPLE__ + return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo"; +#define GOT_UPDATE_URL +#endif + +#ifdef __WINDOWS__ + return "http://download.zerotier.com/ZeroTierOneInstaller-windows-intel-LATEST.nfo"; +#define GOT_UPDATE_URL +#endif + +#ifndef GOT_UPDATE_URL + return ""; +#endif +} +*/ + +static const char *parseUpdateNfo( + const char *nfoText, + unsigned int &vMajor, + unsigned int &vMinor, + unsigned int &vRevision, + Address &signedBy, + std::string &signature, + std::string &url) +{ + try { + Dictionary nfo(nfoText); + + vMajor = Utils::strToUInt(nfo.get("vMajor").c_str()); + vMinor = Utils::strToUInt(nfo.get("vMinor").c_str()); + vRevision = Utils::strToUInt(nfo.get("vRevision").c_str()); + signedBy = nfo.get("signedBy"); + signature = Utils::unhex(nfo.get("ed25519")); + url = nfo.get("url"); + + if (signature.length() != ZT_C25519_SIGNATURE_LEN) + return "bad ed25519 signature, invalid length"; + if ((url.length() <= 7)||(url.substr(0,7) != "http://")) + return "invalid URL, must begin with http://"; + + return (const char *)0; + } catch ( ... ) { + return "invalid NFO file format or one or more required fields missing"; + } +} + +} // anonymous namespace + +#ifdef __WINDOWS__ +int _tmain(int argc, _TCHAR* argv[]) +#else +int main(int argc,char **argv) +#endif +{ +#ifdef __WINDOWS__ + WSADATA wsaData; + WSAStartup(MAKEWORD(2,2),&wsaData); +#endif + + return 0; +} diff --git a/buildinstaller.sh b/buildinstaller.sh deleted file mode 100755 index 8f252dff..00000000 --- a/buildinstaller.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash - -# This script builds the installer for *nix systems. Windows must do everything -# completely differently, as usual. - -export PATH=/bin:/usr/bin:/sbin:/usr/sbin - -if [ ! -f zerotier-one ]; then - echo "Could not find 'zerotier-one' binary, please build before running this script." - exit 2 -fi - -machine=`uname -m` -system=`uname -s` - -vmajor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MAJOR | cut -d ' ' -f 3` -vminor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MINOR | cut -d ' ' -f 3` -revision=`cat version.h | grep -F ZEROTIER_ONE_VERSION_REVISION | cut -d ' ' -f 3` - -if [ -z "$vmajor" -o -z "$vminor" -o -z "$revision" ]; then - echo "Unable to extract version info from version.h, aborting installer build." - exit 2 -fi - -rm -rf build-installer -mkdir build-installer - -case "$system" in - - Linux) - # Canonicalize $machine for some architectures... we use x86 - # and x64 for Intel stuff. ARM and others should be fine if - # we ever ship officially for those. - debian_arch=$machine - case "$machine" in - i386|i486|i586|i686) - machine="x86" - debian_arch="i386" - ;; - x86_64|amd64|x64) - machine="x64" - debian_arch="amd64" - ;; - armv6l|arm|armhf) - machine="armv6l" - debian_arch="armhf" - ;; - esac - - echo "Assembling Linux installer for $machine and version $vmajor.$vminor.$revision" - - mkdir -p 'build-installer/var/lib/zerotier-one' - cp -fp 'ext/installfiles/linux/uninstall.sh' 'build-installer/var/lib/zerotier-one' - cp -fp 'zerotier-one' 'build-installer/var/lib/zerotier-one' - mkdir -p 'build-installer/tmp' - cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/tmp/init.d_zerotier-one' - cp -fp 'ext/installfiles/linux/systemd/zerotier-one.service' 'build-installer/tmp/systemd_zerotier-one.service' - - targ="ZeroTierOneInstaller-linux-${machine}-${vmajor}_${vminor}_${revision}" - # Use gzip in Linux since some minimal Linux systems do not have bunzip2 - rm -f build-installer-tmp.tar.gz - cd build-installer - tar -cf - * | gzip -9 >../build-installer-tmp.tar.gz - cd .. - rm -f $targ - cat ext/installfiles/linux/install.tmpl.sh build-installer-tmp.tar.gz >$targ - chmod 0755 $targ - rm -f build-installer-tmp.tar.gz - ls -l $targ - - if [ -f /usr/bin/dpkg-deb -a "$UID" -eq 0 ]; then - echo - echo Found dpkg-deb and you are root, trying to build Debian package. - - rm -rf build-installer-deb - - debbase="build-installer-deb/zerotier-one_${vmajor}.${vminor}.${revision}.autoupdating_$debian_arch" - debfolder="${debbase}/DEBIAN" - mkdir -p $debfolder - - cat 'ext/installfiles/linux/DEBIAN/control.in' | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}.autoupdating/" | sed "s/__ARCH__/${debian_arch}/" >$debfolder/control - cat $debfolder/control - cp -f 'ext/installfiles/linux/DEBIAN/conffiles' "${debfolder}/conffiles" - - mkdir -p "${debbase}/var/lib/zerotier-one/updates.d" - cp -f $targ "${debbase}/var/lib/zerotier-one/updates.d" - - rm -f "${debfolder}/postinst" "${debfolder}/prerm" - - echo '#!/bin/bash' >${debfolder}/postinst - echo "/var/lib/zerotier-one/updates.d/${targ}" >>${debfolder}/postinst - echo "/bin/rm -f /var/lib/zerotier-one/updates.d/*" >>${debfolder}/postinst - chmod a+x ${debfolder}/postinst - - echo '#!/bin/bash' >${debfolder}/prerm - echo 'export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin' >>${debfolder}/prerm - echo 'if [ "$1" != "upgrade" ]; then' >>${debfolder}/prerm - echo ' /var/lib/zerotier-one/uninstall.sh' >>${debfolder}/prerm - echo 'fi' >>${debfolder}/prerm - chmod a+x ${debfolder}/prerm - - dpkg-deb --build $debbase - - mv -f build-installer-deb/*.deb . - rm -rf build-installer-deb - fi - - if [ -f /usr/bin/rpmbuild ]; then - echo - echo Found rpmbuild, trying to build RedHat/CentOS package. - - rm -f /tmp/zerotier-one.spec - curr_dir=`pwd` - cat ext/installfiles/linux/RPM/zerotier-one.spec.in | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}/g" | sed "s/__INSTALLER__/${targ}/g" >/tmp/zerotier-one.spec - - rpmbuild -ba /tmp/zerotier-one.spec - - rm -f /tmp/zerotier-one.spec - fi - - ;; - - *) - echo "Unsupported platform: $system" - exit 2 - -esac - -rm -rf build-installer - -exit 0 diff --git a/ext/installfiles/linux/buildinstaller.sh b/ext/installfiles/linux/buildinstaller.sh new file mode 100755 index 00000000..8f252dff --- /dev/null +++ b/ext/installfiles/linux/buildinstaller.sh @@ -0,0 +1,131 @@ +#!/bin/bash + +# This script builds the installer for *nix systems. Windows must do everything +# completely differently, as usual. + +export PATH=/bin:/usr/bin:/sbin:/usr/sbin + +if [ ! -f zerotier-one ]; then + echo "Could not find 'zerotier-one' binary, please build before running this script." + exit 2 +fi + +machine=`uname -m` +system=`uname -s` + +vmajor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MAJOR | cut -d ' ' -f 3` +vminor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MINOR | cut -d ' ' -f 3` +revision=`cat version.h | grep -F ZEROTIER_ONE_VERSION_REVISION | cut -d ' ' -f 3` + +if [ -z "$vmajor" -o -z "$vminor" -o -z "$revision" ]; then + echo "Unable to extract version info from version.h, aborting installer build." + exit 2 +fi + +rm -rf build-installer +mkdir build-installer + +case "$system" in + + Linux) + # Canonicalize $machine for some architectures... we use x86 + # and x64 for Intel stuff. ARM and others should be fine if + # we ever ship officially for those. + debian_arch=$machine + case "$machine" in + i386|i486|i586|i686) + machine="x86" + debian_arch="i386" + ;; + x86_64|amd64|x64) + machine="x64" + debian_arch="amd64" + ;; + armv6l|arm|armhf) + machine="armv6l" + debian_arch="armhf" + ;; + esac + + echo "Assembling Linux installer for $machine and version $vmajor.$vminor.$revision" + + mkdir -p 'build-installer/var/lib/zerotier-one' + cp -fp 'ext/installfiles/linux/uninstall.sh' 'build-installer/var/lib/zerotier-one' + cp -fp 'zerotier-one' 'build-installer/var/lib/zerotier-one' + mkdir -p 'build-installer/tmp' + cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/tmp/init.d_zerotier-one' + cp -fp 'ext/installfiles/linux/systemd/zerotier-one.service' 'build-installer/tmp/systemd_zerotier-one.service' + + targ="ZeroTierOneInstaller-linux-${machine}-${vmajor}_${vminor}_${revision}" + # Use gzip in Linux since some minimal Linux systems do not have bunzip2 + rm -f build-installer-tmp.tar.gz + cd build-installer + tar -cf - * | gzip -9 >../build-installer-tmp.tar.gz + cd .. + rm -f $targ + cat ext/installfiles/linux/install.tmpl.sh build-installer-tmp.tar.gz >$targ + chmod 0755 $targ + rm -f build-installer-tmp.tar.gz + ls -l $targ + + if [ -f /usr/bin/dpkg-deb -a "$UID" -eq 0 ]; then + echo + echo Found dpkg-deb and you are root, trying to build Debian package. + + rm -rf build-installer-deb + + debbase="build-installer-deb/zerotier-one_${vmajor}.${vminor}.${revision}.autoupdating_$debian_arch" + debfolder="${debbase}/DEBIAN" + mkdir -p $debfolder + + cat 'ext/installfiles/linux/DEBIAN/control.in' | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}.autoupdating/" | sed "s/__ARCH__/${debian_arch}/" >$debfolder/control + cat $debfolder/control + cp -f 'ext/installfiles/linux/DEBIAN/conffiles' "${debfolder}/conffiles" + + mkdir -p "${debbase}/var/lib/zerotier-one/updates.d" + cp -f $targ "${debbase}/var/lib/zerotier-one/updates.d" + + rm -f "${debfolder}/postinst" "${debfolder}/prerm" + + echo '#!/bin/bash' >${debfolder}/postinst + echo "/var/lib/zerotier-one/updates.d/${targ}" >>${debfolder}/postinst + echo "/bin/rm -f /var/lib/zerotier-one/updates.d/*" >>${debfolder}/postinst + chmod a+x ${debfolder}/postinst + + echo '#!/bin/bash' >${debfolder}/prerm + echo 'export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin' >>${debfolder}/prerm + echo 'if [ "$1" != "upgrade" ]; then' >>${debfolder}/prerm + echo ' /var/lib/zerotier-one/uninstall.sh' >>${debfolder}/prerm + echo 'fi' >>${debfolder}/prerm + chmod a+x ${debfolder}/prerm + + dpkg-deb --build $debbase + + mv -f build-installer-deb/*.deb . + rm -rf build-installer-deb + fi + + if [ -f /usr/bin/rpmbuild ]; then + echo + echo Found rpmbuild, trying to build RedHat/CentOS package. + + rm -f /tmp/zerotier-one.spec + curr_dir=`pwd` + cat ext/installfiles/linux/RPM/zerotier-one.spec.in | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}/g" | sed "s/__INSTALLER__/${targ}/g" >/tmp/zerotier-one.spec + + rpmbuild -ba /tmp/zerotier-one.spec + + rm -f /tmp/zerotier-one.spec + fi + + ;; + + *) + echo "Unsupported platform: $system" + exit 2 + +esac + +rm -rf build-installer + +exit 0 diff --git a/updater.cpp b/updater.cpp deleted file mode 100644 index bc36394b..00000000 --- a/updater.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * ZeroTier One - Network Virtualization Everywhere - * Copyright (C) 2011-2015 ZeroTier, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * -- - * - * ZeroTier may be used and distributed under the terms of the GPLv3, which - * are available at: http://www.gnu.org/licenses/gpl-3.0.html - * - * If you would like to embed ZeroTier into a commercial application or - * redistribute it in a modified binary form, please contact ZeroTier Networks - * LLC. Start here: http://www.zerotier.com/ - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "version.h" -#include "include/ZeroTierOne.h" -#include "node/Constants.hpp" - -#ifdef __WINDOWS__ -#include -#include -#include -#include -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif - -#include "node/Utils.hpp" -#include "node/Address.hpp" -#include "node/Dictionary.hpp" -#include "node/Identity.hpp" -#include "osdep/OSUtils.hpp" -#include "osdep/Http.hpp" - -using namespace ZeroTier; - -namespace { - -static std::map< Address,Identity > updateAuthorities() -{ - std::map< Address,Identity > ua; - { // 0001 - Identity id("e9bc3707b5:0:c4cef17bde99eadf9748c4fd11b9b06dc5cd8eb429227811d2c336e6b96a8d329e8abd0a4f45e47fe1bcebf878c004c822d952ff77fc2833af4c74e65985c435"); - ua[id.address()] = id; - } - { // 0002 - Identity id("56520eaf93:0:7d858b47988b34399a9a31136de07b46104d7edb4a98fa1d6da3e583d3a33e48be531532b886f0b12cd16794a66ab9220749ec5112cbe96296b18fe0cc79ca05"); - ua[id.address()] = id; - } - { // 0003 - Identity id("7c195de2e0:0:9f659071c960f9b0f0b96f9f9ecdaa27c7295feed9c79b7db6eedcc11feb705e6dd85c70fa21655204d24c897865b99eb946b753a2bbcf2be5f5e006ae618c54"); - ua[id.address()] = id; - } - { // 0004 - Identity id("415f4cfde7:0:54118e87777b0ea5d922c10b337c4f4bd1db7141845bd54004b3255551a6e356ba6b9e1e85357dbfafc45630b8faa2ebf992f31479e9005f0472685f2d8cbd6e"); - ua[id.address()] = id; - } - return ua; -} - -static bool validateUpdate( - const void *data, - unsigned int len, - const Address &signedBy, - const std::string &signature) -{ - std::map< Address,Identity > ua(updateAuthorities()); - std::map< Address,Identity >::const_iterator updateAuthority = ua.find(signedBy); - if (updateAuthority == ua.end()) - return false; - return updateAuthority->second.verify(data,len,signature.data(),(unsigned int)signature.length()); -} - -/* -static inline const char *updateUrl() -{ -#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) - if (sizeof(void *) == 8) - return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo"; - else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifdef __APPLE__ - return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifdef __WINDOWS__ - return "http://download.zerotier.com/ZeroTierOneInstaller-windows-intel-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifndef GOT_UPDATE_URL - return ""; -#endif -} -*/ - -static const char *parseUpdateNfo( - const char *nfoText, - unsigned int &vMajor, - unsigned int &vMinor, - unsigned int &vRevision, - Address &signedBy, - std::string &signature, - std::string &url) -{ - try { - Dictionary nfo(nfoText); - - vMajor = Utils::strToUInt(nfo.get("vMajor").c_str()); - vMinor = Utils::strToUInt(nfo.get("vMinor").c_str()); - vRevision = Utils::strToUInt(nfo.get("vRevision").c_str()); - signedBy = nfo.get("signedBy"); - signature = Utils::unhex(nfo.get("ed25519")); - url = nfo.get("url"); - - if (signature.length() != ZT_C25519_SIGNATURE_LEN) - return "bad ed25519 signature, invalid length"; - if ((url.length() <= 7)||(url.substr(0,7) != "http://")) - return "invalid URL, must begin with http://"; - - return (const char *)0; - } catch ( ... ) { - return "invalid NFO file format or one or more required fields missing"; - } -} - -} // anonymous namespace - -#ifdef __WINDOWS__ -int _tmain(int argc, _TCHAR* argv[]) -#else -int main(int argc,char **argv) -#endif -{ -#ifdef __WINDOWS__ - WSADATA wsaData; - WSAStartup(MAKEWORD(2,2),&wsaData); -#endif - - return 0; -} -- cgit v1.2.3 From b6698d8415728a249426ee784fcbebfdfb8e4632 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 20 May 2015 16:35:33 -0700 Subject: Ground work for reincorporating software updater for select platforms. --- ext/installfiles/mac/get-proxy-settings.sh | 6 +++--- make-mac.mk | 20 ++++++++++++-------- one.cpp | 3 +++ service/OneService.cpp | 28 ++++++++++++++++++++++++++++ service/OneService.hpp | 14 ++++++++++++++ 5 files changed, 60 insertions(+), 11 deletions(-) (limited to 'ext') diff --git a/ext/installfiles/mac/get-proxy-settings.sh b/ext/installfiles/mac/get-proxy-settings.sh index 873a8558..16ba0b47 100755 --- a/ext/installfiles/mac/get-proxy-settings.sh +++ b/ext/installfiles/mac/get-proxy-settings.sh @@ -5,9 +5,9 @@ export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin -enabled=`system_profiler SPNetworkDataType|grep "HTTP Proxy Enabled"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` -port=`system_profiler SPNetworkDataType|grep "HTTP Proxy Port"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` -serv=`system_profiler SPNetworkDataType|grep "HTTP Proxy Server"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'}` +enabled=`system_profiler SPNetworkDataType|grep "HTTP Proxy Enabled"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'} 2>/dev/null` +port=`system_profiler SPNetworkDataType|grep "HTTP Proxy Port"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'} 2>/dev/null` +serv=`system_profiler SPNetworkDataType|grep "HTTP Proxy Server"|awk {'sub(/^.*:[ \t]*/, "", $0); print $0;'} 2>/dev/null` if [ "$enabled" = "Yes" ]; then if [ "$serv" ]; then diff --git a/make-mac.mk b/make-mac.mk index 717cbccb..4ad4c5ad 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -13,18 +13,13 @@ OBJS+=osdep/OSXEthernetTap.o CODESIGN=echo CODESIGN_CERT= +# For internal use only -- signs everything with ZeroTier's developer cert ifeq ($(ZT_OFFICIAL_RELEASE),1) - # For use by ZeroTier Networks -- sign with developer cert - ZT_AUTO_UPDATE=1 - DEFS+=-DZT_OFFICIAL_RELEASE + DEFS+=-DZT_OFFICIAL_RELEASE -DZT_AUTO_UPDATE CODESIGN=codesign CODESIGN_CERT="Developer ID Application: ZeroTier Networks LLC (8ZD9JUCZ4V)" endif -ifeq ($(ZT_AUTO_UPDATE),1) - DEFS+=-DZT_AUTO_UPDATE -endif - # Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1) DEFS+=-DZT_ENABLE_NETWORK_CONTROLLER @@ -35,6 +30,7 @@ endif # Enable SSE-optimized Salsa20 -- all Intel macs support SSE2 DEFS+=-DZT_SALSA20_SSE +# Debug mode -- dump trace output, build binary with -g ifeq ($(ZT_DEBUG),1) DEFS+=-DZT_TRACE CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS) @@ -63,10 +59,18 @@ selftest: $(OBJS) selftest.o $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS) $(STRIP) zerotier-selftest -sign-pkg: FORCE +# Requires Packages: http://s.sudre.free.fr/Software/Packages/about.html +mac-dist-pkg: FORCE + cd ext/installfiles/mac ; packagesbuild "ZeroTier One.pkgproj" $(CODESIGN) -f -s $(CODESIGN_CERT) "ZeroTier One.pkg" $(CODESIGN) -vvv "ZeroTier One.pkg" +# For internal use only +official: FORCE + make clean + make -j 4 ZT_OFFICIAL_RELEASE=1 + make ZT_OFFICIAL_RELEASE=1 mac-dist-pkg + clean: rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o zerotier-one zerotier-idtool zerotier-selftest zerotier-cli ZeroTierOneInstaller-* diff --git a/one.cpp b/one.cpp index 4a0a57e8..f2d7970b 100644 --- a/one.cpp +++ b/one.cpp @@ -888,6 +888,9 @@ static void printHelp(const char *cn,FILE *out) { fprintf(out,"ZeroTier One version %d.%d.%d"ZT_EOL_S"(c)2011-2015 ZeroTier, Inc."ZT_EOL_S,ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION); fprintf(out,"Licensed under the GNU General Public License v3"ZT_EOL_S""ZT_EOL_S); + std::string updateUrl(OneService::autoUpdateUrl()); + if (updateUrl.length()) + fprintf(out,"Automatic update enabled:"ZT_EOL_S" %s"ZT_EOL_S""ZT_EOL_S,updateUrl.c_str()); fprintf(out,"Usage: %s [-switches] [home directory]"ZT_EOL_S""ZT_EOL_S,cn); fprintf(out,"Available switches:"ZT_EOL_S); fprintf(out," -h - Display this help"ZT_EOL_S); diff --git a/service/OneService.cpp b/service/OneService.cpp index a566449f..c2ea034b 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -96,6 +96,8 @@ namespace ZeroTier { typedef BSDEthernetTap EthernetTap; } namespace ZeroTier { +namespace { + class OneServiceImpl; static int SnodeVirtualNetworkConfigFunction(ZT1_Node *node,void *uptr,uint64_t nwid,enum ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nwconf); @@ -903,6 +905,8 @@ static int ShttpOnMessageComplete(http_parser *parser) return 0; } +} // anonymous namespace + std::string OneService::platformDefaultHomePath() { #ifdef __UNIX_LIKE__ @@ -939,6 +943,30 @@ std::string OneService::platformDefaultHomePath() #endif // __UNIX_LIKE__ or not... } +std::string OneService::autoUpdateUrl() +{ +#ifdef ZT_AUTO_UPDATE + +/* +#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) + if (sizeof(void *) == 8) + return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo"; + else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo"; +#endif +*/ + +#if defined(__APPLE__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) + return "http://download.zerotier.com/update/mac_intel/LATEST.nfo"; +#endif + +#ifdef __WINDOWS__ + return "http://download.zerotier.com/update/win_intel/LATEST.nfo"; +#endif + +#endif // ZT_AUTO_UPDATE + return std::string(); +} + OneService *OneService::newInstance(const char *hp,unsigned int port,const char *overrideRootTopology) { return new OneServiceImpl(hp,port,overrideRootTopology); } OneService::~OneService() {} diff --git a/service/OneService.hpp b/service/OneService.hpp index 33c40547..aea314f5 100644 --- a/service/OneService.hpp +++ b/service/OneService.hpp @@ -34,6 +34,15 @@ namespace ZeroTier { /** * Local service for ZeroTier One as system VPN/NFV provider + * + * If built with ZT_ENABLE_NETWORK_CONTROLLER defined, this includes and + * runs controller/SqliteNetworkController with a database called + * controller.db in the specified home directory. + * + * If built with ZT_AUTO_UPDATE, an official ZeroTier update URL is + * periodically checked and updates are automatically downloaded, verified + * against a built-in list of update signing keys, and installed. This is + * only supported for certain platforms. */ class OneService { @@ -69,6 +78,11 @@ public: */ static std::string platformDefaultHomePath(); + /** + * @return Auto-update URL or empty string if auto-updates unsupported or not enabled + */ + static std::string autoUpdateUrl(); + /** * Create a new instance of the service * -- cgit v1.2.3 From 12130739166895db88dca0c230f3972bd3ac3d6a Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 20 May 2015 19:38:49 -0700 Subject: Apple auto-update stuff, now for Windows. --- attic/SoftwareUpdater.cpp | 328 --------------------------------------- attic/SoftwareUpdater.hpp | 186 ---------------------- ext/installfiles/mac/postinst.sh | 6 +- ext/installfiles/mac/preinst.sh | 22 ++- make-mac.mk | 4 + node/Node.cpp | 2 +- node/Peer.hpp | 25 --- node/Utils.hpp | 27 ++++ service/OneService.cpp | 180 ++++++++++++++++++++- updater.cpp | 177 --------------------- 10 files changed, 227 insertions(+), 730 deletions(-) delete mode 100644 attic/SoftwareUpdater.cpp delete mode 100644 attic/SoftwareUpdater.hpp delete mode 100644 updater.cpp (limited to 'ext') diff --git a/attic/SoftwareUpdater.cpp b/attic/SoftwareUpdater.cpp deleted file mode 100644 index e3789bcb..00000000 --- a/attic/SoftwareUpdater.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* - * ZeroTier One - Network Virtualization Everywhere - * Copyright (C) 2011-2015 ZeroTier, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * -- - * - * ZeroTier may be used and distributed under the terms of the GPLv3, which - * are available at: http://www.gnu.org/licenses/gpl-3.0.html - * - * If you would like to embed ZeroTier into a commercial application or - * redistribute it in a modified binary form, please contact ZeroTier Networks - * LLC. Start here: http://www.zerotier.com/ - */ - -#include -#include -#include - -#include - -#include "../version.h" - -#include "Constants.hpp" -#include "SoftwareUpdater.hpp" -#include "Dictionary.hpp" -#include "C25519.hpp" -#include "Identity.hpp" -#include "Logger.hpp" -#include "RuntimeEnvironment.hpp" -#include "Thread.hpp" -#include "Node.hpp" -#include "Utils.hpp" -#include "HttpClient.hpp" - -#ifdef __UNIX_LIKE__ -#include -#include -#include -#include -#endif - -namespace ZeroTier { - -static inline std::map< Address,Identity > _mkUpdateAuth() -{ - std::map< Address,Identity > ua; - - { // 0001 - Identity id("e9bc3707b5:0:c4cef17bde99eadf9748c4fd11b9b06dc5cd8eb429227811d2c336e6b96a8d329e8abd0a4f45e47fe1bcebf878c004c822d952ff77fc2833af4c74e65985c435"); - ua[id.address()] = id; - } - { // 0002 - Identity id("56520eaf93:0:7d858b47988b34399a9a31136de07b46104d7edb4a98fa1d6da3e583d3a33e48be531532b886f0b12cd16794a66ab9220749ec5112cbe96296b18fe0cc79ca05"); - ua[id.address()] = id; - } - { // 0003 - Identity id("7c195de2e0:0:9f659071c960f9b0f0b96f9f9ecdaa27c7295feed9c79b7db6eedcc11feb705e6dd85c70fa21655204d24c897865b99eb946b753a2bbcf2be5f5e006ae618c54"); - ua[id.address()] = id; - } - { // 0004 - Identity id("415f4cfde7:0:54118e87777b0ea5d922c10b337c4f4bd1db7141845bd54004b3255551a6e356ba6b9e1e85357dbfafc45630b8faa2ebf992f31479e9005f0472685f2d8cbd6e"); - ua[id.address()] = id; - } - - return ua; -} - -static inline const char *_mkUpdateUrl() -{ -#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) - if (sizeof(void *) == 8) - return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo"; - else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifdef __APPLE__ - return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifdef __WINDOWS__ - return "http://download.zerotier.com/ZeroTierOneInstaller-windows-intel-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifndef GOT_UPDATE_URL - return ""; -#endif -} - -SoftwareUpdater::SoftwareUpdater(const RuntimeEnvironment *renv) : - RR(renv), - _myVersion(packVersion(ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION)), - _lastUpdateAttempt(0), - _status(UPDATE_STATUS_IDLE), - _die(false), - _lock() -{ -} - -SoftwareUpdater::~SoftwareUpdater() -{ - _die = true; - for(;;) { - _lock.lock(); - bool ip = (_status != UPDATE_STATUS_IDLE); - _lock.unlock(); - if (ip) - Thread::sleep(500); - else break; - } -} - -void SoftwareUpdater::cleanOldUpdates() -{ - std::string updatesDir(RR->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); - std::map dl(Utils::listDirectory(updatesDir.c_str())); - for(std::map::iterator i(dl.begin());i!=dl.end();++i) { - if (!i->second) - Utils::rm((updatesDir + ZT_PATH_SEPARATOR_S + i->first).c_str()); - } -} - -void SoftwareUpdater::sawRemoteVersion(unsigned int vmaj,unsigned int vmin,unsigned int rev) -{ - const uint64_t tmp = packVersion(vmaj,vmin,rev); - if (tmp > _myVersion) { - Mutex::Lock _l(_lock); - if ((_status == UPDATE_STATUS_IDLE)&&(!_die)&&(ZT_DEFAULTS.updateLatestNfoURL.length())) { - const uint64_t now = Utils::now(); - if ((now - _lastUpdateAttempt) >= ZT_UPDATE_MIN_INTERVAL) { - _lastUpdateAttempt = now; - _status = UPDATE_STATUS_GETTING_NFO; - RR->http->GET(ZT_DEFAULTS.updateLatestNfoURL,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionInfo,this); - } - } - } -} - -void SoftwareUpdater::checkNow() -{ - Mutex::Lock _l(_lock); - if (_status == UPDATE_STATUS_IDLE) { - _lastUpdateAttempt = Utils::now(); - _status = UPDATE_STATUS_GETTING_NFO; - RR->http->GET(ZT_DEFAULTS.updateLatestNfoURL,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionInfo,this); - } -} - -const char *SoftwareUpdater::parseNfo( - const char *nfoText, - unsigned int &vMajor, - unsigned int &vMinor, - unsigned int &vRevision, - Address &signedBy, - std::string &signature, - std::string &url) -{ - try { - Dictionary nfo(nfoText); - - vMajor = Utils::strToUInt(nfo.get("vMajor").c_str()); - vMinor = Utils::strToUInt(nfo.get("vMinor").c_str()); - vRevision = Utils::strToUInt(nfo.get("vRevision").c_str()); - signedBy = nfo.get("signedBy"); - signature = Utils::unhex(nfo.get("ed25519")); - url = nfo.get("url"); - - if (signature.length() != ZT_C25519_SIGNATURE_LEN) - return "bad ed25519 signature, invalid length"; - if ((url.length() <= 7)||(url.substr(0,7) != "http://")) - return "invalid URL, must begin with http://"; - - return (const char *)0; - } catch ( ... ) { - return "invalid NFO file format or one or more required fields missing"; - } -} - -bool SoftwareUpdater::validateUpdate( - const void *data, - unsigned int len, - const Address &signedBy, - const std::string &signature) -{ - std::map< Address,Identity >::const_iterator updateAuthority = ZT_DEFAULTS.updateAuthorities.find(signedBy); - if (updateAuthority == ZT_DEFAULTS.updateAuthorities.end()) - return false; - return updateAuthority->second.verify(data,len,signature.data(),(unsigned int)signature.length()); -} - -void SoftwareUpdater::_cbHandleGetLatestVersionInfo(void *arg,int code,const std::string &url,const std::string &body) -{ - SoftwareUpdater *upd = (SoftwareUpdater *)arg; - const RuntimeEnvironment *RR = (const RuntimeEnvironment *)upd->RR; - Mutex::Lock _l(upd->_lock); - - if ((upd->_die)||(upd->_status != UPDATE_STATUS_GETTING_NFO)) { - upd->_status = UPDATE_STATUS_IDLE; - return; - } - - if (code != 200) { - LOG("software update check failed: server responded with code %d",code); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - - try { - unsigned int vMajor = 0,vMinor = 0,vRevision = 0; - Address signedBy; - std::string signature,url; - - const char *err = parseNfo(body.c_str(),vMajor,vMinor,vRevision,signedBy,signature,url); - - if (err) { - LOG("software update check aborted: .nfo file parse error: %s",err); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - - if (!ZT_DEFAULTS.updateAuthorities.count(signedBy)) { - LOG("software update check aborted: .nfo file specifies unknown signing authority"); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - -#ifndef ZT_ALWAYS_UPDATE /* for testing */ - if (packVersion(vMajor,vMinor,vRevision) <= upd->_myVersion) { - TRACE("software update check complete: version on update site is not newer than my version, no update necessary"); - upd->_status = UPDATE_STATUS_IDLE; - return; - } -#endif - - upd->_status = UPDATE_STATUS_GETTING_FILE; - upd->_signedBy = signedBy; - upd->_signature = signature; - - RR->http->GET(url,HttpClient::NO_HEADERS,ZT_UPDATE_HTTP_TIMEOUT,&_cbHandleGetLatestVersionBinary,arg); - } catch ( ... ) { - LOG("software update check failed: .nfo file invalid or missing field(s)"); - upd->_status = UPDATE_STATUS_IDLE; - } -} - -void SoftwareUpdater::_cbHandleGetLatestVersionBinary(void *arg,int code,const std::string &url,const std::string &body) -{ - SoftwareUpdater *upd = (SoftwareUpdater *)arg; - const RuntimeEnvironment *RR = (const RuntimeEnvironment *)upd->RR; - Mutex::Lock _l(upd->_lock); - - if (!validateUpdate(body.data(),(unsigned int)body.length(),upd->_signedBy,upd->_signature)) { - LOG("software update failed: update fetched from '%s' failed signature check (image size: %u)",url.c_str(),(unsigned int)body.length()); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - - size_t lastSlash = url.rfind('/'); - if (lastSlash == std::string::npos) { // sanity check, shouldn't happen - LOG("software update failed: invalid URL"); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - std::string updatesDir(RR->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); - std::string updateFilename(url.substr(lastSlash + 1)); - if ((updateFilename.length() < 3)||(updateFilename.find("..") != std::string::npos)) { - LOG("software update failed: invalid URL: filename contains invalid characters"); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - for(std::string::iterator c(updateFilename.begin());c!=updateFilename.end();++c) { - // Only allow a list of whitelisted characters to make up the filename to prevent any - // path shenanigans, esp on Windows where / is not the path separator. - if (!strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.0123456789",*c)) { - LOG("software update failed: invalid URL: filename contains invalid characters"); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - } - std::string updatePath(updatesDir + ZT_PATH_SEPARATOR_S + updateFilename); -#ifdef __WINDOWS__ - CreateDirectoryA(updatesDir.c_str(),NULL); -#else - mkdir(updatesDir.c_str(),0755); -#endif - - FILE *upf = fopen(updatePath.c_str(),"wb"); - if (!upf) { - LOG("software update failed: unable to open %s for writing",updatePath.c_str()); - upd->_status = UPDATE_STATUS_IDLE; - return; - } - if (fwrite(body.data(),body.length(),1,upf) != 1) { - LOG("software update failed: unable to write to %s",updatePath.c_str()); - upd->_status = UPDATE_STATUS_IDLE; - fclose(upf); - Utils::rm(updatePath); - return; - } - fclose(upf); - -#ifdef __UNIX_LIKE__ - ::chmod(updatePath.c_str(),0755); -#endif - - // We exit with this reason code and the path as the text. It is the - // caller's responsibility (main.c) to pick this up and do the right - // thing. - upd->_status = UPDATE_STATUS_IDLE; - RR->node->terminate(Node::NODE_RESTART_FOR_UPGRADE,updatePath.c_str()); -} - -} // namespace ZeroTier diff --git a/attic/SoftwareUpdater.hpp b/attic/SoftwareUpdater.hpp deleted file mode 100644 index 9beaa8ad..00000000 --- a/attic/SoftwareUpdater.hpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * ZeroTier One - Network Virtualization Everywhere - * Copyright (C) 2011-2015 ZeroTier, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * -- - * - * ZeroTier may be used and distributed under the terms of the GPLv3, which - * are available at: http://www.gnu.org/licenses/gpl-3.0.html - * - * If you would like to embed ZeroTier into a commercial application or - * redistribute it in a modified binary form, please contact ZeroTier Networks - * LLC. Start here: http://www.zerotier.com/ - */ - -#ifndef ZT_SOFTWAREUPDATER_HPP -#define ZT_SOFTWAREUPDATER_HPP - -#include - -#include - -#include "../node/Constants.hpp" -#include "../node/Mutex.hpp" -#include "../node/Address.hpp" - -#include "HttpClient.hpp" - -/** - * Delay between fetches of the root topology update URL - * - * 86400000 = check once every 24 hours (this doesn't change often) - */ -#define ZT_UPDATE_ROOT_TOPOLOGY_CHECK_INTERVAL 86400000 - -/** - * Minimum interval between attempts to do a software update - */ -#define ZT_UPDATE_MIN_INTERVAL 120000 - -/** - * Maximum interval between checks for new versions - */ -#define ZT_UPDATE_MAX_INTERVAL 7200000 - -/** - * Software update HTTP timeout in seconds - */ -#define ZT_UPDATE_HTTP_TIMEOUT 120 - -namespace ZeroTier { - -/** - * Software updater - */ -class SoftwareUpdater -{ -public: - SoftwareUpdater(); - ~SoftwareUpdater(); - - /** - * Remove old updates in updates.d - */ - void cleanOldUpdates(); - - /** - * Called on each version message from a peer - * - * If a peer has a newer version, that causes an update to be started. - * - * @param vmaj Peer's major version - * @param vmin Peer's minor version - * @param rev Peer's revision - */ - void sawRemoteVersion(unsigned int vmaj,unsigned int vmin,unsigned int rev); - - /** - * Check for updates now regardless of last check time or version - * - * This only starts a check if one is not in progress. Otherwise it does - * nothing. - */ - void checkNow(); - - /** - * Check for updates now if it's been longer than ZT_UPDATE_MAX_INTERVAL - * - * This is called periodically from the main loop. - */ - inline void checkIfMaxIntervalExceeded(uint64_t now) - { - if ((now - _lastUpdateAttempt) >= ZT_UPDATE_MAX_INTERVAL) - checkNow(); - } - - /** - * Pack three-component version into a 64-bit integer - * - * @param vmaj Major version (0..65535) - * @param vmin Minor version (0..65535) - * @param rev Revision (0..65535) - * @return Version packed into an easily comparable 64-bit integer - */ - static inline uint64_t packVersion(unsigned int vmaj,unsigned int vmin,unsigned int rev) - throw() - { - return ( ((uint64_t)(vmaj & 0xffff) << 32) | ((uint64_t)(vmin & 0xffff) << 16) | (uint64_t)(rev & 0xffff) ); - } - - /** - * Parse NFO data from .nfo file on software update site - * - * The first argument is the NFO data, and all the remaining arguments are - * result parameters to be filled with results. If an error is returned the - * results in the parameters should be considered undefined. - * - * @param nfo NFO data - * @param vMajor Result: major version - * @param vMinor Result: minor version - * @param vRevision Result: revision number - * @param signedBy Result: signing identity - * @param signature Result: Ed25519 signature data - * @param url Result: URL of update binary - * @return NULL on success or error message on failure - */ - static const char *parseNfo( - const char *nfoText, - unsigned int &vMajor, - unsigned int &vMinor, - unsigned int &vRevision, - Address &signedBy, - std::string &signature, - std::string &url); - - /** - * Validate an update once downloaded - * - * This obtains the identity corresponding to the address from the compiled-in - * list of valid signing identities. - * - * @param data Update data - * @param len Length of update data - * @param signedBy Signing authority address - * @param signature Signing authority signature - * @return True on validation success, false if rejected - */ - static bool validateUpdate( - const void *data, - unsigned int len, - const Address &signedBy, - const std::string &signature); - -private: - static void _cbHandleGetLatestVersionInfo(void *arg,int code,const std::string &url,const std::string &body); - static void _cbHandleGetLatestVersionBinary(void *arg,int code,const std::string &url,const std::string &body); - - HttpClient httpClient; - const uint64_t _myVersion; - volatile uint64_t _lastUpdateAttempt; - volatile enum { - UPDATE_STATUS_IDLE, - UPDATE_STATUS_GETTING_NFO, - UPDATE_STATUS_GETTING_FILE - } _status; - volatile bool _die; - Address _signedBy; - std::string _signature; - Mutex _lock; -}; - -} // namespace ZeroTier - -#endif diff --git a/ext/installfiles/mac/postinst.sh b/ext/installfiles/mac/postinst.sh index 094eea48..7d3d516f 100755 --- a/ext/installfiles/mac/postinst.sh +++ b/ext/installfiles/mac/postinst.sh @@ -3,15 +3,11 @@ export PATH=/bin:/usr/bin:/sbin:/usr/sbin launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 -sleep 1 -killall zerotier-one -sleep 1 -killall -9 zerotier-one cd "/Library/Application Support/ZeroTier/One" rm -rf node.log node.log.old root-topology shutdownIfUnreadable autoupdate.log updates.d if [ ! -f authtoken.secret ]; then - head -c 1024 /dev/urandom | md5 | head -c 24 >authtoken.secret + head -c 4096 /dev/urandom | md5 | head -c 24 >authtoken.secret chown root authtoken.secret chgrp wheel authtoken.secret chmod 0600 authtoken.secret diff --git a/ext/installfiles/mac/preinst.sh b/ext/installfiles/mac/preinst.sh index 9fa50bef..c2cb494b 100755 --- a/ext/installfiles/mac/preinst.sh +++ b/ext/installfiles/mac/preinst.sh @@ -4,11 +4,23 @@ export PATH=/bin:/usr/bin:/sbin:/usr/sbin if [ -f /Library/LaunchDaemons/com.zerotier.one.plist ]; then launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 - sleep 1 - killall zerotier-one - sleep 1 - killall -9 zerotier-one fi -cd /Applications +sleep 1 + +if [ -d "/Library/Application Support/ZeroTier/One" ]; then + cd "/Library/Application Support/ZeroTier/One" + if [ -f "zerotier-one.pid" ]; then + ztpid=`cat zerotier-one.pid` + if [ "$ztpid" -gt "0" ]; then + kill `cat zerotier-one.pid` + fi + fi +fi + +sleep 1 + +cd "/Applications" rm -rf "ZeroTier One.app" + +exit 0 diff --git a/make-mac.mk b/make-mac.mk index 4ad4c5ad..7d730ae5 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -20,6 +20,10 @@ ifeq ($(ZT_OFFICIAL_RELEASE),1) CODESIGN_CERT="Developer ID Application: ZeroTier Networks LLC (8ZD9JUCZ4V)" endif +ifeq ($(ZT_AUTO_UPDATE),1) + DEFS+=-DZT_AUTO_UPDATE +endif + # Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1) DEFS+=-DZT_ENABLE_NETWORK_CONTROLLER diff --git a/node/Node.cpp b/node/Node.cpp index 0e3ddd14..8eb9ae90 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -443,7 +443,7 @@ std::string Node::dataStoreGet(const char *name) void Node::postNewerVersionIfNewer(unsigned int major,unsigned int minor,unsigned int rev) { - if (Peer::compareVersion(major,minor,rev,_newestVersionSeen[0],_newestVersionSeen[1],_newestVersionSeen[2]) > 0) { + if (Utils::compareVersion(major,minor,rev,_newestVersionSeen[0],_newestVersionSeen[1],_newestVersionSeen[2]) > 0) { _newestVersionSeen[0] = major; _newestVersionSeen[1] = minor; _newestVersionSeen[2] = rev; diff --git a/node/Peer.hpp b/node/Peer.hpp index 343cfcfa..3d52761a 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -407,31 +407,6 @@ public: else return std::pair(); } - /** - * Compare Peer version tuples - */ - static inline int compareVersion(unsigned int maj1,unsigned int min1,unsigned int rev1,unsigned int maj2,unsigned int min2,unsigned int rev2) - throw() - { - if (maj1 > maj2) - return 1; - else if (maj1 < maj2) - return -1; - else { - if (min1 > min2) - return 1; - else if (min1 < min2) - return -1; - else { - if (rev1 > rev2) - return 1; - else if (rev1 < rev2) - return -1; - else return 0; - } - } - } - private: void _announceMulticastGroups(const RuntimeEnvironment *RR,uint64_t now); diff --git a/node/Utils.hpp b/node/Utils.hpp index bdd673a9..bd567cf5 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -381,6 +381,33 @@ public: } static inline int64_t ntoh(int64_t n) throw() { return (int64_t)ntoh((uint64_t)n); } + /** + * Compare Peer version tuples + * + * @return -1, 0, or 1 based on whether first tuple is less than, equal to, or greater than second + */ + static inline int compareVersion(unsigned int maj1,unsigned int min1,unsigned int rev1,unsigned int maj2,unsigned int min2,unsigned int rev2) + throw() + { + if (maj1 > maj2) + return 1; + else if (maj1 < maj2) + return -1; + else { + if (min1 > min2) + return 1; + else if (min1 < min2) + return -1; + else { + if (rev1 > rev2) + return 1; + else if (rev1 < rev2) + return -1; + else return 0; + } + } + } + /** * Hexadecimal characters 0-f */ diff --git a/service/OneService.cpp b/service/OneService.cpp index c2ea034b..b8a66f6f 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -46,9 +47,12 @@ #include "../node/Utils.hpp" #include "../node/InetAddress.hpp" #include "../node/MAC.hpp" +#include "../node/Identity.hpp" #include "../osdep/Phy.hpp" +#include "../osdep/Thread.hpp" #include "../osdep/OSUtils.hpp" +#include "../osdep/Http.hpp" #include "OneService.hpp" #include "ControlPlane.hpp" @@ -57,10 +61,14 @@ #include "../controller/SqliteNetworkController.hpp" #else class SqliteNetworkController; -#endif +#endif // ZT_ENABLE_NETWORK_CONTROLLER #ifdef __WINDOWS__ #include +#else +#include +#include +#include #endif // Include the right tap device driver for this platform -- add new platforms here @@ -98,6 +106,168 @@ namespace ZeroTier { namespace { +#ifdef ZT_AUTO_UPDATE +#define ZT_AUTO_UPDATE_MAX_HTTP_RESPONSE_SIZE (1024 * 1024 * 64) +class BackgroundSoftwareUpdateChecker +{ +public: + bool isValidSigningIdentity(const Identity &id) + { + return ( + /* 0005 */ (id == Identity("ba57ea350e:0:9d4be6d7f86c5660d5ee1951a3d759aa6e12a84fc0c0b74639500f1dbc1a8c566622e7d1c531967ebceb1e9d1761342f88324a8ba520c93c35f92f35080fa23f")) + /* 0006 */ ||(id == Identity("5067b21b83:0:8af477730f5055c48135b84bed6720a35bca4c0e34be4060a4c636288b1ec22217eb22709d610c66ed464c643130c51411bbb0294eef12fbe8ecc1a1e2c63a7a")) + /* 0007 */ ||(id == Identity("4f5e97a8f1:0:57880d056d7baeb04bbc057d6f16e6cb41388570e87f01492fce882485f65a798648595610a3ad49885604e7fb1db2dd3c2c534b75e42c3c0b110ad07b4bb138")) + /* 0008 */ ||(id == Identity("580bbb8e15:0:ad5ef31155bebc6bc413991992387e083fed26d699997ef76e7c947781edd47d1997161fa56ba337b1a2b44b129fd7c7197ce5185382f06011bc88d1363b4ddd")) + ); + } + + void doUpdateCheck() + { + std::string url(OneService::autoUpdateUrl()); + if ((url.length() <= 7)||(url.substr(0,7) != "http://")) + return; + + std::string httpHost; + std::string httpPath; + { + std::size_t slashIdx = url.substr(7).find_first_of('/'); + if (slashIdx == std::string::npos) { + httpHost = url.substr(7); + httpPath = "/"; + } else { + httpHost = url.substr(7,slashIdx); + httpPath = url.substr(slashIdx + 7); + } + } + if (httpHost.length() == 0) + return; + + std::vector ips(OSUtils::resolve(httpHost.c_str())); + for(std::vector::iterator ip(ips.begin());ip!=ips.end();++ip) { + if (!ip->port()) + ip->setPort(80); + std::string nfoPath = httpPath + "LATEST.nfo"; + std::map requestHeaders,responseHeaders; + std::string body; + requestHeaders["Host"] = httpHost; + unsigned int scode = Http::GET(ZT_AUTO_UPDATE_MAX_HTTP_RESPONSE_SIZE,60000,reinterpret_cast(&(*ip)),nfoPath.c_str(),requestHeaders,responseHeaders,body); + //fprintf(stderr,"UPDATE %s %s %u %lu\n",ip->toString().c_str(),nfoPath.c_str(),scode,body.length()); + if ((scode == 200)&&(body.length() > 0)) { + /* NFO fields: + * + * file= + * signedBy= + * ed25519= + * vMajor= + * vMinor= + * vRevision= */ + Dictionary nfo(body); + + unsigned int vMajor = Utils::strToUInt(nfo.get("vMajor","0").c_str()); + unsigned int vMinor = Utils::strToUInt(nfo.get("vMinor","0").c_str()); + unsigned int vRevision = Utils::strToUInt(nfo.get("vRevision","0").c_str()); + if (Utils::compareVersion(vMajor,vMinor,vRevision,ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION) <= 0) { + //fprintf(stderr,"UPDATE %u.%u.%u is not newer than our version\n",vMajor,vMinor,vRevision); + return; + } + + Identity signedBy; + if ((!signedBy.fromString(nfo.get("signedBy","")))||(!isValidSigningIdentity(signedBy))) { + //fprintf(stderr,"UPDATE invalid signedBy or not authorized signing identity.\n"); + return; + } + + std::string filePath(nfo.get("file","")); + if ((!filePath.length())||(filePath.find("..") != std::string::npos)) + return; + filePath = httpPath + filePath; + + std::string fileData; + if (Http::GET(ZT_AUTO_UPDATE_MAX_HTTP_RESPONSE_SIZE,60000,reinterpret_cast(&(*ip)),filePath.c_str(),requestHeaders,responseHeaders,fileData) != 200) { + //fprintf(stderr,"UPDATE GET %s failed\n",filePath.c_str()); + return; + } + + std::string ed25519(nfo.get("ed25519","")); + if ((ed25519.length() == 0)||(!signedBy.verify(fileData.data(),(unsigned int)fileData.length(),ed25519.data(),(unsigned int)ed25519.length()))) { + //fprintf(stderr,"UPDATE %s failed signature check!\n",filePath.c_str()); + return; + } + + /* --------------------------------------------------------------- */ + /* We made it! Begin OS-specific installation code. */ + +#ifdef __APPLE__ + /* OSX version is in the form of a MacOSX .pkg file, so we will + * launch installer (normally in /usr/sbin) to install it. It will + * then turn around and shut down the service, update files, and + * relaunch. */ + { + char bashp[128],pkgp[128]; + Utils::snprintf(bashp,sizeof(bashp),"/tmp/ZeroTierOne-update-%u.%u.%u.sh",vMajor,vMinor,vRevision); + Utils::snprintf(pkgp,sizeof(pkgp),"/tmp/ZeroTierOne-update-%u.%u.%u.pkg",vMajor,vMinor,vRevision); + FILE *pkg = fopen(pkgp,"w"); + if ((!pkg)||(fwrite(fileData.data(),fileData.length(),1,pkg) != 1)) { + fclose(pkg); + unlink(bashp); + unlink(pkgp); + fprintf(stderr,"UPDATE error writing %s\n",pkgp); + return; + } + fclose(pkg); + FILE *bash = fopen(bashp,"w"); + if (!bash) { + fclose(pkg); + unlink(bashp); + unlink(pkgp); + fprintf(stderr,"UPDATE error writing %s\n",bashp); + return; + } + fprintf(bash, + "#!/bin/bash\n" + "export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin\n" + "sleep 2\n" + "installer -pkg \"%s\" -target /\n" + "sleep 1\n" + "rm -f \"%s\" \"%s\"\n" + "exit 0\n", + pkgp, + pkgp, + bashp); + fclose(bash); + long pid = (long)vfork(); + if (pid == 0) { + execl("/bin/bash","/bin/bash",bashp,(char *)0); + exit(0); + } + } +#endif // __APPLE__ + +#ifdef __WINDOWS__ + /* Windows version comes in the form of .MSI package that + * takes care of everything. */ + { + } +#endif // __WINDOWS__ + + /* --------------------------------------------------------------- */ + + return; + } // else try to fetch from next IP address + } + } + + void threadMain() + throw() + { + try { + this->doUpdateCheck(); + } catch ( ... ) {} + } +}; +static BackgroundSoftwareUpdateChecker backgroundSoftwareUpdateChecker; +#endif // ZT_AUTO_UPDATE + class OneServiceImpl; static int SnodeVirtualNetworkConfigFunction(ZT1_Node *node,void *uptr,uint64_t nwid,enum ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nwconf); @@ -197,6 +367,10 @@ public: char portstr[64]; Utils::snprintf(portstr,sizeof(portstr),"%u",port); OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "zerotier-one.port").c_str(),std::string(portstr)); + +#ifdef ZT_AUTO_UPDATE + Thread::start(&backgroundSoftwareUpdateChecker); +#endif } virtual ~OneServiceImpl() @@ -956,11 +1130,11 @@ std::string OneService::autoUpdateUrl() */ #if defined(__APPLE__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) - return "http://download.zerotier.com/update/mac_intel/LATEST.nfo"; + return "http://download.zerotier.com/update/mac_intel/"; #endif #ifdef __WINDOWS__ - return "http://download.zerotier.com/update/win_intel/LATEST.nfo"; + return "http://download.zerotier.com/update/win_intel/"; #endif #endif // ZT_AUTO_UPDATE diff --git a/updater.cpp b/updater.cpp deleted file mode 100644 index bc36394b..00000000 --- a/updater.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * ZeroTier One - Network Virtualization Everywhere - * Copyright (C) 2011-2015 ZeroTier, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * -- - * - * ZeroTier may be used and distributed under the terms of the GPLv3, which - * are available at: http://www.gnu.org/licenses/gpl-3.0.html - * - * If you would like to embed ZeroTier into a commercial application or - * redistribute it in a modified binary form, please contact ZeroTier Networks - * LLC. Start here: http://www.zerotier.com/ - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "version.h" -#include "include/ZeroTierOne.h" -#include "node/Constants.hpp" - -#ifdef __WINDOWS__ -#include -#include -#include -#include -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif - -#include "node/Utils.hpp" -#include "node/Address.hpp" -#include "node/Dictionary.hpp" -#include "node/Identity.hpp" -#include "osdep/OSUtils.hpp" -#include "osdep/Http.hpp" - -using namespace ZeroTier; - -namespace { - -static std::map< Address,Identity > updateAuthorities() -{ - std::map< Address,Identity > ua; - { // 0001 - Identity id("e9bc3707b5:0:c4cef17bde99eadf9748c4fd11b9b06dc5cd8eb429227811d2c336e6b96a8d329e8abd0a4f45e47fe1bcebf878c004c822d952ff77fc2833af4c74e65985c435"); - ua[id.address()] = id; - } - { // 0002 - Identity id("56520eaf93:0:7d858b47988b34399a9a31136de07b46104d7edb4a98fa1d6da3e583d3a33e48be531532b886f0b12cd16794a66ab9220749ec5112cbe96296b18fe0cc79ca05"); - ua[id.address()] = id; - } - { // 0003 - Identity id("7c195de2e0:0:9f659071c960f9b0f0b96f9f9ecdaa27c7295feed9c79b7db6eedcc11feb705e6dd85c70fa21655204d24c897865b99eb946b753a2bbcf2be5f5e006ae618c54"); - ua[id.address()] = id; - } - { // 0004 - Identity id("415f4cfde7:0:54118e87777b0ea5d922c10b337c4f4bd1db7141845bd54004b3255551a6e356ba6b9e1e85357dbfafc45630b8faa2ebf992f31479e9005f0472685f2d8cbd6e"); - ua[id.address()] = id; - } - return ua; -} - -static bool validateUpdate( - const void *data, - unsigned int len, - const Address &signedBy, - const std::string &signature) -{ - std::map< Address,Identity > ua(updateAuthorities()); - std::map< Address,Identity >::const_iterator updateAuthority = ua.find(signedBy); - if (updateAuthority == ua.end()) - return false; - return updateAuthority->second.verify(data,len,signature.data(),(unsigned int)signature.length()); -} - -/* -static inline const char *updateUrl() -{ -#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) - if (sizeof(void *) == 8) - return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo"; - else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifdef __APPLE__ - return "http://download.zerotier.com/ZeroTierOneInstaller-mac-combined-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifdef __WINDOWS__ - return "http://download.zerotier.com/ZeroTierOneInstaller-windows-intel-LATEST.nfo"; -#define GOT_UPDATE_URL -#endif - -#ifndef GOT_UPDATE_URL - return ""; -#endif -} -*/ - -static const char *parseUpdateNfo( - const char *nfoText, - unsigned int &vMajor, - unsigned int &vMinor, - unsigned int &vRevision, - Address &signedBy, - std::string &signature, - std::string &url) -{ - try { - Dictionary nfo(nfoText); - - vMajor = Utils::strToUInt(nfo.get("vMajor").c_str()); - vMinor = Utils::strToUInt(nfo.get("vMinor").c_str()); - vRevision = Utils::strToUInt(nfo.get("vRevision").c_str()); - signedBy = nfo.get("signedBy"); - signature = Utils::unhex(nfo.get("ed25519")); - url = nfo.get("url"); - - if (signature.length() != ZT_C25519_SIGNATURE_LEN) - return "bad ed25519 signature, invalid length"; - if ((url.length() <= 7)||(url.substr(0,7) != "http://")) - return "invalid URL, must begin with http://"; - - return (const char *)0; - } catch ( ... ) { - return "invalid NFO file format or one or more required fields missing"; - } -} - -} // anonymous namespace - -#ifdef __WINDOWS__ -int _tmain(int argc, _TCHAR* argv[]) -#else -int main(int argc,char **argv) -#endif -{ -#ifdef __WINDOWS__ - WSADATA wsaData; - WSAStartup(MAKEWORD(2,2),&wsaData); -#endif - - return 0; -} -- cgit v1.2.3 From 905d2e91e598945d4ba3a42430cd288f0a1d0839 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 20 May 2015 20:17:56 -0700 Subject: Windows auto-update integration into OneService. --- ext/installfiles/windows/ZeroTier One.aip | 7 ++--- service/OneService.cpp | 49 ++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 9 deletions(-) (limited to 'ext') diff --git a/ext/installfiles/windows/ZeroTier One.aip b/ext/installfiles/windows/ZeroTier One.aip index 69c2c0b7..234873f8 100644 --- a/ext/installfiles/windows/ZeroTier One.aip +++ b/ext/installfiles/windows/ZeroTier One.aip @@ -23,7 +23,7 @@ - + @@ -52,7 +52,6 @@ - @@ -68,14 +67,13 @@ - - + @@ -196,7 +194,6 @@ - diff --git a/service/OneService.cpp b/service/OneService.cpp index b8a66f6f..790f691b 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -108,6 +108,7 @@ namespace { #ifdef ZT_AUTO_UPDATE #define ZT_AUTO_UPDATE_MAX_HTTP_RESPONSE_SIZE (1024 * 1024 * 64) +#define ZT_AUTO_UPDATE_CHECK_PERIOD 21600000 class BackgroundSoftwareUpdateChecker { public: @@ -247,6 +248,40 @@ public: /* Windows version comes in the form of .MSI package that * takes care of everything. */ { + char tempp[512],batp[512],msip[512],cmdline[512]; + if (GetTempPathA(sizeof(tempp),tempp) <= 0) + return; + CreateDirectoryA(tempp,(LPSECURITY_ATTRIBUTES)0); + Utils::snprintf(batp,sizeof(batp),"%s\\ZeroTierOne-update-%u.%u.%u.bat",tempp,vMajor,vMinor,vRevision); + Utils::snprintf(msip,sizeof(msip),"%s\\ZeroTierOne-update-%u.%u.%u.msi",tempp,vMajor,vMinor,vRevision); + FILE *msi = fopen(msip,"wb"); + if ((!msi)||(fwrite(fileData.data(),(size_t)fileData.length(),1,msi) != 1)) { + fclose(msi); + return; + } + fclose(msi); + FILE *bat = fopen(batp,"wb"); + if (!bat) + return; + fprintf(bat, + "TIMEOUT.EXE /T 1 /NOBREAK\r\n" + "NET.EXE STOP \"ZeroTierOneService\"\r\n" + "TIMEOUT.EXE /T 1 /NOBREAK\r\n" + "MSIEXEC.EXE /i \"%s\" /qn\r\n" + "TIMEOUT.EXE /T 1 /NOBREAK\r\n" + "NET.EXE START \"ZeroTierOneService\"\r\n" + "DEL \"%s\"\r\n" + "DEL \"%s\"\r\n", + msip, + msip, + batp); + fclose(bat); + STARTUPINFOA si; + PROCESS_INFORMATION pi; + memset(&si,0,sizeof(si)); + memset(&pi,0,sizeof(pi)); + Utils::snprintf(cmdline,sizeof(cmdline),"CMD.EXE /c \"%s\"",batp); + CreateProcessA(NULL,cmdline,NULL,NULL,FALSE,CREATE_NO_WINDOW|CREATE_NEW_PROCESS_GROUP,NULL,NULL,&si,&pi); } #endif // __WINDOWS__ @@ -367,10 +402,6 @@ public: char portstr[64]; Utils::snprintf(portstr,sizeof(portstr),"%u",port); OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "zerotier-one.port").c_str(),std::string(portstr)); - -#ifdef ZT_AUTO_UPDATE - Thread::start(&backgroundSoftwareUpdateChecker); -#endif } virtual ~OneServiceImpl() @@ -436,6 +467,9 @@ public: _nextBackgroundTaskDeadline = 0; uint64_t lastTapMulticastGroupCheck = 0; +#ifdef ZT_AUTO_UPDATE + uint64_t lastSoftwareUpdateCheck = 0; +#endif // ZT_AUTO_UPDATE for(;;) { _run_m.lock(); if (!_run) { @@ -453,6 +487,13 @@ public: dl = _nextBackgroundTaskDeadline; } +#ifdef ZT_AUTO_UPDATE + if ((now - lastSoftwareUpdateCheck) >= ZT_AUTO_UPDATE_CHECK_PERIOD) { + lastSoftwareUpdateCheck = OSUtils::now(); + Thread::start(&backgroundSoftwareUpdateChecker); + } +#endif // ZT_AUTO_UPDATE + if ((now - lastTapMulticastGroupCheck) >= ZT_TAP_CHECK_MULTICAST_INTERVAL) { lastTapMulticastGroupCheck = now; Mutex::Lock _l(_taps_m); -- cgit v1.2.3