A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 141KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang=fr>
  4. <!-- Has to be within the first 1024 bytes, hence before the <title>
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset=utf-8>
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name=viewport content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>A practical guide to securing macOS. (archive) — David Larlet</title>
  13. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  14. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons/apple-touch-icon.png">
  15. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons/favicon-32x32.png">
  16. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons/favicon-16x16.png">
  17. <link rel="manifest" href="/manifest.json">
  18. <link rel="mask-icon" href="/static/david/icons/safari-pinned-tab.svg" color="#5bbad5">
  19. <link rel="shortcut icon" href="/static/david/icons/favicon.ico">
  20. <meta name="apple-mobile-web-app-title" content="David Larlet">
  21. <meta name="application-name" content="David Larlet">
  22. <meta name="msapplication-TileColor" content="#da532c">
  23. <meta name="msapplication-config" content="/static/david/icons/browserconfig.xml">
  24. <meta name="theme-color" content="#f0f0ea">
  25. <!-- That good ol' feed, subscribe :p. -->
  26. <link rel=alternate type="application/atom+xml" title=Feed href="/david/log/">
  27. <meta name="robots" content="noindex, nofollow">
  28. <meta content="origin-when-cross-origin" name="referrer">
  29. <!-- Canonical URL for SEO purposes -->
  30. <link rel="canonical" href="https://github.com/drduh/macOS-Security-and-Privacy-Guide">
  31. <style>
  32. /* http://meyerweb.com/eric/tools/css/reset/ */
  33. html, body, div, span,
  34. h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  35. a, abbr, address, big, cite, code,
  36. del, dfn, em, img, ins,
  37. small, strike, strong, tt, var,
  38. dl, dt, dd, ol, ul, li,
  39. fieldset, form, label, legend,
  40. table, caption, tbody, tfoot, thead, tr, th, td,
  41. article, aside, canvas, details, embed,
  42. figure, figcaption, footer, header, hgroup,
  43. menu, nav, output, ruby, section, summary,
  44. time, mark, audio, video {
  45. margin: 0;
  46. padding: 0;
  47. border: 0;
  48. font-size: 100%;
  49. font: inherit;
  50. vertical-align: baseline;
  51. }
  52. /* HTML5 display-role reset for older browsers */
  53. article, aside, details, figcaption, figure,
  54. footer, header, hgroup, menu, nav, section { display: block; }
  55. body { line-height: 1; }
  56. blockquote, q { quotes: none; }
  57. blockquote:before, blockquote:after,
  58. q:before, q:after {
  59. content: '';
  60. content: none;
  61. }
  62. table {
  63. border-collapse: collapse;
  64. border-spacing: 0;
  65. }
  66. /* http://practicaltypography.com/equity.html */
  67. /* https://calendar.perfplanet.com/2016/no-font-face-bulletproof-syntax/ */
  68. /* https://www.filamentgroup.com/lab/js-web-fonts.html */
  69. @font-face {
  70. font-family: 'EquityTextB';
  71. src: url('/static/david/css/fonts/Equity-Text-B-Regular-webfont.woff2') format('woff2'),
  72. url('/static/david/css/fonts/Equity-Text-B-Regular-webfont.woff') format('woff');
  73. font-weight: 300;
  74. font-style: normal;
  75. font-display: swap;
  76. }
  77. @font-face {
  78. font-family: 'EquityTextB';
  79. src: url('/static/david/css/fonts/Equity-Text-B-Italic-webfont.woff2') format('woff2'),
  80. url('/static/david/css/fonts/Equity-Text-B-Italic-webfont.woff') format('woff');
  81. font-weight: 300;
  82. font-style: italic;
  83. font-display: swap;
  84. }
  85. @font-face {
  86. font-family: 'EquityTextB';
  87. src: url('/static/david/css/fonts/Equity-Text-B-Bold-webfont.woff2') format('woff2'),
  88. url('/static/david/css/fonts/Equity-Text-B-Bold-webfont.woff') format('woff');
  89. font-weight: 700;
  90. font-style: normal;
  91. font-display: swap;
  92. }
  93. @font-face {
  94. font-family: 'ConcourseT3';
  95. src: url('/static/david/css/fonts/concourse_t3_regular-webfont-20190806.woff2') format('woff2'),
  96. url('/static/david/css/fonts/concourse_t3_regular-webfont-20190806.woff') format('woff');
  97. font-weight: 300;
  98. font-style: normal;
  99. font-display: swap;
  100. }
  101. /* http://practice.typekit.com/lesson/caring-about-opentype-features/ */
  102. body {
  103. /* http://www.cssfontstack.com/ Palatino 99% Win 86% Mac */
  104. font-family: "EquityTextB", Palatino, serif;
  105. background-color: #f0f0ea;
  106. color: #07486c;
  107. font-kerning: normal;
  108. -moz-osx-font-smoothing: grayscale;
  109. -webkit-font-smoothing: subpixel-antialiased;
  110. text-rendering: optimizeLegibility;
  111. font-variant-ligatures: common-ligatures contextual;
  112. font-feature-settings: "kern", "liga", "clig", "calt";
  113. }
  114. pre, code, kbd, samp, var, tt {
  115. font-family: 'TriplicateT4c', monospace;
  116. }
  117. em {
  118. font-style: italic;
  119. color: #323a45;
  120. }
  121. strong {
  122. font-weight: bold;
  123. color: black;
  124. }
  125. nav {
  126. background-color: #323a45;
  127. color: #f0f0ea;
  128. display: flex;
  129. justify-content: space-around;
  130. padding: 1rem .5rem;
  131. }
  132. nav:last-child {
  133. border-bottom: 1vh solid #2d7474;
  134. }
  135. nav a {
  136. color: #f0f0ea;
  137. }
  138. nav abbr {
  139. border-bottom: 1px dotted white;
  140. }
  141. h1 {
  142. border-top: 1vh solid #2d7474;
  143. border-bottom: .2vh dotted #2d7474;
  144. background-color: #e3e1e1;
  145. color: #323a45;
  146. text-align: center;
  147. padding: 5rem 0 4rem 0;
  148. width: 100%;
  149. font-family: 'ConcourseT3';
  150. display: flex;
  151. flex-direction: column;
  152. }
  153. h1.single {
  154. padding-bottom: 10rem;
  155. }
  156. h1 span {
  157. position: absolute;
  158. top: 1vh;
  159. left: 20%;
  160. line-height: 0;
  161. }
  162. h1 span a {
  163. line-height: 1.7;
  164. padding: 1rem 1.2rem .6rem 1.2rem;
  165. border-radius: 0 0 6% 6%;
  166. background: #2d7474;
  167. font-size: 1.3rem;
  168. color: white;
  169. text-decoration: none;
  170. }
  171. h2 {
  172. margin: 4rem 0 1rem;
  173. border-top: .2vh solid #2d7474;
  174. padding-top: 1vh;
  175. }
  176. h3 {
  177. text-align: center;
  178. margin: 3rem 0 .75em;
  179. }
  180. hr {
  181. height: .4rem;
  182. width: .4rem;
  183. border-radius: .4rem;
  184. background: #07486c;
  185. margin: 2.5rem auto;
  186. }
  187. time {
  188. display: bloc;
  189. margin-left: 0 !important;
  190. }
  191. ul, ol {
  192. margin: 2rem;
  193. }
  194. ul {
  195. list-style-type: square;
  196. }
  197. a {
  198. text-decoration-skip-ink: auto;
  199. text-decoration-thickness: 0.05em;
  200. text-underline-offset: 0.09em;
  201. }
  202. article {
  203. max-width: 50rem;
  204. display: flex;
  205. flex-direction: column;
  206. margin: 2rem auto;
  207. }
  208. article.single {
  209. border-top: .2vh dotted #2d7474;
  210. margin: -6rem auto 1rem auto;
  211. background: #f0f0ea;
  212. padding: 2rem;
  213. }
  214. article p:last-child {
  215. margin-bottom: 1rem;
  216. }
  217. p {
  218. padding: 0 .5rem;
  219. margin-left: 3rem;
  220. }
  221. p + p,
  222. figure + p {
  223. margin-top: 2rem;
  224. }
  225. blockquote {
  226. background-color: #e3e1e1;
  227. border-left: .5vw solid #2d7474;
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. padding: 1rem;
  232. margin: 1.5rem;
  233. }
  234. blockquote cite {
  235. font-style: italic;
  236. }
  237. blockquote p {
  238. margin-left: 0;
  239. }
  240. figure {
  241. border-top: .2vh solid #2d7474;
  242. background-color: #e3e1e1;
  243. text-align: center;
  244. padding: 1.5rem 0;
  245. margin: 1rem 0 0;
  246. font-size: 1.5rem;
  247. width: 100%;
  248. }
  249. figure img {
  250. max-width: 250px;
  251. max-height: 250px;
  252. border: .5vw solid #323a45;
  253. padding: 1px;
  254. }
  255. figcaption {
  256. padding: 1rem;
  257. line-height: 1.4;
  258. }
  259. aside {
  260. display: flex;
  261. flex-direction: column;
  262. background-color: #e3e1e1;
  263. padding: 1rem 0;
  264. border-bottom: .2vh solid #07486c;
  265. }
  266. aside p {
  267. max-width: 50rem;
  268. margin: 0 auto;
  269. }
  270. /* https://fvsch.com/code/css-locks/ */
  271. p, li, pre, code, kbd, samp, var, tt, time, details, figcaption {
  272. font-size: 1rem;
  273. line-height: calc( 1.5em + 0.2 * 1rem );
  274. }
  275. h1 {
  276. font-size: 1.9rem;
  277. line-height: calc( 1.2em + 0.2 * 1rem );
  278. }
  279. h2 {
  280. font-size: 1.6rem;
  281. line-height: calc( 1.3em + 0.2 * 1rem );
  282. }
  283. h3 {
  284. font-size: 1.35rem;
  285. line-height: calc( 1.4em + 0.2 * 1rem );
  286. }
  287. @media (min-width: 20em) {
  288. /* The (100vw - 20rem) / (50 - 20) part
  289. resolves to 0-1rem, depending on the
  290. viewport width (between 20em and 50em). */
  291. p, li, pre, code, kbd, samp, var, tt, time, details, figcaption {
  292. font-size: calc( 1rem + .6 * (100vw - 20rem) / (50 - 20) );
  293. line-height: calc( 1.5em + 0.2 * (100vw - 50rem) / (20 - 50) );
  294. margin-left: 0;
  295. }
  296. h1 {
  297. font-size: calc( 1.9rem + 1.5 * (100vw - 20rem) / (50 - 20) );
  298. line-height: calc( 1.2em + 0.2 * (100vw - 50rem) / (20 - 50) );
  299. }
  300. h2 {
  301. font-size: calc( 1.5rem + 1.5 * (100vw - 20rem) / (50 - 20) );
  302. line-height: calc( 1.3em + 0.2 * (100vw - 50rem) / (20 - 50) );
  303. }
  304. h3 {
  305. font-size: calc( 1.35rem + 1.5 * (100vw - 20rem) / (50 - 20) );
  306. line-height: calc( 1.4em + 0.2 * (100vw - 50rem) / (20 - 50) );
  307. }
  308. }
  309. @media (min-width: 50em) {
  310. /* The right part of the addition *must* be a
  311. rem value. In this example we *could* change
  312. the whole declaration to font-size:2.5rem,
  313. but if our baseline value was not expressed
  314. in rem we would have to use calc. */
  315. p, li, pre, code, kbd, samp, var, tt, time, details, figcaption {
  316. font-size: calc( 1rem + .6 * 1rem );
  317. line-height: 1.5em;
  318. }
  319. p, li, pre, details {
  320. margin-left: 3rem;
  321. }
  322. h1 {
  323. font-size: calc( 1.9rem + 1.5 * 1rem );
  324. line-height: 1.2em;
  325. }
  326. h2 {
  327. font-size: calc( 1.5rem + 1.5 * 1rem );
  328. line-height: 1.3em;
  329. }
  330. h3 {
  331. font-size: calc( 1.35rem + 1.5 * 1rem );
  332. line-height: 1.4em;
  333. }
  334. figure img {
  335. max-width: 500px;
  336. max-height: 500px;
  337. }
  338. }
  339. figure.unsquared {
  340. margin-bottom: 1.5rem;
  341. }
  342. figure.unsquared img {
  343. height: inherit;
  344. }
  345. @media print {
  346. body { font-size: 100%; }
  347. a:after { content: " (" attr(href) ")"; }
  348. a, a:link, a:visited, a:after {
  349. text-decoration: underline;
  350. text-shadow: none !important;
  351. background-image: none !important;
  352. background: white;
  353. color: black;
  354. }
  355. abbr[title] { border-bottom: 0; }
  356. abbr[title]:after { content: " (" attr(title) ")"; }
  357. img { page-break-inside: avoid; }
  358. @page { margin: 2cm .5cm; }
  359. h1, h2, h3 { page-break-after: avoid; }
  360. p3 { orphans: 3; widows: 3; }
  361. img {
  362. max-width: 250px !important;
  363. max-height: 250px !important;
  364. }
  365. nav, aside { display: none; }
  366. }
  367. ul.with_columns {
  368. column-count: 1;
  369. }
  370. @media (min-width: 20em) {
  371. ul.with_columns {
  372. column-count: 2;
  373. }
  374. }
  375. @media (min-width: 50em) {
  376. ul.with_columns {
  377. column-count: 3;
  378. }
  379. }
  380. ul.with_two_columns {
  381. column-count: 1;
  382. }
  383. @media (min-width: 20em) {
  384. ul.with_two_columns {
  385. column-count: 1;
  386. }
  387. }
  388. @media (min-width: 50em) {
  389. ul.with_two_columns {
  390. column-count: 2;
  391. }
  392. }
  393. .gallery {
  394. display: flex;
  395. flex-wrap: wrap;
  396. justify-content: space-around;
  397. }
  398. .gallery figure img {
  399. margin-left: 1rem;
  400. margin-right: 1rem;
  401. }
  402. .gallery figure figcaption {
  403. font-family: 'ConcourseT3'
  404. }
  405. footer {
  406. font-family: 'ConcourseT3';
  407. display: flex;
  408. flex-direction: column;
  409. border-top: 3px solid white;
  410. padding: 4rem 0;
  411. background-color: #07486c;
  412. color: white;
  413. }
  414. footer > * {
  415. max-width: 50rem;
  416. margin: 0 auto;
  417. }
  418. footer a {
  419. color: #f1c40f;
  420. }
  421. footer .avatar {
  422. width: 200px;
  423. height: 200px;
  424. border-radius: 50%;
  425. float: left;
  426. -webkit-shape-outside: circle();
  427. shape-outside: circle();
  428. margin-right: 2rem;
  429. padding: 2px 5px 5px 2px;
  430. background: white;
  431. border-left: 1px solid #f1c40f;
  432. border-top: 1px solid #f1c40f;
  433. border-right: 5px solid #f1c40f;
  434. border-bottom: 5px solid #f1c40f;
  435. }
  436. </style>
  437. <h1>
  438. <span><a id="jumper" href="#jumpto" title="Un peu perdu ?">?</a></span>
  439. A practical guide to securing macOS. (archive)
  440. <time>Pour la pérennité des contenus liés. Non-indexé, retrait sur simple email.</time>
  441. </h1>
  442. <section>
  443. <article>
  444. <h3><a href="https://github.com/drduh/macOS-Security-and-Privacy-Guide">Source originale du contenu</a></h3>
  445. <p>This is a collection of thoughts on securing a modern Apple Mac computer using macOS (formerly <em>OS X</em>) 10.12 "Sierra", as well as steps to improving online privacy.</p>
  446. <p>This guide is targeted to “power users” who wish to adopt enterprise-standard security, but is also suitable for novice users with an interest in improving their privacy and security on a Mac.</p>
  447. <p>A system is only as secure as its administrator is capable of making it. There is no one single technology, software, nor technique to guarantee perfect computer security; a modern operating system and computer is very complex, and requires numerous incremental changes to meaningfully improve one's security and privacy posture.</p>
  448. <p>I am <strong>not</strong> responsible if you break a Mac by following any of these steps.</p>
  449. <p>If you wish to make a correction or improvement, please send a pull request or <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues">open an issue</a>.</p>
  450. <ul>
  451. <li><a href="#basics">Basics</a></li>
  452. <li><a href="#firmware">Firmware</a></li>
  453. <li><a href="#preparing-and-installing-macos">Preparing and Installing macOS</a><ul>
  454. <li><a href="#virtualization">Virtualization</a></li>
  455. </ul>
  456. </li>
  457. <li><a href="#first-boot">First boot</a></li>
  458. <li><a href="#admin-and-standard-user-accounts">Admin and standard user accounts</a></li>
  459. <li><a href="#full-disk-encryption">Full disk encryption</a></li>
  460. <li><a href="#firewall">Firewall</a><ul>
  461. <li><a href="#application-layer-firewall">Application layer firewall</a></li>
  462. <li><a href="#third-party-firewalls">Third party firewalls</a></li>
  463. <li><a href="#kernel-level-packet-filtering">Kernel level packet filtering</a></li>
  464. </ul>
  465. </li>
  466. <li><a href="#services">Services</a></li>
  467. <li><a href="#spotlight-suggestions">Spotlight Suggestions</a></li>
  468. <li><a href="#homebrew">Homebrew</a></li>
  469. <li><a href="#dns">DNS</a><ul>
  470. <li><a href="#hosts-file">Hosts file</a></li>
  471. <li><a href="#dnsmasq">Dnsmasq</a></li>
  472. <li><a href="#test-dnssec-validation">Test DNSSEC validation</a></li>
  473. <li><a href="#dnscrypt">DNSCrypt</a></li>
  474. </ul>
  475. </li>
  476. <li><a href="#captive-portal">Captive portal</a></li>
  477. <li><a href="#certificate-authorities">Certificate authorities</a></li>
  478. <li><a href="#openssl">OpenSSL</a></li>
  479. <li><a href="#curl">Curl</a></li>
  480. <li><a href="#web">Web</a><ul>
  481. <li><a href="#privoxy">Privoxy</a></li>
  482. <li><a href="#browser">Browser</a></li>
  483. <li><a href="#plugins">Plugins</a></li>
  484. </ul>
  485. </li>
  486. <li><a href="#pgpgpg">PGP/GPG</a></li>
  487. <li><a href="#otr">OTR</a></li>
  488. <li><a href="#tor">Tor</a></li>
  489. <li><a href="#vpn">VPN</a></li>
  490. <li><a href="#viruses-and-malware">Viruses and malware</a></li>
  491. <li><a href="#system-integrity-protection">System Integrity Protection</a></li>
  492. <li><a href="#gatekeeper-and-xprotect">Gatekeeper and XProtect</a></li>
  493. <li><a href="#passwords">Passwords</a></li>
  494. <li><a href="#backup">Backup</a></li>
  495. <li><a href="#wi-fi">Wi-Fi</a></li>
  496. <li><a href="#ssh">SSH</a></li>
  497. <li><a href="#physical-access">Physical access</a></li>
  498. <li><a href="#system-monitoring">System monitoring</a><ul>
  499. <li><a href="#openbsm-audit">OpenBSM audit</a></li>
  500. <li><a href="#dtrace">DTrace</a></li>
  501. <li><a href="#execution">Execution</a></li>
  502. <li><a href="#network">Network</a></li>
  503. </ul>
  504. </li>
  505. <li><a href="#binary-whitelisting">Binary Whitelisting</a></li>
  506. <li><a href="#miscellaneous">Miscellaneous</a></li>
  507. <li><a href="#related-software">Related software</a></li>
  508. <li><a href="#additional-resources">Additional resources</a></li>
  509. </ul>
  510. <h2>Basics</h2>
  511. <p>The standard best security practices apply:</p>
  512. <ul>
  513. <li>
  514. <p>Create a threat model</p>
  515. <ul>
  516. <li>What are you trying to protect and from whom? Is your adversary a <a href="https://theintercept.com/document/2015/03/10/strawhorse-attacking-macos-ios-software-development-kit/">three letter agency</a> (if so, you may want to consider using <a href="http://www.openbsd.org/">OpenBSD</a> instead), a nosy eavesdropper on the network, or determined <a href="https://en.wikipedia.org/wiki/Advanced_persistent_threat">apt</a> orchestrating a campaign against you?</li>
  517. <li>Study and <a href="https://www.usenix.org/system/files/1401_08-12_mickens.pdf">recognize threats</a> and how to reduce attack surface against them.</li>
  518. </ul>
  519. </li>
  520. <li>
  521. <p>Keep the system up to date</p>
  522. <ul>
  523. <li>Patch, patch, patch your system and software.</li>
  524. <li>macOS system updates can be completed using the App Store application, or the <code>softwareupdate</code> command-line utility - neither requires registering an Apple account.</li>
  525. <li>Subscribe to announcement mailing lists (e.g., <a href="https://lists.apple.com/mailman/listinfo/security-announce">Apple security-announce</a>) for programs you use often.</li>
  526. </ul>
  527. </li>
  528. <li>
  529. <p>Encrypt sensitive data</p>
  530. <ul>
  531. <li>In addition to full disk encryption, create one or many encrypted containers to store passwords, keys, personal documents, and other data at rest.</li>
  532. <li>This will mitigate damage in case of compromise and data exfiltration.</li>
  533. </ul>
  534. </li>
  535. <li>
  536. <p>Frequent backups</p>
  537. <ul>
  538. <li>Create <a href="https://www.amazon.com/o/ASIN/0596102461/backupcentral">regular backups</a> of your data and be ready to reimage in case of compromise.</li>
  539. <li>Always encrypt before copying backups to external media or the "cloud".</li>
  540. <li>Verify backups work by testing them regularly, for example by accessing certain files or performing a hash based comparison.</li>
  541. </ul>
  542. </li>
  543. <li>
  544. <p>Click carefully</p>
  545. <ul>
  546. <li>Ultimately, the security of a system can be reduced to its administrator.</li>
  547. <li>Care should be taken when installing new software. Always prefer <a href="https://www.gnu.org/philosophy/free-sw.en.html">free</a> and open source software (<a href="https://superuser.com/questions/19492/is-mac-os-x-open-source">which macOS is not</a>).</li>
  548. </ul>
  549. </li>
  550. </ul>
  551. <h2>Firmware</h2>
  552. <p>Setting a firmware password prevents your Mac from starting up from any device other than your startup disk. It may also be set to be required on each boot.</p>
  553. <p>This feature <a href="https://www.ftc.gov/news-events/blogs/techftc/2015/08/virtues-strong-enduser-device-controls">can be helpful if your laptop is stolen</a>, as the only way to reset the firmware password is through an Apple Store, or by using an <a href="https://reverse.put.as/2016/06/25/apple-efi-firmware-passwords-and-the-scbo-myth/">SPI programmer</a>, such as <a href="http://ho.ax/posts/2012/06/unbricking-a-macbook/">Bus Pirate</a> or other flash IC programmer.</p>
  554. <ol>
  555. <li>
  556. <p>Start up pressing <code>Command</code> <code>R</code> keys to boot to <a href="https://support.apple.com/en-au/HT201314">Recovery Mode</a> mode.</p>
  557. </li>
  558. <li>
  559. <p>When the Recovery window appears, choose <strong>Firmware Password Utility</strong> from the Utilities menu.</p>
  560. </li>
  561. <li>
  562. <p>In the Firmware Utility window that appears, select <strong>Turn On Firmware Password</strong>.</p>
  563. </li>
  564. <li>
  565. <p>Enter a new password, then enter the same password in the <strong>Verify</strong> field.</p>
  566. </li>
  567. <li>
  568. <p>Select <strong>Set Password</strong>.</p>
  569. </li>
  570. <li>
  571. <p>Select <strong>Quit Firmware Utility</strong> to close the Firmware Password Utility.</p>
  572. </li>
  573. <li>
  574. <p>Select the Apple menu and choose Restart or Shutdown.</p>
  575. </li>
  576. </ol>
  577. <p>The firmware password will activate at next boot. To validate the password, hold <code>Alt</code> during boot - you should be prompted to enter the password.</p>
  578. <p>The firmware password can also be managed with the <code>firmwarepasswd</code> utility while booted into the OS.</p>
  579. <p><img width="750" alt="Using a Dediprog SF600 to dump and flash a 2013 MacBook SPI Flash chip to remove a firmware password, sans Apple" src="https://cloud.githubusercontent.com/assets/12475110/17075918/0f851c0c-50e7-11e6-904d-0b56cf0080c1.png"></p>
  580. <p><em>Using a <a href="http://www.dediprog.com/pd/spi-flash-solution/sf600">Dediprog SF600</a> to dump and flash a 2013 MacBook SPI Flash chip to remove a firmware password, sans Apple</em></p>
  581. <p>See <a href="https://support.apple.com/en-au/HT204455">HT204455</a>, <a href="https://github.com/LongSoft/UEFITool">LongSoft/UEFITool</a> and <a href="https://github.com/chipsec/chipsec">chipsec/chipsec</a> for more information.</p>
  582. <h2>Preparing and Installing macOS</h2>
  583. <p>There are several ways to install a fresh copy of macOS.</p>
  584. <p>The simplest way is to boot into <a href="https://support.apple.com/en-us/HT201314">Recovery Mode</a> by holding <code>Command</code> <code>R</code> keys at boot. A system image can be downloaded and applied directly from Apple. However, this way exposes the serial number and other identifying information over the network in plaintext.</p>
  585. <p><img width="500" alt="PII is transmitted to Apple in plaintext when using macOS Recovery" src="https://cloud.githubusercontent.com/assets/12475110/20312189/8987c958-ab20-11e6-90fa-7fd7c8c1169e.png"></p>
  586. <p><em>Packet capture of an unencrypted HTTP conversation during macOS recovery</em></p>
  587. <p>Another way is to download <strong>macOS Sierra</strong> from the <a href="https://itunes.apple.com/us/app/macos-sierra/id1127487414">App Store</a> or some other place and create a custom, installable system image.</p>
  588. <p>The macOS Sierra installer application is <a href="https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW6">code signed</a>, which should be verified to make sure you received a legitimate copy, using the <code>codesign</code> command:</p>
  589. <p><code>$ codesign -dvv /Applications/Install\ macOS\ Sierra.app
  590. Executable=/Applications/Install macOS Sierra.app/Contents/MacOS/InstallAssistant
  591. Identifier=com.apple.InstallAssistant.Sierra
  592. Format=app bundle with Mach-O thin (x86_64)
  593. CodeDirectory v=20200 size=297 flags=0x200(kill) hashes=5+5 location=embedded
  594. Signature size=4167
  595. Authority=Apple Mac OS Application Signing
  596. Authority=Apple Worldwide Developer Relations Certification Authority
  597. Authority=Apple Root CA
  598. Info.plist entries=30
  599. TeamIdentifier=K36BKF7T3D
  600. Sealed Resources version=2 rules=7 files=137
  601. Internal requirements count=1 size=124</code></p>
  602. <p>macOS installers can be made with the <code>createinstallmedia</code> utility included in <code>Install macOS Sierra.app/Contents/Resources/</code>. See <a href="https://support.apple.com/en-us/HT201372">Create a bootable installer for macOS</a>, or run the utility without arguments to see how it works.</p>
  603. <p><strong>Note</strong> Apple's installer <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/120">does not appear to work</a> across OS versions. If you want to build a 10.12 image, for example, the following steps must be run on a 10.12 machine!</p>
  604. <p>To create a <strong>bootable USB macOS installer</strong>, mount a USB drive, and erase and partition it, then use the <code>createinstallmedia</code> utility:</p>
  605. <p>```
  606. $ diskutil list
  607. [Find disk matching correct size, usually "disk2"]</p>
  608. <p>$ diskutil unmountDisk /dev/disk2</p>
  609. <p>$ diskutil partitionDisk /dev/disk2 1 JHFS+ Installer 100%</p>
  610. <p>$ cd /Applications/Install\ macOS\ Sierra.app</p>
  611. <p>$ sudo ./Contents/Resources/createinstallmedia --volume /Volumes/Installer --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction
  612. Erasing Disk: 0%... 10%... 20%... 30%... 100%...
  613. Copying installer files to disk...
  614. Copy complete.
  615. Making disk bootable...
  616. Copying boot files...
  617. Copy complete.
  618. Done.
  619. ```</p>
  620. <p>To create a custom, installable image which can be <a href="https://en.wikipedia.org/wiki/Apple_Software_Restore">restored</a> to a Mac, you will need to find the file <code>InstallESD.dmg</code>, which is also inside <code>Install macOS Sierra.app</code>.</p>
  621. <p>With Finder, right click on the app, select <strong>Show Package Contents</strong> and navigate to <strong>Contents</strong> &gt; <strong>SharedSupport</strong> to find the file <code>InstallESD.dmg</code>.</p>
  622. <p>You can <a href="https://support.apple.com/en-us/HT201259">verify</a> the following cryptographic hashes to ensure you have the same copy with <code>openssl sha1 InstallESD.dmg</code> or <code>shasum -a 1 InstallESD.dmg</code> or <code>shasum -a 256 InstallESD.dmg</code> (in Finder, you can drag the file into a Terminal window to provide the full path).</p>
  623. <p>To determine which macOS versions and builds originally shipped with or are available for your Mac, see <a href="https://support.apple.com/en-us/HT204319">HT204319</a>.</p>
  624. <p>See <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/blob/master/InstallESD_Hashes.csv">InstallESD_Hashes.csv</a> in this repository for a list of current and previous file hashes. You can also Google the cryptographic hashes to ensure the file is genuine and has not been tampered with.</p>
  625. <p>To create the image, use <a href="https://github.com/MagerValp/AutoDMG">MagerValp/AutoDMG</a>, or to create it manually, mount and install the operating system to a temporary image:</p>
  626. <pre><code>$ hdiutil attach -mountpoint /tmp/install_esd ./InstallESD.dmg
  627. $ hdiutil create -size 32g -type SPARSE -fs HFS+J -volname "macOS" -uid 0 -gid 80 -mode 1775 /tmp/output.sparseimage
  628. $ hdiutil attach -mountpoint /tmp/os -owners on /tmp/output.sparseimage
  629. $ sudo installer -pkg /tmp/install_esd/Packages/OSInstall.mpkg -tgt /tmp/os -verbose
  630. </code></pre>
  631. <p>This part will take a while, so be patient. You can <code>tail -F /var/log/install.log</code> in another Terminal window to check progress.</p>
  632. <p><strong>(Optional)</strong> Install additional software, such as <a href="https://www.wireshark.org/download.html">Wireshark</a>:</p>
  633. <pre><code>$ hdiutil attach Wireshark\ 2.2.0\ Intel\ 64.dmg
  634. $ sudo installer -pkg /Volumes/Wireshark/Wireshark\ 2.2.0\ Intel\ 64.pkg -tgt /tmp/os
  635. $ hdiutil unmount /Volumes/Wireshark
  636. </code></pre>
  637. <p>See <a href="https://github.com/MagerValp/AutoDMG/wiki/Packages-Suitable-for-Deployment">MagerValp/AutoDMG/wiki/Packages-Suitable-for-Deployment</a> for caveats and <a href="https://github.com/chilcote/outset">chilcote/outset</a> to instead processes packages and scripts at first boot.</p>
  638. <p>When you're done, detach, convert and verify the image:</p>
  639. <pre><code>$ hdiutil detach /tmp/os
  640. $ hdiutil detach /tmp/install_esd
  641. $ hdiutil convert -format UDZO /tmp/output.sparseimage -o ~/sierra.dmg
  642. $ asr imagescan --source ~/sierra.dmg
  643. </code></pre>
  644. <p>Now <code>sierra.dmg</code> is ready to be applied to one or multiple Macs. One could futher customize the image to include premade users, applications, preferences, etc.</p>
  645. <p>This image can be installed using another Mac in <a href="https://support.apple.com/en-us/HT201462">Target Disk Mode</a> or from a bootable USB installer.</p>
  646. <p>To use <strong>Target Disk Mode</strong>, boot up the Mac you wish to image while holding the <code>T</code> key and connect it to another Mac using a Firewire, Thunderbolt or USB-C cable.</p>
  647. <p>If you don't have another Mac, boot to a USB installer, with <code>sierra.dmg</code> and other required files copied to it, by holding the <em>Option</em> key at boot.</p>
  648. <p>Run <code>diskutil list</code> to identify the connected Mac's disk, usually <code>/dev/disk2</code></p>
  649. <p><strong>(Optional)</strong> <a href="https://www.backblaze.com/blog/securely-erase-mac-ssd/">Securely erase</a> the disk with a single pass (if previously FileVault-encrypted, the disk must first be unlocked and mounted as <code>/dev/disk3s2</code>):</p>
  650. <pre><code>$ sudo diskutil secureErase freespace 1 /dev/disk3s2
  651. </code></pre>
  652. <p>Partition the disk to Journaled HFS+:</p>
  653. <pre><code>$ sudo diskutil unmountDisk /dev/disk2
  654. $ sudo diskutil partitionDisk /dev/disk2 1 JHFS+ macOS 100%
  655. </code></pre>
  656. <p>Restore the image to the new volume:</p>
  657. <pre><code>$ sudo asr restore --source ~/sierra.dmg --target /Volumes/macOS --erase --buffersize 4m
  658. </code></pre>
  659. <p>You can also use the <strong>Disk Utility</strong> application to erase the connected Mac's disk, then restore <code>sierra.dmg</code> to the newly created partition.</p>
  660. <p>If you've followed these steps correctly, the target Mac should now have a new install of macOS Sierra.</p>
  661. <p>If you want to transfer any files, copy them to a shared folder like <code>/Users/Shared</code> on the mounted disk image, e.g. <code>cp Xcode_8.0.dmg /Volumes/macOS/Users/Shared</code></p>
  662. <p><img width="1280" alt="Finished restore install from USB recovery boot" src="https://cloud.githubusercontent.com/assets/12475110/14804078/f27293c8-0b2d-11e6-8e1f-0fb0ac2f1a4d.png"></p>
  663. <p><em>Finished restore install from USB recovery boot</em></p>
  664. <p>We're not done yet! Unless you have built the image with <a href="https://github.com/MagerValp/AutoDMG">AutoDMG</a>, or installed macOS to a second partition on your Mac, you will need to create a recovery partition (in order to use full disk encryption). You can do so using <a href="https://github.com/MagerValp/Create-Recovery-Partition-Installer">MagerValp/Create-Recovery-Partition-Installer</a> or using the following manual steps:</p>
  665. <p>Download the file <a href="https://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg">RecoveryHDUpdate.dmg</a>.</p>
  666. <p><code>RecoveryHDUpdate.dmg
  667. SHA-256: f6a4f8ac25eaa6163aa33ac46d40f223f40e58ec0b6b9bf6ad96bdbfc771e12c
  668. SHA-1: 1ac3b7059ae0fcb2877d22375121d4e6920ae5ba</code></p>
  669. <p>Attach and expand the installer, then run it:</p>
  670. <p>```
  671. $ hdiutil attach RecoveryHDUpdate.dmg</p>
  672. <p>$ pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recovery</p>
  673. <p>$ hdiutil attach /tmp/recovery/RecoveryHDUpdate.pkg/RecoveryHDMeta.dmg</p>
  674. <p>$ /tmp/recovery/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition /Volumes/macOS/ /Volumes/Recovery\ HD\ Update/BaseSystem.dmg 0 0 /Volumes/Recovery\ HD\ Update/BaseSystem.chunklist
  675. ```</p>
  676. <p>Replace <code>/Volumes/macOS</code> with the path to the target disk mode-booted Mac as necessary.</p>
  677. <p>This step will take several minutes. Run <code>diskutil list</code> again to make sure <strong>Recovery HD</strong> now exists on <code>/dev/disk2</code> or equivalent identifier.</p>
  678. <p>Once you're done, eject the disk with <code>hdiutil unmount /Volumes/macOS</code> and power down the target disk mode-booted Mac.</p>
  679. <h3>Virtualization</h3>
  680. <p>To install macOS as a virtual machine (vm) using <a href="https://www.vmware.com/products/fusion.html">VMware Fusion</a>, follow the instructions above to create an image. You will <strong>not</strong> need to download and create a recovery partition manually.</p>
  681. <p><code>VMware-Fusion-8.5.2-4635224.dmg
  682. SHA-256: f6c54b98c9788d1df94d470661eedff3e5d24ca4fb8962fac5eb5dc56de63b77
  683. SHA-1: 37ec465673ab802a3f62388d119399cb94b05408</code></p>
  684. <p>For the Installation Method, select <em>Install OS X from the recovery partition</em>. Customize any memory or CPU requirements and complete setup. The guest vm should boot into <a href="https://support.apple.com/en-us/HT201314">Recovery Mode</a> by default.</p>
  685. <p>In Recovery Mode, select a language, then Utilities &gt; Terminal from the menubar.</p>
  686. <p>In the guest vm, type <code>ifconfig | grep inet</code> - you should see a private address like <code>172.16.34.129</code></p>
  687. <p>On the host Mac, type <code>ifconfig | grep inet</code> - you should see a private gateway address like <code>172.16.34.1</code></p>
  688. <p>From the host Mac, serve the installable image to the guest vm by editing <code>/etc/apache2/httpd.conf</code> and adding the following line to the top (using the gateway address assigned to the host Mac and port 80):</p>
  689. <pre><code>Listen 172.16.34.1:80
  690. </code></pre>
  691. <p>On the host Mac, link the image to the default Apache Web server directory:</p>
  692. <pre><code>$ sudo ln ~/sierra.dmg /Library/WebServer/Documents
  693. </code></pre>
  694. <p>From the host Mac, start Apache in the foreground:</p>
  695. <pre><code>$ sudo httpd -X
  696. </code></pre>
  697. <p>From the guest VM, install the disk image to the volume over the local network using <code>asr</code>:</p>
  698. <p><code>-bash-3.2# asr restore --source http://172.16.34.1/sierra.dmg --target /Volumes/Macintosh\ HD/ --erase --buffersize 4m
  699. Validating target...done
  700. Validating source...done
  701. Erase contents of /dev/disk0s2 (/Volumes/Macintosh HD)? [ny]: y
  702. Retrieving scan information...done
  703. Validating sizes...done
  704. Restoring ....10....20....30....40....50....60....70....80....90....100
  705. Verifying ....10....20....30....40....50....60....70....80....90....100
  706. Remounting target volume...done</code></p>
  707. <p>When it's finished, stop the Apache Web server on the host Mac by pressing <code>Control</code> <code>C</code> at the <code>sudo httpd -X</code> window and remove the image copy with <code>sudo rm /Library/WebServer/Documents/sierra.dmg</code></p>
  708. <p>In the guest vm, select <em>Startup Disk</em> from the top-left corner Apple menu, select the hard drive and restart. You may wish to disable the Network Adapter in VMware for the initial guest vm boot.</p>
  709. <p>Take and Restore from saved guest vm snapshots before and after attempting risky browsing, for example, or use a guest vm to install and operate questionable software.</p>
  710. <h2>First boot</h2>
  711. <p><strong>Note</strong> Before setting up macOS, consider disconnecting networking and configuring a firewall(s) first. However, <a href="https://www.ifixit.com/Device/MacBook_Pro_15%22_Late_2016_Touch_Bar">late 2016 MacBooks</a> with Touch Bar hardware <a href="https://onemoreadmin.wordpress.com/2016/11/27/the-untouchables-apples-new-os-activation-for-touch-bar-macbook-pros/">require online OS activation</a>.</p>
  712. <p>On first boot, hold <code>Command</code> <code>Option</code> <code>P</code> <code>R</code> keys to <a href="https://support.apple.com/en-us/HT204063">clear NVRAM</a>.</p>
  713. <p>When macOS first starts, you'll be greeted by <strong>Setup Assistant</strong>.</p>
  714. <p>When creating your account, use a <a href="http://www.explainxkcd.com/wiki/index.php/936:_Password_Strength">strong password</a> without a hint.</p>
  715. <p>If you enter your real name at the account setup process, be aware that your <a href="https://support.apple.com/kb/PH18720">computer's name and local hostname</a> will comprise that name (e.g., <em>John Appleseed's MacBook</em>) and thus will appear on local networks and in various preference files. You can change them both in <strong>System Preferences &gt; Sharing</strong> or with the following commands:</p>
  716. <pre><code>$ sudo scutil --set ComputerName your_computer_name
  717. $ sudo scutil --set LocalHostName your_hostname
  718. </code></pre>
  719. <h2>Admin and standard user accounts</h2>
  720. <p>The first user account is always an admin account. Admin accounts are members of the admin group and have access to <code>sudo</code>, which allows them to usurp other accounts, in particular root, and gives them effective control over the system. Any program that the admin executes can potentially obtain the same access, making this a security risk. Utilities like <code>sudo</code> have <a href="https://bogner.sh/2014/03/another-mac-os-x-sudo-password-bypass/">weaknesses that can be exploited</a> by concurrently running programs and many panes in System Preferences are <a href="http://csrc.nist.gov/publications/drafts/800-179/sp800_179_draft.pdf">unlocked by default</a> [p. 61–62] for admin accounts. It is considered a best practice by <a href="https://help.apple.com/machelp/mac/10.12/index.html#/mh11389">Apple</a> and <a href="http://csrc.nist.gov/publications/drafts/800-179/sp800_179_draft.pdf">others</a> [p. 41–42] to use a separate standard account for day-to-day work and use the admin account for installations and system configuration.</p>
  721. <p>It is not strictly required to ever log into the admin account via the macOS login screen. The system will prompt for authentication when required and Terminal can do the rest. To that end, Apple provides some <a href="https://support.apple.com/HT203998">recommendations</a> for hiding the admin account and its home directory. This can be an elegant solution to avoid having a visible 'ghost' account. The admin account can also be <a href="http://apple.stackexchange.com/a/94373">removed from FileVault</a>.</p>
  722. <h4>Caveats</h4>
  723. <ol>
  724. <li>
  725. <p>Only administrators can install applications in <code>/Applications</code> (local directory). Finder and Installer will prompt a standard user with an authentication dialog. Many applications can be installed in <code>~/Applications</code> instead (the directory can be created manually). As a rule of thumb: applications that do not require admin access – or do not complain about not being installed in <code>/Applications</code> – should be installed in the user directory, the rest in the local directory. Mac App Store applications are still installed in <code>/Applications</code> and require no additional authentication.</p>
  726. </li>
  727. <li>
  728. <p><code>sudo</code> is not available in shells of the standard user, which requires using <code>su</code> or <code>login</code> to enter a shell of the admin account. This can make some maneuvers trickier and requires some basic experience with command-line interfaces.</p>
  729. </li>
  730. <li>
  731. <p>System Preferences and several system utilities (e.g. Wi-Fi Diagnostics) will require root privileges for full functionality. Many panels in System Preferences are locked and need to be unlocked separately by clicking on the lock icon. Some applications will simply prompt for authentication upon opening, others must be opened by an admin account directly to get access to all functions (e.g. Console).</p>
  732. </li>
  733. <li>
  734. <p>There are third-party applications that will not work correctly because they assume that the user account is an admin. These programs may have to be executed by logging into the admin account, or by using the <code>open</code> utility.</p>
  735. </li>
  736. </ol>
  737. <h4>Setup</h4>
  738. <p>Accounts can be created and managed in System Preferences. On settled systems, it is generally easier to create a second admin account and then demote the first account. This avoids data migration. Newly installed systems can also just add a standard account. Demoting an account can be done either from the the new admin account in System Preferences – the other account must be logged out – or by executing this command:
  739. <code>sudo dscl . -delete /Groups/admin GroupMembership user_name</code></p>
  740. <h2>Full disk encryption</h2>
  741. <p><a href="https://en.wikipedia.org/wiki/FileVault">FileVault</a> provides full disk (technically, full <em>volume</em>) encryption on macOS.</p>
  742. <p>FileVault encryption will protect data at rest and prevent someone with physical access from stealing data or tampering with your Mac.</p>
  743. <p>With much of the cryptographic operations happening <a href="https://software.intel.com/en-us/articles/intel-advanced-encryption-standard-aes-instructions-set/">efficiently in hardware</a>, the performance penalty for FileVault is not noticeable.</p>
  744. <p>The security of FileVault greatly depends on the pseudo random number generator (PRNG).</p>
  745. <blockquote>
  746. <p>The random device implements the Yarrow pseudo random number generator algorithm and maintains its entropy pool. Additional entropy is fed to the generator regularly by the SecurityServer daemon from random jitter measurements of the kernel.</p>
  747. <p>SecurityServer is also responsible for periodically saving some entropy to disk and reloading it during startup to provide entropy in early system operation.</p>
  748. </blockquote>
  749. <p>See <code>man 4 random</code> for more information.</p>
  750. <p>The PRNG can be manually seeded with entropy by writing to /dev/random <strong>before</strong> enabling FileVault. This can be done by simply using the Mac for a little while before activating FileVault.</p>
  751. <p>To manually seed entropy <em>before</em> enabling FileVault:</p>
  752. <pre><code>$ cat &gt; /dev/random
  753. [Type random letters for a long while, then press Control-D]
  754. </code></pre>
  755. <p>Enable FileVault with <code>sudo fdesetup enable</code> or through <strong>System Preferences</strong> &gt; <strong>Security &amp; Privacy</strong> and reboot.</p>
  756. <p>If you can remember your password, there's no reason to save the <strong>recovery key</strong>. However, your encrypted data will be lost forever if you can't remember the password or recovery key.</p>
  757. <p>If you want to know more about how FileVault works, see the paper <a href="https://eprint.iacr.org/2012/374.pdf">Infiltrate the Vault: Security Analysis and Decryption of Lion Full Disk Encryption</a> (pdf) and related <a href="http://www.cl.cam.ac.uk/~osc22/docs/slides_fv2_ifip_2013.pdf">presentation</a> (pdf). Also see <a href="http://libeccio.di.unisa.it/Crypto14/Lab/p1619.pdf">IEEE Std 1619-2007 “The XTS-AES Tweakable Block Cipher”</a> (pdf).</p>
  758. <p>You may wish to enforce <strong>hibernation</strong> and evict FileVault keys from memory instead of traditional sleep to memory:</p>
  759. <pre><code>$ sudo pmset -a destroyfvkeyonstandby 1
  760. $ sudo pmset -a hibernatemode 25
  761. </code></pre>
  762. <blockquote>
  763. <p>All computers have firmware of some type—EFI, BIOS—to help in the discovery of hardware components and ultimately to properly bootstrap the computer using the desired OS instance. In the case of Apple hardware and the use of EFI, Apple stores relevant information within EFI to aid in the functionality of macOS. For example, the FileVault key is stored in EFI to transparently come out of standby mode.</p>
  764. <p>Organizations especially sensitive to a high-attack environment, or potentially exposed to full device access when the device is in standby mode, should mitigate this risk by destroying the FileVault key in firmware. Doing so doesn’t destroy the use of FileVault, but simply requires the user to enter the password in order for the system to come out of standby mode.</p>
  765. </blockquote>
  766. <p>If you choose to evict FileVault keys in standby mode, you should also modify your standby and power nap settings. Otherwise, your machine may wake while in standby mode and then power off due to the absence of the FileVault key. See <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/124">issue #124</a> for more information. These settings can be changed with:</p>
  767. <pre><code>$ sudo pmset -a powernap 0
  768. $ sudo pmset -a standby 0
  769. $ sudo pmset -a standbydelay 0
  770. $ sudo pmset -a autopoweroff 0
  771. </code></pre>
  772. <p>For more information, see <a href="http://training.apple.com/pdf/WP_FileVault2.pdf">Best Practices for
  773. Deploying FileVault 2</a> (pdf) and paper <a href="https://www.usenix.org/legacy/event/sec08/tech/full_papers/halderman/halderman.pdf">Lest We Remember: Cold Boot Attacks on Encryption Keys</a> (pdf)</p>
  774. <h2>Firewall</h2>
  775. <p>Before connecting to the Internet, it's a good idea to first configure a firewall.</p>
  776. <p>There are several types of firewall available for macOS.</p>
  777. <h4>Application layer firewall</h4>
  778. <p>Built-in, basic firewall which blocks <strong>incoming</strong> connections only.</p>
  779. <p>Note, this firewall does not have the ability to monitor, nor block <strong>outgoing</strong> connections.</p>
  780. <p>It can be controlled by the <strong>Firewall</strong> tab of <strong>Security &amp; Privacy</strong> in <strong>System Preferences</strong>, or with the following commands.</p>
  781. <p>Enable the firewall:</p>
  782. <pre><code>$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
  783. </code></pre>
  784. <p>Enable logging:</p>
  785. <pre><code>$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setloggingmode on
  786. </code></pre>
  787. <p>You may also wish to enable stealth mode:</p>
  788. <pre><code>$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on
  789. </code></pre>
  790. <blockquote>
  791. <p>Computer hackers scan networks so they can attempt to identify computers to attack. You can prevent your computer from responding to some of these scans by using <strong>stealth mode</strong>. When stealth mode is enabled, your computer does not respond to ICMP ping requests, and does not answer to connection attempts from a closed TCP or UDP port. This makes it more difficult for attackers to find your computer.</p>
  792. </blockquote>
  793. <p>Finally, you may wish to prevent <em>built-in software</em> as well as <em>code-signed, downloaded software from being whitelisted automatically</em>:</p>
  794. <pre><code>$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsigned off
  795. $ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setallowsignedapp off
  796. </code></pre>
  797. <blockquote>
  798. <p>Applications that are signed by a valid certificate authority are automatically added to the list of allowed apps, rather than prompting the user to authorize them. Apps included in macOS are signed by Apple and are allowed to receive incoming connections when this setting is enabled. For example, since iTunes is already signed by Apple, it is automatically allowed to receive incoming connections through the firewall.</p>
  799. <p>If you run an unsigned app that is not listed in the firewall list, a dialog appears with options to Allow or Deny connections for the app. If you choose "Allow", macOS signs the application and automatically adds it to the firewall list. If you choose "Deny", macOS adds it to the list but denies incoming connections intended for this app.</p>
  800. </blockquote>
  801. <p>After interacting with <code>socketfilterfw</code>, you may want to restart (or terminate) the process:</p>
  802. <pre><code>$ sudo pkill -HUP socketfilterfw
  803. </code></pre>
  804. <h4>Third party firewalls</h4>
  805. <p>Programs such as <a href="https://www.obdev.at/products/littlesnitch/index.html">Little Snitch</a>, <a href="https://www.oneperiodic.com/products/handsoff/">Hands Off</a>, <a href="http://radiosilenceapp.com/">Radio Silence</a> and <a href="https://pirate.github.io/security-growler/">Security Growler</a> provide a good balance of usability and security.</p>
  806. <p><img width="349" alt="Example of Little Snitch monitored session" src="https://cloud.githubusercontent.com/assets/12475110/10596588/c0eed3c0-76b3-11e5-95b8-9ce7d51b3d82.png"></p>
  807. <p><em>Example of Little Snitch-monitored session</em></p>
  808. <p><code>LittleSnitch-3.7.1.dmg
  809. SHA-256: e6332ee70385f459d9803b0a582d5344bb9dab28bcd56e247ae69866cc321802
  810. SHA-1: d5d602c0f76cd73051792dff0ac334bbdc66ae32</code></p>
  811. <p>These programs are capable of monitoring and blocking <strong>incoming</strong> and <strong>outgoing</strong> network connections. However, they may require the use of a closed source <a href="https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/Extend/Extend.html">kernel extension</a>.</p>
  812. <p>If the number of choices of allowing/blocking network connections is overwhelming, use <strong>Silent Mode</strong> with connections allowed, then periodically check your settings to gain understanding of what various applications are doing.</p>
  813. <p>It is worth noting that these firewalls can be bypassed by programs running as <strong>root</strong> or through <a href="https://www.blackhat.com/docs/us-15/materials/us-15-Wardle-Writing-Bad-A-Malware-For-OS-X.pdf">OS vulnerabilities</a> (pdf), but they are still worth having - just don't expect absolute protection.</p>
  814. <p>For more on how Little Snitch works, see the <a href="https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/NKEConceptual/socket_nke/socket_nke.html#//apple_ref/doc/uid/TP40001858-CH228-SW1">Network Kernel Extensions Programming Guide</a> and <a href="https://reverse.put.as/2016/07/22/shut-up-snitch-reverse-engineering-and-exploiting-a-critical-little-snitch-vulnerability/">Shut up snitch! – reverse engineering and exploiting a critical Little Snitch vulnerability</a>.</p>
  815. <h4>Kernel level packet filtering</h4>
  816. <p>A highly customizable, powerful, but also most complicated firewall exists in the kernel. It can be controlled with <code>pfctl</code> and various configuration files.</p>
  817. <p>pf can also be controlled with a GUI application such as <a href="http://www.hanynet.com/icefloor/">IceFloor</a> or <a href="http://www.murusfirewall.com/">Murus</a>.</p>
  818. <p>There are many books and articles on the subject of pf firewall. Here's is just one example of blocking traffic by IP address.</p>
  819. <p>Add the following into a file called <code>pf.rules</code>:</p>
  820. <p><code>set block-policy drop
  821. set fingerprints "/etc/pf.os"
  822. set ruleset-optimization basic
  823. set skip on lo0
  824. scrub in all no-df
  825. table &lt;blocklist&gt; persist
  826. block in log
  827. block in log quick from no-route to any
  828. pass out proto tcp from any to any keep state
  829. pass out proto udp from any to any keep state
  830. block log on en0 from {&lt;blocklist&gt;} to any</code></p>
  831. <p>Use the following commands:</p>
  832. <ul>
  833. <li><code>sudo pfctl -e -f pf.rules</code> to enable the firewall</li>
  834. <li><code>sudo pfctl -d</code> to disable the firewall</li>
  835. <li><code>sudo pfctl -t blocklist -T add 1.2.3.4</code> to add hosts to a blocklist</li>
  836. <li><code>sudo pfctl -t blocklist -T show</code> to view the blocklist</li>
  837. <li><code>sudo ifconfig pflog0 create</code> to create an interface for logging</li>
  838. <li><code>sudo tcpdump -ni pflog0</code> to dump the packets</li>
  839. </ul>
  840. <p>Unless you're already familiar with packet filtering, spending too much time configuring pf is not recommended. It is also probably unnecessary if your Mac is behind a <a href="https://www.grc.com/nat/nat.htm">NAT</a> on a secured home network, for example.</p>
  841. <p>For an example of using pf to audit "phone home" behavior of user and system-level processes, see <a href="https://github.com/fix-macosx/net-monitor">fix-macosx/net-monitor</a>.</p>
  842. <h2>Services</h2>
  843. <p>Before you connect to the Internet, you may wish to disable some system services, which use up resources or phone home to Apple.</p>
  844. <p>See <a href="https://github.com/fix-macosx/yosemite-phone-home">fix-macosx/yosemite-phone-home</a>, <a href="https://github.com/l1k/osxparanoia">l1k/osxparanoia</a> and <a href="https://github.com/karek314/macOS-home-call-drop">karek314/macOS-home-call-drop</a> for further recommendations.</p>
  845. <p>Services on macOS are managed by <strong>launchd</strong>. See (launchd.info)[http://launchd.info/], as well as <a href="https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html">Apple's Daemons and Services Programming Guide</a> and <a href="https://developer.apple.com/library/mac/technotes/tn2083/_index.html">Technical Note TN2083</a></p>
  846. <p>You can also run <a href="https://github.com/synack/knockknock">KnockKnock</a> that shows more information about startup items.</p>
  847. <ul>
  848. <li>Use <code>launchctl list</code> to view running user agents</li>
  849. <li>Use <code>sudo launchctl list</code> to view running system daemons</li>
  850. <li>Specify the service name to examine it, e.g. <code>launchctl list com.apple.Maps.mapspushd</code></li>
  851. <li>Use <code>defaults read</code> to examine job plists in <code>/System/Library/LaunchDaemons</code> and <code>/System/Library/LaunchAgents</code></li>
  852. <li>Use <code>man</code>, <code>strings</code> and Google to learn about what the agent/daemon runs</li>
  853. </ul>
  854. <p>For example, to learn what a system launch daemon or agent does, start with:</p>
  855. <pre><code>$ defaults read /System/Library/LaunchDaemons/com.apple.apsd.plist
  856. </code></pre>
  857. <p>Look at the <code>Program</code> or <code>ProgramArguments</code> section to see which binary is run, in this case <code>apsd</code>. To find more information about that, look at the man page with <code>man apsd</code></p>
  858. <p>For example, if you're not interested in Apple Push Notifications, disable the service:</p>
  859. <pre><code>$ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist
  860. </code></pre>
  861. <p><strong>Note</strong> Unloading services may break usability of some applications. Read the manual pages and use Google to make sure you understand what you're doing first.</p>
  862. <p>Be careful about disabling any system daemons you don't understand, as it may render your system unbootable. If you break your Mac, use <a href="https://support.apple.com/en-us/HT201573">single user mode</a> to fix it.</p>
  863. <p>Use <a href="https://en.wikipedia.org/wiki/Console_(OS_X)">Console</a> and <a href="https://support.apple.com/en-us/HT201464">Activity Monitor</a> applications if you notice your Mac heating up, feeling sluggish, or generally misbehaving, as it may have resulted from your tinkering.</p>
  864. <p>To view currently disabled services:</p>
  865. <pre><code>$ find /var/db/com.apple.xpc.launchd/ -type f -print -exec defaults read {} \; 2&gt;/dev/null
  866. </code></pre>
  867. <p>Annotated lists of launch daemons and agents, the respective program executed, and the programs' hash sums are included in this repository.</p>
  868. <p><strong>(Optional)</strong> Run the <code>read_launch_plists.py</code> script and <code>diff</code> output to check for any discrepancies on your system, e.g.:</p>
  869. <pre><code>$ diff &lt;(python read_launch_plists.py) &lt;(cat 16A323_launchd.csv)
  870. </code></pre>
  871. <p>See also <a href="http://cirrusj.github.io/Yosemite-Stop-Launch/">cirrusj.github.io/Yosemite-Stop-Launch</a> for descriptions of services and <a href="https://vilimpoc.org/blog/2014/01/15/provisioning-os-x-and-disabling-unnecessary-services/">Provisioning OS X and Disabling Unnecessary Services</a> for another explanation.</p>
  872. <h2>Spotlight Suggestions</h2>
  873. <p>Disable <strong>Spotlight Suggestions</strong> in both the Spotlight preferences and Safari's Search preferences to avoid your search queries being sent to Apple.</p>
  874. <p>Also disable <strong>Bing Web Searches</strong> in the Spotlight preferences to avoid your search queries being sent to Microsoft.</p>
  875. <p>See <a href="https://fix-macosx.com/">fix-macosx.com</a> for detailed instructions.</p>
  876. <blockquote>
  877. <p>If you've upgraded to OS X 10.10 "Yosemite" and you're using the default settings, each time you start typing in Spotlight (to open an application or search for a file on your computer), your local search terms and location are sent to Apple and third parties (including Microsoft).</p>
  878. </blockquote>
  879. <p><strong>Note</strong> This Web site and instructions may no longer work on macOS Sierra - see <a href="https://github.com/drduh/macOS-Security-and-Privacy-Guide/issues/164">issue 164</a>.</p>
  880. <p>To download, view and apply their suggested fixes:</p>
  881. <p>```
  882. $ curl -O https://fix-macosx.com/fix-macosx.py</p>
  883. <p>$ less fix-macosx.py</p>
  884. <p>$ python fix-macosx.py
  885. All done. Make sure to log out (and back in) for the changes to take effect.
  886. ```</p>
  887. <p>Speaking of Microsoft, you may want to see <a href="https://fix10.isleaked.com/">https://fix10.isleaked.com/</a> just for fun.</p>
  888. <h2>Homebrew</h2>
  889. <p>Consider using <a href="http://brew.sh/">Homebrew</a> to make software installations easier and to update userland tools (see <a href="http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/">Apple’s great GPL purge</a>).</p>
  890. <p><strong>Note</strong> If you have not already installed Xcode or Command Line Tools, use <code>xcode-select --install</code> to download and install them from Apple.</p>
  891. <p>To <a href="https://github.com/Homebrew/brew/blob/master/docs/Installation.md#installation">install Homebrew</a>:</p>
  892. <pre><code>$ mkdir homebrew &amp;&amp; curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
  893. </code></pre>
  894. <p>Edit <code>PATH</code> in your shell or shell rc file to use <code>~/homebrew/bin</code> and <code>~/homebrew/sbin</code>. For example, <code>echo 'PATH=$PATH:~/homebrew/sbin:~/homebrew/bin' &gt;&gt; .zshrc</code>, then change your login shell to Z shell with <code>chsh -s /bin/zsh</code>, open a new Terminal window and run <code>brew update</code>.</p>
  895. <p>Homebrew uses SSL/TLS to talk with GitHub and verifies checksums of downloaded packages, so it's <a href="https://github.com/Homebrew/homebrew/issues/18036">fairly secure</a>.</p>
  896. <p>Remember to periodically run <code>brew update</code> and <code>brew upgrade</code> on trusted and secure networks to download and install software updates. To get information on a package before installation, run <code>brew info &lt;package&gt;</code> and check its recipe online.</p>
  897. <p>According to <a href="https://github.com/Homebrew/brew/blob/master/docs/Analytics.md">Homebrew's Anonymous Aggregate User Behaviour Analytics</a>, Homebrew gathers anonymous aggregate user behaviour analytics and reporting these to Google Analytics.</p>
  898. <p>To opt out of Homebrew's analytics, you can set <code>export HOMEBREW_NO_ANALYTICS=1</code> in your environment or shell rc file, or use <code>brew analytics off</code>.</p>
  899. <p>You may also wish to enable <a href="https://github.com/drduh/macOS-Security-and-Privacy-Guide/issues/138">additional security options</a>, such as <code>HOMEBREW_NO_INSECURE_REDIRECT=1</code> and <code>HOMEBREW_CASK_OPTS=--require-sha</code>.</p>
  900. <h2>DNS</h2>
  901. <h4>Hosts file</h4>
  902. <p>Use the <a href="https://en.wikipedia.org/wiki/Hosts_(file)">hosts file</a> to block known malware, advertising or otherwise unwanted domains.</p>
  903. <p>Edit the hosts file as root, for example with <code>sudo vi /etc/hosts</code>. The hosts file can also be managed with the GUI app <a href="https://github.com/2ndalpha/gasmask">2ndalpha/gasmask</a>.</p>
  904. <p>To block a domain, append <code>0 example.com</code> or <code>0.0.0.0 example.com</code> or <code>127.0.0.1 example.com</code> to <code>/etc/hosts</code></p>
  905. <p>There are many lists of domains available online which you can paste in, just make sure each line starts with <code>0</code>, <code>0.0.0.0</code>, <code>127.0.0.1</code>, and the line <code>127.0.0.1 localhost</code> is included.</p>
  906. <p>For hosts lists, see <a href="http://someonewhocares.org/hosts/zero/hosts">someonewhocares.org</a>, <a href="https://github.com/l1k/osxparanoia/blob/master/hosts">l1k/osxparanoia/blob/master/hosts</a>, <a href="https://github.com/StevenBlack/hosts">StevenBlack/hosts</a> and <a href="https://github.com/gorhill/uMatrix/blob/master/assets/umatrix/hosts-files.json">gorhill/uMatrix/hosts-files.json</a>.</p>
  907. <p>To append a raw list:</p>
  908. <p>```
  909. $ curl "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" | sudo tee -a /etc/hosts</p>
  910. <p>$ wc -l /etc/hosts
  911. 31998</p>
  912. <p>$ egrep -ve "^#|^255.255.255|^0.0.0.0|^127.0.0.0|^0 " /etc/hosts
  913. ::1 localhost
  914. fe80::1%lo0 localhost
  915. [should not return any other IP addresses]
  916. ```</p>
  917. <p>See <code>man hosts</code> and <a href="https://www.freebsd.org/doc/handbook/configtuning-configfiles.html">FreeBSD Configuration Files</a> for more information.</p>
  918. <h4>Dnsmasq</h4>
  919. <p>Among other features, <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">dnsmasq</a> is able to cache replies, prevent upstreaming queries for unqualified names, and block entire TLDs.</p>
  920. <p>Use in combination with DNSCrypt to additionally encrypt outgoing DNS traffic.</p>
  921. <p>If you don't wish to use DNSCrypt, you should at least use DNS <a href="http://bcn.boulder.co.us/~neal/ietf/verisign-abuse.html">not provided</a> <a href="http://hackercodex.com/guide/how-to-stop-isp-dns-server-hijacking/">by your ISP</a>. Two popular alternatives are <a href="https://developers.google.com/speed/public-dns/">Google DNS</a> and <a href="https://www.opendns.com/home-internet-security/">OpenDNS</a>.</p>
  922. <p><strong>(Optional)</strong> <a href="https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions">DNSSEC</a> is a set of extensions to DNS which provide to DNS clients (resolvers) origin authentication of DNS data, authenticated denial of existence, and data integrity. All answers from DNSSEC protected zones are digitally signed. The signed records are authenticated via a chain of trust, starting with a set of verified public keys for the DNS root-zone. The current root-zone trust anchors may be downloaded <a href="https://www.iana.org/dnssec/files">from IANA website</a>. There are a number of resources on DNSSEC, but probably the best one is <a href="http://www.dnssec.net">dnssec.net website</a>.</p>
  923. <p>Install Dnsmasq (DNSSEC is optional):</p>
  924. <pre><code>$ brew install dnsmasq --with-dnssec
  925. $ cp ~/homebrew/opt/dnsmasq/dnsmasq.conf.example ~/homebrew/etc/dnsmasq.conf
  926. </code></pre>
  927. <p>Edit the configuration:</p>
  928. <pre><code>$ vim ~/homebrew/etc/dnsmasq.conf
  929. </code></pre>
  930. <p>Examine all the options. Here are a few recommended settings to enable:</p>
  931. <p>```</p>
  932. <h1>Forward queries to DNSCrypt on localhost port 5355</h1>
  933. <p>server=127.0.0.1#5355</p>
  934. <h1>Uncomment to forward queries to Google Public DNS</h1>
  935. <h1>server=8.8.8.8</h1>
  936. <h1>Never forward plain names</h1>
  937. <p>domain-needed</p>
  938. <h1>Examples of blocking TLDs or subdomains</h1>
  939. <p>address=/.onion/0.0.0.0
  940. address=/.local/0.0.0.0
  941. address=/.mycoolnetwork/0.0.0.0
  942. address=/.facebook.com/0.0.0.0</p>
  943. <h1>Never forward addresses in the non-routed address spaces</h1>
  944. <p>bogus-priv</p>
  945. <h1>Reject private addresses from upstream nameservers</h1>
  946. <p>stop-dns-rebind</p>
  947. <h1>Query servers in order</h1>
  948. <p>strict-order</p>
  949. <h1>Set the size of the cache</h1>
  950. <h1>The default is to keep 150 hostnames</h1>
  951. <p>cache-size=8192</p>
  952. <h1>Optional logging directives</h1>
  953. <p>log-async
  954. log-dhcp
  955. log-facility=/var/log/dnsmasq.log</p>
  956. <h1>Uncomment to log all queries</h1>
  957. <h1>log-queries</h1>
  958. <h1>Uncomment to enable DNSSEC</h1>
  959. <h1>dnssec</h1>
  960. <h1>trust-anchor=.,19036,8,2,49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5</h1>
  961. <h1>dnssec-check-unsigned</h1>
  962. <p>```</p>
  963. <p>Install and start the program (sudo is required to bind to <a href="https://unix.stackexchange.com/questions/16564/why-are-the-first-1024-ports-restricted-to-the-root-user-only">privileged port</a> 53):</p>
  964. <pre><code>$ sudo brew services start dnsmasq
  965. </code></pre>
  966. <p>To set Dnsmasq as your local DNS server, open <strong>System Preferences</strong> &gt; <strong>Network</strong> and select the active interface, then the <strong>DNS</strong> tab, select <strong>+</strong> and add <code>127.0.0.1</code>, or use:</p>
  967. <pre><code>$ sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
  968. </code></pre>
  969. <p>Make sure Dnsmasq is correctly configured:</p>
  970. <p>```
  971. $ scutil --dns
  972. DNS configuration</p>
  973. <p>resolver #1
  974. search domain[0] : whatever
  975. nameserver[0] : 127.0.0.1
  976. flags : Request A records, Request AAAA records
  977. reach : Reachable, Local Address, Directly Reachable Address</p>
  978. <p>$ networksetup -getdnsservers "Wi-Fi"
  979. 127.0.0.1
  980. ```</p>
  981. <p><strong>Note</strong> Some VPN software overrides DNS settings on connect. See <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/24">issue #24</a> for more information.</p>
  982. <h5>Test DNSSEC validation</h5>
  983. <p>Test DNSSEC validation succeeds for signed zones:</p>
  984. <pre><code>$ dig +dnssec icann.org
  985. </code></pre>
  986. <p>Reply should have <code>NOERROR</code> status and contain <code>ad</code> flag. For instance,</p>
  987. <pre><code>;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 47039
  988. ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
  989. </code></pre>
  990. <p>Test DNSSEC validation fails for zones that are signed improperly:</p>
  991. <pre><code>$ dig www.dnssec-failed.org
  992. </code></pre>
  993. <p>Reply should have <code>SERVFAIL</code> status. For instance,</p>
  994. <pre><code>;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: SERVFAIL, id: 15190
  995. ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
  996. </code></pre>
  997. <h4>dnscrypt</h4>
  998. <p>Use <a href="https://dnscrypt.org/">dnscrypt</a> to encrypt DNS traffic to the provider of choice.</p>
  999. <p>If you prefer a GUI application, see <a href="https://github.com/alterstep/dnscrypt-osxclient">alterstep/dnscrypt-osxclient</a>.</p>
  1000. <p>Install DNSCrypt from Homebrew:</p>
  1001. <pre><code>$ brew install dnscrypt-proxy
  1002. </code></pre>
  1003. <p>If using in combination with Dnsmasq, find the file <code>homebrew.mxcl.dnscrypt-proxy.plist</code></p>
  1004. <p><code>$ find ~/homebrew -name homebrew.mxcl.dnscrypt-proxy.plist
  1005. /Users/drduh/homebrew/Cellar/dnscrypt-proxy/1.7.0/homebrew.mxcl.dnscrypt-proxy.plist</code></p>
  1006. <p>Edit it to have the line:</p>
  1007. <pre><code>&lt;string&gt;--local-address=127.0.0.1:5355&lt;/string&gt;
  1008. </code></pre>
  1009. <p>Below the line:</p>
  1010. <pre><code>&lt;string&gt;/usr/local/opt/dnscrypt-proxy/sbin/dnscrypt-proxy&lt;/string&gt;
  1011. </code></pre>
  1012. <p><img width="1015" alt="dnscrypt" src="https://cloud.githubusercontent.com/assets/12475110/19222914/8e6f853e-8e31-11e6-8dd6-27c33cbfaea5.png"></p>
  1013. <p><em>Append a local-address line to use DNScrypt on a port other than 53, like 5355</em></p>
  1014. <p>This can also be done using Homebrew, by installing <code>gnu-sed</code> and using the <code>gsed</code> command:</p>
  1015. <pre><code>$ sudo gsed -i "/sbin\\/dnscrypt-proxy&lt;\\/string&gt;/a&lt;string&gt;--local-address=127.0.0.1:5355&lt;\\/string&gt;\n" $(find ~/homebrew -name homebrew.mxcl.dnscrypt-proxy.plist)
  1016. </code></pre>
  1017. <p>By default, the <code>resolvers-list</code> will point to the dnscrypt version specific resolvers file. When dnscrypt is updated, this version may no longer exist, and if it does, may point to an outdated file. This can be fixed by changing the resolvers file in <code>/Library/LaunchDaemons/homebrew.mxcl.dnscrypt-proxy.plist</code> to the symlinked version in <code>/usr/local/share</code>:</p>
  1018. <pre><code>&lt;string&gt;--resolvers-list=/usr/local/share/dnscrypt-proxy/dnscrypt-resolvers.csv&lt;/string&gt;
  1019. </code></pre>
  1020. <p>Start DNSCrypt:</p>
  1021. <pre><code>$ brew services start dnscrypt-proxy
  1022. </code></pre>
  1023. <p>Make sure DNSCrypt is running:</p>
  1024. <p>```
  1025. $ sudo lsof -Pni UDP:5355
  1026. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
  1027. dnscrypt- 83 nobody 7u IPv4 0x1773f85ff9f8bbef 0t0 UDP 127.0.0.1:5355</p>
  1028. <p>$ ps A | grep '[d]nscrypt'
  1029. 83 ?? Ss 0:00.27 /Users/drduh/homebrew/opt/dnscrypt-proxy/sbin/dnscrypt-proxy --local-address=127.0.0.1:5355 --ephemeral-keys --resolvers-list=/Users/drduh/homebrew/opt/dnscrypt-proxy/share/dnscrypt-proxy/dnscrypt-resolvers.csv --resolver-name=dnscrypt.eu-dk --user=nobody
  1030. ```</p>
  1031. <blockquote>
  1032. <p>By default, dnscrypt-proxy runs on localhost (127.0.0.1), port 53,
  1033. and under the "nobody" user using the dnscrypt.eu-dk DNSCrypt-enabled
  1034. resolver. If you would like to change these settings, you will have to edit the plist file (e.g., --resolver-address, --provider-name, --provider-key, etc.)</p>
  1035. </blockquote>
  1036. <p>This can be accomplished by editing <code>homebrew.mxcl.dnscrypt-proxy.plist</code></p>
  1037. <p>You can run your own <a href="https://github.com/Cofyc/dnscrypt-wrapper">dnscrypt server</a> (see also <a href="https://github.com/drduh/Debian-Privacy-Server-Guide#dnscrypt">drduh/Debian-Privacy-Server-Guide#dnscrypt</a>) from a trusted location or use one of many <a href="https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv">public servers</a> instead.</p>
  1038. <p>Confirm outgoing DNS traffic is encrypted:</p>
  1039. <p>```
  1040. $ sudo tcpdump -qtni en0
  1041. IP 10.8.8.8.59636 &gt; 77.66.84.233.443: UDP, length 512
  1042. IP 77.66.84.233.443 &gt; 10.8.8.8.59636: UDP, length 368</p>
  1043. <p>$ dig +short -x 77.66.84.233
  1044. resolver2.dnscrypt.eu
  1045. ```</p>
  1046. <p>See also <a href="https://dnsleaktest.com/what-is-a-dns-leak.html">What is a DNS leak</a>, the <a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/mDNSResponder.8.html">mDNSResponder manual page</a> and <a href="http://ipv6-test.com/">ipv6-test.com</a>.</p>
  1047. <h2>Captive portal</h2>
  1048. <p>When macOS connects to new networks, it <strong>probes</strong> the network and launches a Captive Portal assistant utility if connectivity can't be determined.</p>
  1049. <p>An attacker could trigger the utility and direct a Mac to a site with malware without user interaction, so it's best to disable this feature and log in to captive portals using your regular Web browser, provided you have first disable any custom dns and/or proxy settings.</p>
  1050. <pre><code>$ sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false
  1051. </code></pre>
  1052. <p>See also <a href="https://www.securestate.com/blog/2011/10/07/apple-os-x-lion-captive-portal-hijacking-attack">Apple OS X Lion Security: Captive Portal Hijacking Attack</a>, <a href="http://blog.erratasec.com/2010/09/apples-secret-wispr-request.html">Apple's secret "wispr" request</a>, <a href="https://web.archive.org/web/20130407200745/http://www.divertednetworks.net/apple-captiveportal.html">How to disable the captive portal window in Mac OS Lion</a>, and <a href="https://grpugh.wordpress.com/2014/10/29/an-undocumented-change-to-captive-network-assistant-settings-in-os-x-10-10-yosemite/">An undocumented change to Captive Network Assistant settings in OS X 10.10 Yosemite</a>.</p>
  1053. <h2>Certificate authorities</h2>
  1054. <p>macOS comes with <a href="https://support.apple.com/en-us/HT202858">over 200</a> root authority certificates installed from for-profit corporations like Apple, Verisign, Thawte, Digicert and government agencies from China, Japan, Netherlands, U.S., and more! These Certificate Authorities (CAs) are capable of issuing SSL/TLS certificates for any domain, code signing certificates, etc.</p>
  1055. <p>For more information, see <a href="https://github.com/kirei/catt">Certification Authority Trust Tracker</a>, <a href="http://conferences.sigcomm.org/imc/2013/papers/imc257-durumericAemb.pdf">Analysis of the HTTPS certificate ecosystem</a> (pdf), and <a href="http://www.ifca.ai/fc14/papers/fc14_submission_100.pdf">You Won’t Be Needing These Any More: On Removing Unused Certificates From Trust Stores</a> (pdf).</p>
  1056. <p>You can inspect system root certificates in <strong>Keychain Access</strong>, under the <strong>System Roots</strong> tab or by using the <code>security</code> command line tool and <code>/System/Library/Keychains/SystemRootCertificates.keychain</code> file.</p>
  1057. <p>You can disable certificate authorities through Keychain Access by marking them as <strong>Never Trust</strong> and closing the window:</p>
  1058. <p><img width="450" alt="A certificate authority certificate" src="https://cloud.githubusercontent.com/assets/12475110/19222972/6b7aabac-8e32-11e6-8efe-5d3219575a98.png"></p>
  1059. <p>The risk of a <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">man in the middle</a> attack in which a coerced or compromised certificate authority trusted by your system issues a fake/rogue SSL certificate is quite low, but still <a href="https://en.wikipedia.org/wiki/DigiNotar#Issuance_of_fraudulent_certificates">possible</a>.</p>
  1060. <h2>OpenSSL</h2>
  1061. <p>The version of OpenSSL in Sierra is <code>0.9.8zh</code> which is <a href="https://apple.stackexchange.com/questions/200582/why-is-apple-using-an-older-version-of-openssl">not current</a>. It doesn't support TLS 1.1 or newer, elliptic curve ciphers, and <a href="https://stackoverflow.com/questions/27502215/difference-between-openssl-09-8z-and-1-0-1">more</a>.</p>
  1062. <p>Apple declares OpenSSL <strong>deprecated</strong> in their <a href="https://developer.apple.com/library/mac/documentation/Security/Conceptual/cryptoservices/GeneralPurposeCrypto/GeneralPurposeCrypto.html">Cryptographic Services Guide</a> document. Their version also has patches which may <a href="https://hynek.me/articles/apple-openssl-verification-surprises/">surprise you</a>.</p>
  1063. <p>If you're going to use OpenSSL on your Mac, download and install a recent version of OpenSSL with <code>brew install openssl</code>. Note, linking brew to be used in favor of <code>/usr/bin/openssl</code> may interfere with building software. See <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/39">issue #39</a>.</p>
  1064. <p>Compare the TLS protocol and cipher between the homebrew version and the system version of OpenSSL:</p>
  1065. <p>```
  1066. $ ~/homebrew/bin/openssl version; echo | ~/homebrew/bin openssl s_client -connect github.com:443 2&gt;&amp;1 | grep -A2 SSL-Session
  1067. OpenSSL 1.0.2j 26 Sep 2016
  1068. SSL-Session:
  1069. Protocol : TLSv1.2
  1070. Cipher : ECDHE-RSA-AES128-GCM-SHA256</p>
  1071. <p>$ /usr/bin/openssl version; echo | /usr/bin/openssl s_client -connect github.com:443 2&gt;&amp;1 | grep -A2 SSL-Session
  1072. OpenSSL 0.9.8zh 14 Jan 2016
  1073. SSL-Session:
  1074. Protocol : TLSv1
  1075. Cipher : AES128-SHA
  1076. ```</p>
  1077. <p>See also <a href="https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations">Comparison of TLS implementations</a>, <a href="https://www.howsmyssl.com/">How's My SSL</a>, <a href="https://www.ssllabs.com/projects/">Qualys SSL Labs Tools</a> and for detailed explanations and with latest vulnerabilities tests <a href="http://ssl-checker.online-domain-tools.com">ssl-checker.online-domain-tools.com</a>.</p>
  1078. <h2>Curl</h2>
  1079. <p>The version of Curl which comes with macOS uses <a href="https://developer.apple.com/library/mac/documentation/Security/Reference/secureTransportRef/">Secure Transport</a> for SSL/TLS validation.</p>
  1080. <p>If you prefer to use OpenSSL, install with <code>brew install curl --with-openssl</code> and ensure it's the default with <code>brew link --force curl</code></p>
  1081. <p>Here are several recommended <a href="http://curl.haxx.se/docs/manpage.html">options</a> to add to <code>~/.curlrc</code> (see <code>man curl</code> for more):</p>
  1082. <p><code>user-agent = "Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0"
  1083. referer = ";auto"
  1084. connect-timeout = 10
  1085. progress-bar
  1086. max-time = 90
  1087. verbose
  1088. show-error
  1089. remote-time
  1090. ipv4</code></p>
  1091. <h2>Web</h2>
  1092. <h3>Privoxy</h3>
  1093. <p>Consider using <a href="http://www.privoxy.org/">Privoxy</a> as a local proxy to filter Web browsing traffic.</p>
  1094. <p>A signed installation package for privoxy can be downloaded from <a href="http://silvester.org.uk/privoxy/OSX/">silvester.org.uk</a> or <a href="http://sourceforge.net/projects/ijbswa/files/Macintosh%20%28OS%20X%29/">Sourceforge</a>. The signed package is <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/65">more secure</a> than the Homebrew version, and attracts full support from the Privoxy project.</p>
  1095. <p>Alternatively, install and start privoxy using Homebrew:</p>
  1096. <pre><code>$ brew install privoxy
  1097. $ brew services start privoxy
  1098. </code></pre>
  1099. <p>By default, privoxy listens on local TCP port 8118.</p>
  1100. <p>Set the system <strong>http</strong> proxy for your active network interface <code>127.0.0.1</code> and <code>8118</code> (This can be done through <strong>System Preferences &gt; Network &gt; Advanced &gt; Proxies</strong>):</p>
  1101. <pre><code>$ sudo networksetup -setwebproxy "Wi-Fi" 127.0.0.1 8118
  1102. </code></pre>
  1103. <p><strong>(Optional)</strong> Set the system <strong>https</strong> proxy, which still allows for domain name filtering, with:</p>
  1104. <pre><code>$ sudo networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 8118
  1105. </code></pre>
  1106. <p>Confirm the proxy is set:</p>
  1107. <p><code>$ scutil --proxy
  1108. &lt;dictionary&gt; {
  1109. ExceptionsList : &lt;array&gt; {
  1110. 0 : *.local
  1111. 1 : 169.254/16
  1112. }
  1113. FTPPassive : 1
  1114. HTTPEnable : 1
  1115. HTTPPort : 8118
  1116. HTTPProxy : 127.0.0.1
  1117. }</code></p>
  1118. <p>Visit <a href="http://p.p/">http://p.p/</a> in a browser, or with Curl:</p>
  1119. <p><code>$ ALL_PROXY=127.0.0.1:8118 curl -I http://p.p/
  1120. HTTP/1.1 200 OK
  1121. Content-Length: 2401
  1122. Content-Type: text/html
  1123. Cache-Control: no-cache</code></p>
  1124. <p>Privoxy already comes with many good rules, however you can also write your own.</p>
  1125. <p>Edit <code>~/homebrew/etc/privoxy/user.action</code> to filter elements by domain or with regular expressions.</p>
  1126. <p>Here are some examples:</p>
  1127. <p>```
  1128. { +block{social networking} }
  1129. www.facebook.com/(extern|plugins)/(login_status|like(box)?|activity|fan).php
  1130. .facebook.com</p>
  1131. <p>{ +block{unwanted images} +handle-as-image }
  1132. .com/ads/
  1133. /.<em>1x1.gif
  1134. /.</em>fb-icon.[jpg|gif|png]
  1135. /assets/social-.<em>
  1136. /cleardot.gif
  1137. /img/social.</em>
  1138. ads.<em>.co.</em>/
  1139. ads.*.com/</p>
  1140. <p>{ +redirect{s@http://@https://@} }
  1141. .google.com
  1142. .wikipedia.org
  1143. code.jquery.com
  1144. imgur.com
  1145. ```</p>
  1146. <p>Verify Privoxy is blocking and redirecting:</p>
  1147. <p>```
  1148. $ ALL_PROXY=127.0.0.1:8118 curl ads.foo.com/ -IL
  1149. HTTP/1.1 403 Request blocked by Privoxy
  1150. Content-Type: image/gif
  1151. Content-Length: 64
  1152. Cache-Control: no-cache</p>
  1153. <p>$ ALL_PROXY=127.0.0.1:8118 curl imgur.com/ -IL
  1154. HTTP/1.1 302 Local Redirect from Privoxy
  1155. Location: https://imgur.com/
  1156. Content-Length: 0
  1157. Date: Sun, 09 Oct 2016 18:48:19 GMT</p>
  1158. <p>HTTP/1.1 200 OK
  1159. Content-Type: text/html; charset=utf-8
  1160. ```</p>
  1161. <p>You can replace ad images with pictures of kittens, for example, by starting the a local Web server and <a href="https://www.privoxy.org/user-manual/actions-file.html#SET-IMAGE-BLOCKER">redirecting blocked requests</a> to localhost.</p>
  1162. <h3>Browser</h3>
  1163. <p>The Web browser poses the largest security and privacy risk, as its fundamental job is to download and execute untrusted code from the Internet.</p>
  1164. <p>Use <a href="https://www.google.com/chrome/browser/desktop/">Google Chrome</a> for most of your browsing. It offers <a href="https://www.chromium.org/user-experience/multi-profiles">separate profiles</a>, <a href="https://www.chromium.org/developers/design-documents/sandbox">good sandboxing</a>, <a href="http://googlechromereleases.blogspot.com/">frequent updates</a> (including Flash, although you should disable it - see below), and carries <a href="https://www.chromium.org/Home/chromium-security/brag-sheet">impressive credentials</a>.</p>
  1165. <p>Chrome also comes with a great <a href="http://0xdabbad00.com/2013/01/13/most-secure-pdf-viewer-chrome-pdf-viewer/">PDF viewer</a>.</p>
  1166. <p>If you don't want to use Chrome, <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a> is an excellent browser as well. Or simply use both. See discussion in issues <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/2">#2</a>, <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/90">#90</a>.</p>
  1167. <p>If using Firefox, see <a href="https://github.com/TheCreeper/PrivacyFox">TheCreeper/PrivacyFox</a> for recommended privacy preferences. Also be sure to check out <a href="https://noscript.net/">NoScript</a> for Mozilla-based browsers, which allows whitelist-based, pre-emptive script blocking.</p>
  1168. <p>Create at least three profiles, one for browsing <strong>trusted</strong> Web sites (email, banking), another for <strong>mostly trusted</strong> Web sites (link aggregators, news sites), and a third for a completely <strong>cookie-less</strong> and <strong>script-less</strong> experience.</p>
  1169. <ul>
  1170. <li>
  1171. <p>One profile <strong>without cookies or Javascript</strong> enabled (e.g., turned off in <code>chrome://settings/content</code>) which should be the preferred profile to visiting untrusted Web sites. However, many pages will not load at all without Javascript enabled.</p>
  1172. </li>
  1173. <li>
  1174. <p>One profile with <a href="https://github.com/gorhill/uMatrix">uMatrix</a> or <a href="https://github.com/gorhill/uBlock">uBlock Origin</a> (or both). Use this profile for visiting <strong>mostly trusted</strong> Web sites. Take time to learn how these firewall extensions work. Other frequently recommended extensions are <a href="https://www.eff.org/privacybadger">Privacy Badger</a>, <a href="https://www.eff.org/https-everywhere">HTTPSEverywhere</a> and <a href="http://patrol.psyced.org/">CertPatrol</a> (Firefox only).</p>
  1175. </li>
  1176. <li>
  1177. <p>One or more profile(s) for secure and trusted browsing needs, such as banking and email only.</p>
  1178. </li>
  1179. </ul>
  1180. <p>The idea is to separate and compartmentalize data, so that an exploit or privacy violation in one "session" does not necessarily affect data in another.</p>
  1181. <p>In each profile, visit <code>chrome://plugins/</code> and disable <strong>Adobe Flash Player</strong>. If you must use Flash, visit <code>chrome://settings/contents</code> to enable <strong>Let me choose when to run plugin content</strong>, under the Plugins section (also known as <em>click-to-play</em>).</p>
  1182. <p>Take some time to read through <a href="https://www.chromium.org/Home/chromium-security">Chromium Security</a> and <a href="https://www.chromium.org/Home/chromium-privacy">Chromium Privacy</a>.</p>
  1183. <p>For example you may wish to disable <a href="https://www.chromium.org/developers/design-documents/dns-prefetching">DNS prefetching</a> (see also <a href="https://www.usenix.org/legacy/event/leet10/tech/full_papers/Krishnan.pdf">DNS Prefetching and Its Privacy Implications</a> (pdf)).</p>
  1184. <p>Also be aware of <a href="https://en.wikipedia.org/wiki/WebRTC#Concerns">WebRTC</a>, which may reveal your local or public (if connected to VPN) IP address(es). This can be disabled with extensions such as <a href="https://github.com/gorhill/uBlock/wiki/Prevent-WebRTC-from-leaking-local-IP-address">uBlock Origin</a> and <a href="https://github.com/rentamob/WebRTC-Leak-Prevent">rentamob/WebRTC-Leak-Prevent</a>.</p>
  1185. <p>Many Chromium-derived browsers are not recommended. They are usually <a href="http://yro.slashdot.org/comments.pl?sid=4176879&amp;cid=44774943">closed source</a>, <a href="https://plus.google.com/+JustinSchuh/posts/69qw9wZVH8z">poorly maintained</a>, <a href="https://code.google.com/p/google-security-research/issues/detail?id=679">have bugs</a>, and make dubious claims to protect privacy. See <a href="http://thesimplecomputer.info/the-private-life-of-chromium-browsers">The Private Life of Chromium Browsers</a>.</p>
  1186. <p>Safari is not recommended. The code is a mess and <a href="https://nakedsecurity.sophos.com/2014/02/24/anatomy-of-a-goto-fail-apples-ssl-bug-explained-plus-an-unofficial-patch/">security</a> <a href="https://vimeo.com/144872861">vulnerabilities</a> are frequent, and slower to patch (see <a href="https://news.ycombinator.com/item?id=10150038">discussion on Hacker News</a>). Security does <a href="https://discussions.apple.com/thread/5128209">not appear</a> to be a priority for Safari. If you do use it, at least <a href="https://thoughtsviewsopinions.wordpress.com/2013/04/26/how-to-stop-downloaded-files-opening-automatically/">disable</a> the <strong>Open "safe" files after downloading</strong> option in Preferences, and be aware of other <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/93">privacy nuances</a>.</p>
  1187. <p>Other miscellaneous browsers, such as <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/94">Brave</a>, are not evaluated in this guide, so are neither recommended nor actively discouraged from use.</p>
  1188. <p>For more information about security conscious browsing, see <a href="https://gist.github.com/atcuno/3425484ac5cce5298932">HowTo: Privacy &amp; Security Conscious Browsing</a>, <a href="https://www.browserleaks.com/">browserleaks.com</a> and <a href="https://panopticlick.eff.org/">EFF Panopticlick</a>.</p>
  1189. <h3>Plugins</h3>
  1190. <p><strong>Adobe Flash</strong>, <strong>Oracle Java</strong>, <strong>Adobe Reader</strong>, <strong>Microsoft Silverlight</strong> (Netflix now works with <a href="https://help.netflix.com/en/node/23742">HTML5</a>) and other plugins are <a href="https://news.ycombinator.com/item?id=9901480">security risks</a> and should not be installed.</p>
  1191. <p>If they are necessary, only use them in a disposable virtual machine and subscribe to security announcements to make sure you're always patched.</p>
  1192. <p>See <a href="http://blog.trendmicro.com/trendlabs-security-intelligence/hacking-team-flash-zero-day-integrated-into-exploit-kits/">Hacking Team Flash Zero-Day</a>, <a href="https://en.wikipedia.org/wiki/Trojan_BackDoor.Flashback">Java Trojan BackDoor.Flashback</a>, <a href="http://www.cvedetails.com/vulnerability-list/vendor_id-53/product_id-497/Adobe-Acrobat-Reader.html">Acrobat Reader: Security Vulnerabilities</a>, and <a href="https://blogs.cisco.com/security/angling-for-silverlight-exploits">Angling for Silverlight Exploits</a>, for example.</p>
  1193. <h2>PGP/GPG</h2>
  1194. <p>PGP is a standard for encrypting email end to end. That means only the chosen recipients can decrypt a message, unlike regular email which is read and forever archived by providers.</p>
  1195. <p><strong>GPG</strong>, or <strong>GNU Privacy Guard</strong>, is a GPL licensed program compliant with the standard.</p>
  1196. <p><strong>GPG</strong> is used to verify signatures of software you download and install, as well as <a href="https://en.wikipedia.org/wiki/Symmetric-key_algorithm">symmetrically</a> or <a href="https://en.wikipedia.org/wiki/Public-key_cryptography">asymmetrically</a> encrypt files and text.</p>
  1197. <p>Install from Homebrew with <code>brew install gnupg2</code>.</p>
  1198. <p>If you prefer a graphical application, download and install <a href="https://gpgtools.org/">GPG Suite</a>.</p>
  1199. <p>Here are several <a href="https://github.com/drduh/config/blob/master/gpg.conf">recommended options</a> to add to <code>~/.gnupg/gpg.conf</code>:</p>
  1200. <p><code>auto-key-locate keyserver
  1201. keyserver hkps://hkps.pool.sks-keyservers.net
  1202. keyserver-options no-honor-keyserver-url
  1203. keyserver-options ca-cert-file=/etc/sks-keyservers.netCA.pem
  1204. keyserver-options no-honor-keyserver-url
  1205. keyserver-options debug
  1206. keyserver-options verbose
  1207. personal-cipher-preferences AES256 AES192 AES CAST5
  1208. personal-digest-preferences SHA512 SHA384 SHA256 SHA224
  1209. default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
  1210. cert-digest-algo SHA512
  1211. s2k-digest-algo SHA512
  1212. s2k-cipher-algo AES256
  1213. charset utf-8
  1214. fixed-list-mode
  1215. no-comments
  1216. no-emit-version
  1217. keyid-format 0xlong
  1218. list-options show-uid-validity
  1219. verify-options show-uid-validity
  1220. with-fingerprint</code></p>
  1221. <p>Install the keyservers <a href="https://sks-keyservers.net/verify_tls.php">CA certificate</a>:</p>
  1222. <pre><code>$ curl -O https://sks-keyservers.net/sks-keyservers.netCA.pem
  1223. $ sudo mv sks-keyservers.netCA.pem /etc
  1224. </code></pre>
  1225. <p>These settings will configure GnuPG to use SSL when fetching new keys and prefer strong cryptographic primitives.</p>
  1226. <p>See also <a href="https://github.com/ioerror/duraconf/blob/master/configs/gnupg/gpg.conf">ioerror/duraconf/configs/gnupg/gpg.conf</a>. You should also take some time to read <a href="https://help.riseup.net/en/security/message-security/openpgp/best-practices">OpenPGP Best Practices</a>.</p>
  1227. <p>If you don't already have a keypair, create one using <code>gpg --gen-key</code>. Also see <a href="https://github.com/drduh/YubiKey-Guide">drduh/YubiKey-Guide</a>.</p>
  1228. <p>Read <a href="https://alexcabal.com/creating-the-perfect-gpg-keypair/">online</a> <a href="https://security.stackexchange.com/questions/31594/what-is-a-good-general-purpose-gnupg-key-setup">guides</a> and practice encrypting and decrypting email to yourself and your friends. Get them interested in this stuff!</p>
  1229. <h2>OTR</h2>
  1230. <p>OTR stands for <strong>off-the-record</strong> and is a cryptographic protocol for encrypting and authenticating conversations over instant messaging.</p>
  1231. <p>You can use OTR on top of any existing <a href="https://xmpp.org/about">XMPP</a> chat service, even Google Hangouts (which only encrypts conversations between users and the server using TLS).</p>
  1232. <p>The first time you start a conversation with someone new, you'll be asked to verify their public key fingerprint. Make sure to do this in person or by some other secure means (e.g. GPG encrypted mail).</p>
  1233. <p>A popular macOS GUI client for XMPP and other chat protocols is <a href="https://adium.im/">Adium</a></p>
  1234. <p>Consider downloading the <a href="https://beta.adium.im/">beta version</a> which uses OAuth2, making logging in to Google accounts <a href="https://adium.im/blog/2015/04/">more</a> <a href="https://trac.adium.im/ticket/16161">secure</a>.</p>
  1235. <p><code>Adium_1.5.11b3.dmg
  1236. SHA-256: 999e1931a52dc327b3a6e8492ffa9df724a837c88ad9637a501be2e3b6710078
  1237. SHA-1: ca804389412f9aeb7971ade6812f33ac739140e6</code></p>
  1238. <p>Remember to <a href="https://trac.adium.im/ticket/15722">disable logging</a> for OTR chats with Adium.</p>
  1239. <p>A good console-based XMPP client is <a href="http://www.profanity.im/">profanity</a>, which can be installed with <code>brew install profanity</code></p>
  1240. <p>For improved anonymity, check out <a href="https://blog.torproject.org/blog/tor-messenger-beta-chat-over-tor-easily">Tor Messenger</a>, although it is still in beta, as well as <a href="https://ricochet.im/">Ricochet</a> (which has recently received a thorough <a href="https://ricochet.im/files/ricochet-ncc-audit-2016-01.pdf">security audit</a> (pdf)), which both use the Tor network rather than relying on messaging servers.</p>
  1241. <p>If you want to know how OTR works, read the paper <a href="https://otr.cypherpunks.ca/otr-wpes.pdf">Off-the-Record Communication, or, Why Not To Use PGP</a> (pdf)</p>
  1242. <h2>Tor</h2>
  1243. <p>Tor is an anonymizing proxy which can be used for browsing the Web.</p>
  1244. <p>Download Tor Browser from the <a href="https://www.torproject.org/projects/torbrowser.html">offical Tor Project Web site</a>.</p>
  1245. <p>Do <strong>not</strong> attempt to configure other browsers or applications to use Tor as you will likely make a mistake which will compromise your anonymity.</p>
  1246. <p>Download both the <code>dmg</code> and <code>asc</code> signature files, then verify the disk image has been signed by Tor developers:</p>
  1247. <p>```
  1248. $ cd Downloads</p>
  1249. <p>$ file Tor*
  1250. TorBrowser-6.0.5-osx64_en-US.dmg: bzip2 compressed data, block size = 900k
  1251. TorBrowser-6.0.5-osx64_en-US.dmg.asc: PGP signature Signature (old)</p>
  1252. <p>$ gpg Tor*asc
  1253. gpg: assuming signed data in `TorBrowser-6.0.5-osx64_en-US.dmg'
  1254. gpg: Signature made Fri Sep 16 07:51:52 2016 EDT using RSA key ID D40814E0
  1255. gpg: Can't check signature: public key not found</p>
  1256. <p>$ gpg --recv 0xD40814E0
  1257. gpg: requesting key D40814E0 from hkp server keys.gnupg.net
  1258. gpg: key 93298290: public key "Tor Browser Developers (signing key) <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#116;&#111;&#114;&#98;&#114;&#111;&#119;&#115;&#101;&#114;&#64;&#116;&#111;&#114;&#112;&#114;&#111;&#106;&#101;&#99;&#116;&#46;&#111;&#114;&#103;">&#116;&#111;&#114;&#98;&#114;&#111;&#119;&#115;&#101;&#114;&#64;&#116;&#111;&#114;&#112;&#114;&#111;&#106;&#101;&#99;&#116;&#46;&#111;&#114;&#103;</a>" imported
  1259. gpg: no ultimately trusted keys found
  1260. gpg: Total number processed: 1
  1261. gpg: imported: 1 (RSA: 1)</p>
  1262. <p>$ gpg Tor*asc
  1263. gpg: assuming signed data in 'TorBrowser-6.0.5-osx64_en-US.dmg'
  1264. gpg: Signature made Fri Sep 16 07:51:52 2016 EDT using RSA key ID D40814E0
  1265. gpg: Good signature from "Tor Browser Developers (signing key) <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#116;&#111;&#114;&#98;&#114;&#111;&#119;&#115;&#101;&#114;&#64;&#116;&#111;&#114;&#112;&#114;&#111;&#106;&#101;&#99;&#116;&#46;&#111;&#114;&#103;">&#116;&#111;&#114;&#98;&#114;&#111;&#119;&#115;&#101;&#114;&#64;&#116;&#111;&#114;&#112;&#114;&#111;&#106;&#101;&#99;&#116;&#46;&#111;&#114;&#103;</a>" [unknown]
  1266. gpg: WARNING: This key is not certified with a trusted signature!
  1267. gpg: There is no indication that the signature belongs to the owner.
  1268. Primary key fingerprint: EF6E 286D DA85 EA2A 4BA7 DE68 4E2C 6E87 9329 8290
  1269. Subkey fingerprint: BA1E E421 BBB4 5263 180E 1FC7 2E1A C68E D408 14E0
  1270. ```</p>
  1271. <p>Make sure <code>Good signature from "Tor Browser Developers (signing key) &lt;torbrowser@torproject.org&gt;"</code> appears in the output. The warning about the key not being certified is benign, as it has not yet been manually assigned trust.</p>
  1272. <p>See <a href="https://www.torproject.org/docs/verifying-signatures.html">How to verify signatures for packages</a> for more information.</p>
  1273. <p>To finish installing Tor Browser, open the disk image and drag the it into the Applications folder, or with:</p>
  1274. <p>```
  1275. $ hdiutil mount TorBrowser-6.0.5-osx64_en-US.dmg</p>
  1276. <p>$ cp -rv /Volumes/Tor\ Browser/TorBrowser.app /Applications
  1277. ```</p>
  1278. <p>It is also possible to verify the Tor application's code signature was made by with The Tor Project's Apple developer ID <strong>MADPSAYN6T</strong>:</p>
  1279. <p><code>$ codesign -dvv /Applications/TorBrowser.app
  1280. Executable=/Applications/TorBrowser.app/Contents/MacOS/firefox
  1281. Identifier=org.mozilla.tor browser
  1282. Format=app bundle with Mach-O thin (x86_64)
  1283. CodeDirectory v=20200 size=247 flags=0x0(none) hashes=5+3 location=embedded
  1284. Library validation warning=OS X SDK version before 10.9 does not support Library Validation
  1285. Signature size=4247
  1286. Authority=Developer ID Application: The Tor Project, Inc (MADPSAYN6T)
  1287. Authority=Developer ID Certification Authority
  1288. Authority=Apple Root CA
  1289. Signed Time=Nov 30, 2016, 10:40:34 AM
  1290. Info.plist entries=21
  1291. TeamIdentifier=MADPSAYN6T
  1292. Sealed Resources version=2 rules=12 files=130
  1293. Internal requirements count=1 size=184</code></p>
  1294. <p>To view certificate details, extract it with <code>codesign</code> and decode it with <code>openssl</code>:</p>
  1295. <p>```
  1296. $ codesign -d --extract-certificates /Applications/TorBrowser.app
  1297. Executable=/Applications/TorBrowser.app/Contents/MacOS/firefox</p>
  1298. <p>$ file codesign*
  1299. codesign0: data
  1300. codesign1: data
  1301. codesign2: data</p>
  1302. <p>$ openssl x509 -inform der -in codesign0 -subject -issuer -startdate -enddate -noout
  1303. subject= /UID=MADPSAYN6T/CN=Developer ID Application: The Tor Project, Inc (MADPSAYN6T)/OU=MADPSAYN6T/O=The Tor Project, Inc/C=US
  1304. issuer= /CN=Developer ID Certification Authority/OU=Apple Certification Authority/O=Apple Inc./C=US
  1305. notBefore=Apr 12 22:40:13 2016 GMT
  1306. notAfter=Apr 13 22:40:13 2021 GMT</p>
  1307. <p>$ openssl x509 -inform der -in codesign0 -fingerprint -noout
  1308. SHA1 Fingerprint=95:80:54:F1:54:66:F3:9C:C2:D8:27:7A:29:21:D9:61:11:93:B3:E8</p>
  1309. <p>$ openssl x509 -inform der -in codesign0 -fingerprint -sha256 -noout
  1310. SHA256 Fingerprint=B5:0D:47:F0:3E:CB:42:B6:68:1C:6F:38:06:2B:C2:9F:41:FA:D6:54:F1:29:D3:E4:DD:9C:C7:49:35:FF:F5:D9
  1311. ```</p>
  1312. <p>Tor traffic is <strong>encrypted</strong> to the <a href="https://en.wikipedia.org/wiki/Tor_(anonymity_network)#Exit_node_eavesdropping">exit node</a> (i.e., cannot be read by a passive network eavesdropper), but Tor use <strong>can</strong> be identified - for example, TLS handshake "hostnames" will show up in plaintext:</p>
  1313. <p><code>$ sudo tcpdump -An "tcp" | grep "www"
  1314. listening on pktap, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
  1315. .............". ...www.odezz26nvv7jeqz1xghzs.com.........
  1316. .............#.!...www.bxbko3qi7vacgwyk4ggulh.com.........
  1317. .6....m.....&gt;...:.........|../* Z....W....X=..6...C../....................................0...0..0.......'....F./0.. *.H........0%1#0!..U....www.b6zazzahl3h3faf4x2.com0...160402000000Z..170317000000Z0'1%0#..U....www.tm3ddrghe22wgqna5u8g.net0..0..</code></p>
  1318. <p>See <a href="https://gitweb.torproject.org/torspec.git/tree/tor-spec.txt">Tor Protocol Specification</a> and <a href="https://trac.torproject.org/projects/tor/wiki/org/projects/Tor/TLSHistory">Tor/TLSHistory</a> for more information.</p>
  1319. <p>You may wish to additionally obfuscate Tor traffic using a <a href="https://www.torproject.org/docs/pluggable-transports.html">pluggable transport</a>, such as <a href="https://github.com/Yawning/obfs4">Yawning/obfs4proxy</a> or <a href="https://github.com/SRI-CSL/stegotorus">SRI-CSL/stegotorus</a>.</p>
  1320. <p>This can be done by setting up your own <a href="https://www.torproject.org/docs/tor-relay-debian.html">Tor relay</a> or finding an existing private or public <a href="https://www.torproject.org/docs/bridges.html.en#RunningABridge">bridge</a> to serve as an obfuscating entry node.</p>
  1321. <p>For extra security, use Tor inside a <a href="https://www.virtualbox.org/wiki/Downloads">VirtualBox</a> or <a href="https://www.vmware.com/products/fusion">VMware</a> virtualized <a href="http://www.brianlinkletter.com/installing-debian-linux-in-a-virtualbox-virtual-machine/">GNU/Linux</a> or <a href="http://www.openbsd.org/faq/faq4.html">BSD</a> machine.</p>
  1322. <p>Finally, remember the Tor network provides <a href="https://www.privateinternetaccess.com/blog/2013/10/how-does-privacy-differ-from-anonymity-and-why-are-both-important/">anonymity</a>, which is not necessarily synonymous with privacy. The Tor network does not guarantee protection against a global observer capable of traffic analysis and <a href="https://blog.torproject.org/category/tags/traffic-correlation">correlation</a>. See also <a href="http://bford.info/pub/net/panopticon-cacm.pdf">Seeking Anonymity in an Internet Panopticon</a> (pdf) and <a href="http://www.ohmygodel.com/publications/usersrouted-ccs13.pdf">Traffic Correlation on Tor by Realistic Adversaries</a> (pdf).</p>
  1323. <p>Also see <a href="https://geti2p.net/en/about/intro">Invisible Internet Project (I2P)</a> and its <a href="https://geti2p.net/en/comparison/tor">Tor comparison</a>.</p>
  1324. <h2>VPN</h2>
  1325. <p>If you use your Mac on untrusted networks - airports, cafes, etc. - your network traffic is being monitored and possibly tampered with.</p>
  1326. <p>It is a good idea to use a VPN which encrypts <strong>all</strong> outgoing network traffic (i.e., not <strong>split tunnel</strong>) with a provider you trust. For an example of how to set up and host your own VPN, see <a href="https://github.com/drduh/Debian-Privacy-Server-Guide">drduh/Debian-Privacy-Server-Guide</a>.</p>
  1327. <p>Don't just blindly sign up for a VPN service without understanding the full implications and how your traffic will be routed. If you don't understand how the VPN works or are not familiar with the software used, you are probably better off without it.</p>
  1328. <p>When choosing a VPN service or setting up your own, be sure to research the protocols, key exchange algorithms, authentication mechanisms, and type of encryption being used. Some protocols, such as <a href="https://en.wikipedia.org/wiki/Point-to-Point_Tunneling_Protocol#Security">PPTP</a>, should be avoided in favor of <a href="https://en.wikipedia.org/wiki/OpenVPN">OpenVPN</a>, for example.</p>
  1329. <p>Some clients may send traffic over the next available interface when VPN is interrupted or disconnected. See <a href="https://gist.github.com/scy/8122924">scy/8122924</a> for an example on how to allow traffic only over VPN.</p>
  1330. <p>Another set of scripts to lock down your system so it will only access the internet via a VPN can be found as part of the Voodoo Privacy project - <a href="https://github.com/sarfata/voodooprivacy">sarfata/voodooprivacy</a> and there is an updated guide to setting up an IPSec VPN on a virtual machine (<a href="https://github.com/hwdsl2/setup-ipsec-vpn">hwdsl2/setup-ipsec-vpn</a>) or a docker container (<a href="https://github.com/hwdsl2/docker-ipsec-vpn-server">hwdsl2/docker-ipsec-vpn-server</a>).</p>
  1331. <h2>Viruses and malware</h2>
  1332. <p>There is an <a href="https://www.documentcloud.org/documents/2459197-bit9-carbon-black-threat-research-report-2015.html">ever-increasing</a> amount of Mac malware in the wild. Macs aren't immune from viruses and malicious software!</p>
  1333. <p>Some malware comes bundled with both legitimate software, such as the <a href="http://www.zdnet.com/article/oracle-extends-its-adware-bundling-to-include-java-for-macs/">Java bundling Ask Toolbar</a>, and some with illegitimate software, such as <a href="https://docs.google.com/document/d/1YOfXRUQJgMjJSLBSoLiUaSZfiaS_vU3aG4Bvjmz6Dxs/edit?pli=1">Mac.BackDoor.iWorm</a> bundled with pirated programs. <a href="https://www.malwarebytes.com/antimalware/mac/">Malwarebytes Anti-Malware for Mac</a> is an excellent program for ridding oneself of "garden-variety" malware and other "crapware".</p>
  1334. <p>See <a href="https://www.virusbtn.com/pdf/conference/vb2014/VB2014-Wardle.pdf">Methods of malware persistence on Mac OS X</a> (pdf) and <a href="https://www.rsaconference.com/events/us15/agenda/sessions/1591/malware-persistence-on-os-x-yosemite">Malware Persistence on OS X Yosemite</a> to learn about how garden-variety malware functions.</p>
  1335. <p>You could periodically run a tool like <a href="https://github.com/synack/knockknock">Knock Knock</a> to examine persistent applications (e.g. scripts, binaries). But by then, it is probably too late. Maybe applications such as <a href="https://objective-see.com/products/blockblock.html">Block Block</a> and <a href="https://objective-see.com/products/ostiarius.html">Ostiarius</a> will help. See warnings and caveats in <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/90">issue #90</a> first, however. Using an application such as <a href="https://www.littleflocker.com/">Little Flocker</a> can also protect parts of the filesystem from unauthorized writes similar to how Little Snitch protects the network (note, however, the software is still in beta and should be <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/pull/128">used with caution</a>).</p>
  1336. <p><strong>Anti-virus</strong> programs are a double-edged sword -- not useful for <strong>advanced</strong> users and will likely increase attack surface against sophisticated threats, however possibly useful for catching "garden variety" malware on <strong>novice</strong> users' Macs. There is also the additional processing overhead to consider.</p>
  1337. <p>See <a href="https://lock.cmpxchg8b.com/sophailv2.pdf">Sophail: Applied attacks against Antivirus</a> (pdf), <a href="http://googleprojectzero.blogspot.ro/2015/06/analysis-and-exploitation-of-eset.html">Analysis and Exploitation of an ESET Vulnerability</a>, <a href="https://code.google.com/p/google-security-research/issues/detail?id=546">a trivial Avast RCE</a>, <a href="https://theintercept.com/2015/06/22/nsa-gchq-targeted-kaspersky/">Popular Security Software Came Under Relentless NSA and GCHQ Attacks</a>, and <a href="https://code.google.com/p/google-security-research/issues/detail?id=675">AVG: "Web TuneUP" extension multiple critical vulnerabilities</a>.</p>
  1338. <p>Therefore, the best anti-virus is <strong>Common Sense 2016</strong>. See more discussion in <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/44">issue #44</a>.</p>
  1339. <p>Local privilege escalation bugs are plenty on macOS, so always be careful when downloading and running untrusted programs or trusted programs from third party websites or downloaded over HTTP (<a href="http://arstechnica.com/security/2015/08/0-day-bug-in-fully-patched-os-x-comes-under-active-exploit-to-hijack-macs/">example</a>).</p>
  1340. <p>Have a look at <a href="http://www.thesafemac.com/">The Safe Mac</a> for past and current Mac security news.</p>
  1341. <p>Also check out <a href="https://www.schneier.com/blog/archives/2015/07/hacking_team_is.html">Hacking Team</a> malware for Mac OS: <a href="https://github.com/hackedteam/vector-macos-root">root installation for MacOS</a>, <a href="https://github.com/hackedteam/driver-macos">Support driver for Mac Agent</a> and <a href="https://github.com/hackedteam/core-macos">RCS Agent for Mac</a>, which is a good example of advanced malware with capabilities to hide from <strong>userland</strong> (e.g., <code>ps</code>, <code>ls</code>), for example. For more, see <a href="https://objective-see.com/blog/blog_0x0D.html">A Brief Analysis of an RCS Implant Installer</a> and <a href="https://reverse.put.as/2016/02/29/the-italian-morons-are-back-what-are-they-up-to-this-time/">reverse.put.as</a></p>
  1342. <h2>System Integrity Protection</h2>
  1343. <p><a href="https://support.apple.com/en-us/HT204899">System Integrity Protection</a> (SIP) is a security feature since OS X 10.11 "El Capitan". It is enabled by default, but <a href="https://derflounder.wordpress.com/2015/10/01/system-integrity-protection-adding-another-layer-to-apples-security-model/">can be disabled</a>, which may be necessary to change some system settings, such as deleting root certificate authorities or unloading certain launch daemons. Keep this feature on, as it is by default.</p>
  1344. <p>From <a href="https://developer.apple.com/library/prerelease/mac/releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_11.html">What's New in OS X 10.11</a>:</p>
  1345. <blockquote>
  1346. <p>A new security policy that applies to every running process, including privileged code and code that runs out of the sandbox. The policy extends additional protections to components on disk and at run-time, only allowing system binaries to be modified by the system installer and software updates. Code injection and runtime attachments to system binaries are no longer permitted.</p>
  1347. </blockquote>
  1348. <p>Also see <a href="https://apple.stackexchange.com/questions/193368/what-is-the-rootless-feature-in-el-capitan-really">What is the “rootless” feature in El Capitan, really?</a></p>
  1349. <p>Some MacBook hardware has shipped with <a href="http://appleinsider.com/articles/16/11/17/system-integrity-protection-disabled-by-default-on-some-touch-bar-macbook-pros">SIP disabled</a>. To verify SIP is enabled, use the command <code>csrutil status</code>, which should return: <code>System Integrity Protection status: enabled.</code> Otherwise, <a href="https://developer.apple.com/library/content/documentation/Security/Conceptual/System_Integrity_Protection_Guide/ConfiguringSystemIntegrityProtection/ConfiguringSystemIntegrityProtection.html">enable SIP</a> through Recovery Mode.</p>
  1350. <h2>Gatekeeper and XProtect</h2>
  1351. <p><strong>Gatekeeper</strong> and the <strong>quarantine</strong> system try to prevent unsigned or "bad" programs and files from running and opening.</p>
  1352. <p><strong>XProtect</strong> prevents the execution of known bad files and outdated plugin versions, but does nothing to cleanup or stop existing malware.</p>
  1353. <p>Both offer trivial protection against common risks and are fine at default settings.</p>
  1354. <p>See also <a href="http://www.thesafemac.com/mmg-builtin/">Mac Malware Guide : How does Mac OS X protect me?</a> and <a href="http://ilostmynotes.blogspot.com/2012/06/gatekeeper-xprotect-and-quarantine.html">Gatekeeper, XProtect and the Quarantine attribute</a>.</p>
  1355. <p><strong>Note</strong> Quarantine stores information about downloaded files in <code>~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2</code>, which may pose a privacy risk. To examine the file, simply use <code>strings</code> or the following command:</p>
  1356. <pre><code>$ echo 'SELECT datetime(LSQuarantineTimeStamp + 978307200, "unixepoch") as LSQuarantineTimeStamp, LSQuarantineAgentName, LSQuarantineOriginURLString, LSQuarantineDataURLString from LSQuarantineEvent;' | sqlite3 /Users/$USER/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2
  1357. </code></pre>
  1358. <p>See <a href="http://www.zoharbabin.com/hey-mac-i-dont-appreciate-you-spying-on-me-hidden-downloads-log-in-os-x/">here</a> for more information.</p>
  1359. <p>To permanently disable this feature, <a href="https://superuser.com/questions/90008/how-to-clear-the-contents-of-a-file-from-the-command-line">clear the file</a> and <a href="http://hints.macworld.com/article.php?story=20031017061722471">make it immutable</a>:</p>
  1360. <pre><code>$ :&gt;~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2
  1361. $ sudo chflags schg ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2
  1362. </code></pre>
  1363. <p>Furthermore, macOS attaches metadata (<a href="https://en.wikipedia.org/wiki/Extended_file_attributes#OS_X">HFS+ extended attributes</a>) to downloaded files:</p>
  1364. <p>```
  1365. $ ls -l@ ~/Downloads/TorBrowser-6.0.5-osx64_en-US.dmg
  1366. -rw-r--r--@ 1 drduh staff 59322237 Oct 9 15:20 TorBrowser-6.0.5-osx64_en-US.dmg
  1367. com.apple.metadata:kMDItemWhereFroms 186
  1368. com.apple.quarantine 68</p>
  1369. <p>$ xattr -l ~/Downloads/TorBrowser-6.0.5-osx64_en-US.dmg
  1370. com.apple.metadata:kMDItemWhereFroms:
  1371. 00000000 62 70 6C 69 73 74 30 30 A2 01 02 5F 10 4D 68 74 |bplist00...<em>.Mht|
  1372. 00000010 74 70 73 3A 2F 2F 64 69 73 74 2E 74 6F 72 70 72 |tps://dist.torpr|
  1373. 00000020 6F 6A 65 63 74 2E 6F 72 67 2F 74 6F 72 62 72 6F |oject.org/torbro|
  1374. 00000030 77 73 65 72 2F 36 2E 30 2E 35 2F 54 6F 72 42 72 |wser/6.0.5/TorBr|
  1375. 00000040 6F 77 73 65 72 2D 36 2E 30 2E 35 2D 6F 73 78 36 |owser-6.0.5-osx6|
  1376. 00000050 34 5F 65 6E 2D 55 53 2E 64 6D 67 5F 10 39 68 74 |4_en-US.dmg</em>.9ht|
  1377. 00000060 74 70 73 3A 2F 2F 77 77 77 2E 74 6F 72 70 72 6F |tps://www.torpro|
  1378. 00000070 6A 65 63 74 2E 6F 72 67 2F 64 6F 77 6E 6C 6F 61 |ject.org/downloa|
  1379. 00000080 64 2F 64 6F 77 6E 6C 6F 61 64 2D 65 61 73 79 2E |d/download-easy.|
  1380. 00000090 68 74 6D 6C 2E 65 6E 08 0B 5B 00 00 00 00 00 00 |html.en..[......|
  1381. 000000A0 01 01 00 00 00 00 00 00 00 03 00 00 00 00 00 00 |................|
  1382. 000000B0 00 00 00 00 00 00 00 00 00 97 |..........|
  1383. 000000ba
  1384. com.apple.quarantine: 0081;52fb9173;Google Chrome.app;3AB6D46E-4AC5-3C3E-B427-32C7F804AAA3</p>
  1385. <p>$ xattr -d com.apple.metadata:kMDItemWhereFroms ~/Downloads/TorBrowser-6.0.5-osx64_en-US.dmg</p>
  1386. <p>$ xattr -d com.apple.quarantine ~/Downloads/TorBrowser-6.0.5-osx64_en-US.dmg</p>
  1387. <p>$ xattr -l ~/Downloads/TorBrowser-6.0.5-osx64_en-US.dmg
  1388. [No output after removal.]
  1389. ```</p>
  1390. <h2>Passwords</h2>
  1391. <p>You can generate strong passwords with OpenSSL:</p>
  1392. <pre><code>$ openssl rand -base64 30
  1393. LK9xkjUEAemc1gV2Ux5xqku+PDmMmCbSTmwfiMRI
  1394. </code></pre>
  1395. <p>Or GPG:</p>
  1396. <pre><code>$ gpg --gen-random -a 0 30
  1397. 4/bGZL+yUEe8fOqQhF5V01HpGwFSpUPwFcU3aOWQ
  1398. </code></pre>
  1399. <p>Or <code>/dev/urandom</code> output:</p>
  1400. <pre><code>$ dd if=/dev/urandom bs=1 count=30 2&gt;/dev/null | base64
  1401. CbRGKASFI4eTa96NMrgyamj8dLZdFYBaqtWUSxKe
  1402. </code></pre>
  1403. <p>With control over character sets:</p>
  1404. <pre><code>$ LANG=C tr -dc 'a-zA-Z0-9' &lt; /dev/urandom | fold -w 40 | head -n 1
  1405. jm0iKn7ngQST8I0mMMCbbi6SKPcoUWwCb5lWEjxK
  1406. $ LANG=C tr -dc 'DrDuh0-9' &lt; /dev/urandom | fold -w 40 | head -n 1
  1407. 686672u2Dh7r754209uD312hhh23uD7u41h3875D
  1408. </code></pre>
  1409. <p>You can also generate passwords, even memorable ones, using <strong>Keychain Access</strong> password assistant, or a command line equivalent like <a href="https://github.com/anders/pwgen">anders/pwgen</a>.</p>
  1410. <p>Keychains are encrypted with a <a href="https://en.wikipedia.org/wiki/PBKDF2">PBKDF2 derived key</a> and are a <em>pretty safe</em> place to store credentials. See also <a href="http://juusosalonen.com/post/30923743427/breaking-into-the-os-x-keychain">Breaking into the OS X keychain</a>. Also be aware that Keychain <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide/issues/118">does not encrypt</a> the names corresponding to password entries.</p>
  1411. <p>Alternatively, you can manage an encrypted passwords file yourself with GnuPG (shameless plug for my <a href="https://github.com/drduh/pwd.sh">drduh/pwd.sh</a> password manager script).</p>
  1412. <p>In addition to passwords, ensure eligible online accounts, such as GitHub, Google accounts, banking, have <a href="https://en.wikipedia.org/wiki/Two-factor_authentication">two factor authentication</a> enabled.</p>
  1413. <p>Look to <a href="https://www.yubico.com/products/yubikey-hardware/yubikey-neo/">Yubikey</a> for a two factor and private key (e.g., ssh, gpg) hardware token. See <a href="https://github.com/drduh/YubiKey-Guide">drduh/YubiKey-Guide</a> and <a href="https://trmm.net/Yubikey">trmm.net/Yubikey</a>. One of two Yubikey's slots can also be programmed to emit a long, static password (which can be used in combination with a short, memorized password, for example).</p>
  1414. <h2>Backup</h2>
  1415. <p>Always encrypt files locally before backing them up to external media or online services.</p>
  1416. <p>One way is to use a symmetric cipher with GPG and a password of your choosing.</p>
  1417. <p>To encrypt a directory:</p>
  1418. <pre><code>$ tar zcvf - ~/Downloads | gpg -c &gt; ~/Desktop/backup-$(date +%F-%H%M).tar.gz.gpg
  1419. </code></pre>
  1420. <p>To decrypt an archive:</p>
  1421. <pre><code>$ gpg -o ~/Desktop/decrypted-backup.tar.gz -d ~/Desktop/backup-2015-01-01-0000.tar.gz.gpg &amp;&amp; \
  1422. tar zxvf ~/Desktop/decrypted-backup.tar.gz
  1423. </code></pre>
  1424. <p>You may also create encrypted volumes using <strong>Disk Utility</strong> or <code>hdiutil</code>:</p>
  1425. <pre><code>$ hdiutil create ~/Desktop/encrypted.dmg -encryption -size 1g -volname "Name" -fs JHFS+
  1426. </code></pre>
  1427. <p>Also see the following applications and services: <a href="https://spideroak.com/">SpiderOak</a>, <a href="https://www.arqbackup.com/">Arq</a>, <a href="https://www.espionageapp.com/">Espionage</a>, and <a href="https://restic.github.io/">restic</a>.</p>
  1428. <h2>Wi-Fi</h2>
  1429. <p>macOS remembers access points it has connected to. Like all wireless devices, the Mac will broadcast all access point names it remembers (e.g., <em>MyHomeNetwork</em>) each time it looks for a network, such as when waking from sleep.</p>
  1430. <p>This is a privacy risk, so remove networks from the list in <strong>System Preferences</strong> &gt; <strong>Network</strong> &gt; <strong>Advanced</strong> when they're no longer needed.</p>
  1431. <p>Also see <a href="http://conferences.sigcomm.org/imc/2013/papers/imc148-barberaSP106.pdf">Signals from the Crowd: Uncovering Social Relationships through Smartphone Probes</a> (pdf) and <a href="http://confiance-numerique.clermont-universite.fr/Slides/M-Cunche-2014.pdf">Wi-Fi told me everything about you</a> (pdf).</p>
  1432. <p>Saved Wi-Fi information (SSID, last connection, etc.) can be found in <code>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</code></p>
  1433. <p>You may wish to <a href="https://en.wikipedia.org/wiki/MAC_spoofing">spoof the MAC address</a> of your network card before connecting to new and untrusted wireless networks to mitigate passive fingerprinting:</p>
  1434. <pre><code>$ sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's%\(..\)%\1:%g; s%.$%%')
  1435. </code></pre>
  1436. <p><strong>Note</strong> MAC addresses will reset to hardware defaults on each boot.</p>
  1437. <p>Also see <a href="https://github.com/feross/SpoofMAC">feross/SpoofMAC</a>.</p>
  1438. <p>Finally, WEP protection on wireless networks is <a href="http://www.howtogeek.com/167783/htg-explains-the-difference-between-wep-wpa-and-wpa2-wireless-encryption-and-why-it-matters/">not secure</a> and you should favor connecting to <strong>WPA2</strong> protected networks only to mitigate the risk of passive eavesdroppers.</p>
  1439. <h2>SSH</h2>
  1440. <p>For outgoing ssh connections, use hardware- or password-protected keys, <a href="http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/">set up</a> remote hosts and consider <a href="http://nms.csail.mit.edu/projects/ssh/">hashing</a> them for added privacy.</p>
  1441. <p>Here are several recommended <a href="https://www.freebsd.org/cgi/man.cgi?query=ssh_config&amp;sektion=5">options</a> to add to <code>~/.ssh/config</code>:</p>
  1442. <pre><code>Host *
  1443. PasswordAuthentication no
  1444. ChallengeResponseAuthentication no
  1445. HashKnownHosts yes
  1446. </code></pre>
  1447. <p><strong>Note</strong> <a href="https://openradar.appspot.com/28394826">macOS Sierra permanently remembers SSH key passphrases by default</a>. Append the option <code>UseKeyChain no</code> to turn this feature off.</p>
  1448. <p>You can also use ssh to create an <a href="http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html">encrypted tunnel</a> to send your traffic through, which is similar to a VPN.</p>
  1449. <p>For example, to use Privoxy on a remote host:</p>
  1450. <pre><code>$ ssh -C -L 5555:127.0.0.1:8118 you@remote-host.tld
  1451. $ sudo networksetup -setwebproxy "Wi-Fi" 127.0.0.1 5555
  1452. $ sudo networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 5555
  1453. </code></pre>
  1454. <p>Or to use an ssh connection as a <a href="https://www.mikeash.com/ssh_socks.html">SOCKS proxy</a>:</p>
  1455. <pre><code>$ ssh -NCD 3000 you@remote-host.tld
  1456. </code></pre>
  1457. <p>By default, macOS does <strong>not</strong> have sshd or <em>Remote Login</em> enabled.</p>
  1458. <p>To enable sshd and allow incoming ssh connections:</p>
  1459. <pre><code>$ sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
  1460. </code></pre>
  1461. <p>Or use the <strong>System Preferences</strong> &gt; <strong>Sharing</strong> menu.</p>
  1462. <p>If you are going to enable sshd, at least disable password authentication and consider further <a href="https://stribika.github.io/2015/01/04/secure-secure-shell.html">hardening</a> your configuration.</p>
  1463. <p>To <code>/etc/sshd_config</code>, add:</p>
  1464. <p><code>PasswordAuthentication no
  1465. ChallengeResponseAuthentication no
  1466. UsePAM no</code></p>
  1467. <p>Confirm whether sshd is enabled or disabled:</p>
  1468. <pre><code>$ sudo lsof -Pni TCP:22
  1469. </code></pre>
  1470. <h2>Physical access</h2>
  1471. <p>Keep your Mac physically secure at all times. Don't leave it unattended in hotels and such.</p>
  1472. <p>A skilled attacker with unsupervised physical access to your computer can infect the boot ROM to install a keylogger and steal your password - see <a href="https://trmm.net/Thunderstrike">Thunderstrike</a>, for example.</p>
  1473. <p>A helpful tool is <a href="https://github.com/hephaest0s/usbkill">usbkill</a>, which is <em>"an anti-forensic kill-switch that waits for a change on your USB ports and then immediately shuts down your computer"</em>.</p>
  1474. <p>Consider purchasing a <a href="https://www.amazon.com/s/ref=nb_sb_noss_2?url=node%3D15782001&amp;field-keywords=macbook">privacy filter</a> for your screen to thwart shoulder surfers.</p>
  1475. <h2>System monitoring</h2>
  1476. <h4>OpenBSM audit</h4>
  1477. <p>macOS has a powerful OpenBSM auditing capability. You can use it to monitor process execution, network activity, and much more.</p>
  1478. <p>To tail audit logs, use the <code>praudit</code> utility:</p>
  1479. <p><code>$ sudo praudit -l /dev/auditpipe
  1480. header,201,11,execve(2),0,Thu Sep 1 12:00:00 2015, + 195 msec,exec arg,/Applications/.evilapp/rootkit,path,/Applications/.evilapp/rootkit,path,/Applications/.evilapp/rootkit,attribute,100755,root,wheel,16777220,986535,0,subject,drduh,root,wheel,root,wheel,412,100005,50511731,0.0.0.0,return,success,0,trailer,201,
  1481. header,88,11,connect(2),0,Thu Sep 1 12:00:00 2015, + 238 msec,argument,1,0x5,fd,socket-inet,2,443,173.194.74.104,subject,drduh,root,wheel,root,wheel,326,100005,50331650,0.0.0.0,return,failure : Operation now in progress,4354967105,trailer,88
  1482. header,111,11,OpenSSH login,0,Thu Sep 1 12:00:00 2015, + 16 msec,subject_ex,drduh,drduh,staff,drduh,staff,404,404,49271,::1,text,successful login drduh,return,success,0,trailer,111,</code></p>
  1483. <p>See the manual pages for <code>audit</code>, <code>praudit</code>, <code>audit_control</code> and other files in <code>/etc/security</code></p>
  1484. <p><strong>Note</strong> although <code>man audit</code> says the <code>-s</code> flag will synchronize the audit configuration, it appears necessary to reboot for changes to take effect.</p>
  1485. <p>See articles on <a href="http://ilostmynotes.blogspot.com/2013/10/openbsm-auditd-on-os-x-these-are-logs.html">ilostmynotes.blogspot.com</a> and <a href="https://derflounder.wordpress.com/2012/01/30/openbsm-auditing-on-mac-os-x/">derflounder.wordpress.com</a> for more information.</p>
  1486. <h4>DTrace</h4>
  1487. <p><code>iosnoop</code> monitors disk I/O</p>
  1488. <p><code>opensnoop</code> monitors file opens</p>
  1489. <p><code>execsnoop</code> monitors execution of processes</p>
  1490. <p><code>errinfo</code> monitors failed system calls</p>
  1491. <p><code>dtruss</code> monitors all system calls</p>
  1492. <p>See <code>man -k dtrace</code> for more information.</p>
  1493. <p><strong>Note</strong> <a href="https://github.com/drduh/OS-X-Security-and-Privacy-Guide#system-integrity-protection">System Integrity Protection</a> <a href="http://internals.exposed/blog/dtrace-vs-sip.html">interferes</a> with DTrace, so it may no longer be possible to use these tools.</p>
  1494. <h4>Execution</h4>
  1495. <p><code>ps -ef</code> lists information about all running processes.</p>
  1496. <p>You can also view processes with <strong>Activity Monitor</strong>.</p>
  1497. <p><code>launchctl list</code> and <code>sudo launchctl list</code> list loaded and running user and system launch daemons and agents.</p>
  1498. <h4>Network</h4>
  1499. <p>List open network files:</p>
  1500. <pre><code>$ sudo lsof -Pni
  1501. </code></pre>
  1502. <p>List contents of various network-related data structures:</p>
  1503. <pre><code>$ sudo netstat -atln
  1504. </code></pre>
  1505. <p>You can also use <a href="https://www.wireshark.org/">Wireshark</a> from the command line.</p>
  1506. <p>Monitor DNS queries and replies:</p>
  1507. <p><code>$ tshark -Y "dns.flags.response == 1" -Tfields \
  1508. -e frame.time_delta \
  1509. -e dns.qry.name \
  1510. -e dns.a \
  1511. -Eseparator=,</code></p>
  1512. <p>Monitor HTTP requests and responses:</p>
  1513. <p><code>$ tshark -Y "http.request or http.response" -Tfields \
  1514. -e ip.dst \
  1515. -e http.request.full_uri \
  1516. -e http.request.method \
  1517. -e http.response.code \
  1518. -e http.response.phrase \
  1519. -Eseparator=/s</code></p>
  1520. <p>Monitor x509 certificates:</p>
  1521. <p><code>$ tshark -Y "ssl.handshake.certificate" -Tfields \
  1522. -e ip.src \
  1523. -e x509sat.uTF8String \
  1524. -e x509sat.printableString \
  1525. -e x509sat.universalString \
  1526. -e x509sat.IA5String \
  1527. -e x509sat.teletexString \
  1528. -Eseparator=/s -Equote=d</code></p>
  1529. <p>Also see the simple networking monitoring application <a href="https://github.com/BonzaiThePenguin/Loading">BonzaiThePenguin/Loading</a>.</p>
  1530. <h2>Binary Whitelisting</h2>
  1531. <p><a href="https://github.com/google/santa/">google/santa</a> is a security software developed for Google's corporate Macintosh fleet and open sourced.</p>
  1532. <blockquote>
  1533. <p>Santa is a binary whitelisting/blacklisting system for macOS. It consists of a kernel extension that monitors for executions, a userland daemon that makes execution decisions based on the contents of a SQLite database, a GUI agent that notifies the user in case of a block decision and a command-line utility for managing the system and synchronizing the database with a server.</p>
  1534. </blockquote>
  1535. <p>Santa uses the <a href="https://developer.apple.com/library/content/technotes/tn2127/_index.html">Kernel Authorization API</a> to monitor and allow/disallow binaries from executing in the kernel. Binaries can be white- or black-listed by unique hash or signing developer certificate. Santa can be used to only allow trusted code execution, or to blacklist known malware from executing on a Mac, similar to Bit9 software for Windows.</p>
  1536. <p><strong>Note</strong> Santa does not currently have a graphical user interface for managing rules. The following instructions are for advanced users only!</p>
  1537. <p>To install Santa, visit the <a href="https://github.com/google/santa/releases">Releases</a> page and download the latest disk image, the mount it and install the contained package:</p>
  1538. <p>```
  1539. $ hdiutil mount ~/Downloads/santa-0.9.14.dmg</p>
  1540. <p>$ sudo installer -pkg /Volumes/santa-0.9.14/santa-0.9.14.pkg -tgt /
  1541. ```</p>
  1542. <p>By default, Santa installs in "Monitor" mode (meaning, nothing gets blocked, only logged) and comes with two rules: one for Apple binaries and another for Santa software itself.</p>
  1543. <p>Verify Santa is running and its kernel module is loaded:</p>
  1544. <p>```
  1545. $ santactl status</p>
  1546. <blockquote>
  1547. <blockquote>
  1548. <blockquote>
  1549. <p>Daemon Info
  1550. Mode | Monitor
  1551. File Logging | No
  1552. Watchdog CPU Events | 0 (Peak: 0.00%)
  1553. Watchdog RAM Events | 0 (Peak: 0.00MB)
  1554. Kernel Info
  1555. Kernel cache count | 0
  1556. Database Info
  1557. Binary Rules | 0
  1558. Certificate Rules | 2
  1559. Events Pending Upload | 0</p>
  1560. </blockquote>
  1561. </blockquote>
  1562. </blockquote>
  1563. <p>$ ps -ef | grep "[s]anta"
  1564. 0 786 1 0 10:01AM ?? 0:00.39 /Library/Extensions/santa-driver.kext/Contents/MacOS/santad --syslog</p>
  1565. <p>$ kextstat | grep santa
  1566. 119 0 0xffffff7f822ff000 0x6000 0x6000 com.google.santa-driver (0.9.14) 693D8E4D-3161-30E0-B83D-66A273CAE026 &lt;5 4 3 1&gt;
  1567. ```</p>
  1568. <p>Create a blacklist rule to prevent iTunes from executing:</p>
  1569. <pre><code>$ sudo santactl rule --blacklist --path /Applications/iTunes.app/
  1570. Added rule for SHA-256: e1365b51d2cb2c8562e7f1de36bfb3d5248de586f40b23a2ed641af2072225b3.
  1571. </code></pre>
  1572. <p>Try to launch iTunes - it will be blocked.</p>
  1573. <pre><code>$ open /Applications/iTunes.app/
  1574. LSOpenURLsWithRole() failed with error -10810 for the file /Applications/iTunes.app.
  1575. </code></pre>
  1576. <p><img width="450" alt="Santa block dialog when attempting to run a blacklisted program" src="https://cloud.githubusercontent.com/assets/12475110/21062284/14ddde88-be1e-11e6-8e9b-32f8a44c0cf6.png"></p>
  1577. <p>To remove the rule:</p>
  1578. <pre><code>$ sudo santactl rule --remove --path /Applications/iTunes.app/
  1579. Removed rule for SHA-256: e1365b51d2cb2c8562e7f1de36bfb3d5248de586f40b23a2ed641af2072225b3.
  1580. </code></pre>
  1581. <p>Open iTunes:</p>
  1582. <pre><code>$ open /Applications/iTunes.app/
  1583. [iTunes will open successfully]
  1584. </code></pre>
  1585. <p>Create a new, example C program:</p>
  1586. <p>```
  1587. $ cat &lt;<EOF > foo.c</p>
  1588. <blockquote>
  1589. <h1>include <stdio.h></h1>
  1590. <p>main() { printf("Hello World\n”); }
  1591. EOF
  1592. ```</p>
  1593. </blockquote>
  1594. <p>Compile the program with GCC (requires installation of Xcode or command-line tools):</p>
  1595. <p>```
  1596. $ gcc -o foo foo.c</p>
  1597. <p>$ file foo
  1598. foo: Mach-O 64-bit executable x86_64</p>
  1599. <p>$ codesign -d foo
  1600. foo: code object is not signed at all
  1601. ```</p>
  1602. <p>Run it:</p>
  1603. <p><code>$ ./foo
  1604. Hello World</code></p>
  1605. <p>Toggle Santa into “Lockdown” mode, which only allows whitelisted binaries to run:</p>
  1606. <pre><code>$ sudo defaults write /var/db/santa/config.plist ClientMode -int 2
  1607. </code></pre>
  1608. <p>Try to run the unsigned binary:</p>
  1609. <p>```
  1610. $ ./foo
  1611. bash: ./foo: Operation not permitted</p>
  1612. <p>Santa</p>
  1613. <p>The following application has been blocked from executing
  1614. because its trustworthiness cannot be determined.</p>
  1615. <p>Path: /Users/demouser/foo
  1616. Identifier: 4e11da26feb48231d6e90b10c169b0f8ae1080f36c168ffe53b1616f7505baed
  1617. Parent: bash (701)
  1618. ```
  1619. To whitelist a specific binary, determine its SHA-256 sum:</p>
  1620. <p><code>$ santactl fileinfo /Users/demouser/foo
  1621. Path : /Users/demouser/foo
  1622. SHA-256 : 4e11da26feb48231d6e90b10c169b0f8ae1080f36c168ffe53b1616f7505baed
  1623. SHA-1 : 4506f3a8c0a5abe4cacb98e6267549a4d8734d82
  1624. Type : Executable (x86-64)
  1625. Code-signed : No
  1626. Rule : Blacklisted (Unknown)</code></p>
  1627. <p>Add a whitelist rule:</p>
  1628. <pre><code>$ sudo santactl rule --whitelist --sha256 4e11da26feb48231d6e90b10c169b0f8ae1080f36c168ffe53b1616f7505baed
  1629. Added rule for SHA-256: 4e11da26feb48231d6e90b10c169b0f8ae1080f36c168ffe53b1616f7505baed.
  1630. </code></pre>
  1631. <p>Run it:</p>
  1632. <p><code>$ ./foo
  1633. Hello World</code></p>
  1634. <p>It's allowed and works!</p>
  1635. <p>Applications can also be whitelisted by developer certificate (so that new binary versions will not need to be manually whitelisted on each update). For example, download and run Google Chrome - it will be blocked by Santa in "Lockdown" mode:</p>
  1636. <p>```
  1637. $ curl -sO https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg</p>
  1638. <p>$ hdiutil mount googlechrome.dmg</p>
  1639. <p>$ cp -r /Volumes/Google\ Chrome/Google\ Chrome.app /Applications/</p>
  1640. <p>$ open /Applications/Google\ Chrome.app/
  1641. LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Google Chrome.app.
  1642. ```</p>
  1643. <p>Whitelist the application by its developer certificate (first item in the Signing Chain):</p>
  1644. <p>```
  1645. $ santactl fileinfo /Applications/Google\ Chrome.app/
  1646. Path : /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  1647. SHA-256 : 0eb08224d427fb1d87d2276d911bbb6c4326ec9f74448a4d9a3cfce0c3413810
  1648. SHA-1 : 9213cbc7dfaaf7580f3936a915faa56d40479f6a
  1649. Bundle Name : Google Chrome
  1650. Bundle Version : 2883.87
  1651. Bundle Version Str : 55.0.2883.87
  1652. Type : Executable (x86-64)
  1653. Code-signed : Yes
  1654. Rule : Blacklisted (Unknown)
  1655. Signing Chain:
  1656. 1. SHA-256 : 15b8ce88e10f04c88a5542234fbdfc1487e9c2f64058a05027c7c34fc4201153
  1657. SHA-1 : 85cee8254216185620ddc8851c7a9fc4dfe120ef
  1658. Common Name : Developer ID Application: Google Inc.
  1659. Organization : Google Inc.
  1660. Organizational Unit : EQHXZ8M8AV
  1661. Valid From : 2012/04/26 07:10:10 -0700
  1662. Valid Until : 2017/04/27 07:10:10 -0700</p>
  1663. <pre><code> 2. SHA-256 : 7afc9d01a62f03a2de9637936d4afe68090d2de18d03f29c88cfb0b1ba63587f
  1664. SHA-1 : 3b166c3b7dc4b751c9fe2afab9135641e388e186
  1665. Common Name : Developer ID Certification Authority
  1666. Organization : Apple Inc.
  1667. Organizational Unit : Apple Certification Authority
  1668. Valid From : 2012/02/01 14:12:15 -0800
  1669. Valid Until : 2027/02/01 14:12:15 -0800
  1670. 3. SHA-256 : b0b1730ecbc7ff4505142c49f1295e6eda6bcaed7e2c68c5be91b5a11001f024
  1671. SHA-1 : 611e5b662c593a08ff58d14ae22452d198df6c60
  1672. Common Name : Apple Root CA
  1673. Organization : Apple Inc.
  1674. Organizational Unit : Apple Certification Authority
  1675. Valid From : 2006/04/25 14:40:36 -0700
  1676. Valid Until : 2035/02/09 13:40:36 -0800
  1677. </code></pre>
  1678. <p>```</p>
  1679. <p>In this case, <code>15b8ce88e10f04c88a5542234fbdfc1487e9c2f64058a05027c7c34fc4201153</code> is the SHA-256 of Google’s Apple developer certificate (team ID EQHXZ8M8AV). To whitelist it:</p>
  1680. <p><code>$ sudo santactl rule --whitelist --certificate --sha256 15b8ce88e10f04c88a5542234fbdfc1487e9c2f64058a05027c7c34fc4201153
  1681. Added rule for SHA-256: 15b8ce88e10f04c88a5542234fbdfc1487e9c2f64058a05027c7c34fc4201153.</code></p>
  1682. <p>Google Chrome should now launch, and subsequent updates to the application will continue to work as long as the code signing certificate doesn’t change or expire.</p>
  1683. <p>To disable “Lockdown” mode:</p>
  1684. <pre><code>$ sudo defaults delete /var/db/santa/config.plist ClientMode
  1685. </code></pre>
  1686. <p>See <code>/var/log/santa.log</code> to monitor ALLOW and DENY execution decisions.</p>
  1687. <p><strong>Note</strong> Python, Bash and other interpreters are whitelisted (since they are signed by Apple's developer certificate), so Santa will not be able to block such scripts from executing. Thus, a potential non-binary program which disables Santa is a weakness (not vulnerability, since it is so by design) to take note of.</p>
  1688. <h2>Miscellaneous</h2>
  1689. <p>If you wish, disable <a href="https://github.com/fix-macosx/fix-macosx/wiki/Diagnostics-&amp;-Usage-Data">Diagnostics &amp; Usage Data</a>.</p>
  1690. <p>If you want to play <strong>music</strong> or watch <strong>videos</strong>, use <a href="https://www.videolan.org/vlc/index.html">VLC media player</a> which is free and open source.</p>
  1691. <p>If you want to use <strong>torrents</strong>, use <a href="http://www.transmissionbt.com/download/">Transmission</a> which is free and open source (note: like all software, even open source projects, <a href="http://researchcenter.paloaltonetworks.com/2016/03/new-os-x-ransomware-keranger-infected-transmission-bittorrent-client-installer/">malware may still find its way in</a>). You may also wish to use a block list to avoid peering with known bad hosts - see <a href="https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/">Which is the best blocklist for Transmission</a> and <a href="https://gist.github.com/johntyree/3331662">johntyree/3331662</a>.</p>
  1692. <p>Manage default file handlers with <a href="http://duti.org/">duti</a>, which can be installed with <code>brew install duti</code>. One reason to manage extensions is to prevent auto-mounting of remote filesystems in Finder (see <a href="https://www.taoeffect.com/blog/2016/02/apologies-sky-kinda-falling-protecting-yourself-from-sparklegate/">Protecting Yourself From Sparklegate</a>). Here are several recommended handlers to manage:</p>
  1693. <p>```
  1694. $ duti -s com.apple.Safari afp</p>
  1695. <p>$ duti -s com.apple.Safari ftp</p>
  1696. <p>$ duti -s com.apple.Safari nfs</p>
  1697. <p>$ duti -s com.apple.Safari smb
  1698. ```</p>
  1699. <p>Monitor system logs with the <strong>Console</strong> application or <code>syslog -w</code> or <code>log stream</code> commands.</p>
  1700. <p>In systems prior to macOS Sierra (10.12), enable the <a href="https://derflounder.wordpress.com/2016/09/21/tty_tickets-option-now-on-by-default-for-macos-sierras-sudo-tool/">tty_tickets flag</a> in <code>/etc/sudoers</code> to restrict the sudo session to the Terminal window/tab that started it. To do so, use <code>sudo visudo</code> and add the line <code>Defaults tty_tickets</code>.</p>
  1701. <p>Set your screen to lock as soon as the screensaver starts:</p>
  1702. <pre><code>$ defaults write com.apple.screensaver askForPassword -int 1
  1703. $ defaults write com.apple.screensaver askForPasswordDelay -int 0
  1704. </code></pre>
  1705. <p>Expose hidden files and Library folder in Finder:</p>
  1706. <pre><code>$ defaults write com.apple.finder AppleShowAllFiles -bool true
  1707. $ chflags nohidden ~/Library
  1708. </code></pre>
  1709. <p>Show all filename extensions (so that "Evil.jpg.app" cannot masquerade easily).</p>
  1710. <pre><code>$ defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  1711. </code></pre>
  1712. <p>Don't default to saving documents to iCloud:</p>
  1713. <pre><code>$ defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
  1714. </code></pre>
  1715. <p>Enable <a href="https://security.stackexchange.com/questions/47749/how-secure-is-secure-keyboard-entry-in-mac-os-xs-terminal">Secure Keyboard Entry</a> in Terminal (unless you use <a href="https://mig5.net/content/secure-keyboard-entry-os-x-blocks-interaction-yubikeys">YubiKey</a> or applications such as <a href="https://smilesoftware.com/textexpander/secureinput">TextExpander</a>).</p>
  1716. <p>Disable crash reporter (the dialog which appears after an application crashes and prompts to report the problem to Apple):</p>
  1717. <pre><code>$ defaults write com.apple.CrashReporter DialogType none
  1718. </code></pre>
  1719. <p>Disable Bonjour <a href="https://www.trustwave.com/Resources/SpiderLabs-Blog/mDNS---Telling-the-world-about-you-(and-your-device)/">multicast advertisements</a>:</p>
  1720. <pre><code>$ sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES
  1721. </code></pre>
  1722. <p><a href="https://apple.stackexchange.com/questions/151481/why-is-my-macbook-visibile-on-bluetooth-after-yosemite-install">Disable Handoff</a> and Bluetooth features, if they aren't necessary.</p>
  1723. <p>Consider <a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/sandbox-exec.1.html">sandboxing</a> your applications. See <a href="https://reverse.put.as/wp-content/uploads/2011/09/Apple-Sandbox-Guide-v0.1.pdf">fG! Sandbox Guide</a> (pdf) and <a href="https://github.com/s7ephen/OSX-Sandbox--Seatbelt--Profiles">s7ephen/OSX-Sandbox--Seatbelt--Profiles</a>.</p>
  1724. <p>Did you know Apple has not shipped a computer with TPM since <a href="http://osxbook.com/book/bonus/chapter10/tpm/">2006</a>?</p>
  1725. <h2>Related software</h2>
  1726. <p><a href="https://github.com/google/santa/">Santa</a> - A binary whitelisting/blacklisting system for macOS.</p>
  1727. <p><a href="https://github.com/kristovatlas/osx-config-check">kristovatlas/osx-config-check</a> - checks your OSX machine against various hardened configuration settings.</p>
  1728. <p><a href="https://objective-see.com/products/lockdown.html">Lockdown</a> - audits and remediates security configuration settings.</p>
  1729. <p><a href="https://objective-see.com/products/dhs.html">Dylib Hijack Scanner</a> - scan for applications that are either susceptible to dylib hijacking or have been hijacked.</p>
  1730. <p><a href="https://www.littleflocker.com/">Little Flocker</a> - "Little Snitch for files"; prevents applications from accessing files.</p>
  1731. <p><a href="https://github.com/facebook/osquery">facebook/osquery</a> - can be used to retrieve low level system information. Users can write SQL queries to retrieve system information.</p>
  1732. <p><a href="https://github.com/google/grr">google/grr</a> - incident response framework focused on remote live forensics.</p>
  1733. <p><a href="https://github.com/yelp/osxcollector">yelp/osxcollector</a> - forensic evidence collection &amp; analysis toolkit for OS X.</p>
  1734. <p><a href="https://github.com/jipegit/OSXAuditor">jipegit/OSXAuditor</a> - analyzes artifacts on a running system, such as quarantined files, Safari, Chrome and Firefox history, downloads, HTML5 databases and localstore, social media and email accounts, and Wi-Fi access point names.</p>
  1735. <p><a href="https://github.com/libyal/libfvde">libyal/libfvde</a> - library to access FileVault Drive Encryption (FVDE) (or FileVault2) encrypted volumes.</p>
  1736. <p><a href="https://github.com/CISOfy/lynis">CISOfy/lynis</a> - cross-platform security auditing tool and assists with compliance testing and system hardening.</p>
  1737. <h2>Additional resources</h2>
  1738. <p><em>In no particular order</em></p>
  1739. <p><a href="http://newosxbook.com/files/moxii3/AppendixA.pdf">MacOS Hardening Guide - Appendix of *OS Internals: Volume III - Security &amp; Insecurity Internals</a></p>
  1740. <p><a href="https://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Introduction.html">Mac Developer Library: Secure Coding Guide</a></p>
  1741. <p><a href="https://www.apple.com/osx/all-features/pdf/osx_elcapitan_core_technologies_overview.pdf">OS X Core Technologies Overview White Paper</a></p>
  1742. <p><a href="https://reverse.put.as/">Reverse Engineering Mac OS X blog</a></p>
  1743. <p><a href="http://samdmarshall.com/re.html">Reverse Engineering Resources</a></p>
  1744. <p><a href="https://objective-see.com/blog.html">Patrick Wardle's Objective-See blog</a></p>
  1745. <p><a href="https://www.usenix.org/conference/lisa13/managing-macs-google-scale">Managing Macs at Google Scale (LISA '13)</a></p>
  1746. <p><a href="https://www.usenix.org/conference/lisa13/os-x-hardening-securing-large-global-mac-fleet">OS X Hardening: Securing a Large Global Mac Fleet (LISA '13)</a></p>
  1747. <p><a href="http://iase.disa.mil/stigs/os/mac/Pages/mac-os.aspx">DoD Security Technical Implementation Guides for Mac OS</a></p>
  1748. <p><a href="http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html">The EFI boot process</a></p>
  1749. <p><a href="http://refit.sourceforge.net/info/boot_process.html">The Intel Mac boot process</a></p>
  1750. <p><a href="https://archive.org/details/joshpitts_shmoocon2015">Userland Persistence on Mac OS X</a></p>
  1751. <p><a href="http://phrack.org/issues/66/16.html#article">Developing Mac OSX kernel rootkits</a></p>
  1752. <p><a href="https://code.google.com/p/google-security-research/issues/detail?id=135">IOKit kernel code execution exploit</a></p>
  1753. <p><a href="https://truesecdev.wordpress.com/2015/04/09/hidden-backdoor-api-to-root-privileges-in-apple-os-x/">Hidden backdoor API to root privileges in Apple OS X</a></p>
  1754. <p><a href="http://www.insinuator.net/2015/02/ipv6-hardening-guide-for-os-x/">IPv6 Hardening Guide for OS X</a></p>
  1755. <p><a href="http://docs.hardentheworld.org/OS/OSX_10.11_El_Capitan/">Harden the World: Mac OSX 10.11 El Capitan</a></p>
  1756. <p><a href="https://news.ycombinator.com/item?id=10148077">Hacker News discussion</a></p>
  1757. <p><a href="https://news.ycombinator.com/item?id=13023823">Hacker News discussion 2</a></p>
  1758. <p><a href="https://opensource.apple.com/">Apple Open Source</a></p>
  1759. <p><a href="http://arstechnica.com/apple/2014/10/os-x-10-10/">OS X 10.10 Yosemite: The Ars Technica Review</a></p>
  1760. <p><a href="https://benchmarks.cisecurity.org/tools2/osx/CIS_Apple_OSX_10.10_Benchmark_v1.1.0.pdf">CIS Apple OSX 10.10 Benchmark</a> (pdf)</p>
  1761. <p><a href="https://taoofmac.com/space/HOWTO/Switch">How to Switch to the Mac</a></p>
  1762. <p><a href="http://www.apple.com/support/security/guides/docs/SnowLeopard_Security_Config_v10.6.pdf">Security Configuration For Mac OS X Version 10.6 Snow Leopard</a> (pdf)</p>
  1763. <p><a href="https://ssd.eff.org/">EFF Surveillance Self-Defense Guide</a></p>
  1764. <p><a href="https://macadmins.herokuapp.com/">MacAdmins on Slack</a></p>
  1765. <p><a href="http://support.apple.com/kb/HT4865">iCloud security and privacy overview</a></p>
  1766. <p><a href="http://newosxbook.com/DMG.html">Demystifying the DMG File Format</a></p>
  1767. <p><a href="https://vulnsec.com/2016/osx-apps-vulnerabilities/">There's a lot of vulnerable OS X applications out there (Sparkle Framework RCE)</a></p>
  1768. <p><a href="https://jscholarship.library.jhu.edu/handle/1774.2/36569">iSeeYou: Disabling the MacBook Webcam Indicator LED</a></p>
  1769. <p><a href="https://www.ma.rhul.ac.uk/static/techrep/2015/RHUL-MA-2015-8.pdf">Mac OS X Forensics - Technical Report</a> (pdf)</p>
  1770. <p><a href="https://cet4861.pbworks.com/w/file/fetch/71245694/mac.forensics.craiger-burke.IFIP.06.pdf">Mac Forensics: Mac OS X and the HFS+ File System</a> (pdf)</p>
  1771. <p><a href="https://tribalchicken.com.au/security/extracting-filevault-2-keys-with-volatility/">Extracting FileVault 2 Keys with Volatility</a></p>
  1772. <p><a href="https://googleprojectzero.blogspot.com/2015/09/revisiting-apple-ipc-1-distributed_28.html">Auditing and Exploiting Apple IPC</a></p>
  1773. <p><a href="https://www.amazon.com/Mac-OS-iOS-Internals-Apples/dp/1118057651">Mac OS X and iOS Internals: To the Apple's Core by Jonathan Levin</a></p>
  1774. <p><a href="http://ramtin-amin.fr/#nvmepcie">Demystifying the i-Device NVMe NAND (New storage used by Apple)</a></p>
  1775. </article>
  1776. </section>
  1777. <nav id="jumpto">
  1778. <p>
  1779. <a href="/david/blog/">Accueil du blog</a> |
  1780. <a href="https://github.com/drduh/macOS-Security-and-Privacy-Guide">Source originale</a> |
  1781. <a href="/david/stream/2019/">Accueil du flux</a>
  1782. </p>
  1783. </nav>
  1784. <footer>
  1785. <div>
  1786. <img src="/static/david/david-larlet-avatar.jpg" loading="lazy" class="avatar" width="200" height="200">
  1787. <p>
  1788. Bonjour/Hi!
  1789. Je suis <a href="/david/" title="Profil public">David&nbsp;Larlet</a>, je vis actuellement à Montréal et j’alimente cet espace depuis 15 ans. <br>
  1790. Si tu as apprécié cette lecture, n’hésite pas à poursuivre ton exploration. Par exemple via les <a href="/david/blog/" title="Expériences bienveillantes">réflexions bimestrielles</a>, la <a href="/david/stream/2019/" title="Pensées (dés)articulées">veille hebdomadaire</a> ou en t’abonnant au <a href="/david/log/" title="S’abonner aux publications via RSS">flux RSS</a> (<a href="/david/blog/2019/flux-rss/" title="Tiens c’est quoi un flux RSS ?">so 2005</a>).
  1791. </p>
  1792. <p>
  1793. Je m’intéresse à la place que je peux avoir dans ce monde. En tant qu’humain, en tant que membre d’une famille et en tant qu’associé d’une coopérative. De temps en temps, je fais aussi des <a href="https://github.com/davidbgk" title="Principalement sur Github mais aussi ailleurs">trucs techniques</a>. Et encore plus rarement, <a href="/david/talks/" title="En ce moment je laisse plutôt la place aux autres">j’en parle</a>.
  1794. </p>
  1795. <p>
  1796. Voici quelques articles choisis :
  1797. <a href="/david/blog/2019/faire-equipe/" title="Accéder à l’article complet">Faire équipe</a>,
  1798. <a href="/david/blog/2018/bivouac-automnal/" title="Accéder à l’article complet">Bivouac automnal</a>,
  1799. <a href="/david/blog/2018/commodite-effondrement/" title="Accéder à l’article complet">Commodité et effondrement</a>,
  1800. <a href="/david/blog/2017/donnees-communs/" title="Accéder à l’article complet">Des données aux communs</a>,
  1801. <a href="/david/blog/2016/accompagner-enfant/" title="Accéder à l’article complet">Accompagner un enfant</a>,
  1802. <a href="/david/blog/2016/senior-developer/" title="Accéder à l’article complet">Senior developer</a>,
  1803. <a href="/david/blog/2016/illusion-sociale/" title="Accéder à l’article complet">L’illusion sociale</a>,
  1804. <a href="/david/blog/2016/instantane-scopyleft/" title="Accéder à l’article complet">Instantané Scopyleft</a>,
  1805. <a href="/david/blog/2016/enseigner-web/" title="Accéder à l’article complet">Enseigner le Web</a>,
  1806. <a href="/david/blog/2016/simplicite-defaut/" title="Accéder à l’article complet">Simplicité par défaut</a>,
  1807. <a href="/david/blog/2016/minimalisme-esthetique/" title="Accéder à l’article complet">Minimalisme et esthétique</a>,
  1808. <a href="/david/blog/2014/un-web-omni-present/" title="Accéder à l’article complet">Un web omni-présent</a>,
  1809. <a href="/david/blog/2014/manifeste-developpeur/" title="Accéder à l’article complet">Manifeste de développeur</a>,
  1810. <a href="/david/blog/2013/confort-convivialite/" title="Accéder à l’article complet">Confort et convivialité</a>,
  1811. <a href="/david/blog/2013/testament-numerique/" title="Accéder à l’article complet">Testament numérique</a>,
  1812. et <a href="/david/blog/" title="Accéder aux archives">bien d’autres…</a>
  1813. </p>
  1814. <p>
  1815. On peut <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">échanger par courriel</a>. Si éventuellement tu souhaites que l’on travaille ensemble, tu devrais commencer par consulter le <a href="http://larlet.com">profil dédié à mon activité professionnelle</a> et/ou contacter directement <a href="http://scopyleft.fr/">scopyleft</a>, la <abbr title="Société coopérative et participative">SCOP</abbr> dont je fais partie depuis six ans. Je recommande au préalable de lire <a href="/david/blog/2018/cout-site/" title="Attention ce qui va suivre peut vous choquer">combien coûte un site</a> et pourquoi je suis plutôt favorable à une <a href="/david/pro/devis/" title="Discutons-en !">non-demande de devis</a>.
  1816. </p>
  1817. <p>
  1818. Je ne traque pas ta navigation mais mon
  1819. <abbr title="Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33.184162340">hébergeur</abbr>
  1820. conserve des logs d’accès.
  1821. </p>
  1822. </div>
  1823. </footer>
  1824. <script type="text/javascript">
  1825. ;(_ => {
  1826. const jumper = document.getElementById('jumper')
  1827. jumper.addEventListener('click', e => {
  1828. e.preventDefault()
  1829. const anchor = e.target.getAttribute('href')
  1830. const targetEl = document.getElementById(anchor.substring(1))
  1831. targetEl.scrollIntoView({behavior: 'smooth'})
  1832. })
  1833. })()
  1834. </script>