DaemonForums  

Go Back   DaemonForums > Miscellaneous > General software and network

General software and network General OS-independent software and network questions, X11, MTA, routing, etc.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 11th September 2019
Berion Berion is offline
New User
 
Join Date: Sep 2019
Posts: 2
Default Mounting encryped UFS2 on *BSD, custom partition table, Big Endian

Hello,
this is my first thread and to be honest, first contact in any BSD operating system. For years I'm using Windows and Linux. However, I like learning new stuff and today is perfect occasion. Also, sorry for my bad English but it is not my native language and I don't have any linguistic skills, enough to say I learned it only from just playing video games. Oh, and I'm not interesting in any OS war, all my compares with Linux are for seeking parallel solutions. Most of the questions will be quite noobish so please for patience. ^^

In my PlayStation 3, main partition is in UFS2 file system. I have successfully fully decrypted it on Linux and also have access to some data on Windows. However, only reading is possible, not write. On Linux we have experimental write support in ufs kernel module but it is far from trustworthy solution (also transfer rate is for some reason slow). So, since CellOS (PS3 operating system) is some kind of FreeBSD fork and UFS2 is native BSD family file system, then the best solution would be to use just *BSD for such task, right? And here are the problems. But before I describe how I doing it on Linux and asking for similar tools and help with syntax in BSD world, I must explain that this is NOT related to any kind of piracy (HDD keys are uniqe per unit and games must be bought or will not work, so this is not any kind of easy pirating stuff junk solution, but my fetish to IT forensics and seeking a way to be free from Sony servers in backup restoring manners).
  1. All data in HDD is writing in Big Endian instead to Little Endian. Is there any converter for such task on BSD? On Linux I'm using special kernel module and cryptosetup with zeroed key to converting it on the fly, making a device mapper which put out the same dev but with "byte swapped" which can be understand by other tools.
  2. Partition table is custom but years ago, support for it, was streamlined with standard kaprtx. I didn't find any port of this specific tool for BSD. Is gmultipath a worth replacement?
  3. Is there any loop device equivalent? Is vnd is what I'm looking for?
  4. Is there any device mappers equivalent? If this functionality exist, how can I create one?
  5. Is there any dmcrypt packet equivalent? I found geom and geli but reading documentation I'm not sure if they support old AES-CBC-192.
  6. If points 1 and/or 2 and/or 4 cannot be achieve on BSD, can I use network block device (redirected decrypted mappers on Linux as nbd and connecting to them on *BSD)?
  7. On top of that, I would be happy if I could use all this stuff from LiveDVD. What BSD should I choose? I found GhostBSD but I need experts advice.

Here is how procedure looks like on Linux:
Code:
losetup loop1 /home/mint/ps3/disk.img
insmod '/home/mint/ps3/bswap16-ecb.ko'
cryptsetup create -c bswap16-ecb -d /dev/zero ps3hdd-bs /dev/loop1
cryptsetup create -c aes-cbc-null -d /home/mint/ps3/ata_key.bin -s 192 ps3hdd /dev/mapper/ps3hdd-bs
kpartx -a /dev/mapper/ps3hdd
cryptsetup create -c aes-xts-plain64 -d /home/mint/ps3/vflash_key.bin -s 256 -p 8 ps3vflash /dev/mapper/ps3hdd1
kpartx -a /dev/mapper/ps3vflash

mount -t ufs -o ufstype=ufs2,ro /dev/mapper/ps3hdd2 /home/mint/ps3/dev_hdd0
mount -t vfat /dev/mapper/ps3hdd3 /home/mint/ps3/dev_hdd1
mount -t vfat /dev/mapper/ps3vflash2 /home/mint/ps3/dev_flash1
mount -t vfat /dev/mapper/ps3vflash3 /home/mint/ps3/dev_flash2
mount -t vfat /dev/mapper/ps3vflash4 /home/mint/ps3/dev_flash3
And here is how it looks like in terminal from lsblk:


Thank You for Your attention.

Best regards,
- P.B.
Attached Images
File Type: png lsblk.png (67.8 KB, 81 views)
Reply With Quote
  #2   (View Single Post)  
Old 11th September 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,739
Default

Hello, and welcome!

I don't have any answers to your specific questions; instead some general guidance.

The BSDs (Open, Net, Free, Dragonfly) are a family of historically-related operating systems, but otherwise are independent. Unlike Linux distributions, they do not share a common kernel distributed with selected tools and application suites. Each is an independent, complete OS with integrated kernel and userland, and a separate set of third party derived, ported application packages.

The FreeBSD-based Sony platform is therefore best approached using the FreeBSD OS.

While those four BSDs are independent, there are a number of "desktop friendly" distributions of FreeBSD. GhostBSD and TrueOS are the leaders in this space.

Last edited by jggimi; 11th September 2019 at 01:41 PM. Reason: edit:one word
Reply With Quote
  #3   (View Single Post)  
Old 11th September 2019
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 877
Default

Welcome also. I can't add much but I think the answer to

Quote:
3. Is there any loop device equivalent? Is vnd is what I'm looking for?
is "yes".
Reply With Quote
  #4   (View Single Post)  
Old 11th September 2019
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,561
Default

Acording to Freebsd's geli(8) AES-CBC with keylength of 192 is supported:

Code:
-e ealgo	        Encryption algorithm to	use.  Currently	sup-
			ported algorithms are: AES-XTS, AES-CBC,
			Blowfish-CBC, Camellia-CBC, 3DES-CBC, and
			NULL.  The default and recommended algorithm
			is AES-XTS.  NULL is unencrypted.

-l keylen	        Data Key length to use with the given crypto-
			graphic algorithm.  If the length is not spec-
			ified, the selected algorithm uses its default
			key length.

				      AES-XTS
				      128, 256

				      AES-CBC, Camellia-CBC
				      128, 192, 256
Not much time at this moment, but I cannot find anything which byte-order UFS2 is using and/or whether it is processor architecture dependent.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #5   (View Single Post)  
Old 11th September 2019
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,561
Default

Just found https://www.psdevwiki.com/ps3/Building_FreeBSD_World , but now I really have to go ........
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #6   (View Single Post)  
Old 11th September 2019
Berion Berion is offline
New User
 
Join Date: Sep 2019
Posts: 2
Default

Thanks for the answers. geli and vnd checked. ^^ So the main problem left is BE>>LE and custom partition table (only kpartx have it so probably I'm out of luck now). I'll try different approach like i.e access to put out mapper via network for some BSD.

To get HDD keys, I need a hacked console (which I hacked and read all needed keys years ago). However, now I have fully original firmware which doesn't allow to run any kind of unsigned code and I don't want hack it again (also downgrade firmware is impossible without special service dongle and special software on pendrive). So I cannot run OtherOS >> Linux/FreeBSD from pendrive and/or internal HDD (this was removed from official firmwares many years ago for official reason as potential attack vector). My point of all of this is to not use console for reading data (and this can be already done on Windows/Linux) and writing data (here is why I turned my eyes to BSD because of full trustworthy support for UFS2).

I'm now after the lecture of devfs and many related stuff. Quite harder than on Linux or it is just the first impression. ^^
Reply With Quote
  #7   (View Single Post)  
Old 11th September 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,739
Default

Quote:
Originally Posted by Berion View Post
...to BSD because of full trustworthy support for UFS2
If instead of "BSD" you were thinking "FreeBSD" you would be more accurate. FreeBSD's UFS2 is not the same as OpenBSD's FFS2, even though they share some of the same UFS/FFS history.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with mounting windows partition Ondrej NetBSD General 4 2nd December 2016 03:26 PM
Clean install of OpenBSD but keeping existing partition table daemonbak OpenBSD Installation and Upgrading 8 27th May 2015 10:39 PM
I think I just mangled my partition table Mantazz FreeBSD Installation and Upgrading 2 2nd July 2009 09:55 PM
FBSD 7.2 installation not seeing partition table correctly Mantazz FreeBSD Installation and Upgrading 0 2nd July 2009 11:36 AM
Mounting a FreeBSD UFS partition roddierod Solaris 1 7th August 2008 02:02 PM


All times are GMT. The time now is 02:17 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick