Tomato httpd with self-signed SHA256?

Discussion in 'Tomato Firmware' started by philess, Mar 20, 2013.

  1. philess

    philess Networkin' Nut Member

    Hi guys,

    maybe its not possible with the current httpd that is integrated in the Tomato builds,
    but i wanted to use a 2048 bit self-signed certificate with SHA256, but when i
    try to add the key.pem and cert.pem to Tomato and restart the httpd, it seems
    to refuse them and falls back to its own certificate (256bits SHA1).

    router daemon.warn httpd[22334]: Unable to start SSL
    router httpd[22334]: Generating SSL certificate...
    Any ideas? Or simply not possible?

    Here are the steps i did:

    (on Ubuntu 12.04 with OpenSSL 1.0.1)

    openssl genrsa -out privkey.pem -des 2048
    (entered a passphrase)

    openssl req -new -key privkey.pem -out certreq.csr -sha256
    (entered the passphrase and used the same as challenge password)

    openssl x509 -req -days 3650 -in certreq.csr -signkey privkey.pem -out newcert.pem -extfile router.cnf -sha256
    (router.cnf contains DNS names for the cert in addition to the common name:

    I checked the certificate (openssl x509 -noout -text -in newcert.pem)
    and it was generated as SHA256 and 2048 bits, extensions show up as well.

    Then i followed the guide from here:

    Uploaded the two PEM files, replacing the old ones in /etc.
    Then tar them and set the https_crt_file in nvram, commit, restart httpd.

    Edit: Hmm it does work without the -des in the first step.
    I suppose the httpd cannot handle the required passphrase when trying to load the cert. My bad then!
    But atleast the 2048/SHA256 combo works now, and that icon in Chrome and Firefox has turned green :)
  2. koitsu

    koitsu Network Guru Member

    You should not use -des during the private key generation phase. Per OpenSSL's own documentation:

               These options encrypt the private key with the DES, triple DES, or
               the IDEA ciphers respectively before outputting it. If none of
               these options is specified no encryption is used. If encryption is
               used a pass phrase is prompted for if it is not supplied via the
               -passout argument.
    The key thing to note with -des is that the private key itself then become encrypted. I wouldn't use this on a router or even a public-facing SSL site either -- why? Because if someone gets their hands on your private key, you have bigger problems to worry about. The last time I saw someone using a passphrase-protected cert on a public-facing webserver was back in 1998, and I laughed at the fact that every time the server rebooted the admin had to manually type in a password (and that came around to bite him in the ass + nearly got him fired when the server panic'd one day and auto-rebooted, but sat waiting to start Apache for nearly 10 hours until the admin woke up + dealt with it).

    Furthermore, I think some of these ciphers are not available in TomatoUSB -- I would need to go look at all the OpenSSL build arguments, but if I remember correctly, an extremely minimal set of ciphers is available. This is done solely to decrease firmware size, as added ciphers appear to greatly increase relevant library sizes (and likewise memory usage).

    Finally, no, TomatoUSB's webserver (which is a custom/proprietary daemon written by the Tomato author himself) does not support passphrase-based certs.
    philess likes this.
  3. philess

    philess Networkin' Nut Member

    Thank you for that reply and great explanation koitsu!

    As i thought, DES is not possible with Tomato, but it works great like it is now.
  4. Mangix

    Mangix Networkin' Nut Member

    DES takes on average ~13 hours to crack using moxie marlinspike's cloudcracker service.

    So yes, don't do it.

    More than there should be in my opinion. I created builds where I disabled the totally useless ones like DES, IDEA, RC2, etc... and have had no issues. However I have not tested OpenVPN, Transmission, or HTTPS to see if they break since I don't use those things.
    philess likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice