<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>System &#8211; Phocean.net</title>
	<atom:link href="/category/administration-systeme/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Computer Security Blog</description>
	<lastBuildDate>Fri, 24 Feb 2017 21:17:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.10</generator>
	<item>
		<title>TopIcons-plus for Gnome (v18)</title>
		<link>/2016/12/18/topicons-plus-for-gnome-v18.html</link>
		<comments>/2016/12/18/topicons-plus-for-gnome-v18.html#comments</comments>
		<pubDate>Sun, 18 Dec 2016 17:49:11 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[gnome-shell]]></category>
		<category><![CDATA[topicons-plus]]></category>

		<guid isPermaLink="false">http://phocean.net/?p=2148</guid>
		<guid isPermaLink="false">http://phocean.net/?p=2148</guid>
		<description><![CDATA[This is another off-topic post as it is not related to security. It has been awhile since I released the TopIcons-plus Gnome-Shell extension. I had not advertised it here because it was not really ready or stable, but now I believe it is taking shape. How is Topicons-plus useful ? The Gnome developers want to...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2016/12/18/topicons-plus-for-gnome-v18.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>This is another off-topic post as it is not related to security.</p>
<p>It has been awhile since I released the <a href="https://github.com/phocean/TopIcons-plus">TopIcons-plus Gnome-Shell extension</a>.</p>
<p>I had not advertised it here because it was not really ready or stable, but now I believe it is taking shape.</p>
<h2>How is Topicons-plus useful ?</h2>
<p>The Gnome developers want to kill system tray icons, which are displayed in what they call the legacy tray.</p>
<p>Such icons are familiar to everybody: messaging programs like RocketChat or Telegram, e-mail clients like Thunderbird, Dropbox, KeepassX, etc.</p>
<p>Gnome designers think such a design belongs to past, is flawed in many ways (status or menu?) and should be useless with modern environments with a dock and a powerful notification system.</p>
<p>I would not comment on that and I actually believe they are right.</p>
<p>However, the legacy tray they propose is horrible. It is hidden most of the time and you have to click to open it before accessing to your icons. It is very painful, and it is done on purpose, to clearly send a message that it should not be used anymore by application developers.</p>
<h2>Well, but what about the existing applications ?</h2>
<p>They are not going away all the sudden. As a user, I still need them.</p>
<p>And it is open-source, mostly developed on free time: developers are not going to re-implement everything just for the Gnome ecosystem&#8230;</p>
<p>That is where I think an extension like TopIcons-plus is useful. It removes the hassle of this legacy tray by bringing back the icons to the top bar, so they are always visible.</p>
<h2>Latest release</h2>
<p>It comes with extra features, like styling (opacity, desaturation, size) and positioning.</p>
<p>The <a href="https://github.com/phocean/TopIcons-plus/releases/tag/v18">latest release</a> should be in pretty good shape. If you don&#8217;t want to use the Github code, be patient: it should get validated on the <a href="https://extensions.gnome.org/extension/1031/topicons/">Gnome website</a> within the next days.</p>
<p>Enjoy!</p>
<div id="attachment_2149" style="width: 1930px" class="wp-caption aligncenter"><img class="wp-image-2149 size-full" src="http://phocean.net/wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20.png" width="1920" height="157" srcset="/wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20.png 1920w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-580x47.png 580w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-768x63.png 768w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-940x77.png 940w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-624x51.png 624w" sizes="(max-width: 1920px) 100vw, 1920px" /><p class="wp-caption-text">TopIcons-Plus v18, tray icons centered</p></div>
<div id="attachment_2149" style="width: 1930px" class="wp-caption aligncenter"><img class="wp-image-2149 size-full" src="http://phocean.net/wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20.png" width="1920" height="157" srcset="/wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20.png 1920w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-580x47.png 580w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-768x63.png 768w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-940x77.png 940w, /wp-content/uploads/2016/12/Capture-décran-de-2016-12-18-14-35-20-624x51.png 624w" sizes="(max-width: 1920px) 100vw, 1920px" /><p class="wp-caption-text">TopIcons-Plus v18, tray icons centered</p></div>
]]></content:encoded>
			<wfw:commentRss>/2016/12/18/topicons-plus-for-gnome-v18.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One more rant against the Linux Intel graphic driver</title>
		<link>/2016/10/09/one-more-rant-against-the-linux-intel-driver.html</link>
		<pubDate>Sun, 09 Oct 2016 21:21:04 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://phocean.net/?p=2123</guid>
		<guid isPermaLink="false">http://phocean.net/?p=2123</guid>
		<description><![CDATA[Some quick notes that may help random Linux users looking for similar issues. I am, like many, the unfortunate user of a laptop with Intel graphics (Thinkpad T460 to be precise). Why unfortunate? Because the graphic driver provided by Intel sucks. i915, as it is being called, really has been sucking for years, and it...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2016/10/09/one-more-rant-against-the-linux-intel-driver.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>Some quick notes that may help random Linux users looking for similar issues.</p>
<p>I am, like many, the unfortunate user of a laptop with Intel graphics (Thinkpad T460 to be precise). Why unfortunate? Because the graphic driver provided by Intel sucks.</p>
<p><em><strong>i915</strong></em>, as it is being called, really has been sucking for years, and it is known for that (just google it, if you don&#8217;t believe me).</p>
<p>For the sake of completeness, here is the exact model with which I experienced some issues:</p>
<pre>%  lspci
00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)
...</pre>
<h2>For performance, remove the X11 Intel driver</h2>
<p>First, its X11 module is generally under-performing under X11, so I just removed it to have X11 using <em>modsettings. </em>These are the instructions for Fedora (24), but you can virtually do something similar for any distribution:</p>
<pre>% dnf remove xorg-x11-drv-intel</pre>
<p>Do not worry, it just remove the X11 part of the driver, not the kernel driver itself.</p>
<p>Login, logout, job done: you should have less lags with desktop environments like gnome-shell.</p>
<h2>For stability, disable RC6</h2>
<p>I experienced frequent, daily freezes of my work session. The display would totally hang or display a blank screen, forcing me to cold reboot the computer.</p>
<p>Here is an extract of the <em>dmesg</em> kernel traces leading the the crash (it is a bit lengthy, but that may help people to find this post):</p>
<pre>oct. 06 11:00:25 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:00:44 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:01:01 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:01:25 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:01:43 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:02:01 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:02:22 localhost.localdomain kernel: [drm] RC6 on
oct. 06 11:04:08 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=6364 end=6365) time 287 us, min 954, max 959, scanline start 950, end 967
oct. 06 11:13:58 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=41777 end=41778) time 340 us, min 954, max 959, scanline start 946, end 967
oct. 06 11:20:18 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=64583 end=64584) time 284 us, min 954, max 959, scanline start 946, end 964
oct. 06 11:20:33 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=65517 end=65518) time 284 us, min 1073, max 1079, scanline start 1071, end 1091
oct. 06 11:28:27 localhost.localdomain kernel: [drm:intel_cpu_fifo_underrun_irq_handler [i915]] *ERROR* CPU pipe B FIFO underrun
oct. 06 11:31:53 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=106339 end=106340) time 285 us, min 1073, max 1079, scanline start 1066, end 1086
oct. 06 11:33:58 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=113803 end=113804) time 287 us, min 954, max 959, scanline start 948, end 966
oct. 06 11:35:13 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=118345 end=118346) time 285 us, min 1073, max 1079, scanline start 1062, end 1081
oct. 06 11:52:59 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=182278 end=182279) time 282 us, min 1073, max 1079, scanline start 1064, end 1084
oct. 06 12:01:29 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=212893 end=212894) time 284 us, min 1073, max 1079, scanline start 1068, end 1088
oct. 06 12:02:44 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=217395 end=217396) time 282 us, min 1073, max 1079, scanline start 1068, end 1088
oct. 06 12:02:49 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=217642 end=217643) time 247 us, min 954, max 959, scanline start 949, end 964
oct. 06 12:03:54 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=221597 end=221598) time 281 us, min 1073, max 1079, scanline start 1067, end 1086
oct. 06 12:05:49 localhost.localdomain kernel: [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=228446 end=228447) time 290 us, min 954, max 959, scanline start 948, end 966
oct. 06 12:17:32 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:18:01 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:18:23 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:18:44 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:19:01 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:19:25 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:19:44 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:20:01 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:20:25 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:20:44 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:20:52 localhost.localdomain kernel: [drm] stuck on render ring
oct. 06 12:20:52 localhost.localdomain kernel: [drm] GPU HANG: ecode 9:0:0xfffffffe, in Xorg [2322], reason: Engine(s) hung, action: reset
oct. 06 12:20:52 localhost.localdomain kernel: [drm] GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.
oct. 06 12:20:52 localhost.localdomain kernel: [drm] Please file a _new_ bug report on bugs.freedesktop.org against DRI -&gt; DRM/Intel
oct. 06 12:20:52 localhost.localdomain kernel: [drm] drm/i915 developers can then reassign to the right component if it's not a kernel issue.
oct. 06 12:20:52 localhost.localdomain kernel: [drm] The gpu crash dump is required to analyze gpu hangs, so please always attach it.
oct. 06 12:20:52 localhost.localdomain kernel: [drm] GPU crash dump saved to /sys/class/drm/card0/error
oct. 06 12:20:52 localhost.localdomain kernel: drm/i915: Resetting chip after gpu hang
oct. 06 12:20:54 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:21:05 localhost.localdomain kernel: [drm] stuck on render ring
oct. 06 12:21:05 localhost.localdomain kernel: [drm] GPU HANG: ecode 9:0:0xfffffffe, in gnome-shell [2532], reason: Engine(s) hung, action: reset
oct. 06 12:21:05 localhost.localdomain kernel: drm/i915: Resetting chip after gpu hang
oct. 06 12:21:07 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:21:15 localhost.localdomain kernel: [drm] stuck on render ring
oct. 06 12:21:15 localhost.localdomain kernel: [drm] GPU HANG: ecode 9:0:0xfffffffe, in gnome-shell [2532], reason: Engine(s) hung, action: reset
oct. 06 12:21:15 localhost.localdomain kernel: drm/i915: Resetting chip after gpu hang
oct. 06 12:21:17 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:21:27 localhost.localdomain kernel: [drm] stuck on render ring
oct. 06 12:21:27 localhost.localdomain kernel: [drm] GPU HANG: ecode 9:0:0xfffffffe, in Xorg [2322], reason: Engine(s) hung, action: reset
oct. 06 12:21:27 localhost.localdomain kernel: drm/i915: Resetting chip after gpu hang
oct. 06 12:21:29 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:21:37 localhost.localdomain kernel: [drm] stuck on render ring
oct. 06 12:21:37 localhost.localdomain kernel: [drm] GPU HANG: ecode 9:0:0xfffffffe, in Xorg [2322], reason: Engine(s) hung, action: reset
oct. 06 12:21:37 localhost.localdomain kernel: drm/i915: Resetting chip after gpu hang
oct. 06 12:21:39 localhost.localdomain kernel: [drm] RC6 on
oct. 06 12:21:43 localhost.localdomain kernel: ------------[ cut here ]------------
oct. 06 12:21:43 localhost.localdomain kernel: WARNING: CPU: 0 PID: 1109 at drivers/gpu/drm/i915/intel_display.c:13533 intel_atomic_commit+0x13b8/0x1470 [i915]
oct. 06 12:21:43 localhost.localdomain kernel: pipe A vblank wait timed out
oct. 06 12:21:43 localhost.localdomain kernel: Modules linked in: tun nfnetlink_queue nfnetlink_log uas usb_storage xt_nat veth rfcomm ccm ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_addrtype br_netfilter ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack dm_thin_pool dm_persistent_data dm_bio_prison loop ip_set nfnetlink ebtable_nat ebtable_broute bridge ip6table_raw ip6table_mangle ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_security iptable_raw iptable_mangle iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_security ebtable_filter ebtables ip6table_filter ip6_tables vmnet(O) ppdev parport_pc parport vboxpci(O) vboxnetadp(O) vboxnetflt(O) fuse vmw_vsock_vmci_transport vsock vmw_vmci vmmon(O) vboxdrv(O) cmac bnep cpufreq_stats vfat fat arc4 iTCO_wdt snd_soc_skl iTCO_vendor_support
oct. 06 12:21:43 localhost.localdomain kernel:  snd_soc_skl_ipc snd_hda_codec_hdmi snd_soc_sst_ipc intel_rapl snd_soc_sst_dsp x86_pkg_temp_thermal snd_hda_codec_realtek snd_hda_ext_core intel_powerclamp snd_hda_codec_generic coretemp snd_soc_sst_match kvm_intel snd_soc_core kvm snd_compress snd_pcm_dmaengine ac97_bus snd_hda_intel snd_hda_codec iwlmvm snd_hda_core mac80211 irqbypass intel_cstate intel_rapl_perf snd_hwdep snd_seq snd_seq_device btusb snd_pcm btrtl uvcvideo btbcm btintel videobuf2_vmalloc videobuf2_memops joydev bluetooth videobuf2_v4l2 iwlwifi i2c_i801 snd_timer videobuf2_core cfg80211 rtsx_pci_ms videodev memstick media mei_me mei shpchp thinkpad_acpi intel_pch_thermal snd soundcore rfkill wmi tpm_tis tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc xfs libcrc32c dm_crypt hid_logitech_hidpp hid_logitech_dj 8021q garp
oct. 06 12:21:43 localhost.localdomain kernel:  stp llc mrp i915 rtsx_pci_sdmmc mmc_core crct10dif_pclmul crc32_pclmul crc32c_intel e1000e i2c_algo_bit drm_kms_helper ghash_clmulni_intel drm serio_raw ptp pps_core rtsx_pci video fjes
oct. 06 12:21:43 localhost.localdomain kernel: CPU: 0 PID: 1109 Comm: systemd-logind Tainted: G     U  W  O    4.7.5-200.fc24.x86_64 #1
oct. 06 12:21:43 localhost.localdomain kernel: Hardware name: LENOVO 20FNCTO1WW/20FNCTO1WW, BIOS R06ET42W (1.16 ) 09/20/2016
oct. 06 12:21:43 localhost.localdomain kernel:  0000000000000286 0000000018e0c148 ffff8800d283b850 ffffffffb63daaaf
oct. 06 12:21:43 localhost.localdomain kernel:  ffff8800d283b8a0 0000000000000000 ffff8800d283b890 ffffffffb60a0b0b
oct. 06 12:21:43 localhost.localdomain kernel:  000034dd00000000 ffff88040f607000 0000000000000000 0000000000000000
oct. 06 12:21:43 localhost.localdomain kernel: Call Trace:
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb63daaaf&gt;] dump_stack+0x63/0x84
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb60a0b0b&gt;] __warn+0xcb/0xf0
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb60a0b8f&gt;] warn_slowpath_fmt+0x5f/0x80
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb60e4483&gt;] ? finish_wait+0x53/0x70
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffc05046a8&gt;] intel_atomic_commit+0x13b8/0x1470 [i915]
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb60e46e0&gt;] ? prepare_to_wait_event+0xf0/0xf0
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffc0380ba7&gt;] drm_atomic_commit+0x37/0x60 [drm]
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffc03e21e8&gt;] restore_fbdev_mode+0x238/0x260 [drm_kms_helper]
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffc03e45d4&gt;] drm_fb_helper_restore_fbdev_mode_unlocked+0x34/0x80 [drm_kms_helper]
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffc03e464d&gt;] drm_fb_helper_set_par+0x2d/0x50 [drm_kms_helper]
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffc051ea4a&gt;] intel_fbdev_set_par+0x1a/0x60 [i915]
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb645a6b6&gt;] fb_set_var+0x236/0x460
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb60e4004&gt;] ? __wake_up+0x44/0x50
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb67ea562&gt;] ? down_write+0x12/0x40
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb64caabb&gt;] ? tty_unthrottle+0x3b/0x60
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb645074f&gt;] fbcon_blank+0x30f/0x350
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb64db0b2&gt;] do_unblank_screen+0xd2/0x1a0
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb64d0ef6&gt;] vt_ioctl+0x4f6/0x1270
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb64c537a&gt;] tty_ioctl+0x35a/0xc50
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb625f909&gt;] ? dput+0xd9/0x260
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb625b4b2&gt;] do_vfs_ioctl+0xa2/0x5d0
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb60be9b8&gt;] ? task_work_run+0x88/0xb0
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb625ba59&gt;] SyS_ioctl+0x79/0x90
oct. 06 12:21:43 localhost.localdomain kernel:  [&lt;ffffffffb67ec572&gt;] entry_SYSCALL_64_fastpath+0x1a/0xa4
oct. 06 12:21:43 localhost.localdomain kernel: ---[ end trace 9f62268cfd97b6cb ]---</pre>
<p>As seen above, it would always happen after a while and when the graphic chip goes to the RC6 power saving mode.</p>
<p>After searching on different forum and wikis, I applied the proposed solution of completly disabling the RC6 mode. Add the part in <span style="color: #ff0000;">red</span> to the kernel options in your grub configuration file:</p>
<pre>%  cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.luks.uuid=luks-a9d14a0e-6c22-4976-919a-d216bd69d563 rd.lvm.lv=fedora/swap resume=/dev/dm-2 quiet splash <span style="color: #ff0000;"><strong>i915.enable_rc6=0</strong></span>"
GRUB_DISABLE_RECOVERY="true"</pre>
<p>Then, just rebuild grub and reboot. If you are on a UEFI system (as root):</p>
<pre class="prettyprint"><code><span class="pln">grub2</span><span class="pun">-</span><span class="pln">mkconfig </span><span class="pun">-</span><span class="pln">o </span><span class="pun">/</span><span class="pln">boot</span><span class="pun">/</span><span class="pln">efi</span><span class="pun">/</span><span class="pln">EFI</span><span class="pun">/</span><span class="pln">fedora</span><span class="pun">/</span><span class="pln">grub</span><span class="pun">.</span><span class="pln">cfg</span></code></pre>
<p><span style="text-decoration: underline;">Or</span>, for legacy BIOS:</p>
<pre class="prettyprint"><code><span class="com">grub2-mkconfig -o /boot/grub2/grub.cfg</span></code></pre>
<p>Finally reboot and you are done.</p>
<p>There is a caveat however, as it will probably cause some battery drain. With <em>Powertop</em>, I measured a consumption increase of around 6 W (8 to 13W), which caused my battery life to drop from approximately 10h to 5h30.</p>
<p>Still enough and a acceptable price to pay to work reliably without risking a complete system hang.</p>
<p>But, if I had to buy a computer personally, I would make sure that it has an nvidia card. Yeah, I know that there proprietary blob has its caveats too, but from what I heard it is probably more stable.</p>
<p>Graphic drivers have always been a problem for &#8220;Linux on the desktop&#8221;.</p>
<h2>References</h2>
<ul>
<li>https://wiki.archlinux.org/index.php/intel_graphics</li>
<li>https://wiki.gentoo.org/wiki/Intel</li>
</ul>
]]></content:encoded>
			</item>
		<item>
		<title>Lessons learned with Docker, Nodejs apps and volumes</title>
		<link>/2016/05/06/the-quest-for-a-secure-nodejs-app-docker-container.html</link>
		<pubDate>Fri, 06 May 2016 17:05:01 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Defense]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Dockerfile]]></category>
		<category><![CDATA[Etherpad]]></category>
		<category><![CDATA[Nodejs]]></category>

		<guid isPermaLink="false">http://phocean.net/?p=2099</guid>
		<guid isPermaLink="false">http://phocean.net/?p=2099</guid>
		<description><![CDATA[Context I have kept playing with Docker recently, just for fun and to learn. It is very powerful, but still young. It quickly shows some limit when it comes to security or persistence. There are some workarounds, yet more or less complex, more or less hacky. Indeed, I had some issues with Etherpad, which is...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2016/05/06/the-quest-for-a-secure-nodejs-app-docker-container.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<h2>Context</h2>
<p>I have kept playing with Docker recently, just for fun and to learn.</p>
<p>It is very powerful, but still young. It quickly shows some limit when it comes to security or persistence. There are some workarounds, yet more or less complex, more or less hacky.</p>
<p>Indeed, I had some issues with Etherpad, which is a Nodejs application, and its integration into Docker.</p>
<p>Initially, I made something quite simple, so my Dockerfile ended like that:</p>
<pre>USER etherpad
CMD ["node","/opt/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js"]</pre>
<p>Thus, I simply start the app with a low privileges user.</p>
<p>It worked, but I had two issues:</p>
<ol>
<li>Docker was not able to stop it nicely. Instead, it timed out after 10 sec and finally killed the app and the container altogether.</li>
<li>No persistence of any kind, of course.</li>
</ol>
<p>I decided to tackle these two issues to understand what was going on behind.</p>
<h2>The PID 1 issue</h2>
<p>I could not understand immediately the first issue: why was Docker unable to terminate the container properly?</p>
<p>After wandering a few hours on wrong paths (trying to get through with Nodejs nodemon or supervisor), I finally found some good articles, explaining that Docker misses an init system to catch signals, wich causes some issues with applications started with a PID = 1, which cannot be killed, or with Bash (the shell doesn&#8217;t handle transmitted signals.</p>
<p>I am not going to repeat poorly what has already been explained very well, so I encourage you to read this two excellent posts:</p>
<ul>
<li><a href="https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/">The PID 1 zombie reaping problem</a></li>
<li><a href="https://medium.com/@gchudnov/trapping-signals-in-docker-containers-7a57fdda7d86#.wqy8msjbk">Trapping signals in Docker containers</a></li>
</ul>
<p>You will also find a lot of bug reports in the Docker github about this issue, and a lot of hacky or overkilling solutions.</p>
<p>In my opinion, the most elegant solution among them is to use a launcher program, very simple and dedicated to catch and handle signal.</p>
<p>I chose to use <a href="https://github.com/yelp/dumb-init">Dumb-init</a>, as it is well packaged (there are plenty of options) and seems to be well maintained.</p>
<p>So, after installing Dump-init in the Dockerfile, the CMD line should now look like this:</p>
<pre>USER etherpad
CMD ["dumb-init","node","/opt/etherpad-lite/node_modules/ep_etherpad-lite/node/server.js"]</pre>
<p>And indeed, as expected, <em>docker stop</em> now works flawlessly.</p>
<h2>Volume permissions</h2>
<p>This is where I had the toughest issue, although it is supposed to be straightforward with volumes.</p>
<p>Volumes enable to share files or folders between host and containers, or between containers solely. There are plenty of possibilities, nicely illustrated on this blog:</p>
<ul>
<li><a href="https://kvaes.wordpress.com/2016/02/11/docker-storage-patterns-for-persistence/">Docker: storage patterns for persistence</a></li>
</ul>
<p>And it works very well&#8230;. as long as you application runs as root.</p>
<p>In my case, for instance, Etherpad runs with a low privileged user, which is highly recommended. At startup, it creates a sqlite database, etherpad.db,  in its ./var folder.</p>
<p>Mounting a volume, of any kind, over the ./var folder, would result in a folder with root only permissions. Subsequently, of course, the launch of Etherpad from the CMD command would fail miserably.</p>
<p>Simple solutions like <em>chown</em> in the Dockerfile don&#8217;t work, because they apply <em>before</em> the mount. The <em>mount</em> occurs at runtime and works like a standard Linux <em>mount:</em> it is created by the docker daemon, with <em>root</em> permissions, over possibly existing data.</p>
<p>My solution was to completely change the way Etherpad is started. I now use an external script which is started at runtime:</p>
<ol>
<li>First, it applies the appropriate permissions to the mounted volume with <em>chown,</em></li>
<li>Then, it starts Etherpad with a low privileged user thanks to a <em>su</em> hack.</li>
</ol>
<p>So now the Dockerfile ends with:</p>
<pre>VOLUME /opt/etherpad-lite/var
ADD run-docker.sh ./bin/
CMD ["./bin/run-docker.sh"]</pre>
<p>And here is the script:</p>
<pre>#!/bin/bash

chown -R etherpad:etherpad /opt/etherpad-lite/var
su etherpad -s /bin/bash -c  "dumb-init node /opt/etherpad-lite/node_modules/ep_etherpad-lite/no
de/server.js"</pre>
<p>I use a data volume for persistency, so the run command looks like this:</p>
<pre>docker run -d --name etherpad -p 80:9001 -v etherpad:/opt/etherpad-lite/var -t debian-etherpad</pre>
<p>Far from being ideal, but it works. I really hope some features are coming to bring more options in this area, especially in the Dockerfile.</p>
<h2>Some final thoughts</h2>
<p>Globally, we can still hope a lot of improvements in security, because when I look at many Dockerfiles around, I see two behaviors:</p>
<ul>
<li>A lot of people don&#8217;t care and everything is happily running as root, from unauthenticated third-party images or binaries&#8230;</li>
<li>Some people do care but end up with dirty hacks, because there is no other way to do so.</li>
</ul>
<p>It is scary and so far from the Linux philosophy. Let&#8217;s wait for the enhancements to come.</p>
<p>You can find the complete <em>updated</em> Dockerfile on <a href="https://github.com/phocean/dockerfile-debian-etherpad/blob/master/Dockerfile">this github page</a>.</p>
<p>While we are on this topic, have a look to <a href="http://blog.labianchin.me/2016/02/15/docker-tips-and-tricks">this nice post with some nice tips and tricks</a> for Docker.</p>
]]></content:encoded>
			</item>
		<item>
		<title>A few (convenient) dockerfiles</title>
		<link>/2016/04/10/a-few-convenient-dockerfiles.html</link>
		<pubDate>Sun, 10 Apr 2016 17:22:40 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Privacy]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Etherpad]]></category>
		<category><![CDATA[Phishing Frenzy]]></category>
		<category><![CDATA[Tor]]></category>

		<guid isPermaLink="false">http://phocean.net/?p=2084</guid>
		<guid isPermaLink="false">http://phocean.net/?p=2084</guid>
		<description><![CDATA[I just put on my github a few dockerfiles for virtual machines that I frequently use to get some quick work done or to temporary share some data. Here they are: Debian-based Etherpad Debian-based Phishing Frenzy Debian-based Tor Browser I used to use VirtualBox guests, but maintaining them was a hassle (updates, snapshots, disk defragmation...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2016/04/10/a-few-convenient-dockerfiles.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I just put on my github a few dockerfiles for virtual machines that I frequently use to get some quick work done or to temporary share some data.</p>
<p>Here they are:</p>
<ul>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;"><a href="https://github.com/phocean/dockerfile-debian-etherpad">Debian-based Etherpad</a></li>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;"><a href="https://github.com/phocean/dockerfile-debian-phishingfrenzy">Debian-based Phishing Frenzy</a></li>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;"><a href="https://github.com/phocean/dockerfile-debian-torbrowser">Debian-based Tor Browser</a></li>
</ul>
<p>I used to use VirtualBox guests, but maintaining them was a hassle (updates, snapshots, disk defragmation and shrinking, etc.).</p>
<p>It makes perfect sense to use Docker just for that, and on top of that it consumes much fewer resources. Starting with the disk usage : all these containers along with their image stands below 1 GB!</p>
<p>The fact that I am using Btrfs as the underlying storage driver is not for nothing: compression is extremely efficient on images!</p>
<p>Note that my Dockerfiles have nothing special, you can actually find others on the Internet (and I was inspired by some).</p>
<p>There are a few differences, however:</p>
<ul>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;">I care much about security, so at least I try to make Web services not running as root, even if it is inside a container (the root user is still the same as on the host, so let&#8217;s make a compromise as unlikely as possible).</li>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;">I like simple things, so I tried to keep everything straightforward and simplified some stuff.</li>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;">I don&#8217;t like to waste disk space. So when I some Dockerfiles based on Ubuntu, Debian Wheezy, Debian Jessie, Fedora, etc., I try to unify all of them under Debian &#8220;stable&#8221; (so as of today, Jessie). Why bother with useless images? I chose a versatile and common server distribution and I am trying to stick with it.</li>
</ul>
<p>While I was playing, I had two things bothering me:</p>
<ul>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;"><a href="https://github.com/docker/docker/issues/3804">No quota support</a>: for a Samba sharing guest that I have, I would have liked to implement quotas from within the container. There is no support for that at the moment, and the global limitation by container is not nice (and once you choose a big size, you can&#8217;t go backward for existing containers&#8230;). I have a dedicated partition for Docker, so, while not perfect, it is okay for now.</li>
<li style="font-family: 'Open Sans,Helvetica,Arial,sans-serif'; color: #444444;">The devicemapper storage driver totally sucks at this time: <a href="https://github.com/docker/docker/issues/3182">free space is never reclaimed after you delete images or containers</a>! So the more you use Docker, the more your partition gets full.</li>
</ul>
]]></content:encoded>
			</item>
		<item>
		<title>A journey with Btrfs</title>
		<link>/2016/03/20/a-journey-with-btrfs.html</link>
		<comments>/2016/03/20/a-journey-with-btrfs.html#comments</comments>
		<pubDate>Sun, 20 Mar 2016 15:35:59 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[btrfs]]></category>
		<category><![CDATA[snapper]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://phocean.net/?p=2064</guid>
		<guid isPermaLink="false">http://phocean.net/?p=2064</guid>
		<description><![CDATA[Why BTRFS ? I have recently tested Btrfs as the file system for my /home partition (which was previously on ext4). I have been impressed by what this file system enables to do, but also came to the conclusion that it is not for me. As a quick reminder, the goal of this file system is...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2016/03/20/a-journey-with-btrfs.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<h1>Why BTRFS ?</h1>
<p>I have recently tested Btrfs as the file system for my /home partition (which was previously on ext4).</p>
<p>I have been impressed by what this file system enables to do, but also came to the conclusion that it is not for me.</p>
<p>As a quick reminder, the goal of this file system is to bring to Linux a fully featured file system similar to zfs. Some of these features promise a lot of awesomeness: snapshots, native RAID, automatic defragmentation and repairs, etc.</p>
<p>Wouldn&#8217;t it be cool to have such a file system for your data? Among them, snapshotting really is a killer feature. See it as a global git for all your data. You can track any file history, make a diff comparison on them and revert back to a chosen version, anytime and on-line.</p>
<p>Btrfs has been under development for a while and it is still undergoing. However, the first stable version has finally been released last year.</p>
<p>Many people warn that it is not production ready yet. It seems obvious for critical production systems, under heavy load or using the most advanced features (e.g. RAID). But what about a simple /home, mainly using snapshots (which have been around for a while)?</p>
<p>You will see that there are still some issues with virtualization.</p>
<p><strong><em>Disclaimer 1: this is in no way a review or a benchmark of Btrfs. Consider it simply as some feedback for my specific use case.</em></strong></p>
<h1>Getting ready</h1>
<p>This chapter is a summary of procedures found in various resources, along with my feedback.</p>
<p><em><strong>Disclaimer 2: First of all, make several backup of your entire /home. And make sure that it is operational and complete. Anyway, beware that there is obviously some inherent risk for your data in manipulating your home partition. So, do not come back to insult me if you lose any data.</strong></em></p>
<p>First, note that there is a conversion utility <em>btrfs-convert</em>, to convert an existing ext4 partition to btrfs. While this sounds cool, it did not work well with my partition, leading to many corrupted inodes.</p>
<p>So my advice is to just make a good backup of your home:</p>
<pre>% rsync -av /home /your/backup/</pre>
<p>Then, log out and format the partition as root:</p>
<pre># mount | grep home
/dev/mapper/system-home on /home type ext4 (rw,noatime,data=ordered)
# umount /home
# mkfs.btrfs /dev/mapper/system-home</pre>
<p>Change the file system and its options in /etc/fstab. For example:</p>
<pre>/dev/system/home     /home     ext4     defaults,noatime     1 1</pre>
<p>should become (also note the change on the last digit):</p>
<pre>/dev/system/home   /home    btrfs  defaults,noatime,ssd,space_cache,compress=lzo    1 0</pre>
<p>Re-mount /home and you are done!</p>
<h1>Snapper</h1>
<p>The main purpose for me to test Btrfs was the snapshot feature, in the hope to keep a version history of each file and avoid accidental deletions and changes.</p>
<p>Of course, one could use the Btrfs commands and implement snapshots manually. But why reinventing the wheel?</p>
<p>The guys behind <a href="http://snapper.io/">snapper</a>  already made a service especially for that. It is basically a wrapper over Btrfs that will make automatic snapshots in the background, based on your frequency settings, and ease their handling.</p>
<p>Once installed, it can be enabled with the following command:</p>
<pre># snapper -c home create-config /home</pre>
<p>It has the effect of creating a configuration file, where you can adjust the number of snapshots you want to keep per day, week, month, etc. Of course, don&#8217;t keep too much data as it will waste free space, especially if you happen to move large amounts of data. Hourly and daily snapshots are OK, as they would be cleaned up quickly. But monthly or yearly snapshots would consume a lot of space and would be pretty useless for a /home.</p>
<p>Here is what I used, without consuming much more than 10 GB:</p>
<pre># subvolume to snapshot
SUBVOLUME="/home"

# filesystem type
FSTYPE="btrfs"

# users and groups allowed to work with config
ALLOW_USERS=""
ALLOW_GROUPS="

# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
# directory
SYNC_ACL="no"

# start comparing pre- and post-snapshot in background after creating
# post-snapshot
BACKGROUND_COMPARISON="yes"

# run daily number cleanup
NUMBER_CLEANUP="yes"

# limit for number cleanup
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="10"
NUMBER_LIMIT_IMPORTANT="5"

# create hourly snapshots
TIMELINE_CREATE="yes"

# cleanup hourly snapshots after some time
TIMELINE_CLEANUP="yes"

# limits for timeline cleanup
TIMELINE_MIN_AGE="1800"
<strong>TIMELINE_LIMIT_HOURLY="10"</strong>
<strong>TIMELINE_LIMIT_DAILY="7"</strong>
<strong>TIMELINE_LIMIT_WEEKLY="2"</strong>
TIMELINE_LIMIT_MONTHLY="0"
TIMELINE_LIMIT_YEARLY="0"

# cleanup empty pre-post-pairs
EMPTY_PRE_POST_CLEANUP="yes"

# limits for empty pre-post-pair cleanup
EMPTY_PRE_POST_MIN_AGE="1800"</pre>
<p>Now, let&#8217;s play a little. In the following sequence, we create a file containing &#8220;Hello World!&#8221;, we then create a manual snapshot, change the file and display the differences:</p>
<pre># vim test.txt
# snapper -c home create --description "before test"
# vim test.txt
# sudo snapper -c home list
Type   | # | Pre # | Date                     | User | Cleanup  | Description  | Userdata
-------+---+-------+--------------------------+------+----------+--------------+---------
single | 0 |       |                          | root |          | current      | 
single | 1 |       | Sun Mar 13 19:44:21 2016 | root |          | before test  | 
single | 2 |       | Sun Mar 13 19:45:12 2016 | root |          | created test | 
single | 3 |       | Sun Mar 13 19:52:39 2016 | root |          | update test  | 
single | 4 |       | Sun Mar 13 20:00:01 2016 | root | timeline | timeline     | 
single | 5 |       | Sun Mar 13 21:00:01 2016 | root | timeline | timeline     | 
single | 6 |       | Sun Mar 13 22:00:01 2016 | root | timeline | timeline     | 
# snapper -c home status 1..0
--- "/home/.snapshots/2/snapshot/phocean/test.txt" 2016-03-13 19:44:53.370641373 +0100
+++ "/home/phocean/test.txt" 2016-03-13 19:45:27.226586459 +0100
@@ -1 +1,2 @@
Hell World!
+Good bye.
@@ -0,0 +1,2 @@
+Hell World!
+Good bye</pre>
<p>Neat, isn&#8217;t it? Now, what if we decide to restore the file to this snapshot:</p>
<pre>snapper -c home undochange 1..0 /home/phocean/test.txt</pre>
<p>That&#8217;s it!</p>
<p>Note that all these operations can be done against the entire partition (no argument needed), a folder or a file.</p>
<h1>Pros</h1>
<p>Regarding regular files, I had no issue at all. After a week of intensive use, I already the occasion to enjoy the benefits of having snapshots and being able to restore a file.</p>
<p>On the performance side, even though I haven&#8217;t done any benchmark, it is a least as fast as ext4. It is said that under some conditions, compression can be a big read rate boost.</p>
<p>On the compression side, on my partition of 400 GB, it allowed me to reclaim around 20 GB of space. Of course, the gain you can expect is totally related to the sorts of files you have (you won&#8217;t gain much on files that are already compressed or encrypted).</p>
<h1>Cons</h1>
<p>As warned on the official wiki itself, you should not use Btrfs as-is with database or virtualization solutions.</p>
<p>Dixit the official wiki:</p>
<blockquote><p>Files with a lot of random writes can become heavily fragmented (10000+ extents) causing trashing on HDDs and excessive multi-second spikes of CPU load on systems with an SSD or large amount a RAM.</p></blockquote>
<p>Indeed, I quickly experienced some issues with Virtualbox. Under heavy I/O operations, and having several machines running at a time, I had the guest file systems corrupted more than once. And so badly that the guest machine was unrecoverable (even with snapshots). Sometimes I got plenty of ext4 errors, or sometimes it just froze, while copying a bunch of file or doing an <em>apt-get upgrade.</em>..</p>
<p>The <a href="https://wiki.archlinux.org/index.php/Btrfs#Copy-On-Write_.28CoW.29">workarounds</a> did not make it for me:</p>
<ol>
<li>I even did not test disabling CoW for the whole partition. It kills one of the main advantages of using Btrfs.</li>
<li>I tried disabling CoW for all the VM folder. While the corruption frequency decreased, it still occurred after a while.</li>
</ol>
<p>So, I would simply adivse of not putting any virtual machine on the Btrfs partitions, until this thing definitely get sorted. I use virtual machines intensively at work and need them to be reliable.</p>
<h1>Conclusion</h1>
<p>Btrfs is awesome and pretty stable at this time, unless you need to host virtual machines. You could still have a dedicate ext4 partition for you VMs, and enjoy Btrfs for the rest of your home.</p>
<p>To be honest, I did not bother (not wanting to manage several partitions), and switched back to ext4 for all, in the expectation of better days. I am not sure if this should be addressed on the Btrfs, or the Virtualbox side (or both).</p>
<h1>References</h1>
<ul>
<li><a href="https://en.opensuse.org/openSUSE:Snapper_FAQ">Snapper FAQ</a></li>
<li><a href="https://fr.opensuse.org/openSUSE:Snapper_Tutorial">Snapper tutorial</a></li>
<li><a href="https://wiki.archlinux.org/index.php/Btrfs">Arch Linux Btrfs wiki</a></li>
<li><a href="https://wiki.gentoo.org/wiki/Btrfs">Gentoo Btrfs wiki</a></li>
<li><a href="http://www.nrtm.org/index.php/2012/03/13/the-joys-of-btrfs-and-opensuse-or-no-space-left-on-device/">The joys of btrfs and opensuse or no space left on device</a></li>
<li><a href="https://wiki.archlinux.org/index.php/Btrfs#Copy-On-Write_.28CoW.29">CoW workarounds</a></li>
<li><a href="https://btrfs.wiki.kernel.org/index.php/Gotchas">Btrfs wiki: gotchas</a> (virtual machines and databases)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>/2016/03/20/a-journey-with-btrfs.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Password stealing using a password filter</title>
		<link>/2013/10/02/password-stealing-using-a-password-filter.html</link>
		<comments>/2013/10/02/password-stealing-using-a-password-filter.html#comments</comments>
		<pubDate>Wed, 02 Oct 2013 09:12:31 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[IDA Pro]]></category>
		<category><![CDATA[lsass]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[Sysinternals]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=1736</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=1736</guid>
		<description><![CDATA[Nice stuff from @mubix: the technic consists in injecting a DLL to lsass.exe, using the password filter feature of Windows. The password filter architecture is useful to check that a password is compliant with the system security policy. It will typically check that when a user changes his password, it follows the required complexity. Microsoft...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2013/10/02/password-stealing-using-a-password-filter.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><a href="http://carnal0wnage.attackresearch.com/2013/09/stealing-passwords-every-time-they.html">Nice stuff</a> from <a href="https://twitter.com/mubix">@mubix</a>: the technic consists in injecting a DLL to <code>lsass.exe</code>, using the <em>password filter</em> feature of Windows.</p>
<p>The password filter architecture is useful to check that a password is compliant with the system security policy. It will typically check that when a user changes his password, it follows the required complexity.</p>
<p>Microsoft opened the API so that users can extend the functionality with their own filters.</p>
<p>Mubix diverted this API by developing a password logger: the DLL just logs the password both on the disk and a remote server,  and does nothing else.</p>
<p>A perfect way to maintain a persistent access… I tested it:</p>
<div id="attachment_1738" style="width: 635px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2013/10/CapturFiles_14.png" rel="lightbox[1736]"><img class="size-large wp-image-1738" alt="Evilpassfilter exploitation process" src="/wp-content/uploads/2013/10/CapturFiles_14-940x587.png" width="625" height="390" srcset="/wp-content/uploads/2013/10/CapturFiles_14-940x587.png 940w, /wp-content/uploads/2013/10/CapturFiles_14-580x362.png 580w, /wp-content/uploads/2013/10/CapturFiles_14-624x389.png 624w" sizes="(max-width: 625px) 100vw, 625px" /></a><p class="wp-caption-text">Evilpassfilter exploitation process</p></div>
<ol>
<li><code>Evilpassfilter.dll</code> is loaded into <code>lsass.exe</code></li>
<li>A user updates his password</li>
<li>The password goes through the <em>Evilpassfilter </em>password filter, which notifies the attacker through HTTP and also logs it locally.</li>
</ol>
<p>Here is what I did to get it work (Windows 7 x64):</p>
<ul>
<li>Make sure the local password security policy is enabled on the target</li>
<li>Create a new Win32 project in Visual Studio (2012)</li>
<li>Eventually delete unnecessary files, to start with an empty project (<code>stadfx.h</code> and cie)</li>
<li>Import the <a title="Evilpassfilter" href="https://gist.github.com/mubix/6514311#file-evilpassfilter-cpp">source code</a></li>
<li>Create a <code>Evilpassfilter.def</code> file, which defines the exports:
<pre>LIBRARY Evilpassfilter
EXPORTS
   InitializeChangeNotify
   PasswordFilter
   PasswordChangeNotify</pre>
</li>
<li>In the project properties, make sure to select the appropriate architecture, matching with the one of your target.
<p><div id="attachment_1745" style="width: 590px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2013/10/CapturFiles_18.png" rel="lightbox[1736]"><img class="size-medium wp-image-1745" alt="Selecting the compilation target architecture (win32/x64)" src="/wp-content/uploads/2013/10/CapturFiles_18-580x133.png" width="580" height="133" srcset="/wp-content/uploads/2013/10/CapturFiles_18-580x133.png 580w, /wp-content/uploads/2013/10/CapturFiles_18-624x143.png 624w, /wp-content/uploads/2013/10/CapturFiles_18.png 725w" sizes="(max-width: 580px) 100vw, 580px" /></a><p class="wp-caption-text">Selecting the compilation target architecture (win32/x64)</p></div></li>
<li>In the input settings of the link editor, add wininet.lib as additional dependancy.</li>
<li>Also add <code>Evilpassfilter.def</code> as module definition file.
<p><div id="attachment_1743" style="width: 590px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2013/10/CapturFiles_16.png" rel="lightbox[1736]"><img class="size-medium wp-image-1743" alt="Evilpassfilter Visual Studio settings" src="/wp-content/uploads/2013/10/CapturFiles_16-580x413.png" width="580" height="413" srcset="/wp-content/uploads/2013/10/CapturFiles_16-580x413.png 580w, /wp-content/uploads/2013/10/CapturFiles_16-624x444.png 624w, /wp-content/uploads/2013/10/CapturFiles_16.png 859w" sizes="(max-width: 580px) 100vw, 580px" /></a><p class="wp-caption-text">Evilpassfilter Visual Studio settings</p></div></li>
<li>In the source code, fix line 72: <code>return;</code> &#8211;&gt; <code>return 1;</code></li>
<li>Now you should be able to compile the library. You may want to make sure that the DLL is valid and integrated the exports (open it with IDA or a PE tool):
<p><div id="attachment_1741" style="width: 913px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2013/10/CapturFiles_19.png" rel="lightbox[1736]"><img class="size-full wp-image-1741" alt="Evilpassfilter.dll exports seen in IDA" src="/wp-content/uploads/2013/10/CapturFiles_19.png" width="903" height="226" srcset="/wp-content/uploads/2013/10/CapturFiles_19.png 903w, /wp-content/uploads/2013/10/CapturFiles_19-580x145.png 580w, /wp-content/uploads/2013/10/CapturFiles_19-624x156.png 624w" sizes="(max-width: 903px) 100vw, 903px" /></a><p class="wp-caption-text">Evilpassfilter.dll exports seen in IDA</p></div></li>
<li>Copy the resulting DLL to the <code>system32</code> folder.</li>
<li>Open regedit <code>HKLM\System\CurrentControlSet\Control\Lsa</code><br />
and add <code>Evilpassfilter</code> to the <code>Notification Packages</code></li>
</ul>
<p>Reboot and… now you should know what to do next :-)</p>
]]></content:encoded>
			<wfw:commentRss>/2013/10/02/password-stealing-using-a-password-filter.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>My goodness, I got mainframed!</title>
		<link>/2013/05/28/my-goodness-i-got-mainframed.html</link>
		<comments>/2013/05/28/my-goodness-i-got-mainframed.html#comments</comments>
		<pubDate>Tue, 28 May 2013 12:20:17 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[hercules390]]></category>
		<category><![CDATA[ISPF]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[mainframe]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[pentest]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[tn3270]]></category>
		<category><![CDATA[TSO]]></category>
		<category><![CDATA[tun]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[z/os]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=1587</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=1587</guid>
		<description><![CDATA[Mainframes are not dead, why not pentesting it? I just watched the presentation of Phil Young at Shmoocon 2013: &#8220;Mainframed: the secrets inside that black box&#8220;. I truly loved it. I thought mainframes where disappearing, but I was surprised to see that it still alive. I was even more surprised to find out that they...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2013/05/28/my-goodness-i-got-mainframed.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>Mainframes are not dead, why not pentesting it?</p>
<p>I just watched the presentation of <strong>Phil Young</strong> at <a href="https://www.shmoocon.org/shmoocon_2013" target="_blank">Shmoocon 2013</a>: &#8220;<a href="https://www.shmoocon.org/2013/videos/Shmoocon%202013%20-%20Mainframed%20The%20Secrets%20Inside%20that%20Black%20Box.mp4" target="_blank">Mainframed: the secrets inside that black box</a>&#8220;. I truly loved it. I thought mainframes where disappearing, but I was surprised to see that it still alive. I was even more surprised to find out that they have some Unix interface, and that there is a emulator for x86. Where it was less of a surprise is that their security is pretty low :-)</p>
<p>Anyway, don&#8217;t miss watching the video. <a href="http://mainframed767.tumblr.com" target="_blank">Phil&#8217;s blog, &#8220;Soldier of Fortran&#8221;</a>, is also a gold mine, he wrote many tips, tutos and tools.</p>
<p>It made me very curious and just in case I find some IBM Z/OS during a pentest, I though it would be nice to run it.</p>
<h1>Installing</h1>
<blockquote><p>Disclaimer:</p>
<p>Although some Z/OS files are available for download on the Internet, you must own a legal license of Z/OS. This tutorial is exclusively for education-purpose, use it only for testing, never in production nor for illegal activities.</p>
<p>Also, I am a noob in the area. So if some of you are skilled and find mistakes or improvements, please let me know in the comments. I give a great importance to your feedback and it encourages me to continue.</p></blockquote>
<p>I glued the pieces in the following steps (Mac OS oriented and tested only with it, the same should work for Linux with minor adjustments and see the reference otherwise):</p>
<ol class="split start">
<li>Download and install <a href="http://www.brown.edu/cis/tn3270/" target="_blank">tn3270</a> (Mac) or <a href="http://x3270.bgp.nu/download.html" target="_blank">x3270</a> (Windows, Linux, Mac): this will be the client terminal used to connect to the mainframe.</li>
<li>Download the emulator, <a href="http://www.hercules-390.eu" target="_blank">Hercules</a>. Install it, following the README instructions relevant to your system. Note that the instructions for Mac OS are outdated and won&#8217;t work. I followed Phil&#8217;s instructions:</li>
</ol>
<pre>git clone git://github.com/s390guy/hercules-390.git
cd hercules-390
sh autogen.sh
./configure
make
make install</pre>
<ol class="split">
<li>Take some IBM Z/OS release, and install it:</li>
</ol>
<pre>mv IBM\ ZOS\ 1.10/Z110SA/images/Z110\ -\ Copy /YOUR/PATH/HERE/Z110
cd /YOUR/PATH/HERE/Z110
mkdir PRTR
cd CONF
cp ADCD_LINUX.CONF ADCD_MAC.CONF
sed -i '' 's/\/home\/ehrocha\/hercules\/images/\/YOUR\/PATH\/HERE/g' ADCD_MAC.CONF
sed -i '' 's/CNSLPORT \{2\}23/CNSLPORT  3270/g' ADCD_MAC.CONF
sed -i '' 's/0E20.2   LCS  10.0.1.20/0E20.2 3088 CTCI \/dev\/tun0 1500 10.10.10.11 10.10.10.12 255.255.255.255/g' ADCD_MAC.CONF</pre>
<ol class="split">
<li>Getting the network to work on Mac OS require some extra steps (skip it if your are using Linux).</li>
</ol>
<p><a href="http://sourceforge.net/projects/tuntaposx/files/tuntap/20111101/">Download tuntaposx</a>, uncompress and install the package. No reboot it necessary, you should now have plenty of tun* (and tap*) interfaces:</p>
<pre>$ ls /dev/tun*
/dev/tun0 /dev/tun10 /dev/tun12 /dev/tun14 /dev/tun2 /dev/tun4 /dev/tun6 /dev/tun8
/dev/tun1 /dev/tun11 /dev/tun13 /dev/tun15 /dev/tun3 /dev/tun5 /dev/tun7 /dev/tun9</pre>
<ol class="split">
<li>Okay, now we can start the emulator (we need to sudo to access to the tun0 interface, among other reasons):</li>
</ol>
<pre>sudo hercules -f ADCD_MAC.CONF</pre>
<p>First of all, checks that the network is fine:</p>
<pre># From Mac OS:
$ ifconfig tun0
tun0: flags=8851&lt;UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
 inet 10.10.10.12 --&gt; 10.10.10.11 netmask 0xff000000 
 open (pid 98687)

# From Hercules:
herc =====&gt; devlist
[...]
HHC02279I 0:0E20 3088 CTCI 10.10.10.11/10.10.10.12 (tun0) IO[0] open
HHC02279I 0:0E21 3088 CTCI 10.10.10.11/10.10.10.12 (tun0) IO[0] open</pre>
<p>Open <strong>tn3270</strong> and connect with default settings on localhost:</p>
<p><img class="size-full wp-image-1601 aligncenter" alt="tn3270 connection" src="/wp-content/uploads/2013/05/tn3270-connection.png" width="423" height="219" /></p>
<p>And then in the hercules terminal, enter <code>ipl a80</code></p>
<div id="attachment_1602" style="width: 590px" class="wp-caption aligncenter"><img class="size-medium wp-image-1602 " alt="boot zos" src="/wp-content/uploads/2013/05/boot-zos-580x474.png" width="580" height="474" srcset="/wp-content/uploads/2013/05/boot-zos-580x474.png 580w, /wp-content/uploads/2013/05/boot-zos-624x510.png 624w, /wp-content/uploads/2013/05/boot-zos.png 775w" sizes="(max-width: 580px) 100vw, 580px" /><p class="wp-caption-text">Hercules390 console: booting Z/OS</p></div>
<p><strong>It is very long to boot, don&#8217;t worry. You will actually have to use 2 terminals</strong>, so open the second one, which will show the logon screen (see screenshot below) after booting is done. It will be used for &#8220;userland&#8221; aka TSO commands.</p>
<p>The first terminal shall be kept open as the master console, which receive system logs and can be used for &#8220;system-level&#8221;* commands (e.g root level).</p>
<div id="attachment_1620" style="width: 590px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2013/05/logon-screen.png" rel="lightbox[1587]"><img class="size-medium wp-image-1620" alt="Z/OS &quot;Duza&quot; logon screen" src="/wp-content/uploads/2013/05/logon-screen-580x462.png" width="580" height="462" srcset="/wp-content/uploads/2013/05/logon-screen-580x462.png 580w, /wp-content/uploads/2013/05/logon-screen-624x498.png 624w, /wp-content/uploads/2013/05/logon-screen.png 684w" sizes="(max-width: 580px) 100vw, 580px" /></a><p class="wp-caption-text">Z/OS &#8220;Duza&#8221; logon screen</p></div>
<ol class="split">
<li>At the prompt, enter <code>TSO</code>, then <code>IBMUSER</code> as the login, and <code>SYS1</code> as the password. It will automatically launch the ISPF menu:</li>
</ol>
<div id="attachment_1619" style="width: 590px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2013/05/ispf.png" rel="lightbox[1587]"><img class="size-medium wp-image-1619" alt="ISPF menu" src="/wp-content/uploads/2013/05/ispf-580x462.png" width="580" height="462" srcset="/wp-content/uploads/2013/05/ispf-580x462.png 580w, /wp-content/uploads/2013/05/ispf-624x498.png 624w, /wp-content/uploads/2013/05/ispf.png 684w" sizes="(max-width: 580px) 100vw, 580px" /></a><p class="wp-caption-text">ISPF menu</p></div>
<ol class="split">
<li>Now, you are good to go ahead with Z/OS commands&#8230;</li>
</ol>
<p>This video demonstrates the boot process:</p>
<p><iframe src="http://player.vimeo.com/video/67114095" height="281" width="500" allowfullscreen="" frameborder="0"></iframe></p>
<p><a href="http://vimeo.com/67114095">Z/OS emulation with Hercules390</a> from <a href="http://vimeo.com/user12629826">phocean</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<ol class="split">
<li>Now, let&#8217;s get the network up.</li>
</ol>
<p><strong>Prepare Mac OS</strong>:</p>
<ul>
<li>Make sure that the Mac OS firewall is deactivated or/and that you configured pf to allow the <code>tun0</code> interface (another article coming soon on this topic).</li>
<li>Add a route to <code>tun0</code></li>
</ul>
<pre>sudo route add -net 10.10.10.0/24 -interface tun0</pre>
<ul>
<li><span style="line-height: 14px;">You may want to activate ip forwarding, to have the Z/OS reach other interfaces through the kernel:</span></li>
</ul>
<pre>sudo sysctl -w net.inet.ip.forwarding=1</pre>
<p>Now every thing is in place to allow the mainframe to reach the outside. Further routing considerations are outside the scope of this article.</p>
<p><strong>Prepare Z/OS</strong>:</p>
<ul>
<li>In TSO menu, choose 3 (utilities), 4 (Dslist)</li>
<li>Click on the line besides <code>Dsname Level</code> and type-in <code>ADCD</code> and then press <code>[Enter]</code>. ADCD is what is called a dataset.</li>
<li>In the Command column, on the left of <code>ADCD.Z110S.PROCLIB</code>, type in <code>e</code> (stands for edit, reproduce the same pattern when I say &#8220;edit&#8221; in the following steps)</li>
<li>Edit the TCPIP member, and make sure that the <code>//PROFILE</code> line looks like this:</li>
</ul>
<pre>//PROFILE DD DISP=SHR,DSN=ADCD.Z110S.TCPPARMS(DUZA)</pre>
<p>You could change the <code>DUZA</code> string, but you would have to make sure that the corresponding profile exists in <code>ADCD.Z110S.TCPPARMS</code> (see TODO section).</p>
<ul>
<li>Go back to <code>Dslist</code> page using end or exit as a command. This time, type <code>DUZA</code> as dataset.</li>
<li>Edit the <code>TCPARMS</code> member, then <code>PROFILE</code>. Once in the file, edit carefuly the following lines (at the bottom, around line 90):</li>
</ul>
<pre>000090 DEVICE CTCA1 CTC e20
000091 LINK CTC1 CTC 1 CTCA1
000092
000093 HOME
000094    10.10.10.11  CTC1
000095
000096 GATEWAY
000097    10.10.10.12  = CTC1 1492 HOST
000098
000099 DEFAULTNET 10.10.10.12 CTC1 1492 0
[...]
000109 START CTCA1</pre>
<ul>
<li>In the console window, restart the network stack:</li>
</ul>
<pre>stop tcpip
# wait for termination message
start tcpip</pre>
<ul>
<li>If every is going well, the tunnel should get up and you should be able to ping both side (use the ping command in Z/OS from the command menu).</li>
</ul>
<p>This video illustrates some of this networking stuff:</p>
<p><iframe src="http://player.vimeo.com/video/69912699" height="281" width="500" allowfullscreen="" frameborder="0"></iframe></p>
<p><a href="http://vimeo.com/69912699">Hercules390 and Z/OS, getting the network up</a> from <a href="http://vimeo.com/user12629826">phocean</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<h1>Useful commands</h1>
<ul>
<li>Ifconfig</li>
</ul>
<pre>netstat home</pre>
<ul>
<li>Shutdown</li>
</ul>
<pre># in "system" terminal:
S SHUTSYS
Z EOD

# then, once finished, in Hercules:
exit</pre>
<h1>Tips</h1>
<ul>
<li>I was stuck at an early moment during the boot process with:</li>
</ul>
<pre>IXC208I THE RESPONSE TO MESSAGE IXC420D IS INCORRECT: IS NOT A VALID 
ACTION 
 IXC420D REPLY I TO INITIALIZE SYSPLEX ADCDPL, OR R TO REINITIALIZE 
XCF.     
  REPLYING I WILL IMPACT OTHER ACTIVE SYSTEMS.</pre>
<p>You can go over it by entering this in your terminal session (tn3270):</p>
<pre>R 00, I</pre>
<ul>
<li><span style="line-height: 14px;">After the long process, I actually had to open a second connection with the terminal to get the logon screen. So, just check from time to time instead of waiting for nothing in front of the first window.</span></li>
<li>To logoff, type <code>X</code> from the ISPF main menu. The first time, you have to configure the printer. Choose <code>LOCAL</code> as print mode, and give it any name as <code>Local printer ID</code>. Then press <code>[Enter]</code>, and if you are asked for a <code>sysout class</code>, choose <code>"J"</code>. You should be back in TSO, where you can execute <code>logoff</code>. Next time, it will default to these values, so you should get straight from ISPF to TSO.</li>
<li>Don&#8217;t forget that TSO is a CLI where you can type Z/OS and Unix commands. You actually don&#8217;t need or have to use ISPF, so don&#8217;t hesitate to use it!</li>
</ul>
<p>Of course, a good source of information is the <a href="http://publib.boulder.ibm.com/infocenter/zos/basics/index.js">hercules390 forum</a> may also be of help.</p>
<p>Voilà, happy hacking! WTF, it seems I got mainframed too! Did you?</p>
<p>Big thanks again to Phil Young for catching our attention on this stuff.</p>
<h1>TODO</h1>
<ul>
<li><span style="line-height: 14px;">Understand and get rid off the DUZO profile: you probably noticed that we are using the DUZO  profile to load the network stack (which is after the name of the torrent, and does probably more stuff behind). For example, there is no DUZO profile in ADCD.Z110S.TCPPARMS, so I still have no idea how it actually gets loaded. It has been only 2 days that I work on Z/OS, so I still have to read the doc (and any help is welcome).</span></li>
<li>Change the logon screen (see references).</li>
</ul>
<h1>References</h1>
<ul>
<li><a href="http://mainframed767.tumblr.com/post/27787457789/hercules-3-08-on-mac-os-x-lion" target="_blank">Hercules 3.08 on Mac OS X Lion</a></li>
<li><a href="http://mainframed767.tumblr.com/post/40836059586/instructions-to-installing-z-os-in-hercules" target="_blank">Instructions to installing z/OS in Hercules</a></li>
<li><a href="http://pastebin.com/raw.php?i=PHiT8jmE" target="_blank">Installin&#8217; that sweet sweet big iron on your Linux laptop or server</a> (<a href="/wp-content/uploads/2013/05/install_zOS_in_Hercules.txt">local mirror</a>)</li>
<li><a href="http://kat.ph/ibm-z-os-emulation-files-t5780374.html" target="_blank">Z/OS files</a></li>
<li><a href="http://patata.homeip.net/blog/hercules-and-zos-tcp-ip-networking-for-adcd-versions" target="_blank">Hercules and Z/OS TCP/IP networking for ADCD versions</a></li>
<li><a href="http://mainframed.wordpress.com/2012/06/17/changing-the-logon-screen-on-the-mainframe-zos-vtam-in-adcd/" target="_blank">Changing the logon screen on the mainframe</a></li>
<li><a href="http://tuntaposx.sourceforge.net/">tuntaposx</a></li>
<li><a href="http://www.js">TSO tutorial</a></li>
<li><a href="http://answers.uchicago.edu/page.php?id=19482#GETTINGM" target="_blank">Mainframe &#8211; using TSO and ISPF</a></li>
<li><a href="http://publib.boulder.ibm.com/infocenter/zos/basics/index.js">IBM online documentation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>/2013/05/28/my-goodness-i-got-mainframed.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing Metasploit on Mac OS X [Mountain Lion]</title>
		<link>/2013/05/05/installing-metasploit-on-os-x-mountain-lion.html</link>
		<comments>/2013/05/05/installing-metasploit-on-os-x-mountain-lion.html#comments</comments>
		<pubDate>Sun, 05 May 2013 17:08:36 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Metasploit]]></category>
		<category><![CDATA[rbenv]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=1571</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=1571</guid>
		<description><![CDATA[It happened to me a little more complex than expected, so I thought it would deserve a post. There are a few good tutorials already, but they actually did not work flawlessly for me. So while this post is mostly based on them, there are some slight differences. Getting Metasploit First, let&#8217;s fetch Metasploit. Adjust...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2013/05/05/installing-metasploit-on-os-x-mountain-lion.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p><!--StartFragment-->It happened to me a little more complex than expected, so I thought it would deserve a post. There are a few <a href="http://www.darkoperator.com/installing-metasploit-in-ubunt/">good</a> <a href="http://briancanfixit.blogspot.fr/2011/12/setting-up-metasploit-and-armitage-on.html">tutorials</a> already, but they actually did not work flawlessly for me. So while this post is mostly based on them, there are some slight differences.</p>
<h1>Getting Metasploit</h1>
<p>First, let&#8217;s fetch Metasploit. Adjust the last two lines by replacing <code>.zshrc</code> (I am using Zsh) with <code>.bash_profile</code> if you are using Bash, for instance.</p>
<p>This will download, create symlinks and set the database settings path (we will come back on it later) in your environment:</p>
<pre>cd /usr/local/share/
git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework
for MSF in $(ls msf*); do ln -s /usr/local/share/metasploit-framework/$MSF /usr/local/bin/$MSF;done
ln -s /usr/local/share/metasploit-framework/armitage /usr/local/bin/armitage
echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml &gt;&gt; ~/.zshrc
source ~/.zshrc</pre>
<p>Metasploit is almost ready, but don&#8217;t run anything yet. There a still quite a few steps&#8230;</p>
<h1>Getting Postgres</h1>
<p>We use Homebrew:</p>
<pre>brew install postgresql --without-ossp-build</pre>
<p>Initialization stuff:</p>
<pre>initdb /usr/local/var/postgres</pre>
<p>To have launchd start postgresql at login:</p>
<pre>ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents</pre>
<p>But I prefer to keep my startup clean, so I added two aliases in my <code>.zshrc</code></p>
<pre>alias pg_start='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias pg_stop='pg_ctl stop'</pre>
<p>So you now have two commands, <code>pg_start</code> and <code>pg_stop</code>, to use for Metasploit.<br />
Finally, we create the msf user that will connect to the database from within Metasploit:</p>
<pre><code>createuser msf -P -h localhost  
createdb -O msf msf -h localhost </code></pre>
<p>While we are at the database stuff, let&#8217;s configure Metasploit to use it. Create a <code>database.yml</code> file in  <code>/usr/local/share/metasploit-framework/config/</code> and put these lines:</p>
<pre>production:
    adapter: postgresql
    database: msf
    username: msf
    password: &lt;password&gt;
    host: 127.0.0.1
    port: 5432
    pool: 75
    timeout: 5</pre>
<p>The database is ready!</p>
<h1>Getting Ruby</h1>
<p>The last big step is to install Ruby. The one provided by Mac Os is a little too old, and you don&#8217;t want to mess with system libraries, so let&#8217;s leave it untouched. You could install Ruby with Homebrew, but it happens that the latest version (2.0.0-p0) is not working with Metasploit (OpenSSL libraries conflicts). So we need to use something like the 1.9.3 version of Ruby.</p>
<p>Anyway, a good practice is to have some flexibility on the version you are going to use, so you would be able to switch between 1.9.3, 2.0.0 or whatever and that whenever you need.</p>
<p>Here comes <strong>rbenv</strong>. For the next steps, I will assume that you have a working homebrew setting.</p>
<p>Let&#8217;s go:</p>
<pre>brew install rbenv ruby-build</pre>
<p>Add this line to your .zshrc or bash_profile:</p>
<pre>eval "$(rbenv init -)"</pre>
<p>Now you should be able to list all installable versions of Ruby:</p>
<pre>rbenv install --list</pre>
<p>Let&#8217;s pick up 1.9.3:</p>
<pre>rbenv install 1.9.3-p392</pre>
<p>It takes a while, but after it is completed, you can set it as your default:</p>
<pre>rbenv rehash
rbenv global 1.9.3-p392</pre>
<p>Note that you could use the <code>local</code> command instead of <code>global</code> to set it for the current terminal only.</p>
<p>Let&#8217;s check that everything is correctly set. This is where the Ruby versions are stored:</p>
<pre>$ ls ~/.rbenv/versions/
1.9.3-p392 2.0.0-p0</pre>
<p><code>ruby</code> and <code>gem</code> MUST point to the 1.9.3 version:</p>
<pre>$ rbenv which ruby
$HOME/.rbenv/versions/1.9.3-p392/bin/ruby
$ rbenv which gem
$HOME/.rbenv/versions/1.9.3-p392/bin/gem</pre>
<p>Looks good, let&#8217;s go ahead.</p>
<p>We are now able to install up the required gems for Metasploit. They made it easy by packaging these in a Gemfile that can be read by the &#8220;bundle&#8221; utility:</p>
<pre>gem install bundle
cd /usr/local/share/metasploit-framework
rbenv rehash
bundle install</pre>
<h1>Final steps</h1>
<p>Create an <code>vncviewer</code> wrapper to facilitate use from within Metasploit:</p>
<pre>echo '#!/usr/bin/env bash'  &gt;&gt; /usr/local/bin/vncviewer   
echo open vnc://\$1 &gt;&gt; /usr/local/bin/vncviewer  
chmod +x /usr/local/bin/vncviewer</pre>
<p>Get and compile the pcaprub library (optional):</p>
<pre>cd /usr/local/share/metasploit-framework/external
git clone <a href="http://github.com/shadowbq/pcaprub.git">http://github.com/shadowbq/pcaprub.git</a>
cd ./ext/pcaprub
ruby extconf.rb &amp;&amp; make &amp;&amp; make install</pre>
<h1>Have fun!</h1>
<p>If you haven&#8217;t, don&#8217;t forget to start Postgres, and you are ready to play:</p>
<pre>sudo -E msfconsole</pre>
<p>It should deploy the database structure and then start to work without warning. Hurrah! That was not hard, but a bit long, wasn&#8217;t it?</p>
<p>In case it still fails for you, it means that something went wrong with the setup. Check the steps again, and then leave a comment as it may be the time for an update or a correction of this article.</p>
<h1>Credits</h1>
<p>As stated in the introduction, this article is mostly taken from <a href="http://www.darkoperator.com/installing-metasploit-in-ubunt/">darkoperator.com</a> with minor adjustments (it actually did not work out of the box for me), so the use of rbenv. I hope it will be helpful to other people in the same case as me.</p>
<p><em><strong>UPDATE 09/07/2013</strong>:</em></p>
<ul>
<li><em>change in pcaprub directory (./pcaprub &#8211;&gt; ./ext/pcaprub)</em></li>
</ul>
<p><em><strong>UPDATE 07/23/2013</strong>:</em></p>
<ul>
<li><em><span style="line-height: 1.714285714; font-size: 1rem;">add missing </span><span style="line-height: 1.714285714; font-size: 1rem;">rbenv rehash command (thanks @</span><span style="line-height: 1.714285714; font-size: 1rem;">amukofes)</span></em></li>
<li><em>add missing commands to retrieve pcaprub (thanks @Ton)</em></li>
<li><em>fix indentation in postgres config file</em></li>
</ul>
<p><!--EndFragment--></p>
]]></content:encoded>
			<wfw:commentRss>/2013/05/05/installing-metasploit-on-os-x-mountain-lion.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>CVE-2009-3555: Safari, fix reached Mountain Lion&#8230;</title>
		<link>/2012/08/13/cve-2009-3555-safari-fix-reached-mountain-lion.html</link>
		<pubDate>Mon, 13 Aug 2012 17:53:15 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[cve]]></category>
		<category><![CDATA[CVE-2009-3555]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=1348</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=1348</guid>
		<description><![CDATA[I haven&#8217;t investigated much (and I will not more), but since my upgrade to Mac OS 10.8 (Mountain Lion), Safari supports safe renegociation. Meanwhile, I had received a laconic answer from Apple to my bug report saying that they &#8220;are aware of this issue&#8221;. Note that Safari 6.0 on Lion did not (at least on my...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2012/08/13/cve-2009-3555-safari-fix-reached-mountain-lion.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>I haven&#8217;t investigated much (and I will not more), but since my upgrade to Mac OS 10.8 (Mountain Lion), Safari supports safe renegociation.</p>
<p>Meanwhile, I had received a laconic answer from Apple to my bug report saying that they &#8220;are aware of this issue&#8221;.</p>
<p>Note that Safari 6.0 on Lion <a href="/2012/06/10/cve-2009-3555-safari-not-yet-patched.html">did not</a> (at least on my computer, if someone could confirm)&#8230; so same browser version, different OS, the system SSL library must have been &#8211; silently &#8211; updated.</p>
<p>Anyway, good move finally.</p>
]]></content:encoded>
			</item>
		<item>
		<title>Rootkit in my lab? (Part III)</title>
		<link>/2012/07/22/rootkit-in-my-lab-part-iii.html</link>
		<comments>/2012/07/22/rootkit-in-my-lab-part-iii.html#comments</comments>
		<pubDate>Sun, 22 Jul 2012 07:48:06 +0000</pubDate>
		<dc:creator><![CDATA[phocean]]></dc:creator>
				<category><![CDATA[Forensic]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[Reversing]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Assembly]]></category>
		<category><![CDATA[BSOD]]></category>
		<category><![CDATA[crashdump]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Regshot]]></category>
		<category><![CDATA[Rootkit]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[WinDBG]]></category>

		<guid isPermaLink="false">http://www.phocean.net/?p=1317</guid>
		<guid isPermaLink="false">http://www.phocean.net/?p=1317</guid>
		<description><![CDATA[First, thanks for all the comments in the previous articles (Part I and Part II). I decided to analyze one the crash I experienced during registry analysis. I could reproduce all the time a BSOD with Regshot. I thought it would be nice to see what I could get with WinDBG. I had my environment set up...<br><i class="icon-right-hand"></i> <span class="read-more"><a href="/2012/07/22/rootkit-in-my-lab-part-iii.html">Continue Reading</a></span>]]></description>
				<content:encoded><![CDATA[<p>First, thanks for all the comments in the previous articles (<a title="Rootkit in my lab ? (part I)" href="/2012/06/30/rootkit-in-my-lab.html">Part I</a> and <a title="Rootkit in my lab ? (part II)" href="/2012/07/11/rootkit-in-my-lab-part-ii.html">Part II</a>).</p>
<p>I decided to analyze one the crash I experienced during registry analysis.<br />
I could reproduce all the time a BSOD with Regshot. I thought it would be nice to see what I could get with WinDBG.</p>
<p>I had my environment set up with the suspicious VM configured to debug activated on the serial port, which is a simple pipe on Mac OS X.<br />
Another VM is configured with a serial port as the other end of this pipe, and WinDBG attached to it.<br />
Another method would be to just configure Windows to create a crashdump file with kernel symbols, that you can later load into WinDBG. Of course, the first method offers more opportunities to check and play with the live system.</p>
<p>Then, I just boot the target and trigger the crash, simply by starting a scan with Regshot:</p>
<p style="text-align: center;"><iframe src="http://player.vimeo.com/video/46157626" frameborder="0" width="500" height="281"></iframe></p>
<p>Windows then crashes, WinDBG catches the exception and stops.</p>
<p>So what do we have ?</p>
<p>First, the error type, <em><strong>PAGE_FAULT_IN_NONPAGED_AREA (50)</strong></em>, means that an instruction pointed to an invalid memory address. Let&#8217;s check this.</p>
<p>With <em><strong>!analyse -v</strong></em>, you get the <a href="/wp-content/uploads/2012/07/regshot-BSOD.txt">full error dump</a>.</p>
<div id="attachment_1331" style="width: 727px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2012/07/WinXP-ReversingBox-2.png" rel="lightbox[1317]"><img class=" wp-image-1331 " title="Crashing Instruction" src="/wp-content/uploads/2012/07/WinXP-ReversingBox-2-1024x557.png" alt="" width="717" height="390" srcset="/wp-content/uploads/2012/07/WinXP-ReversingBox-2-1024x557.png 1024w, /wp-content/uploads/2012/07/WinXP-ReversingBox-2-300x163.png 300w, /wp-content/uploads/2012/07/WinXP-ReversingBox-2.png 1206w" sizes="(max-width: 717px) 100vw, 717px" /></a><p class="wp-caption-text">Crashing Instruction</p></div>
<p>It shows the function (nt!CmpGetValueKeyFromCache, offset 0x89) and the memory address where the crash was triggered.</p>
<p>The instruction at this address is:</p>
<pre>80637807 f3a5 rep movs dword ptr es:[edi],dword ptr [esi]</pre>
<p>This instruction is trying to copy 8 bytes at the address pointed by EDI.<br />
EDI has the value of <strong>0xe1285050</strong> at execution time.</p>
<p>And what do we have at this memory location ?</p>
<div id="attachment_1333" style="width: 727px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2012/07/WinXP-ReversingBox-3.png" rel="lightbox[1317]"><img class=" wp-image-1333 " title="EDI pointing to invalid memory section" src="/wp-content/uploads/2012/07/WinXP-ReversingBox-3-1024x671.png" alt="" width="717" height="470" srcset="/wp-content/uploads/2012/07/WinXP-ReversingBox-3-1024x671.png 1024w, /wp-content/uploads/2012/07/WinXP-ReversingBox-3-300x196.png 300w, /wp-content/uploads/2012/07/WinXP-ReversingBox-3.png 1394w" sizes="(max-width: 717px) 100vw, 717px" /></a><p class="wp-caption-text">EDI pointing to invalid memory section</p></div>
<p>Nothing indeed. Note that this corruption persists at every boot.</p>
<p>So what can we conclude?<br />
We can certainly exclude hardware failure, because it is a virtual machine and because the corruption always occur at the same memory region, even after a reboot.<br />
At least, I can now be sure that something in the kernel is definitely corrupted.</p>
<p>Could it be a rootkit trick? Still the question remains, but to me it now looks very, very suspicious. Some rootkit code, poorly written, could have sat in this non-paged memory area and been paged out, causing the BSOD. I have not much knowledge about it at this time but I am going to search on this. At least, I now have good starting point to look at.</p>
<p>That&#8217;s all for today, folks. I wrote it while I am still working on it, so sorry if it looks rough and incomplete. It is sort of live, thoughts are still in process.</p>
<p>Again, I am looking forward to reading your comments and suggestions. (Hopefully) there will be a part IV!</p>
]]></content:encoded>
			<wfw:commentRss>/2012/07/22/rootkit-in-my-lab-part-iii.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
