الرئيسيّةHome/المدوّنةWriting/دليلGuide
دليلGuidemacOSmacOSApple SiliconApple Siliconبطاقة ذكيةSmart card

تشغيل SConnect على أجهزة Mac (Apple Silicon)Running SConnect on macOS (Apple Silicon)

تسجيل الدخول بالبطاقة الذكية على أجهزة Mac بمعالج Apple Silicon يحتاج خطوتين: تثبيت برنامج SConnect المساعد يدوياً، وتشغيله عبر Rosetta.Two fixes to get smart card login working on Apple Silicon Macs: install the SConnect helper by hand, then run it under Rosetta.

⌘⌘
صورة: غلاف المقالFig: cover image

نظرة عامةOverview

على أجهزة Mac بمعالج Apple Silicon، يحتاج SConnect خطوتين قبل ما يشتغل تسجيل الدخول بالبطاقة الذكية (مثل idp.pki.ita.gov.om): تثبيت يدوي، وتشغيل البرنامج المساعد عبر Rosetta.On Apple Silicon Macs, SConnect needs two fixes before smart card login works (for example on idp.pki.ita.gov.om): a manual install, and running its helper under Rosetta.

جرّبت الخطوات على SConnect host 2.16.1.0 مع Chrome وقارئ بطاقات CCID عادي. كل الأوامر تشغّلها في Terminal بحسابك العادي.Tested with SConnect host 2.16.1.0, Chrome, and a generic CCID card reader. All commands run in Terminal as your normal user.

قبل ما تبدأBefore you start

الخطوة 1: تثبيت برنامج SConnect المساعدStep 1: Install the SConnect helper

جرّب ملف .pkg أولاً. إذا طلعت لك رسالة "The installation failed"، تأكّد من السبب في سجل التثبيت:Try the .pkg first. If it ends with "The installation failed", confirm the cause in the install log:

grep -iE "sconnect|error|fail" /var/log/install.log | tail -40

إذا شفت error opening dstPath=.../Google/Chrome: Operation not permitted، ثبّت الملفات يدوياً. الحزمة تكتب بس في مجلد ~/Library الخاص فيك، فالنسخ العادي يكفي:If you see error opening dstPath=.../Google/Chrome: Operation not permitted, install the files by hand. The package only writes to your own ~/Library, so a plain copy does the same job:

pkgutil --expand-full ~/Downloads/sconnect-host-v2.16.1.0.pkg /tmp/sconnect

P="/tmp/sconnect/sconnect.pkg/Payload/Library/Application Support"
A="$HOME/Library/Application Support"

mkdir -p "$A/SConnect" "$A/Google/Chrome/NativeMessagingHosts" "$A/Mozilla/NativeMessagingHosts"
cp "$P/SConnect/sconnect" "$P/SConnect/uninstall.sh" "$A/SConnect/"
chmod +x "$A/SConnect/sconnect"
xattr -c "$A/SConnect/sconnect"

sed "s#UserPath#$HOME#g" "$P/Google/Chrome/NativeMessagingHosts/com.gemalto.sconnect.json" > "$A/Google/Chrome/NativeMessagingHosts/com.gemalto.sconnect.json"
sed "s#UserPath#$HOME#g" "$P/Mozilla/NativeMessagingHosts/com.gemalto.sconnect.json" > "$A/Mozilla/NativeMessagingHosts/com.gemalto.sconnect.json"

grep path "$A/Google/Chrome/NativeMessagingHosts/com.gemalto.sconnect.json"

آخر سطر لازم يطبع مسار مجلدك الرئيسي وبعده /Library/Application Support/SConnect/sconnect. إذا سألك macOS هل يقدر Terminal يوصل لبيانات تطبيقات ثانية، اضغط Allow.The last line should print your home path followed by /Library/Application Support/SConnect/sconnect. If macOS asks whether Terminal can access data from other apps, click Allow.

إذا في ملفات باقية من تثبيت قديم لـ SConnect (مجلد addons وملف sconnect.db بتواريخ قديمة)، حطّها على جنب عشان يبدأ البرنامج المساعد من الصفر:If an older SConnect install left files behind (addons and sconnect.db dated years back), move them aside so the helper starts clean:

cd ~/Library/Application\ Support/SConnect
mv addons addons.old
mv sconnect.db sconnect.db.old

الخطوة 2: تثبيت إضافة المتصفحStep 2: Install the browser extension

  1. ثبّت إضافة SConnect من Chrome Web Store. لازم يكون معرّفها mjhbkkaddmmnkghdnnmkjcgpphnopnfk، لأنها الإضافة الوحيدة اللي يقبلها البرنامج المساعد.Install the SConnect extension from the Chrome Web Store. Its ID must be mjhbkkaddmmnkghdnnmkjcgpphnopnfk, the only extension the helper accepts.
  2. افتح chrome://extensions، اضغط SConnect ← Details، وخلّ Site access على On all sites.Open chrome://extensions, click SConnect → Details, and set Site access to On all sites.
  3. اقفل Chrome بالكامل (Cmd+Q) وافتحه من جديد.Quit Chrome (Cmd+Q) and open it again.

عشان تتأكّد إن Chrome يقدر يشغّل البرنامج المساعد، فعّل Developer mode في chrome://extensions، اضغط رابط service worker الخاص بالإضافة، وشغّل هذا في Console:To confirm Chrome can start the helper, turn on Developer mode in chrome://extensions, click the extension's service worker link, and run this in its Console:

chrome.runtime.sendNativeMessage('com.gemalto.sconnect', {}, r => console.log(r, chrome.runtime.lastError))

بعدها شغّل pgrep -fl sconnect في Terminal. إذا شفت عملية sconnect شغّالة، معناه الإضافة والبرنامج المساعد متصلين.Then run pgrep -fl sconnect in Terminal. A running sconnect process means the extension and helper are connected.

الخطوة 3: التأكد من القارئ والبطاقةStep 3: Check the reader and card

ركّب القارئ مباشرة في الجهاز (بدون hub)، دخّل البطاقة، وشغّل:Plug the reader straight into the Mac (avoid hubs), insert the card, and run:

for i in {1..10}; do system_profiler SPSmartCardsDataType | grep -m1 "#01"; sleep 1; done

الأسطر العشرة كلها لازم يطلع فيها ATR:{...}، وهذا معناه إن البطاقة تستجيب.All ten lines should show ATR:{...}, which means the card is answering.

البطاقة ما راح تظهر تحت "Available SmartCards"، وهذا طبيعي: SConnect يقرأها من القارئ مباشرة، مو من Keychain.The card won't appear under "Available SmartCards". That's normal: SConnect reads it through the reader directly, not the macOS keychain.

الخطوة 4: تشغيل البرنامج المساعد عبر Rosetta (Apple Silicon)Step 4: Run the helper under Rosetta (Apple Silicon)

هذي الخطوة اللي تخلّي خانة الرقم السري تظهر. البرنامج المساعد نفسه يدعم Apple Silicon، لكن الإضافة اللي تنزّلها البوابة في ~/Library/Application Support/SConnect/addons مبنية لـ Intel فقط. العملية اللي تشتغل على Apple Silicon ما تقدر تحمّل مكتبة Intel، فالبرنامج ما يقرأ البطاقة أبداً.This is the step that makes the PIN field appear. The helper itself supports Apple Silicon, but the add-on the portal downloads into ~/Library/Application Support/SConnect/addons is Intel-only. An Apple Silicon process can't load an Intel library, so the card is never read.

للتأكد، افتح البوابة مرة وحدة، وبعدها شغّل:To confirm, open the portal once, then run:

file ~/Library/Application\ Support/SConnect/addons/*/*/addon.dylib

إذا طلع x86_64 بس، طبّق الحل:If it shows only x86_64, apply the fix:

softwareupdate --install-rosetta --agree-to-license
pkill sconnect

S="$HOME/Library/Application Support/SConnect"
printf '#!/bin/sh\nexec /usr/bin/arch -x86_64 "%s/sconnect" "$@"\n' "$S" > "$S/sconnect-x86"
chmod +x "$S/sconnect-x86"
xattr -dr com.apple.quarantine "$S/addons"

for f in "$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.gemalto.sconnect.json" \
         "$HOME/Library/Application Support/Mozilla/NativeMessagingHosts/com.gemalto.sconnect.json"; do
  sed -i '' 's#/SConnect/sconnect"#/SConnect/sconnect-x86"#' "$f"
done
grep path "$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.gemalto.sconnect.json"

آخر سطر لازم ينتهي بـ /SConnect/sconnect-x86. الأوامر هذي تسوي مشغّل صغير يشغّل البرنامج المساعد بوضع Intel، وتوجّه Chrome وFirefox له.The last line should end in /SConnect/sconnect-x86. This creates a small launcher that starts the helper in Intel mode and points Chrome and Firefox at it.

التحقق وحل المشاكلVerify and troubleshoot

خلّ البطاقة في القارئ، اقفل Chrome (Cmd+Q)، افتحه، وافتح البوابة. لازم تظهر خانة الرقم السري، ونافذة SConnect في شريط الأدوات لازم تبيّن Status: active لدومين البوابة.With the card inserted, quit Chrome (Cmd+Q), open it, and load the portal. The PIN field should appear. The SConnect toolbar popup should show Status: active for the portal's domain.

العرَضSymptomالسبب المحتملLikely causeالحلFix
المثبّت: "The installation failed"Installer: "The installation failed"macOS يمنع الكتابة في مجلد بيانات ChromemacOS blocks writes to Chrome's data folderالخطوة 1، التثبيت اليدويStep 1, manual install
البوابة: "SConnect not detected"Portal: "SConnect not detected"الإضافة مو مثبّتة، أو صلاحية المواقع محدودةExtension missing, or site access restrictedالخطوة 2Step 2
اختبار Console: "native messaging host not found"‎Console test: "native messaging host not found"ملف الربط ناقص أو المسار غلطConnector file missing or wrong pathأعد تشغيل أسطر sed في الخطوة 1Re-run the sed lines in Step 1
اختبار Console: "access ... is forbidden"‎Console test: "access ... is forbidden"معرّف الإضافة غلطWrong extension IDثبّت إضافة SConnect الرسميةInstall the official SConnect extension
البوابة واقفة على "Insert your smart card" والبطاقة تطلّع ATRPortal stuck on "Insert your smart card", card shows an ATRإضافة Intel فقط على Apple SiliconIntel-only add-on on Apple Siliconالخطوة 4Step 4
system_profiler يطلّع no card presentsystem_profiler shows no card presentالبطاقة مقلوبة أو ما داخلة زينCard upside down or looseالخطوة 3Step 3

وجودك برّا عُمان ما يؤثّر على فحص البطاقة، لأنه يصير كله على جهازك.Being outside Oman doesn't affect the card check: it runs entirely on your Mac.

التراجع أو إلغاء التثبيتUndo or uninstall

للرجوع للبرنامج المساعد الأصلي (مثلاً لما تنزّل Thales إضافة تدعم Apple Silicon):To go back to the native helper (for example once Thales ships an Apple Silicon add-on):

for f in "$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.gemalto.sconnect.json" \
         "$HOME/Library/Application Support/Mozilla/NativeMessagingHosts/com.gemalto.sconnect.json"; do
  sed -i '' 's#/SConnect/sconnect-x86"#/SConnect/sconnect"#' "$f"
done

لإزالة SConnect بالكامل، احذف إضافة المتصفح، وبعدها احذف هذي:To remove SConnect completely, uninstall the browser extension, then delete these:

أ

أمجدAmjad

مهندس برمجيّات مستقلّ. أبني تطبيقات ويب وجوّال، وأهتمّ بالتجربة العربيّة والطباعة والتفاصيل.Independent software engineer. I build web and mobile apps, with a focus on the Arabic experience, typography and detail.

me@amjad.om ←@akalsulimani ←@akalsulimani ←