Changeset 44772


Ignore:
Timestamp:
2015-03-15T11:32:10+01:00 (3 years ago)
Author:
nbd
Message:

uhttpd: make generating SSL keys more reliable against interrupted boots

Signed-off-by: Felix Fietkau <nbd@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/network/services/uhttpd/files/uhttpd.init

    r44548 r44772  
    4646        [ -x "$PX5G_BIN" ] && { 
    4747                $PX5G_BIN selfsigned -der \ 
    48                         -days ${days:-730} -newkey rsa:${bits:-1024} -keyout "$UHTTPD_KEY" -out "$UHTTPD_CERT" \ 
     48                        -days ${days:-730} -newkey rsa:${bits:-1024} -keyout "${UHTTPD_KEY}.new" -out "${UHTTPD_CERT}.new" \ 
    4949                        -subj /C="${country:-DE}"/ST="${state:-Saxony}"/L="${location:-Leipzig}"/CN="${commonname:-OpenWrt}" 
     50                sync 
     51                mv "${UHTTPD_KEY}.new" "${UHTTPD_KEY}" 
     52                mv "${UHTTPD_CERT}.new" "${UHTTPD_CERT}" 
    5053        } 
    5154} 
     
    112115 
    113116        [ -f /lib/libustream-ssl.so ] && [ -n "$https" ] && { 
    114                 [ -f "$UHTTPD_CERT" -a -f "$UHTTPD_KEY" ] || { 
     117                [ -s "$UHTTPD_CERT" -a -s "$UHTTPD_KEY" ] || { 
    115118                        config_foreach generate_keys cert 
    116119                } 
Note: See TracChangeset for help on using the changeset viewer.