Sandboxing QtWebengine for apple store - qt
For the last 4 days I've been trying to publish my app in the apple store (which I've never done before). In it I use qt 5.12.1 with qtwebengine. But I really got stuck with sandboxing webengine because after sandboxing app won't even start. I followed this https://mediaarea.net/blog/2018/02/14/QtWebEngine-MacAppStore initially without recompiling and changing webengine but afterwards doing this as well (Unsuccessfully though 'cause they used qt 5.9). I tried as well suggestions from this thread https://forum.qt.io/topic/102212/qtwebengine-signing-issues/4 but had no luck. So I thought maybe you guys could give me some tips on how could I do this. Here's my script for signing package.
echo SIGN PACKAGE
# special case for QtWebEngineCore
find dist/MyApp.app -name Info.plist -exec plutil -replace CFBundleIdentifier -string "com.MyApp.desktop" {} \;
find dist/MyApp.app -name _CodeSignature -exec rm -fr {} \;
find dist/MyApp.app -name "*.dSYM" -exec rm -fr {} \;
# 1*
for f in $(find dist/MyApp.app/Contents/Frameworks -name '*.framework' -type d)
do
codesign --force --verbose -s "3rd Party Mac Developer Application: MyApp (*)" $f
done
for f in $(find dist/MyApp.app/Contents -name '*.dylib' -type f)
do
codesign --force --verbose -s "3rd Party Mac Developer Application: MyApp (*)" $f
done
codesign --entitlements app/MyApp.entitlements -s "3rd Party Mac Developer Application: MyApp (*)" dist/MyApp.app/Contents/MacOS/MyAppUpdater
codesign --entitlements app/MyApp.entitlements -s "3rd Party Mac Developer Application: MyApp (*)" dist/MyApp.app/Contents/MacOS/crashpad_handler
# 2*
codesign --force --verify --verbose -s "3rd Party Mac Developer Application: MyApp (*)" --entitlements app/MyApp.entitlements dist/MyApp.app
codesign --force --verify --verbose --sign "3rd Party Mac Developer Application: MyApp (*)" --identifier "com.MyApp.desktop" --entitlements app/webengine.entitlements dist/MyApp.app/Contents/Frameworks/QtWebEngineCore.framework/Helpers/QtWebEngineProcess.app
# 3*
codesign --entitlements app/MyApp.entitlements -s "3rd Party Mac Developer Application: MyApp (*)" dist/MyApp.app/Contents/MacOS/MyApp
It is kinda mixture of all suggestions of those posts. Eventually I managed to get rid of all apple errors except of this one.
ITMS-90296: App sandbox not enabled - The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list: [( "com.MyApp.desktop.pkg/Payload/MyApp.app/Contents/MacOS/MyApp" )] Refer to App Sandbox page at https://developer.apple.com/devcenter/mac/app-sandbox/ for more information on sandboxing your app.
The problem with it is if I move part where I sign webengine to (1*) I'll get my app through apple checks but it will crash. But if I leave it where it is right now I will receive error above. I had initially 3* above 2* and tried the combination of moving around webengine signature.
For more details I will attach my MyApp.plist, MyApp.entitlements and webengine.entitlements below.
I run macos mojave 10.14.3 on VirtualBox, qt 5.12.1
webengine.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.inherit</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
</dict>
</plist>
MyApp.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>MyApp</string>
<key>CFBundleExecutable</key>
<string>MyApp</string>
<key>CFBundleIdentifier</key>
<string>com.MyApp.desktop</string>
<key>CFBundleSpokenName</key>
<string>MyApp</string>
<key>CFBundleGetInfoString</key>
<string>blalba</string>
<key>CFBundleIconFile</key>
<string>MyApp.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone is required for voice messages and calls</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<false/>
<key>CFBundleVersion</key>
<string>0.5.1225</string>
<key>CFBundleShortVersionString</key>
<string>0.5.1225</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
MyApp.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.inherit</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>
I ran out of ideas and information of how to solve this problem. One more problem is that I've never published app in apple store before and I don't usually develop under macos as well. So everything is new to me(love it). And if I don't do this my team lead is going to hang me if I don't do this myself first.
So any help appreciated.
Related
Why does my zsh script works standalone but not when called by launchd?
I seeking help for to setup a periodical job on my imac with macOS Big Sur v11.4. What I want to do, is to delete all contents of a given folder every 60 seconds with a bash or zsh script. It doesn't matter which one. Default for terminal is set to zsh. Therefore I tried it with zsh. My current approach is to have two files. A zsh script which deletes the folder contents and for 'launchd' I have a plist which periodically should calls the script. If I call the zsh script in terminal it works fine and deletes the folder contents. But when it is called by launchd it returns with "no matches found" and I don't know where the problem is. Therefore it would be very kind, if someone can help me with this. /Library/LaunchDaemons/com.deleteGCODE.plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.deleteGCODE.plist</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/deleteGCODE.sh</string> </array> <key>StartInterval</key> <integer>60</integer> <key>StandardErrorPath</key> <string>/tmp/mycommand.err</string> <key>StandardOutPath</key> <string>/tmp/mycommand.out</string> </dict> </plist> /usr/local/bin/deleteGCODE.sh: #!/bin/zsh dir="/Users/simon/Documents/Simplify3D/GCODE/" rm -rf "$dir"* the output of /tmp/mycommand.out: /usr/local/bin/deleteGCODE.sh:3: no matches found: /Users/simon/Documents/Simplify3D/GCODE/* p.s. I am very sorry that I have postet my previous message in the wrong section. Hopefully this time it is correct.
QT application with admin privileges can't edit text file on startup
I have created an application that is designed to startup, complete a form on my university website to allow access through the proxy for applications like google drive and steam (lel). It accesses a text file in the program directory to obtain the username and password (encrypted obviously). I've made it run on startup by adding it to the startup programs in the registry. WINDOWS 7 WORKS PERFECTLY. Here is what happens IN WINDOWS 8.1: *Opening it from explorer manually, the program works as expected, accessing the username and password and automatically logging in. Running as admin also works perfectly. *Allowing it to run on start up causes the program to give an error saying it can't read/write the file with the password in it, making me have to manually enter the username and password in. All folders/file in the program directory are all read/write enabled. *Giving the program administrator rights by including a manifest file when compiling (has the UAC logo on the icon, so I know it has worked) or giving it admin rights via the .exe properties - opening it manually from explorer works perfectly, however on startup it won't even start the application. Does anyone know the reason for my observations? Registry command: QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); settings.setValue("BorderAuth.exe", QCoreApplication::applicationFilePath().replace('/','\\')); BorderAuth.exe.manifest: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="BorderAuth" type="win32"/> <description>Opens and closes the border of the network</description> <!-- Identify the application security requirements. --> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> .rc file: IDI_ICON1 ICON DISCARDABLE "icon_blue.ico" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "BorderAuth.exe.manifest" .pro file: QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets webkitwidgets TARGET = BorderAuth TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp \ settings.cpp HEADERS += mainwindow.h \ settings.h FORMS += mainwindow.ui \ settings.ui RESOURCES += \ icons.qrc RC_FILE = icon.rc Thanks!
Jenkins server is not accessible by host name (ip address)
I setup jenkins on my Mac OS X with homebrew and it works just fine via http://localhost:8080 or http://127.0.0.1:8080 I couldn't access jenkins instance via hostname/ipaddress: 1. http://myjenkinshost.local:8080 2. http://192.168.0.100:8080 Both links are not accessible even from local computer (jenkins host itself). Same time commands ping 192.168.0.100 and ping myjenkinshost.local work just fine.
It turned out that launch agent was configured to listen only 127.0.0.1 (or localhost). To fixed that edit jenkins agent's plist: nano /Users/admin/Library/LaunchAgents/homebrew.mxcl.jenkins.plist and modify httpListenAddress to 0.0.0.0 instead of 127.0.0.1 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$ <plist version="1.0"> <dict> <key>Label</key> <string>homebrew.mxcl.jenkins</string> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> <string>-Dmail.smtp.starttls.enable=true</string> <string>-jar</string> <string>/usr/local/opt/jenkins/libexec/jenkins.war</string> <string>--httpListenAddress=0.0.0.0</string> <string>--httpPort=8080</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
The correct location of the file to edit is /usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist Found the answer here
At my macOS 11.4 Big Sur installation the plist file was found here: /opt/homebrew/Cellar/jenkins-lts/2.xxx.x/homebrew.mxcl.jenkins-lts.plist Changing ip address to 0.0.0.0 worked as described.
By starting jenkins using sudo /etc/init.d/jenkins restart instead of sudo service jenkins start started the browser access. I hope it will be helpful.
I came across something like this but, it was for windows,I'm sure the steps to resolve will be the same,Please give it a try: https://apple.stackexchange.com/questions/31376/how-can-i-open-port-8080-of-mac-os-x-lion
If your Jenkins running through Homebrew (macos), don't touch /Users/admin/Library/LaunchAgents/homebrew.mxcl.jenkins.plist Use this one: /usr/local/Cellar/jenkins/2.xxx/homebrew.mxcl.jenkins.plist Change httpListenAddress to 0.0.0.0
If you have installed Jenkins LTS using Homebrew(macos) macOS Installers for Jenkins LTS The path of the file homebrew.mxcl.jenkins-lts.plist is: /opt/homebrew/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist Since the the folder opt is a hidden folder on macOS. You will need to do the following to see it in finder. Open Macintosh HD in finder -> and press cmd + shift + [.] This will reveal all hidden folders. You now have everything you need to make the required changes. As stated in previous answers.
If your Jenkins running through Homebrew (macOS Big Sur), First things first, you need to unhide the hidden folders. Since the folder is a hidden folder on macOS. so you will need to do the following things to unhide the folder. Open Macintosh HD in finder -> and press cmd + shift + . (dot) This will reveal all hidden folders. After you unhidden the folder, paste the below command in the terminal: nano /usr/local/Cellar/jenkins-lts/2.xxx/homebrew.mxcl.jenkins-lts.plist Change httpListenAddress 127.0.0.1 to 0.0.0.0 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$ <plist version="1.0"> <dict> <key>Label</key> <string>homebrew.mxcl.jenkins</string> <key>ProgramArguments</key> <array> <string>/usr/bin/java</string> <string>-Dmail.smtp.starttls.enable=true</string> <string>-jar</string> <string>/usr/local/opt/jenkins/libexec/jenkins.war</string> <string>--httpListenAddress=0.0.0.0</string> <string>--httpPort=8080</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> Once the above steps are done, you can access the Jenkins using hostname or public ip address.
phpunit --testsuite command does not work
I am on Windows in some project directory (I will call this my "root" directory). I run this: php vendor/bin/phpunit.phar -c tests/phpunit.xml --testsuite "Suite" command runs but ignores my "Suite" and gleefully reports "No tests executed!" phpunit.xml contains: <phpunit bootstrap="bootstrap.php" > <testsuites> <testsuite name="Suite"> <directory>;./</directory> <file>ProductTest.php</file> </testsuite> </testsuites> </phpunit> I have no problem running this on Linux, but on Windows it does not run this suite. I tried changing directory from ;./ to ;\ to tests, to full directory path on Windows, but no luck. It does not complain but does not run the tests either. How to I fix it?
<directory>..\tests</directory> worked for me
How to remove file from user's home folder on Nokia N9 (MeeGo) on app removal
My Qt application for Nokia N9 stores some data in the my folder inside /home/user/.config. I need to delete this folder with my data when application will be uninstalled. As far as I understand this can be reached using postrm file. I use the following file: postrm #!/bin/sh rm -rf /home/user/.config/mydatafolder/ exit 0 But this code doesn't work. I assume there's not enough right to remove something in the user's folder. So, I've tried to use devel-su user -c "rm -rf /home/user/.config/mydatafolder/" But it works only in developer mode and I need the app to work properly without it. The following code doesn't work too: su user -c "rm -rf /home/user/.config/mydatafolder/" Does anybody know how to remove this folder?
Ok, I've solved this. You don't need to use su or su-devel in this case. All pre/post rm/install scripts are running by 'root' by default. To make those scripts running by 'user' we simply need to add following strings to the aegis manifest file: <request context="INSTALL"> <credential name="UID::user" /> <credential name="GID::users" /> </request>