Commit e8e19884 authored by Matt Colyer's avatar Matt Colyer

Fixes initconf.

parent 7ea2be32
......@@ -13,24 +13,20 @@ You must have:
autoconf
gcc
IMPORTANT: You must edit src/ifuse.c and src/main.c and replace your HostID
from the plist file stored by iTunes. You can find these lines because they are
currently commented out. In Windows this file is located in:
C:\Documents and Settings\Your Username\Application Data\Apple Computer\Lockdown\<device serial number>.plist
IMPORTANT: You must also have a public certificate for the device located in
the root directory of the source named hostcert.pem. This can also be extracted
from the above file.
To compile run:
./autogen.sh
./configure
make
sudo make install (if you want to install it into your system directories)
libiphone-initconf (as the user you intend to user the library)
USAGE
================================================================================
IMPORTANT: Before using the library you must run "libiphone-initconf". It will
generate keys and a host id for your system. It only needs to be run once but
it MUST be run.
There are currently 2 executables iphoneclient and ifuse, located in src/.
iphoneclient is a basic commandline interface, it just runs a few various operations.
......@@ -43,5 +39,3 @@ like this:
To unmount:
umount mountpoint
Currently the ifuse filesystem is read-only, until the development has
progressed further.
AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libfuse_CFLAGS) $(libgnutls_CFLAGS) -g
AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(libgnutls_LIBS)
bin_PROGRAMS = iphoneclient ifuse initconf
bin_PROGRAMS = iphoneclient ifuse libiphone-initconf
iphoneclient_SOURCES = usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c
ifuse_SOURCES = ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c
initconf_SOURCES = initconf.c userpref.c
libiphone_initconf_SOURCES = initconf.c userpref.c
......@@ -52,10 +52,13 @@ char *lockdownd_generate_hostid() {
}
int main(int argc, char *argv[]) {
printf("This program generates keys required to connect with the iPhone\n");
printf("It only needs to be run ONCE.\n\n");
printf("Additionally it may take several minutes to run, please be patient.\n\n");
gnutls_global_init();
size_t size;
char* host_id = NULL;
gnutls_x509_privkey_t root_privkey;
gnutls_x509_privkey_t host_privkey;
......@@ -72,11 +75,17 @@ int main(int argc, char *argv[]) {
/* generate HostID */
//TODO
host_id = lockdownd_generate_hostid();
if (debug) printf("HostID: %s\n", host_id);
/* generate keys */
printf("Generating root key...");
fflush(stdout);
gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0);
printf("done\n");
printf("Generating private key...");
fflush(stdout);
gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0);
printf("done\n");
/* generate certificates */
gnutls_x509_crt_set_key(root_cert, root_privkey);
......@@ -102,34 +111,31 @@ int main(int argc, char *argv[]) {
gnutls_datum_t root_key_pem = {NULL, 0};
gnutls_datum_t host_key_pem = {NULL, 0};
gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &size);
root_key_pem.size = size;
gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &size);
host_key_pem.size = size;
gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &root_key_pem.size);
gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_pem.size);
root_key_pem.data = gnutls_malloc(root_key_pem.size);
host_key_pem.data = gnutls_malloc(host_key_pem.size);
gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &size);
root_key_pem.size = size;
gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &size);
host_key_pem.size = size;
gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_pem.size);
gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_pem.size);
gnutls_datum_t root_cert_pem = {NULL, 0};
gnutls_datum_t host_cert_pem = {NULL, 0};
gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &size);
root_cert_pem.size = size;
gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &size);
host_cert_pem.size = size;
gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &root_cert_pem.size);
gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_pem.size);
root_cert_pem.data = gnutls_malloc(root_cert_pem.size);
host_cert_pem.data = gnutls_malloc(host_cert_pem.size);
gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &size);
root_cert_pem.size = size;
gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &size);
host_cert_pem.size = size;
printf("Generating root certificate...");
gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size);
printf("done\n");
printf("Generating root certificate...");
gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size);
printf("done\n");
/* store values in config file */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment