New mac osx vulnerabilities

A new patch , the Security Update 2018-003, has recently been released on 1st june, which would fix some vulnerabilities afflicting Mac OS X High Sierra, Sierra, El Capitan.
Such vulnerabilities would allow, for example, a local attacker to gain elevated privileges on the system ,another one could allow a local user to bypass security restrictions.
There was also mentioned about of a non-specified validation defect in the kernel that an authenticated user could exploit to perform Ddos attacks.

You can refer to Apple security document HT208849

Posted in Mac Os, Tech news - tutorials | Leave a comment

How long ago your Linux system has been installed?

Do you need to know when your Linux was installed?
here you have one way
i used tune2fs on Arch linux
basically command is”
sudo tune2fs -l /dev/YOURPARTITION | grep ‘Filesystem created:’
This useful command checking file system data creation and consequently, operating system installation date (unless you are checking  an empty partition:-)
In my case, partition is /dev/sda6, where i have installed Arch linux almost one year ago

If you don’t remember your partition , you can execute sudo fdisk-l , partition is obviously “Linux filesystem”

Posted in Gnu-Linux | Leave a comment

Spectre – Meltdown checker (linux)

I have just tried on my not so new pc this interesting script: Specter-Meltdown-Checker , as specified also in instructions, it is not a bible, but surely it is something could give you very useful informations – this script give you the possibility to check your pc vulnerability to  Spectre (2 variants) and Meltdown.

Pc features:
Intel I5-3470 (ivy bridge) 3.20 GHz
Kernel: 4.14.13-1-ARCH
8 GB ram
Arch Linux
Nvidia Geforce Gt-630
full Hardware details are here , (i have used lshw command)

i downloaded  and extracted .zip file ,
then i applied execute permission to .sh file through chmod +x

Then i have executed the script (Is recommended to execute script being root)
after password insertion, the script can run:below results:

Spectre Variant 1 (CVE-2017-5753 bounds check bypass)
final result is
 

Spectre Variant 2 (CVE-2017-5715 branch target injection)
as you can see, script try to check if in my machine are some mitigations 

final result is
 
 

Meltdown (CVE-2017-5754 rogue data cache load)
In that case result was positive, thanks Kernel 🙂

 Just for curiosity i have also executed script without root permission (i know, have no sense but i wanted see differences) below you can see what happens:

Obviously script will warn you, then will start


Spectre (Variant 1)
only differences are B^B^B^checking LFENCE while outcome (UNKNOWN) and especially final result (VULNERABLE) are exactly the same you can see executing script as root

Spectre (Variant 2)
during mitigation 1 check there is a read permission error (predictable considering we don’t have root permission) on /dev/cpu/0/msr , so script can’t check cpu microcode

Rest of other checks (IBRS kernel support,kernel space,user space etc) were identical as reported above , included final result (VULNERABLE)

Meltdown
Identical result as reported above (NOT VULNERABLE)

Posted in Gnu-Linux, Tech news - tutorials | Leave a comment

How to install Debian 9 on Macbook 13″ (end 2009) – dual boot

Here how i installed Debian 9 stretch on my old macbook 6,1 (mid 2009)
NB: where you’ll see a # before command, means you should be root or need to use sudo.

Hardware:
Video card NVIDIA  GeForce 9400M with 256 MB of SDRAM shared with main memory
Screen size 13″
Wireless card Broadcom BCM4360
Disk 256 Gb Serial ATA (5400 RPM) hard drive
Ram 8 gb SODIMM 1600MHz
Wi-fi controller Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)
Ethernet controller NVIDIA Corporation MCP79 Ethernet (rev b1)
USB 2.0 ports (2x)
Audio in/out port NVIDIA Corporation MCP79 High Definition Audio (rev b1)
Mini DisplayPort that supports an external display at 2560×1600

Procedure :
1)From mac OS , using utility disk, i resized Osx partition freeing up space for Linux ( i did not format this empty space)
2) i ‘ve downloaded a debian image (i used netinst ) and put in a usb pen (i used unetbootin)
3) i have connected wired cable (wi-fi will not work at first time)
4) inserted usb pen, turned on mac holding down the Option key while booting
5) I have installed Debian – i formatted free space as ext4,  i choose Mate as display manager, because is light (Kde would have been unfeasible)- LightDM was selected automatically as login manager.
After reboot, MBR will be overwritten by Grub, so only Debian will start (for now)

Fix Reboot
Shutdown, suspend and hibernate all work out of the box. For reboots, a modification should be made.
# /nano/etc/default/grub
adding  “reboot=pci” in GRUB_CMDLINE_LINUX DEFAULT row
if e.g. you have
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
will become GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash reboot=pci
Now, on the terminal run sudo update-grub, shutdown macbook and power it on again.
Reboot should works at the end.

Refind Bootloader installation
Since i have Mac Osx in the other partition, i need to install Refind boot manager, that will allow to choose between Debian/Mac during system startup, therefore :
# apt-get install refind
After installation, at startup time you will have in addition to Mac, 2 (?) Debian icons, each of which respectivaly run initrd (initial ramdisk) and vmlinuz (kernel).
Leaving aside initrd/vmlinuz explanation, (is not the scope of this post) , important thing to know is that if we will boot using initrd we’ll use Grub, while if we will boot choosing kernel we’ll not use Grub
/boot/initrd.img-4.9.0.3-amd64 –> start with grub
/boot/vmlinuz-4.9.03-amd64 –> start without grub
Since as i described in Grub section, reboot works thanks to grub modification (reboot=pci); therefore clearly we need to start image that uses grub (unless you want to reboot the macbook by turning it off and then turning it back on with the button 🙂
Only option is to use initrd.img, so we have to modify refind configuration in order to hide vmlinux image in refind startup menu:
# nano /boot/efi/EFI/refind/refind.conf
and we add:
dont_scan_files vmlinuz-4.9.0-3-amd64
scan_all_linux_kernels false
Save and Exit.

Video drivers
i am not a nouveau lover:basically, in my opinion Nvidia drivers working better, so i don’t see any reason to not use them; furthermore, i needed to have possibility to work also with an external monitor and this is perfectly working using nvidia drivers
Therefore i installed nvidia-drivers (340) and  nvidia-settings (optional but strongly suggested)
# apt-get install nvidia-legacy-340xx-driver nvidia-settings-legacy-340xx
Nvidia-settings-legacy is a GUI with all settings, useful especially if you need to use an external monitor (but not only, as you can see later).
After reboot you will see nvidia logo before login-manager (obviously you can remove it).
NB i tried to install drivers with version > 340 but did’nt work out , so don’t waste your time:-)

Wi-fi
At first boot,Wi-fi will be not recognized
we have to install broadcom drivers
# apt-get install linux-image-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) linux-headers-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) broadcom-sta-dkms
let’s avoid that other wifi modules would be in conflict with my broadcoam
# modprobe -r b44 b43 b43legacy ssb brcmsmac bcma
now  we add our wl module
# modprobe wl
at reboot you should have your working Wi-fi.

Audio
Work out of the box, Nvidia audio card was recognizes, however checking alsamixer*configurations i noticed that pulseaudio was present as additional sound card, so i decided to remove it
# apt-get remove pulseaudio
After reboot , default card will be HDA Nvidia

Headphone as default are set to zero volume; with alsamixer you can active them (headphone section)
*i strongly suggest to install alsamixer and alsamixer-gui

Isight (webcam)
Work out of the box , i suggest to make a first check doing (being root) dmesg | grep iSight 

to see cam in action you can also install cheese, and guvcview to change settings.
# apt-get install cheese guvcview

Optional ( isight-firmware-tools)
this part is optional (if cam works, skip this part)
i installed isight-firmware-tool
I wanted to try isight-firmware tool extracting original firmware directly from Mac Osx partition : In order to avoid boring useless permission problems, instead to specify Mac Osx path in tool i prefered to copy in advance the file AppleUSBVideoSupport from Mac Osx partition to my Desktop , so path was /home/fafa/Scrivania/AppleUSBVideoSupport
Then i have execute command:
root@MacDebian:/home/fafa/Scrivania#
ift-extract -a /home/fafa/Scrivania/AppleUSBVideoSupport
As result:
** Message: Found firmware signature at offset 0x1998.
** Message: Firmware extracted successfully in /lib/firmware/isight.fw
………………………………………….
** Message: Firmware patched successfully
Now, looking in /lib/firmware you can see isight.fw
I must say i did’nt notice any difference after installation of this firmware, so if your webcam will immediatly works , you can avoid to install isight-firmware-tools

NB: Scrivania is Desktop in italian language :-).

f1-f2  buttons( backlights)
At beginning will not work, i fixed problem adding in /etc/X11/xorg.conf following row, under Device section
Option “RegistryDwords” “EnableBrightnessControl=1”

if xorg.conf is not present, you can easily edit/save it trough nvidia-settings tool:
Go to Server Display Configuration , then on the bottom right corner clickbutton “save toX configuration file” , before save, click “show preview” and addOption “RegistryDwords” “EnableBrightnessControl=1” under Device section
After reboot , f1-f2 should work – in order to preserve backlight level after reboot, i strongly suggest to add string in grub
# /nano/etc/default/grub
then in GRUB_CMDLINE_LINUX_DEFAULT section i added
acpi_backlight=vendor
so (if you followed my previous suggestion ) will have situation below

NB: i have also removed from grub “quiet-splash ” cause i like to see loading services (of course you can leave it.

f10-f12 buttons (sound level regulation )
Work out of the box.

Bluetooth
It seems working; i wrote “seems” because i did not tested it with other bluetooth devices.
as default is enabled, to disable it:
nano /etc/bluetooth/main.conf
Then look for a row named Initially powered =true and replace “true” with “false”
Save, exit and reboot: Afterthat Bt should be off.

Final result 
(click image below for enlarge)
Debian 9 stretch + Mate+Docky on macbook 6.1

Posted in Gnu-Linux, Mac Os | Leave a comment