2014/03/08

OS X 10.9.2: MacVim

MacVim 7.4 をダウンロード して .vimrc の設定。

MacVim.app において...下記の設定をしていないと、

1, yank した内容が clipboard にコピーされない。
2, 日本語を入力しおわって esc した時、 IM が自動的に切り替わってくれない。:w する為に command + space で IM を切り替えしなくちゃいけなくなる。
3, ':' と ';' が入れ替わっていないといちいち shift key を押す必要にみまわれる。
4, 不思議なことに下記の設定がないと Visual mode にした時 Shift Key が思うように動かない。
(具体的に書くと、V して、複数の行を選択しようと Shift Key を押しながら ↓ Key を押すと
「自動的に最終行まで選択されてしまう」という残酷。2, 3 行だけ選択することができない。)

# .vimrc | .gvimrc

" MacVim.app に有効 (/usr/bin/vim には反映されない)

if has("gui_macvim")
  let macvim_hig_shift_movement = 1
endif
" http://vim-users.jp/2010/02/hack126/
" yank to clipbord
set clipboard=unnamed,autoselect

" http://yuroyoro.hatenablog.com
" insert モードを抜けると IM オフ
set noimdisable
set iminsert=0
set imsearch=0

inoremap :set iminsert=0
noremap :set iminsert=0

" 入れ替え
noremap ; :
noremap : ;

Single Mode Boot

$ cat /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist
$ sudo launchctl list | grep disk
$ man diskarbitrationd

$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist


RESTART してみたら歯車が回り続け、いつまでたっても Login 画面が現れなくなった。仕方なく電源を長押しして ShutDown...
launchctl unload -w してしまった Daemon を (何事もなかったかのように) load -w する為に

Power ON with command+S (Single Mode Boot)

$ /sbin/mount -uw /
$ cd /var/db/launchd.db/com.apple.launchd
$ vi overrides.plist

### delete key #########
#        <key>com.apple.diskarbitrationd</key>
#        <dict>
#                <key>Disabled</key>
#                <true/>
#        </dict>
#######################

# Single mode 終了
$ exit


ログインできたので、すかさず SHUT DOWN 。
再び Power ON 。通常どおり Login 画面があらわれて無事にログインできた。

2014/03/07

Published Date

2014 年 03月中に、Blogger へ投稿する際、mblogger を使って投稿しました。
順調に動いたと思っていたのは間違いでした。

% ./mblogger --update /path/to/投稿した記事に追記などを記入した.txt


を実行すると Blogger から割り振られた公開日時とは異なる公開日時で update してしまうことに気がつきました。
原因は下記で AM PM を含めた文字列を Time.parse すると文字列で指定した日付よりも未来の日付になってしまっていたのでした。
従って、きっちりと AM PM を削除した”文字列”を Time.parse するように変更して Blogger から振られた公開日時を維持しつつ update できるようになりました。

http://github.com/midore/mblogger には、まだ $ git push していない

# mblogger/lib/mblogger-xml.rb

def set_published
  return nil unless @h[:date]
  begin
    d = Time.parse(@h[:date].to_s.gsub(/AM|PM/,''))
    #  d = Time.parse(@h[:date])
  rescue
    return nil
  end
  @xentry.add_element("published").add_text(d.iso8601.to_s)
end


# 2014-03-07
2014年03月中に公開した記事の中には、公開日時が本日(日本時間 2014-03-07)よりも未来の日付になったままの記事が存在していたりしています。

# 2014-03-08
若干修正 & testing

2014/03/06

OS X 10.9.2: overwrite-Update OSX 10.9.2 Combo

このようなエラー

xpcd[192]: Info.plist does not contain an XPCService dictionary: /System/Library/Frameworks/Security.framework/XPCServices/SecurityAgent.xpc

が頻出することと、バッテリー残量が少なくなった時のお知らせが現れなかったので
OSXUpdCombo10.9.2.dmg を上書きインストールすることにしました。
そのための前準備から。

#---------------------------------------------------------------------
1) Login 鍵の復元
#---------------------------------------------------------------------
# 管理者権限でログイン
OS X 10.9.2: pam.d
http://midorex.blogspot.com/2014/03/os-x-1092-pamd.html
を実行していなかったことにする。
(ただし、移動させている /etc/pam.d/sshd などはそのままにしておく。System Keychains から削除した Kerberos の公開鍵などは復元できない為ほっておく。)

$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.digest-service.plist
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kpasswdd.plist
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kadmind.plist
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kcm.plist

Kerberos daemon が読み込まれた後に

$ launchctl load -w /System/Library/LaunchAgents/com.apple.identityservicesd.plist

を読み込んで Keychain Access.app を開くと

$ open /Applications/Utilities/Keychain\ Access.app/

再び Keychains "Login" の中に複数の鍵(Message 用とか)が system によって自動生成される。

# 一旦、ログアウト Shift+Command+Q

# 一般ユーザでログイン

先ほどと同様に identityservicesd.plist を読み込んでキーチェイン.app を開くと

% launchctl load -w /System/Library/LaunchAgents/com.apple.identityservicesd.plist
% open /Applications/Utilities/Keychain\ Access.app/

再び鍵が Keychains "Login" の中に生成されている。

# ログアウト Shift+Command+Q

#---------------------------------------------------------------------
2) override.plist の初期化
#---------------------------------------------------------------------
# 管理者権限を持つユーザでログイン。

# root:wheel  所有ファイル をバックアップ。
$ sudo cp /var/db/launchd.db/com.apple.launchd/overrides.plist ~/latest-overrides.plist
# root:wheel  所有ファイルの削除。
$ sudo rm /var/db/launchd.db/com.apple.launchd/overrides.plist
# 今ログインしているユーザの id を確認
$ id
# 今ログインしているユーザの User id 番号を持つ plist
$ rm /var/db/launchd.db/com.apple.launchd.peruser.50X/overrides.plist
# 他ユーザの plist も削除。
$ suod rm /var/db/launchd.db/com.apple.launchd.peruser.50X/overrides.plist


#---------------------------------------------------------------------
3) mv daemon plist, mv agent plist
#---------------------------------------------------------------------
# 管理者権限を持つユーザでログインしたまま。

# http://midorex.blogspot.com/2014/03/os-x-1092-unload-agents.html
# で unload した agents を集めて移動しておく。
OS X 10.9.2: mv-unloaded-agents-plist
http://midorex.blogspot.com/2014/03/os-x-1092-mv-unloaded-agents-plist.html

# http://midorex.blogspot.com/2014/03/os-x-1092-unload-daemon.html
# で unload した daemon を集めて移動しておく。
OS X 10.9.2: mv-unloaded-daemon-plist
http://midorex.blogspot.com/2014/03/os-x-1092-mv-unloaded-daemon-plist.html

# RESTART

#---------------------------------------------------------------------
4) SoftwareUpdate
#---------------------------------------------------------------------
OSXUpdCombo10.9.2.dmg を開いて上書きインストールを開始。リスタートしたら
# 管理者権限ユーザでログイン

OS X 10.9.2 であることや Version を確認。

uname -a


システム環境設定の再設定。

$ open /Applications/System\ Preferences.app/


# Security&Privacy
FileVault 以外、鍵をかけ直す。

# 2014-03-04 追記
# http://midorex.blogspot.com/2014/03/os-x-1092-mavericks-install.html の時は
# Allow apps downloaded from: Mac App Store and identified developers
# にしていたが、今回は
# Allow apps downloaded from: Mac App Store
# にした。

# Displays
mirroring にチェックをいれて、はずす。

# Energy Saver
check を入れて、外す。

# NetWork
新しいインターフェイスが自動的に生成されていたら、古い方を削除。

# Sharing
チェックがはいっていない状態を、維持しているものに対しても、
チェックを入れて、再びチェックを外す。
どのサービスにもチェックが入っていない状態が維持されているものの、
例えば ファイル共有にチェックを入れて、再びチェックを外すと

$ sudo more /var/db/launchd.db/com.apple.launchd/overrides.plist

        <key>com.apple.AppleFileServer</key>
        <dict>
                <key>Disabled</key>
                <true/>
        </dict>

キャッシュされる。
(もしも、true/ がfalse/ になっていたら true/ に書き換えておく)

ただし、Remote Management は、サービス丸ごと移動させてしまった
http://midorex.blogspot.com/2014/03/os-x-1092-04-coreservice.html
から決して Remote Management の項目にふれないように気をつけたつもり。

# App Store
すべてのチェックをいれて、再び外す。

# Date&Time
ntpd 同期のチェックを外すと

$ sudo more /var/db/launchd.db/com.apple.launchd/overrides.plist

        <key>org.ntp.ntpd</key>
        <dict>
                <key>Disabled</key>
                <true/>
        </dict>

が書き込まれる。

# Users&Groups
guest ユーザが許可されていないことを確認。

システム環境設定を終了して

# SHUT DOWN

#---------------------------------------------------------------------
5) kext
#---------------------------------------------------------------------
# Safe Boot (Shift Key)
# 管理者権限ユーザでログイン

#!/bin/bash
# kext-back2.sh
# OS X 10.9.2
home=$HOME
d=$home/backup-extentions2
mkdir $d

# face time camera
sudo mv /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBMergeNub.kext $d/
sudo touch /System/Library/Extensions

# bluetooth
sudo srm -rf /System/Library/Extensions/IOBluetoothFamily.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/IOBluetoothHIDDriver.kext
sudo touch /System/Library/Extensions

# bluetooth keyboard
sudo srm -rf /System/Library/Extensions/AppleBluetoothMultitouch.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/AppleHIDKeyboard.kext/Contents/PlugIns/AppleBluetoothHIDKeyboard.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/AppleHIDMouse.kext/Contents/PlugIns/AppleBluetoothHIDMouse.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/AppleHIDKeyboard.kext/Contents/Resources/BS_UI_Plugin_IOAppleBluetoothHIDDriver-Info.plist
sudo touch /System/Library/Extensions

# irc
sudo srm -rf /System/Library/Extensions/AppleIRController.kext
sudo touch /System/Library/Extensions

# iSight
sudo srm -rf /System/Library/Extensions/Apple_iSight.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext
sudo touch /System/Library/Extensions

# Audio
sudo mv /System/Library/Extensions/AppleUSBAudio.kext $d/
sudo touch /System/Library/Extensions
sudo mv /System/Library/Extensions/IOAudioFamily.kext $d/
sudo touch /System/Library/Extensions

$ sudo ./kext-back2.sh

を実行。

# REBOOT

再起動したらすぐに syslog -w 300 中に、

... com.apple.kextd[12] <Error>: /System/Library/Extensions/AppleHDA.kext - no dependency found for com.apple.iokit.IOAudioFamily.

が出現することを確認してから、再び

# SAFE BOOT

$ sudo mv /System/Library/Extensions/AppleHDA.kext ~/backup-extentions2
$ sudo touch /System/Library/Extensions
$ sudo mv /System/Library/Extensions/webdav_fs.kext ~/backup-extentions2
$ sudo touch /System/Library/Extensions
$ sudo mv /System/Library/Extensions/smbfs.kext ~/backup-extentions2
$ sudo touch /System/Library/Extensions/

# http://midorex.blogspot.com/2014/03/os-x-1092-02-kext-remove.html

# REBOOT

#---------------------------------------------------------------------
6) chmod & AirDrop
#---------------------------------------------------------------------
# 管理者権限ユーザでログイン
http://midorex.blogspot.com/2014/03/os-x-1092-05-chmod.html
を念押しで実行。(/usr/sbin/httpd などは上書きインストールすることで復活する為。)

http://midorex.blogspot.com/2014/03/os-x-1092-disable-airdrop.html
を実行。今度は間違えないように

$ man sharing
$ ls -l /usr/sbin/sharing

であることを確認して

$ sudo chmod 0 /usr/sbin/sharing


#---------------------------------------------------------------------
7) Keys in "Login" Keychains
#---------------------------------------------------------------------
上書きインストールしたので、Kerberos Daemon の存在確認。

$ sudo launchctl list | grep Kerb
- 0 com.apple.Kerberos.kpasswdd
- 0 com.apple.Kerberos.kdc
- 0 com.apple.Kerberos.kcm
- 0 com.apple.Kerberos.kadmind
- 0 com.apple.Kerberos.digest-service
$ 

$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kpasswdd.plist
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kcm.plist
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kadmind.plist
$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.digest-service.plist

を行ってから

$ cd /etc/pam.d
$ grep -r kr .

# Kerberos を利用しているファイルを編集。

$ pwd
$ sudo vi /etc/pam.d/authorization
# auth       optional       pam_krb5.so use_first_pass use_kcminit
$ sudo vi /etc/pam.dlogin
# auth       optional       pam_krb5.so use_kcminit
$ sudo vi /etc/pam.d/screensaver:
# auth       optional       pam_krb5.so use_first_pass use_kcminit


# 2014-03-04
# 補足
# Keychain Access.app の設定を開き、"First Aid" 欄にある Check をすべて外す。
# "Certificates" にある(OCSP) (CRL) をOFF に。

# Keychain Access.app を開いて Login の中にある鍵をすべて削除

# syslog をみながら
$ syslog -w
# 別のウィンドウを開いて
$ launchctl unload -w /System/Library/LaunchAgents/com.apple.identityservicesd.plist

すると、syslog が

... identityservicesd[248] <Notice>: Quit - notifying about shutdown
... identityservicesd[248] <Notice>: Quit - shutting down daemon
... kernel[0] <Debug>: AppleKeyStore:Sending lock change 1

とのメッセージをプリントしてくれた。

unload した com.apple.identityservicesd が override.plist に反映されているかを、確認。

% more /var/db/launchd.db/com.apple.launchd.peruser.504/overrides.plist
        <key>com.apple.identityservicesd</key>
        <dict>
                <key>Disabled</key>
                <true/>
        </dict>


#---------------------------------------------------------------------
# 2014-03-04
# 追記 -- ここから。
#
# 一旦ログアウトして他ユーザにログイン。
#
# 他ユーザも同様の設定にする。
# Keychain Access.app の設定を開き"First Aid" 欄にある Check をすべて外し
# (OCSP) (CRL) をOFF に。
# Keychain Access.app を開いて Login の中にある鍵をすべて削除して unload。

$ launchctl unload -w /System/Library/LaunchAgents/com.apple.identityservicesd.plist

#
#
# 4) SoftwareUpdate のシステム環境設定を再設定する時に
# Security 欄で App Store とデベロッパーからダウンロードするを変更して
# App Store からのみダウンロードするを選択していた、ことを追記した。
#
# 追記 -- ここまで。

#---------------------------------------------------------------------
8) unload agent
#---------------------------------------------------------------------
# 管理者権限を持つユーザでログイン。
http://midorex.blogspot.com/2014/03/os-x-1092-unload-agents.html
を再び実行。

# User id 50X (現在ログインしている管理者権限を持つユーザ)が所有している overrides.plist を
# User di 50Y (管理者権限を持たないユーザ)が所有している overrides.plist へコピー。
$ sudo cp /var/db/launchd.db/com.apple.launchd.peruser.50X/overrides.plist  /var/db/launchd.db/com.apple.launchd.peruser.50Y/overrides.plist


# REBOOT

#---------------------------------------------------------------------
# syslog -w
#---------------------------------------------------------------------
# 管理者権限を持つユーザでログイン。

$ syslog -w 250 | more

など。

... secd[266] <Error>: ...

とのことなので

# 一時的にホームに plist を移動させる。
$ sudo mv /System/Library/LaunchAgents/com.apple.secd.plist ~/


# REBOOT

$ syslog -w 250 | more
alias 'syse'='syslog -k Level Nle error -k Time ge -2000'
alias 'sysw'='syslog -k Level Nle warning -k Time ge -2000

$ syse
# =>
# ... UserEventAgent[155] <Error>: Failed to copy info dictionary for bundle /System/Library/UserEventPlugins/alfUIplugin.plugin
# ... UserEventAgent[155] <Error>: Failed to copy info dictionary for bundle /System/Library/UserEventPlugins/com.apple.bonjour.plugin

このエラーは
http://midorex.blogspot.com/2014/03/os-x-1092-disable-airdrop.html
において

$ sudo mv /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns

した為だと思うので気にしていない。

... secd[266] <Error>: ...

は消えた。

そして重要なこと。そもそもこの↓ようなエラー

xpcd[192]: Info.plist does not contain an XPCService dictionary: /System/Library/Frameworks/Security.framework/XPCServices/SecurityAgent.xpc

が、頻出していた為にわざわざ上書きインストールしたことを思い出した。
syslog -k を使って検索してみたところ、上書きインストール以降、エラーは無事消えていた。よかった。
しかしバッテリー残量が少なくなった時のお知らせは正常に戻らなかった。pmset が原因かもしれない。

# ~/.bashrc などにエイリアスを記入しておくと便利
# alias 'sysk'='syslog -k Message Seq'
# alias 'syse'='syslog -k Level Nle error -k Time ge -3000'
$ sysk XPCService

して使う。

# syslog -k Level Nle error -k Time ge -3000
$ syse
# =>
# 気になった箇所の抜粋(日付削除)
osx.local UserEventAgent[155] <Error>: Failed to copy info dictionary for bundle /System/Library/UserEventPlugins/BonjourEvents.plugin
osx.local UserEventAgent[155] <Error>: Failed to copy info dictionary for bundle /System/Library/UserEventPlugins/alfUIplugin.plugin
osx.local UserEventAgent[155] <Error>: Failed to copy info dictionary for bundle /System/Library/UserEventPlugins/com.apple.bonjour.plugin

$ sudo mv /System/Library/UserEventPlugins/alfUIplugin.plugin  ~/backup-sys-lib-UserEventPlugins/
$ sudo mv /System/Library/UserEventPlugins/BonjourEvents.plugin ~/backup-sys-lib-UserEventPlugins/
$ sudo mv /System/Library/UserEventPlugins/com.apple.bonjour.plugin ~/backup-sys-lib-UserEventPlugins/


# REBOOT

IconServicesAgent[203] <Error>: Error: Failed to add value to tree: Invalid node at index: 6.

のあとに数行にわたって続く IconServiceAgent の派手なエラーは
システム環境設定のすべての設定内容を見直して不要なもの等を off にすることで消えたが、再び出現するかもしれない。

osx.local com.apple.kextcache[247] <Error>: CellPhoneHelper.kext - no dependency found for com.apple.driver.AppleUSBMergeNub.
osx.local com.apple.kextcache[247] <Error>: AppleMobileDevice.kext - no dependency found for com.apple.driver.AppleUSBMergeNub.

等の kext のエラーは Caches リンクが再生成されると消える。2回ほど REBOOT しおなしたら消えた。
CellPhoneHelper.kext は AppleUSBMergeNub に依存しているようだ。
私が AppleUSBMergeNubを mv した為に CellPhoneHelper.kext をロードできなかったようだ。
CellPhoneHelper.kext を AppleUSBMergeNub 同様に mv することがおそらく正しい選択だろうと思う。

# 2014-03-04
88行93行あたり、それぞれ daemon と daemon が逆だったことを訂正。
s/daemon/agents
s/agents/daemon
4) SoftwareUpdate と 7) Keys in "Login" Keychains
の中に書き忘れていたことを追記。

2014/03/04

OS X 10.9.2: mv-unloaded-daemon-plist

http://midorex.blogspot.com/2014/03/os-x-1092-unload-daemon.html
で unload したdaemon plist を移動。

#!/bin/bash
# mv-unloaded-daemon.sh
# OS X 10.9.2
#
home=$HOME
d=$home/backup-unload-daemon

sudo mv /System/Library/LaunchDaemons/com.apple.smb.preferences.plist $d

# aosnotifyd -- Find My Mac daemon
sudo mv /System/Library/LaunchDaemons/com.apple.AOSNotificationOSX.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.locationd.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.cmio.AVCAssistant.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.cmio.VDCAssistant.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.iCloudStats.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.wwand.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.AirPlayXPCHelper.plist $d

# blued
sudo mv /System/Library/LaunchDaemons/com.apple.blued.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.bluetoothaudiod.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.IOBluetoothUSBDFU.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.rpcbind.plist $d
sudo mv /System/Library/LaunchDaemons/org.postfix.master.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.spindump.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.spindump_symbolicator.plist $d

# metadata
sudo mv /System/Library/LaunchDaemons/com.apple.metadata.mds.index.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.metadata.mds.spindump.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.metadata.mds.scan.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.metadata.mds.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.lockd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.nis.ypbind.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.mbicloudsetupd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.gssd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.findmymac.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.findmymacmessenger.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.cmio.IIDCVideoAssistant.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.afpfs_checkafp.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.afpfs_afpLoad.plist $d

# Apple Push Notification service daemon
sudo mv /System/Library/LaunchDaemons/com.apple.apsd.plist $d
# awacsd -- Apple Wide Area Connectivity Service daemon
sudo mv /System/Library/LaunchDaemons/com.apple.awacsd.plist $d

# share service
sudo mv /System/Library/LaunchDaemons/com.apple.RFBEventHelper.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.cmio.AppleCameraAssistant.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.mdmclient.daemon.plist $d
# revision
sudo mv /System/Library/LaunchDaemons/com.apple.revisiond.plist $d

OS X 10.9.2: mv-unloaded-agents-plist

http://midorex.blogspot.com/2014/03/os-x-1092-unload-agents.html
で unload したagents plist を移動。

#!/bin/bash
# mv-unloaded-agents.sh
# OS X 10.9.2
#
home=$HOME
d=$home/backup-unloaded-agents
mkdir $d
#
# http://midorex.blogspot.com/2014/03/os-x-1092-mavericks-install.html
sudo mv /System/Library/LaunchAgents/com.apple.speech.* $d

sudo mv /System/Library/LaunchAgents/com.apple.mbloginhelper.user.plist $d
sudo mv /System/Library/LaunchAgents/com.apple.RemoteDesktop.plist $d

sudo mv /System/Library/LaunchAgents/com.apple.AirPlayUIAgent.plist $d
sudo mv /System/Library/LaunchAgents/com.apple.sharingd.plist $d

sudo mv /System/Library/LaunchAgents/com.apple.screensharing.agent.plist $d
sudo mv /System/Library/LaunchAgents/com.apple.screensharing.MessagesAgent.plist $d

# rcd -- Remote control daemon.
sudo mv /System/Library/LaunchAgents/com.apple.rcd.plist $d

sudo mv /System/Library/LaunchAgents/com.apple.java.InstallOnDemand.plist $d
sudo mv /System/Library/LaunchAgents/com.apple.java.updateSharing.plist $d

sudo mv /System/Library/LaunchAgents/com.apple.SocialPushAgent.plist $d
sudo mv /System/Library/LaunchAgents/com.apple.ScreenReaderUIServer.plist $d


#---------------------------------------------------------------------
# 暫定的な処置(必要に応じて)
#---------------------------------------------------------------------

$ sudo mv /System/Library/LaunchAgents/com.apple.secd.plist ~/

2014/03/03

OS X 10.9.2: ruby 2.0

# OS X 10.9.2

% ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]


<BIG> ものすごく嬉しい!!! </BIG>

mblogger
http://midorex.blogspot.com/2010/01/mblogger.html

頃に作成した
mblogger
を、動かしてみたところ、正常に post | get | update など できています!!!
# 2014-03-07
# 訂正。できていなかった。
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

嬉しさのあまり、最近、複数の記事を投稿している次第です。

(久しぶりに ruby を動かした為、当初

#!/usr/bin/ruby

を記入しないまま実行してしまいエラーをみながら呆然となっていたことは内緒)

また
Blogger
が API interface を長年にわたって変更していないことに感謝もうしあげたいです。ありがとうございます。

# 2014-03-05
脱字の訂正。

OS X 10.9.2: install-my-ipfw

コンピュータの電源をいれた瞬間にネットワークに接続「できない」ようにする為のルール。

OS X 10.9.2: Disable AirDrop
http://midorex.blogspot.com/2014/03/os-x-1092-disable-airdrop.html

sudo ipfw -q add reject udp from any to me dst-port 5353


を、電源をいれた瞬間に反映させたい為。
しかしこの状態ではネットワークに接続できない為、起動後にネットワークに接続したくなったら
下記とは「別」のルールを作成しておく必要がある。

# install-my-ipfw.sh

#!/bin/bash
# OS X 10.9.2

sudo mkdir /usr/local
sudo chmod 755 /usr/local
sudo mkdir /usr/local/sbin
sudo chmod 755 /usr/local/sbin

sudo cp rc.firewall /usr/local/sbin/
sudo chmod 755 /usr/local/sbin/rc.firewall
sudo cp myfirewall.plist /Library/LaunchDaemons/
sudo chmod 644 /Library/LaunchDaemons/myfirewall.plist


# myfirewall.plist

<?xml version=“1.0” encoding=“UTF-8”?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
“http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=“1.0”>
    <dict>
        <key>Label</key>
        <string>com.apple.firewall</string>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/local/sbin/rc.firewall</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>root</string>
    </dict>
</plist>


# rc.firewall

#!/bin/bash
fw=/sbin/ipfw
fq="/sbin/ipfw -q"

$fw -f flush
$fq add allow ip from any to any via lo0
$fq add reject log ip from 127.0.0.0/8 to any in
$fq add reject log ip from any to 127.0.0.0/8 in

$fq add reject log icmp from any to any
$fq add reject log udp from any to any
$fq add reject log tcp from any to any

$fq add reject ipv6 from any to any
$fq add reject ipv6 from any to any in

$fq add reject log udp from any to any in
$fq add reject log tcp from any to any in
$fq add 65534 deny log ip from any to any in

# Reference
# Haught.org :: Articles :: OSX Firewall
# https://www.haught.org/article/osx-firewall/

$ chmod 700 install-my-ipfw.sh
$ sudo ./install-my-ipfw.sh


# LINK
Haught.org :: Articles :: OSX Firewall
https://www.haught.org/article/osx-firewall/

OS X 10.9.2: pam.d

# pamd.sh

#!/bin/bash
# OS X 10.9.2
# pamd.sh
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.digest-service.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kpasswdd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kadmind.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kcm.plist


# pamd-mv.sh

#!/bin/bash
# OS X 10.9.2
# pamd-mv.sh
#
#### Safe Mode Boot ####
home=$HOME
pam=$home/backup-pamd
mkdir $pam
sudo mv /etc/pam.d/sshd $pam
sudo mv /etc/pam.d/ftpd $pam
sudo mv /etc/pam.d/smbd $pam
sudo mv /etc/pam.d/rshd $pam

$ chmd 700 pamd.sh
$ sudo ./pamd.sh
# After Safe Mode Boot
$ chmd 700 pamd-mv.sh
$ sudo ./pamd-mv.sh


# 追記

% open /Applications/Utilities/Keychain\ Access.app/

して、Keychains "System"
の中にあるKerberos の自己証明書と public key と private key を削除。

# 2014-03-04
続きは
http://midorex.blogspot.com/2014/03/os-x-1092-overwrite-update-osx-1092.html
の 7) Keys in "Login" Keychains

# 2014-03-07
pre tag の訂正
この記事の公開日時を訂正。
http://midorex.blogspot.com/2014/03/published-date.html

OS X 10.9.2: mDNS-change

support.apple.com/kb/HT3789
の内容を確認。

/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

は 10.9 で変更されているようだが、これまでと同様に

<string>-NoMulticastAdvertisements</string>

の1行を下記のように追加。インターネットにつなげ、いくつかのサイトを閲覧できることを確認した。

        <array>
                <string>/usr/sbin/mDNSResponder</string>
                <string>-NoMulticastAdvertisements</string>
        </array>


# 新規フォルダの作成
$ mkdir custom-mDNS-plist
# 移動
$ cd custom-mDNS-plist
# オリジナルの mDNSResponder.plist を別名で保存。
$ sudo cp -pR /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist custom-com.apple.mDNSResponder.plist
# 別名 custom-com.apple.mDNSResponder.plist で保存した file を編集。
$ sudo nano custom-com.apple.mDNSResponder.plist
# $ sudo vi custom-com.apple.mDNSResponder.plist

# mdns-change.sh

#!/bin/bash
# mdns-change.sh
# OS X 10.9.2
#---------------------------------------------------------------------
# mDNS
#---------------------------------------------------------------------
# Backup Original File
sudo cp -pR /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist  .
# Remove Original File
sudo rm /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
#
# Copy customd file to /System/Library/LaunchDaemons/
sudo cp custom-com.apple.mDNSResponder.plist /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
#
# chnage mode
sudo chmod 644 /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
#
# mDNS reload
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
# process
ps aux | grep mDNS
# =>
# ... /usr/sbin/mDNSResponder -NoMulticastAdvertisements


# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

2014/03/01

OS X 10.9.2: 04-coreservice

# 04-coreservice.sh

#!/bin/bash
# OSX 10.9.2
# 04-coreservice.sh
#---------------------------------------------------------------------
# remove coreservice
#---------------------------------------------------------------------
home=$HOME
bk=$home/backup-coreservice
mkdir $bk

sudo mv /System/Library/CoreServices/Search.bundle $bk/
sudo mv /System/Library/CoreServices/RemoteManagement $bk/
sudo mv /System/Library/CoreServices/AppleFileServer.app $bk/
sudo mv /System/Library/CoreServices/Bluetooth*  $bk/
sudo mv /System/Library/CoreServices/InternetSharing.bundle $bk/
sudo mv /System/Library/CoreServices/Screen\ Sharing.app $bk/
sudo mv /System/Library/CoreServices/ODSAgent.app $bk/
sudo mv /System/Library/CoreServices/XsanManagerDaemon.bundle $bk/
sudo mv /System/Library/CoreServices/VoiceOver.app $bk/
sudo mv /System/Library/CoreServices/SocialPushAgent.app $bk/
sudo mv /System/Library/CoreServices/AirPlayUIAgent.app $bk/
sudo mv /System/Library/CoreServices/RFBEventHelper.bundle $bk/
sudo mv /System/Library/CoreServices/RawCamera* $bk


# 2014-03-03

$ sudo ./04-coreservice.sh


# 2014-03-04
コメントアウトを削除。

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

OS X 10.9: when-new-create-account.sh

# when-new-create-account.sh

#!/bin/bash
# when-new-create-account.sh
# OS X 10.9
#---------------------------------------------------------------------
# When First BOOT after OS X Install | When create new account after SoftWareUpdate
#---------------------------------------------------------------------
chmod 0 ~/Public/Drop\ Box/ ~/Public/
chmod 700 $HOME

# 2014-03-03
# AirPlay
launchctl unload -w /System/Library/LaunchAgents/com.apple.AirPlayUIAgent.plist

# AirDrop
defaults write com.apple.NetworkBrowser DisableAirDrop -bool Yes
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool No


# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

OS X 10.9.2: lib-pref-remove

# 08-lib-pref-remove.sh

#!/bin/bash
# 08-lib-pref-remove.sh
# OS X 10.9.2
### SAFE MODE BOOT ###
sudo rm /Library/Preferences/com.apple.P2PSupervisor.plist
sudo rm /Library/Preferences/com.apple.xsanmgrd.plist
sudo rm -rf /Library/Preferences/Xsan

# network plist
sudo rm /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
sudo rm /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist
sudo rm /Library/Preferences/SystemConfiguration/preferences.plist
sudo rm /Library/Preferences/SystemConfiguration/preferences.plist.old
sudo rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist


# 2014-03-03
sudo rm -rf /Library/Preferences/com.apple.*

# 2014-03-05
$d 削除 など。

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

OS X 10.9.2: Mavericks Install

#---------------------------------------------------------------------
# Install 前準備
#---------------------------------------------------------------------

0) 現在のすべてのデータを外部HDDへバックアップ。

1) USB Media に OS X Installer を保存
App.Store からOS X 10.9.x をダウンロード。ダウンロードが完了しても Continue しないでおく(インストール開始していない状態を保つ)
下記を読みながら USB Media にInstaller 保存。

Create an OS X Mavericks Installer Drive in 4 Simple Steps
http://osxdaily.com/2013/10/23/create-os-x-mavericks-install-drive/
http://osxdaily.com/2013/10/23/create-os-x-mavericks-install-drive/

実行結果。(/Volumes/以下 のパスを自分の環境にあわせて変更)

$ sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/mediasub --applicationpath /Applications/Install\ OS\ X\ Mavericks.app/
Password:
Ready to start.
To continue we need to erase the disk at /Volumes/mediasub
If you wish to continue type (Y) then press return: Y
Erasing Disk: 0%... 10%... 20%...100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.
$ 


2) OSXUpdCombo10.9.2.dmg ダウンロード
http://support.apple.com/kb/DL1726
<quote>
SHA1=c06a63982b522e43997a05cedc04b0bdb1a10207
</quote>

# SHA 1

% openssl sha1 OSXUpdCombo10.9.2.dmg
SHA1(OSXUpdCombo10.9.2.dmg)= c06a63982b522e43997a05cedc04b0bdb1a10207
% 


3) SytemePreference.app ネットワークの設定をクリア。
keychain に存在している Wi-Fi用key 削除。
システム環境設定 NetWork の中に存在する Interface を削除。

4) PRAM CLEAR
 ⌘+Option+P+R
# => 3 times ジャーン確認。

#---------------------------------------------------------------------
# Install
#---------------------------------------------------------------------

電源アダプタと USB メディアを装着して Option key を押しながらマシンの電源をON。

USB media から起動できたら Installer をクリックする前に
DiskUtility.app を開きハードディスク全体を Extended (Journal) として初期化。
パーティションを作成して、すべてのパーティションに対してディスクの検証(Verify Disk)で問題がないことを確認。

Mavericks Installer を起動しインストール。約20分程度。
Installer が終了し新規アカウントを作成した直後、ネットワークに接続しない。

#---------------------------------------------------------------------
# After Install
#---------------------------------------------------------------------

0) 私的設定ポリシー
# サーバではない個人使用向け。
# 不要なサービスの起動をおさえたい。
# 自らが意図しない TCP/UDP OutGoing を Stop したい。
# Spotlight, PrintTool, iCloud, iTunes.app, Mail.app, FaceTime.app, Message.app を使用しない。
# AirDrop、AirPlay サービスを無効にしたい。
# 自分が作成したファイルと System を別々のパーティションに分離。

1) Wi-Fi Power OFF
Menu Bar の Bluetooth, Wi-Fi アイコンをクリックして電源をOFFにする。

2) $ open /Applications/System\ Preferences.app/
# Security
FireWall: ON
Advance Require an administrator password : ON
Mac App Store and identified developers: ON
FileVault: OFF

# NetWork
デフォルトで作成されているロケーションをすべて削除する。
新規にロケーションを作成して、インターフェースを何か追加したらTCP/IP をOFF にしておく。

# Sharing
ALL Services : OFF
すべてのサービスを無効にしておく。ファイル共有などに存在するフォルダとユーザを削除しておく。

# Users&Groups
Guest user: OFF
ゲストユーザを許可しない。

# App Store
Automatically check for updates: OFF
ALL Automatically ... : OFF
どこにもチェックを入れない。

# Startup Disk
起動ディスクを選択するとパスワード認証を2回求められた。パスワードを入力すると鍵がかかる。

# Date & times
時刻同期しない。
ntpd サーバと交信しない。

3) SoftwareUpdate
あらかじめダウンロードしておいた OS X 10.9.2 COMBO.dmg を開きインストールすると自動的にリスタートする。
# AppStore からダウンロードした時、既に10.9.2 がダウンロードできた場合は必要ない。

4) 新規アカウントを作成。
# user id 501 ユーザではない管理者権限を持つアカウントの作成。

5) 設定用コマンドの実行
http://midorex.blogspot.com/2014/03/os-x-1092-disable-airdrop.html
http://midorex.blogspot.com/2014/03/os-x-1092-00-hostconfig-hostsdeny.html
http://midorex.blogspot.com/2014/03/os-x-1092-00-first.html
http://midorex.blogspot.com/2014/03/os-x-1092-01-defaults-write.html

6) 1 度目の手動シャットダウン
Menu Bar  の ShutDown をクリックして正常に電源が落ちることを確認。

#---------------------------------------------------------------------
# Terminal.app から設定
#---------------------------------------------------------------------

0) 1 度目のSafe Mode Boot
# (Shif key + Power button)
Shift Key を押しながら電源ボタンをおす。新規に作ったアカウントでログイン。

# 501 ユーザではないことを確認

$ id


下記を実行
http://midorex.blogspot.com/2014/03/os-x-1092-02-kext-remove.html

1) 1 度目の Safe Mode を終了。Menu Bar  から Shut Down 電源を落とす。

#---------------------------------------------------------------------

2) 起動
下記を実行
http://midorex.blogspot.com/2014/03/os-x-1092-unload-agents.html
http://midorex.blogspot.com/2014/03/os-x-1092-unload-daemon.html
http://midorex.blogspot.com/2014/03/os-x-1092-04-coreservice.html
http://midorex.blogspot.com/2014/03/os-x-1092-05-chmod.html
http://midorex.blogspot.com/2014/03/os-x-1092-mv-noneed-daemon.html

4) FileVault ON
コマンドの実行を終了してからシステム環境設定セキュリティの中にある FileVault をON。

5) その他
# xattr にシステム全体を眺めてもらう。
http://midorex.blogspot.com/2014/03/os-x-1092-xattr-rd-finderinfo.html

$ man xattr
$ sudo find ./ -xattr


6) 確認

$ sudo lsof -i
$ ifconfig
$ sudo launchctl list
$ launchctl list


#---------------------------------------------------------------------
# syslog -w
#---------------------------------------------------------------------

alias 'syerr'='syslog -k Level Nle error -k'


#---------------------------------------------------------------------
# 過去 OS X をインストールした時に書いたもの
#---------------------------------------------------------------------
Mac OS X Lion Install
http://midorex.blogspot.com/2011/07/mac-os-x-lion-install.html

Snow Leopard Re-Install memo
http://midorex.blogspot.com/2010/02/snow-leopard-re-install-memo.html

OS X 10.8.2: disable-bluetooth
http://midorex.blogspot.com/2012/10/os-x-1082-disable-bluetooth.html

# OS X 10.9.2 においても引き続き参考になったところ。
Mac OS X Security Configuration Guides
http://www.apple.com/support/security/guides/

#---------------------------------------------------------------------
# ネットワーク
#---------------------------------------------------------------------
上記が完了したら管理者権限を持たない一般ユーザを新規に作成。
このユーザでログインしなおしてから
http://midorex.blogspot.com/2014/03/os-x-109-when-new-create-accountsh.html
http://midorex.blogspot.com/2014/03/os-x-1092-unload-agents.html
を実行。

Safa Mode Boot して 501 ユーザではない管理者権限をもつユーザでログイン。
http://midorex.blogspot.com/2014/03/os-x-1092-lib-pref-remove.html
を実行してネットワーク設定ファイルを一旦クリアする。

システム環境設定ーネットワークで新しい Location を作り新しいintereface を追加。

$ networksetup -listallnetworkservices

で active な <networkservice> 名を確認して

$ sudo networksetup -setv6off <networkservice>

を実行。

Reboot 再起動。

管理者権限を持たないユーザでログイン。
# インターネットに接続する時は管理者権限を持つユーザでログイン使用しない。

ネットワークに接続して
intego の
http://www.intego.com
VirusBarrier X6 評価版ををダウンロードインストール。
使用 version 10.6.21(2014-03-01 現在)

VirusBarrier X6 の設定において”システムプロセスを信頼する”の、チェックを外す。

インターネットに接続したとたん、
VB 6 (VirusBarrier X6) は

/System/Library/PrivateFrameworks/IMFoundation.framework/XPCServices/IMRemoteURLConnectionAgent.xpc

が外部に接続しようとしていると知らせた。

ps aux | grep xpc

などしてみたが、どのプロセスがこれを発動しているのかは、わからない。
ネットワークに接続したタイミングで必ず出現する。複数のIP address を使用しているようだ。

また
http://midorex.blogspot.com/2014/03/os-x-1092-unload-agents.html
http://midorex.blogspot.com/2014/03/os-x-1092-unload-daemon.html
を実行して speech 関連を抑制したつもりだったが、
ps aux してみたら

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/XPCServices/com.apple.speech.speechsynthesisd.xpc/Contents/MacOS/com.apple.speech.speechsynthesisd

が動いていた。speech サービスは抑制できていないことが判明した。

# 2014-03-01
# 下記の内容を追記。
# Date & times
# ネットワーク
# 2014-03-01
# 下記を追記。
# http://midorex.blogspot.com/2014/03/os-x-1092-04-coreservice.html
# 2014-03-01
# ”5) 設定用コマンドの実行” を追記。
# 誤字を修正したつもり。

#---------------------------------------------------------------------

# 2014-03-02

% open /Applications/Utilities/Keychain\ Access.app/


Keychain Access.app の設定を開き、"First Aid" 欄にある Check をすべて外す。
"Certificates" にある(OCSP) (CRL) をOFF に。
Keychains "login" の中にある鍵(インストール時に自動生成されたもの)をすべて削除。
# /Applications/Messages.app/ を
# 起動できなくしている
# http://midorex.blogspot.com/2014/03/os-x-1092-05-chmod.html 
# 為、messages に関係する鍵は不要。

管理者権限を持たないユーザ(ログインしているユーザ)で

% launchctl unload -w /System/Library/LaunchAgents/com.apple.safaridavclient.plist 
% launchctl unload -w /System/Library/LaunchAgents/com.apple.identityservicesd.plist

を実行した後、再起動。

% ps aux | grep Speech

してみたところ

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/XPCServices/com.apple.speech.speechsynthesisd.xpc/Contents/MacOS/com.apple.speech.speechsynthesisd

は、なくなっていた。

さらに、インターネットに接続するタイミングで

/System/Library/PrivateFrameworks/IMFoundation.framework/XPCServices/IMRemoteURLConnectionAgent.xpc

が外部に接続しようとしていると、VB 6 が知らせていた現象が、なくなった。しばらく様子をみる。

# 2014-03-03
管理者権限を持たないユーザでログインしている状態。

% ps aux | grep Speech


"Speech" ではなく "speech" だったことに気がつきまして正確に

% ps aux | grep speech

してみたところ

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/XPCServices/com.apple.speech.speechsynthesisd.xpc/Contents/MacOS/com.apple.speech.speechsynthesisd

は、存在したままであることが判明したので、

% launchctl list | grep speech
/System/Library/LaunchAgents/com.apple.speech.speechsynthesisd.plist

が動いているとわかった。

% launchctl list com.apple.speech.speechsynthesisd
{
	"Label" = "com.apple.speech.speechsynthesisd";
	"LimitLoadToSessionType" = "Background";
	"OnDemand" = true;
	"LastExitStatus" = 0;
	"PID" = 3513;
	"TimeOut" = 30;
	"Program" = "/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/XPCServices/com.apple.speech.speechsynthesisd.xpc/Contents/MacOS/com.apple.speech.speechsynthesisd";
	"EnableTransactions" = true;
	"MachServices" = {
		"com.apple.speech.speechsynthesisd" = mach-port-object;
	};
};
% 


リムーブをこころみるが

% launchctl remove /System/Library/LaunchAgents/com.apple.speech.speechsynthesisd.plist
launchctl remove error: No such process
% 

と、いわれて remove できません

# 管理者権限を持つユーザになる
$ su AdminUser
# make backup folder
$ mkdir ~/backup-speechsynthesisd-agent
# 移動させてしまう
$ sudo mv /System/Library/LaunchAgents/com.apple.speech.*   ~/backup-speechsynthesisd-agent


Menu から Restart "再起動"して管理者権限を持たないユーザでログイン。

% launchctl list | grep speech
% ps aux | grep speech

を確認して今度こそ

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/XPCServices/com.apple.speech.speechsynthesisd.xpc/Contents/MacOS/com.apple.speech.speechsynthesisd

が存在していないことを確認した。

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

OS X 10.9.2: 00-hostconfig-hostsdeny

# custom-etc-hostconfig

# This file is going away

AFPSERVER=-NO-
AUTHSERVER=-NO-
TIMESYNC=-NO-
QTSSERVER=-NO-

APPLETALK=-NO-
MAILSERVER=-NO-
MANAGEMENTSERVER=-NO-
NETINFOSERVER=-NO-

RPCSERVER=-NO-
NETBOOTSERVER=-NO-
NISDOMAIN=-NO-
TIMESYNC=-NO-
QTSSERVER=-NO-
SSHSERVER=-NO-
WEBSERVER=-NO-
SMBSERVER=-NO-
VPNSERVER=-NO-


# setting-custom-hostconifg.sh

#!/bin/bash
sudo mv /etc/hostconfig org-hostconfig
sudo cp custom-etc-hostconfig  /etc/hostconfig
sudo chmod 644 /etc/hostconfig
cat /etc/hostconfig


#---------------------------------------------------------------------
# /etc/hosts.deny
#---------------------------------------------------------------------
# hostsdeny.txt

ALL:ALL


# setting-hosts-deny.sh

#!/bin/bash
sudo cp hostsdeny.txt /etc/hosts.deny
sudo chmod 644 /etc/hosts.deny


# 実行

sudo ./setting-custom-hostconifg.sh
sudo ./setting-hosts-deny.sh

OS X 10.9.2: 00-first

# 00-first.sh

#!/bin/bash
# 00-first.sh
# OS X 10.9.2
#
#---------------------------------------------------------------------
# change mode share folder
#---------------------------------------------------------------------
chmod 0 ~/Public/Drop\ Box/ ~/Public/
chmod 700 $HOME

#---------------------------------------------------------------------
# airplay, cupsd, netbiosd
#---------------------------------------------------------------------
# AirPlay
launchctl unload -w /System/Library/LaunchAgents/com.apple.AirPlayUIAgent.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AirPlayXPCHelper.plist
# Cupsd
sudo launchctl unload -w /System/Library/LaunchDaemons/org.cups.cupsd.plist
# Netbios
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist

## AirDrop
# OS X 10.9.2: Disable AirDrop
# http://midorex.blogspot.com/2014/03/os-x-1092-disable-airdrop.html

#---------------------------------------------------------------------
# ipv6 OFF all Interfaces
#---------------------------------------------------------------------
sudo networksetup -setv6off "Thunderbolt Bridge"
sudo networksetup -setv6off "Thunderbolt 1"
sudo networksetup -setv6off 'USB Ethernet'
sudo networksetup -setv6off "Wi-Fi"
# sudo networksetup -setv6off "Bluetooth DUN"

#---------------------------------------------------------------------
# Computer Name
#---------------------------------------------------------------------
# cname='mycomputername'
# sudo systemsetup -setcomputername $cname
# sudo systemsetup -getcomputername

#---------------------------------------------------------------------
# Netbios Name
#---------------------------------------------------------------------
# nbname='mybiosname'
# sudo scutil --set LocalHostName $nbname
# sudo scutil --get LocalHostName

cat /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist

#---------------------------------------------------------------------
# input Volume
#---------------------------------------------------------------------
sudo osascript -e "set volume input volume 0"

#---------------------------------------------------------------------
# root
#---------------------------------------------------------------------
## sudo rm -rf /var/root/Library/
## sudo chmod 0 /private/var/root

#---------------------------------------------------------------------
# Spotright off
#---------------------------------------------------------------------
sudo mdutil -a -E -i off /

# Enable or disable Spotlight in Mac OS X
# http://kristerlaag.tumblr.com/post/69885371103/enable-or-disable-spotlight-in-mac-os-x
sudo touch /.metadata_never_index

#---------------------------------------------------------------------
# fseventsd
#---------------------------------------------------------------------
sudo chmod 755 /.fseventsd/
cd /.fseventsd/
sudo rm -rf 0000*
sudo touch /.fseventsd/no_log
# 2014-03-12
sudo chmod 644 /.fseventsd/no_log

sudo chmod 700 /.fseventsd/
sudo ls -la /.fseventsd/

#---------------------------------------------------------------------
# Other Directory
#---------------------------------------------------------------------
## path to /Volumes/not-system-root-volumes
# vo=/Volumes/path

# sudo chmod 755 $vo/.fseventsd/
# cd $vo/.fseventsd/
# sudo rm -rf 0000*
# sudo touch $vo/.fseventsd/no_log
# 2014-03-12
# sudo chmod 644 $vo/.fseventsd/no_log

# sudo chmod 700 $vo/.fseventsd/
# sudo ls -la $vo/.fseventsd/

#---------------------------------------------------------------------
# memory
#---------------------------------------------------------------------
sudo nvram security-mode="full"
sudo nvram -x -p

#---------------------------------------------------------------------
# Pmset
#---------------------------------------------------------------------
# sudo srm -rf /private/var/vm/sleepimage 
sudo pmset -a sleep 0
sudo pmset -a womp 0
sudo pmset -a autorestart 0
sudo pmset -a hibernatemode 0
# sudo pmset -a disksleep 1
# sudo pmset -a ttyskeepawake 0

#---------------------------------------------------------------------
# softwareupdate
#---------------------------------------------------------------------
### sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate catalogURL http://swupdate.apple.com:8088/index-leopard-snowleopard.merged-1.suctalog
sudo softwareupdate --schedule off
#=>Automatic check is off

#---------------------------------------------------------------------
# sshd off
#---------------------------------------------------------------------
# $ man systemsetup
# Displays whether remote login (SSH) is on or off.
sudo systemsetup -f -setremotelogin off
sudo systemsetup -getremotelogin
# =>
# Remote Login: Off


# 参考にしたところ
Mac OS X Security Configuration Guides
http://www.apple.com/support/security/guides/

# 2014-03-01 追記
Enable or disable Spotlight in Mac OS X
http://kristerlaag.tumblr.com/post/69885371103/enable-or-disable-spotlight-in-mac-os-x
Enable or disable Spotlight in Mac OS X

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

# 2014-03-12
# added
sudo chmod 644 /.fseventsd/no_log

OS X 10.9.2: 01-defaults-write

# 01-defaults-write.sh

#!/bin/bash
# OS X 10.9.2
#
#---------------------------------------------------------------------
# defaults write
#---------------------------------------------------------------------
# AirDrop NetworkBrowser
sudo defaults write /Library/Preferences/com.apple.NetworkBrowser DisableAirDrop -bool Yes
sudo defaults write /Library/Preferences/com.apple.NetworkBrowser BrowseAllInterfaces -bool No

defaults write com.apple.NetworkBrowser DisableAirDrop -bool Yes
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool No

# aperance
sudo defaults write com.apple.recentitems Applications -dict MaxAmount 0
sudo defaults read com.apple.recentitems

# power of blutooth
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0
defaults read /Library/Preferences/com.apple.Bluetooth

# blank cd
sudo defaults write /library/preferences/com.apple.digihub com.apple.digihub.blank.cd.appeared -dict action 1
sudo defaults write /library/preferences/com.apple.digihub com.apple.digihub.blank.cd.appeared -dict action 1
sudo defaults write /library/preferences/com.apple.digihub com.apple.digihub.cd.music.appeared -dict action 1
sudo defaults write /library/preferences/com.apple.digihub com.apple.digihub.cd.picture.appeared -dict action 1
sudo defaults write /library/preferences/com.apple.digihub com.apple.digihub.blank.dvd.appeared -dict action 1
sudo defaults write /library/preferences/com.apple.digihub com.apple.digihub.blank.dvd.video.appeared -dict action 1
sudo defaults read /library/preferences/com.apple.digihub

# scrennsaver
sudo defaults -currentHost write com.apple.screensaver askForPassword -int 1
sudo defaults write /Library/Preferences/.GlobalPreferences.plist com.apple.userspref.DisableAutoLogin -bool yes
sudo defaults write /Library/Preferences/.GlobalPreferences.plist com.apple.autologout.AutoLogOutDelay -int 0

# Memory
sudo defaults write /Library/Preferences/com.apple.virtualMemory UseEncryptedSwap -bool yes

# IR
sudo defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool no

# firewall
sudo defaults write /Library/Preferences/com.apple.alf stealthenabled 1
sudo defaults write /Library/Preferences/com.apple.alf loggingenabled 1
sudo defaults write /Library/Preferences/com.apple.alf loggingoption 1
defaults read /Library/Preferences/com.apple.alf

# SWAP
sudo defaults write /Library/Preferences/com.apple.virtualMemory UseEncryptedSwap -bool YES

# Time Machine OFF
sudo defaults write /Library/Preferences/com.apple.TimeMachine AutoBackup 0
defaults read /Library/Preferences/com.apple.TimeMachine

# disable speech
sudo defaults write "com.apple.speech.recognition.AppleSpeechRecognition.prefs" StartSpeakableItem -bool false

# disable text speech
sudo defaults write "com.apple.speech.synthesis.general.prefs" TalkingAlertsSpeakTextFlag -bool false
sudo defaults write "com.apple.speech.synthesis.general.prefs" SpokenNotificationAppActivationFlag -bool false
sudo defaults write "com.apple.speech.synthesis.general.prefs" SpokenUIUseSpeakingHotKeyFlag -bool false

#---------------------------------------------------------------------
# Bluetooth Sharing
#---------------------------------------------------------------------
# Bluetooth OFF
sudo defaults -currentHost write com.apple.bluetooth PrefKeyServicesEnabled 0
sudo defaults -currentHost read  com.apple.bluetooth

#---------------------------------------------------------------------
# Nat
#---------------------------------------------------------------------
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.nat Nat -dict Enabled -int 0
sudo defaults read  /Library/Preferences/SystemConfiguration/com.apple.nat
#{
#    Nat =     {
#        Enabled = 0;
#    };
#}
sudo chmod 0 /usr/sbin/natd

# original mode
#$ ls -la /usr/sbin/natd
#-r-xr-xr-x  1 root  wheel  114720  4  1  2010 /usr/sbin/natd


# 参考にしたところ
Mac OS X Security Configuration Guides
http://www.apple.com/support/security/guides/

OS X 10.9.2: 02-kext-remove

# 02-kext-remove.sh

#!/bin/bash
# OS X 10.9.2
#
#---------------------------------------------------------------------
# Extentions remove
#---------------------------------------------------------------------
home=$HOME
d=$home/backup-extentions
mkdir $d

# face time camera
sudo mv /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBMergeNub.kext $d/
sudo touch /System/Library/Extensions

# bluetooth
sudo srm -rf /System/Library/Extensions/IOBluetoothFamily.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/IOBluetoothHIDDriver.kext
sudo touch /System/Library/Extensions

# bluetooth keyboard
sudo srm -rf /System/Library/Extensions/AppleBluetoothMultitouch.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/AppleHIDKeyboard.kext/Contents/PlugIns/AppleBluetoothHIDKeyboard.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/AppleHIDMouse.kext/Contents/PlugIns/AppleBluetoothHIDMouse.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/AppleHIDKeyboard.kext/Contents/Resources/BS_UI_Plugin_IOAppleBluetoothHIDDriver-Info.plist
sudo touch /System/Library/Extensions

# irc
sudo srm -rf /System/Library/Extensions/AppleIRController.kext
sudo touch /System/Library/Extensions

# iSight
sudo srm -rf /System/Library/Extensions/Apple_iSight.kext
sudo touch /System/Library/Extensions
sudo srm -rf /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext
sudo touch /System/Library/Extensions

###
# Cache
###
# sudo srm -rf /System/Library/Extensions/AppleHDA.kext/
# sudo touch /System/Library/Extensions

# Audio
# sudo mv /System/Library/Extensions/AppleUSBAudio.kext $d/
# sudo touch /System/Library/Extensions
# sudo mv /System/Library/Extensions/IOAudioFamily.kext $d/
# sudo touch /System/Library/Extensions

# web application
# sudo mv /System/Library/Extensions/webdav_fs.kext $d/
# sudo touch /System/Library/Extensions/

# smb
# sudo mv /System/Library/Extensions/smbfs.kext $d/
# sudo touch /System/Library/Extensions/

# PPP Modem
## sudo mv /System/Library/Extensions/PPPoE.ppp $d
## sudo mv /System/Library/Extensions/PPP.kext $d
## sudo mv /System/Library/Extensions/PPPSerial.ppp $d
## sudo mv /System/Library/Extensions/JMicronATA.kext $d
## sudo touch /System/Library/Extensions/


# 参考
Mac OS X Security Configuration Guides
http://www.apple.com/support/security/guides/

OS X 10.9.2: mv-noneed-daemon

# 06-mv-noneed-daemon.sh

#!/bin/bash
# OS X 10.9.2

home=$HOME
d=$home/backup-daemon
mkdir $d

sudo mv /System/Library/LaunchDaemons/com.apple.InternetSharing.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.racoon.plist $d
sudo mv /System/Library/LaunchDaemons/exec.plist $d

# /usr/libexec/rlogind
sudo mv /System/Library/LaunchDaemons/login.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.comsat.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.eppc.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.uucp.plist $d
sudo mv /System/Library/LaunchDaemons/ntalk.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.msrpc* $d
sudo mv /System/Library/LaunchDaemons/com.apple.screensharing.plist $d
sudo mv /System/Library/LaunchDaemons/ssh.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.xsan.plist
sudo mv /System/Library/LaunchDaemons/com.apple.xsanmgrd.plist $d

sudo mv /System/Library/LaunchDaemons/tftp.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.kdumpd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist $d

sudo mv /System/Library/LaunchDaemons/finger.plist $d
sudo mv /System/Library/LaunchDaemons/ftp.plist $d
sudo mv /System/Library/LaunchDaemons/telnet.plist $d
sudo mv /System/Library/LaunchDaemons/org.cups.cupsd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.RemoteDesktop.PrivilegeProxy.plist $d

sudo mv /System/Library/LaunchDaemons/com.apple.netbiosd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.smbd.plist $d

sudo mv /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist $d
sudo mv /System/Library/LaunchDaemons/org.apache.httpd.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.nfsd.plist  $d
sudo mv /System/Library/LaunchDaemons/com.apple.nfsconf.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.webdavfs_load_kext.plist $d
sudo mv /System/Library/LaunchDaemons/com.apple.bnepd.plist $d

# man rshd
sudo mv /System/Library/LaunchDaemons/shell.plist $d

OS X 10.9.2: 05-chmod

# 05-chmod.sh

#!/bin/bash
# 05-chmod.sh
# OS X 10.9.2
#---------------------------------------------------------------------
# appleEvent
#---------------------------------------------------------------------
sudo chmod 0 /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Versions/A/Support/AEServer

#---------------------------------------------------------------------
# Bonjour Plugins
#---------------------------------------------------------------------
sudo chmod 0 /System/Library/UserEventPlugins/com.apple.bonjour.plugin
sudo chmod 0 /System/Library/UserEventPlugins/BonjourEvents.plugin

#---------------------------------------------------------------------
# nat
#---------------------------------------------------------------------
sudo chmod 0 /usr/sbin/natd

#---------------------------------------------------------------------
# App
#---------------------------------------------------------------------
sudo chmod 0 /Applications/Utilities/Boot\ Camp\ Assistant.app/
sudo chmod 0 /Applications/Mail.app/
sudo chmod 0 /Applications/Messages.app/
sudo chmod 0 /Applications/FaceTime.app/
sudo chmod 0 /Applications/Photo\ Booth.app/
sudo chmod 0 /Applications/Image\ Capture.app/
sudo chmod 0 /Applications/QuickTime\ Player.app/

#---------------------------------------------------------------------
# root
#---------------------------------------------------------------------
# 2014-03-05
sudo rm -rf /private/var/root/Library/
sudo chmod 0 /private/var/root

#---------------------------------------------------------------------
# rlogin
#---------------------------------------------------------------------
sudo chmod 0 /usr/libexec/rshd
sudo chmod 0 /usr/libexec/rlogind
sudo chmod 0 /usr/libexec/rpcsvchost

#---------------------------------------------------------------------
# smbd, smbf, cups
#---------------------------------------------------------------------
sudo chmod 0 /sbin/mount_smbfs
sudo chmod 0 /usr/bin/smbutil

sudo chmod 0 /usr/lib/sasl2/smb_nt.la
sudo chmod 0 /usr/lib/sasl2/smb_nt.so
sudo chmod 0 /usr/lib/sasl2/smb_ntlmv2.la
sudo chmod 0 /usr/lib/sasl2/smb_ntlmv2.so

sudo chmod 0 /usr/libexec/cups/apple/smb
sudo chmod 0 /usr/libexec/cups/backend/smb
sudo chmod 0 /usr/libexec/dtrace/smbd
sudo chmod 0 /usr/libexec/dtrace/smbtrace.d

sudo chmod 0 /usr/libexec/smb-migrate-preferences
sudo chmod 0 /usr/libexec/smb-sync-preferences

sudo chmod 0 /usr/sbin/cupsaddsmb
sudo chmod 0 /usr/sbin/smbd
sudo chmod 0 /usr/share/doc/cups/help/man-cupsaddsmb.html

sudo chmod 0 /private/etc/openldap/schema/samba.schema
sudo chmod 0 /usr/share/cups/templates/samba-export.tmpl
sudo chmod 0 /usr/share/cups/templates/samba-exported.tmpl

sudo chmod 0 /usr/sbin/netbiosd

# The Mac OS X Bluetooth network daemon
sudo chmod 0 /usr/sbin/bnepd

# 2014-03-12
sudo chmod 0 /usr/sbin/blued
# http://midorex.blogspot.com/2014/03/os-x-1092-disable-airdrop.html
# sharing -- create share points for afp, ftp and smb services.
sudo chmod 0 /usr/sbin/sharing

#---------------------------------------------------------------------
# httpd
#---------------------------------------------------------------------
sudo chmod 0 /usr/sbin/httpd
sudo chmod 0 /usr/sbin/apachectl

sudo chmod 0 /usr/share/examples/DTTk/httpdstat_example.txt
sudo chmod 600 /usr/share/httpd
sudo chmod 0 /usr/bin/httpdstat.d

sudo srm -rf /Library/WebServer/
# /Library/WebServer/CGI-Executables/
# /Library/WebServer/share/

sudo srm -rf /private/etc/apache2
sudo srm -rf /usr/libexec/apache2
sudo chmod 0 /usr/bin/rails

#---------------------------------------------------------------------
# Internet Plugins
#---------------------------------------------------------------------
# sudo chmod 600 /System/Library/Java/
sudo chmod 0 /Library/Internet\ Plug-Ins/QuickTime\ Plugin.plugin/

#---------------------------------------------------------------------
# sshd
#---------------------------------------------------------------------
sudo chmod 0 /usr/sbin/sshd
sudo chmod 0 /private/etc/sshd_config

#---------------------------------------------------------------------
# ftpd
#---------------------------------------------------------------------
sudo chmod 0 /usr/libexec/ftpd
sudo chmod 0 /usr/libexec/sftp-server

# $ sudo find ./ -name "*ftpd*"
sudo chmod 0 /private/etc/ftpd.conf
sudo chmod 0 /private/etc/ftpd.conf.default

sudo chmod 0 /System/Library/Tcl/tcllib1.12/ftpd
sudo chmod 0 /System/Library/Tcl/tcllib1.12/ftpd/ftpd.tcl

sudo chmod 0 /usr/libexec/tftpd

sudo chmod 0 /usr/share/examples/tnftpd
sudo chmod 0 /usr/share/examples/tnftpd/ftpd.conf

sudo chmod 0 /usr/share/ftpd
sudo chmod 0 /usr/share/ftpd/examples/ftpd.conf

#---------------------------------------------------------------------
# nfsd
#---------------------------------------------------------------------
sudo chmod 0 /sbin/nfsd

#.//System/Library/Filesystems/acfs.fs/Contents/bin/snfsdefrag
#.//System/Library/Filesystems/acfs.fs/Contents/man/man1/snfsdefrag.1
# sudo chmod 0 /System/Library/LaunchDaemons/com.apple.nfsd.plist
# snfsdefrag - Xsan File System Defrag Utility

#---------------------------------------------------------------------
# cupsd
#---------------------------------------------------------------------
sudo chmod 0 /usr/sbin/cupsd
sudo chmod 0 /private/etc/cups/cupsd.conf
sudo chmod 0 /private/etc/cups/cupsd.conf.default

sudo chmod 400 /usr/bin/cups-config
sudo chmod 400 /usr/bin/cupstestdsc
sudo chmod 400 /usr/bin/cupstestppd

sudo chmod 600 /usr/sbin/cupsaccept
sudo chmod 600 /usr/sbin/cupsaddsmb
sudo chmod 600 /usr/sbin/cupsctl
sudo chmod 600 /usr/sbin/cupsenable
sudo chmod 600 /usr/sbin/cupsfilter
sudo chmod 600 /usr/sbin/cupsreject
sudo chmod 600 /usr/share/cups

#---------------------------------------------------------------------
# racoon
#---------------------------------------------------------------------
sudo chmod 0 /usr/sbin/racoon
sudo chmod 0 /private/etc/racoon
sudo chmod 0 /private/etc/racoon/racoon.conf

#---------------------------------------------------------------------
# pppd, vpnd
#---------------------------------------------------------------------
sudo chmod 0 /usr/sbin/pppd
sudo chmod 0 /usr/sbin/vpnd

#---------------------------------------------------------------------
# PPP Modem
#---------------------------------------------------------------------
sudo chmod 0 /Library/Modem\ Scripts/

#---------------------------------------------------------------------
# rpc
#---------------------------------------------------------------------
# 2014-03-03
sudo chmod 0 /etc/rpc
sudo chmod 0 /etc/rc.common
sudo chmod 0 /etc/snmp

# 2014-03-05
sudo chmod 0 /usr/sbin/postfix

sudo chmod 0 /usr/sbin/sendmail
sudo chmod 0 /var/jabberd
sudo chmod 0 /var/rpc
sudo chmod 0 /var/rwho


# 2014-03-02
# 追記と訂正。
重複していた行を削除。
pam.d に対するコマンドの # を削除。

# 2014-03-03
pam.dについては別の記事にした為
http://midorex.blogspot.com/2014/03/os-x-1092-pamd.html
下記を削除した。

#---------------------------------------------------------------------
# /etc/pam.d/
#---------------------------------------------------------------------
# sudo chmod 0 /private/etc/pam.d/smbd
# sudo chmod 0 /private/etc/pam.d/ftpd
# sudo chmod 0 /private/etc/pam.d/sshd
# sudo chmod 0 /private/etc/pam.d/rshd


# 2014-03-03
# rpc を追加。

# 2014-03-05
# root
# "#" を削除

# 2014-03-05
# s/postfix/\/usr\/sbin\/postfix/

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

# 2014-03-12
# added
sudo chmod 0 /usr/sbin/blued
sudo chmod 0 /usr/sbin/sharing

# $ man rexecd
# rexecd -- remote execution server
# $ sudo chmod 0 /usr/libexec/rexecd

# $ sudo chmod 0 /usr/libexec/AirPlayXPCHelper
# $ sudo chmod 0 /usr/libexec/InternetSharing

# $ tail -f /var/log/displaypolicyd.log
# $ sudo chmod 600 /usr/libexec/displaypolicyd

# $ pwd /etc
# $ sudo chmod 0 ppp
# $ sudo chmod 0 afpovertcp.cfg
# $ man mnthome
# $ whereis mnthome
# /usr/bin/mnthome

OS X 10.9.2: unload-daemon

# 03-2-unload-daemon.sh

<pre>
#!/bin/bash
# OS X 10.9.2
#
# aosnotifyd -- Find My Mac daemon
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AOSNotificationOSX.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.locationd.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.cmio.AVCAssistant.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.cmio.VDCAssistant.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.iCloudStats.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.wwand.plist

# /usr/libexec/rpcsvchos
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.msrpc.netlogon.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.msrpc.srvsvc.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.msrpc.wkssvc.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.msrpc.mdssvc.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.msrpc.lsarpc.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/org.cups.cupsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AirPlayXPCHelper.plist

# blued
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.blued.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.bluetoothaudiod.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.IOBluetoothUSBDFU.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.rpcbind.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump_symbolicator.plist

# metadata
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.index.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.spindump.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.scan.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.RemoteDesktop.PrivilegeProxy.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.racoon.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.lockd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.nfsd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.nfsconf.plist
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.nis.ypbind.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mbicloudsetupd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.gssd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.findmymac.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.findmymacmessenger.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.cmio.IIDCVideoAssistant.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.bnepd.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.afpfs_checkafp.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.afpfs_afpLoad.plist

# Apple Push Notification service daemon
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist
# awacsd -- Apple Wide Area Connectivity Service daemon
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.awacsd.plist

# share service
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.RFBEventHelper.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.webdavfs_load_kext.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mdmclient.daemon.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.cmio.AppleCameraAssistant.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.revisiond.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smb.preferences.plist

OS X 10.9.2: unload-agents

# 03-1-unload-agents.sh

#!/bin/bash
# 03-1-unload-agents.sh
# OS X 10.9.2
launchctl unload -w /System/Library/LaunchAgents/com.apple.librariand.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.soagent.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.NetworkBrowserAgent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.AirPlayUIAgent.plist

# sharingd -- Sharing Daemon that enables AirDrop, Shared Computers, and Remote Disc in the Finder.
launchctl unload -w /System/Library/LaunchAgents/com.apple.sharingd.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.imagent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.WebKit.PluginAgent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.scopedbookmarkagent.xpc.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.bookstoreagent.plist

launchctl unload -w  /System/Library/LaunchAgents/com.apple.assistantd.plist
launchctl unload -w  /System/Library/LaunchAgents/com.apple.assistant_service.plist

launchctl unload -w  /System/Library/LaunchAgents/com.apple.AirPortBaseStationAgent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.AOSPushRelay.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.icloud.AOSNotificationAgent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.quicklook.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.quicklook.config.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.quicklook.ui.helper.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.quicklook.32bit.plist

# meta data
launchctl unload -w /System/Library/LaunchAgents/com.apple.metadata.mdwrite.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.spindump_agent.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.VoiceOver.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.ubd.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.syncservices.uihandler.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.syncservices.SyncServer.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.speech.voiceinstallerd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.speech.synthesisserver.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.speech.recognitionserver.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.speech.feedbackservicesserver.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.speech.speechdatainstallerd.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.SocialPushAgent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.maspushagent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.Maps.pushdaemon.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.screensharing.agent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.screensharing.MessagesAgent.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.RemoteDesktop.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.printuitool.agent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.printtool.agent.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.midiserver.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.mdmclient.agent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.gamed.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.findmymacmessenger.plist

## launchctl unload -w /System/Library/LaunchAgents/com.apple.bluetoothAudioAgent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.bluetoothUIServer.plist
launchctl unload -w /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.java.updateSharing.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.java.InstallOnDemand.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.talagent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.librariand.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.AddressBook.SourceSync.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.AddressBook.abd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.AddressBook.AssistantService.plist

launchctl unload -w /System/Library/LaunchAgents/com.apple.familycontrols.useragent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.parentalcontrols.check.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.ScreenReaderUIServer.plist

# 2014-03-02
launchctl unload -w /System/Library/LaunchAgents/com.apple.safaridavclient.plist


# 2014-03-05
# 要手動
# launchctl unload -w /System/Library/LaunchAgents/com.apple.identityservicesd.plist

# 2014-03-05
# 下記の追記を pre の中から削除
# 2014-03-03
launchctl unload -w /System/Library/LaunchAgents/com.apple.storeagent.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.store_helper.plist
launchctl unload -w /System/Library/LaunchAgents/com.apple.appstoreupdateagent.plist
# 2014-03-03
launchctl unload -w /System/Library/LaunchAgents/com.apple.softwareupdate_notify_agent.plist

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

OS X 10.9.2: xattr-rd-finderInfo

# xattr-rd-finderInfo.sh

#!/bin/bash
# xattr-rd-finderInfo.sh
# OS X 10.9.2

sudo xattr -r -d com.apple.FinderInfo /
sudo find ./ -xattr
echo finish

OS X 10.9.2: Disable AirDrop

# disable_airdrop.sh

#!/bin/bash
# disable_airdrop.sh
# OS X 10.9.2
#
home=$HOME
#---------------------------------------------------------------------
# defaults write com.apple.NetworkBrowser
#---------------------------------------------------------------------
# osx - how to disable Airdrop on Mac Book Pro (Retina)? - Super User
# http://superuser.com/questions/568676/how-to-disable-airdrop-on-mac-book-pro-retina
#
sudo defaults write /Library/Preferences/com.apple.NetworkBrowser DisableAirDrop -bool Yes
sudo defaults write /Library/Preferences/com.apple.NetworkBrowser BrowseAllInterfaces -bool No
defaults write com.apple.NetworkBrowser DisableAirDrop -bool Yes
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool No

#---------------------------------------------------------------------
# unload agents
#---------------------------------------------------------------------
sudo launchctl unload -w /System/Library/LaunchAgents/com.apple.sharingd.plist
sudo chmod 0 /System/Library/LaunchAgents/com.apple.sharingd.plist

# 2014-03-03
# man sharingd に書かれいる  /usr/libexec/sharingd は存在していなかった。
#
# "shringd" の "d" がない方のマニュアルを読んでみたところ
# sharing は様々なサービス(smb とか)の share point を提供するものだとわかった。
# パスもわかった。
#
# $ man sharing
# =>
# sharing -- create share points for afp, ftp and smb services.
# ...
#
sudo chmod 0 /usr/sbin/sharing

#---------------------------------------------------------------------
# remove Plugins
#---------------------------------------------------------------------
hal=$home/backup-lib-audio-plugin-hal
mkdir $hal
sudo mv /Library/Audio/Plug-Ins/HAL/ $hal

#---------------------------------------------------------------------
# remove System/Library/PrivateFrameworks/ShareKit
#---------------------------------------------------------------------
sk=$home/backup-lib-private-framework-sharekit-plugins
mkdir $sk
sudo mv /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns  $sk/

#---------------------------------------------------------------------
# reject udp 5353
#---------------------------------------------------------------------
sudo ipfw -q add reject udp from any to me dst-port 5353


# 2014-03-01
bloggger においてのTag 追記

# 2014-03-01
# 追記。

% whatis airdrop
airdrop: nothing appropriate
% whatis AirDrop
AirDrop: nothing appropriate
% whereis AirDrop
% whereis AirDropd
% whereis airdropd
% 
% apropoe airdrop
airdrop: nothing appropriate
% apropos AirDrop
AirDrop: nothing appropriate


# HERE!

% man -K AirDrop
/usr/share/man/man8/sharingd.8? [ynq] y

% man sharingd
sharingd(8)               BSD System Manager's Manual              sharingd(8)

NAME
     sharingd -- Sharing Daemon that enables AirDrop, Shared Computers, and Remote Disc in the Finder.

SYNOPSIS
     sharingd

DESCRIPTION
     sharingd is used by the Finder to enable AirDrop file sharing, connecting to shared computers, and accessing Remote Discs from other computers.

FILES
     /usr/libexec/sharingd

HISTORY
     sharingd first appeared in Mac OS X 10.9.

Darwin                           March 1, 2014                          Darwin
(END) 


# 2014-03-01
# 追記。
osx - how to disable Airdrop on Mac Book Pro (Retina)? - Super User

# 2014-03-02
複数の # を削除。

# 2014-03-04
# UPDATED: 2014-03-04T06:45:46.525+09:00
# $ man sharing 追記

# 2014-03-07
# 公開日時の訂正
http://midorex.blogspot.com/2014/03/published-date.html

# MEMO
# 2014-03-12

% cat /etc/pf.anchors/com.apple
#
# com.apple ruleset, referred to by the default /etc/pf.conf file.
# See notes in that file regarding the anchor point in the main ruleset.
#
# Copyright (c) 2011 Apple Inc. All rights reserved.
#

#
# AirDrop anchor point.
#
anchor "200.AirDrop/*"

#
# Application Firewall anchor point.
#
anchor "250.ApplicationFirewall/*"

% 

% man pfctl