TrungNguyen1909 / qemu-t8030

iPhone 11 emulated on QEMU
Other
1.97k stars 194 forks source link

help getting sshd to work #92

Closed jthorpe6 closed 1 year ago

jthorpe6 commented 1 year ago

Hi,

During the BH presentation, it was shown that the emulator has sshd enabled after a successful restore. Is it possible to provide some instructions to get this working ?

I've completed a successful restore of the emulator, and can interact with it via gdb but doing iproxy 2222 44 on the linux vm and then attempting to ssh on port 2222 to the emulator fails. I've also tried the default port 22 but that fails also.

Thanks

TrungNguyen1909 commented 1 year ago

You will need to initialize USB and run Dropbear, similar to this, excluding the micro_inetd part.

Dropbear will need to be added to launchd.plist with sthg like

<key>/System/Library/LaunchDaemons/dropbear.plist</key>
<dict>
            <key>Label</key>
            <string>dropbear</string>
            <key>POSIXSpawnType</key>
            <string>Interactive</string>
            <key>Program</key>
            <string>/usr/sbin/dropbear</string>
            <key>ProgramArguments</key>
            <array>
                <string>/usr/sbin/dropbear</string>
                <string>-i</string>
                <string>-S</string>
                <string>/bin/bash</string>
                <string>-r</string>
                <string>/private/var/dropbear_rsa_host_key</string>
            </array>
            <key>RunAtLoad</key>
            <true/>

            <key>SessionCreate</key>
            <true/>

            <key>Sockets</key>
            <dict>
                <key>DropbearV4Listener</key>
                <dict>
                    <key>SockFamily</key>
                    <string>IPv4</string>
                    <key>SockNodeName</key>
                    <string>127.0.0.1</string>
                    <key>SockServiceName</key>
                    <string>44</string>
                </dict>
                <key>DropbearV6Listener</key>
                <dict>
                    <key>SockFamily</key>
                    <string>IPv6</string>
                    <key>SockNodeName</key>
                    <string>::1</string>
                    <key>SockServiceName</key>
                    <string>44</string>
                </dict>
            </dict>

            <key>StandardErrorPath</key>
            <string>/dev/null</string>

            <key>inetdCompatibility</key>
            <dict>
                <key>Wait</key>
                <false/>
            </dict>
</dict>

Don't forget to add/generate the host key!

jthorpe6 commented 1 year ago

Thanks, got it working in the end !

erjinzhi2333 commented 1 year ago

@jthorpe6 Is it possible to write a tutorial that getting sshd to work? thank you!

jthorpe6 commented 1 year ago

All I did was what @TrungNguyen1909 said to do, and I did forget to add/generate host keys. Once I added them it all worked fine.