Forwarding ….

I think scott meant this for the starlingx discuss list.

Greg.

 

From: Little, Scott <Scott.Little@windriver.com>
Sent: Wednesday, July 6, 2022 2:37 PM
To: Waines, Greg <Greg.Waines@windriver.com>
Subject: Re: [Starlingx-discuss] Incorrect public key for signed starlingX 5.0 iso .

 

I'll attempt to answer this at a high level.

 

Secure boot signing uses a client/server approach.  build-pkgs acts as the client.  The server holds the signing scripts and the keys used for signing.

 

The client side code was released to  open source as part of StarlingX.  The server side code was not released. 

 

The interface between client and server is currently undocumented.  I'll try to give an overview as best I can.  Basically it is a series of ssh/scp calls made into signing server.

 

'build-pkgs' requires that the following environment variables be defined before it will attempt to request a secure boot signing.

 

export SIGNING_SERVER=<signing-host>
export SIGNING_USER=<signing-user>

export SIGNING_SERVER_SCRIPT=<path-to-signing-script>

 

'build-pkgs' further requires that "$USER" == "jenkins", and

 

export FORMAL_BUILD=1

If that is satisfied, it calls into 'sign-secure-boot'

'sign-secure-boot' contains a fairly good set of comments describing what happens next.

The client side call sequence looks like this ...

    # Set up the server side directory for files transfers.
    UPLOAD_PATH=`ssh $SIGNING_USER@$SIGNING_SERVER sudo $SIGNING_SCRIPT -r`

    # upload the original package
    scp -q $FILE $SIGNING_USER@$SIGNING_SERVER:$UPLOAD_PATH

    # Request that the package be signed
    ssh $SIGNING_USER@$SIGNING_SERVER sudo $SIGNING_SCRIPT -v -i $UPLOAD_PATH/$(basename $FILE) $UNSIGNED_OPTION -t $TYPE > $TMPFILE

    # Download the file from the signing server
    DOWNLOAD_FILENAME=$(basename $OUTPUT_FILE)
    scp -q $SIGNING_USER@$SIGNING_SERVER:$OUTPUT_FILE $(dirname $FILE)

Within the signing server there are two keys used for signing, known as the 'boot' key and the 'shim' key.  The public half of the 'boot' key must manually added to the secure boot keychain in firmware.  The 'boot' key signs first executable loaded, contained in the 'shim' package.   The first executable must then install the public half of the shim key (automatically) before passing control to grub, and ultimately the kernel, both of which are signed by the 'shim' key.

Three packages need to be passed to the signing server.  The rpms need to be unpacked, the relevant binaries signed with correct keys, and the rpms reassembled.

 
package    key   files to sign
=========  ====  ===========================
shim       boot  BOOTX64, shim, shimx64
           shim  MokManager, fallback, mmx64, fbx64
grub       shim  grubx64.efi, gcdx64.efi
kernel     shim  vmlinuz

NOTE: shim files to sign might include a '.efi' or '.EFI' suffix.  Sign those as well.

NOTE: some files may be absent in newer packages.  It is probably ok if some of the above are missing.

 

Signing looks like this ...

    sbsign --key $KEYPATH/$KEYNAME.key --cert $KEYPATH/$KEYNAME.crt  --output $SIGNEDFILE $UNSIGNEDFILE

 

On keys and certs ...

 

   boot.crt - Certificate to boot (to be programmed in firmware)
   boot.key - Private key with which to sign shim
   shim.crt - Certificated embedded within shim used to validate kernel, grub
   shim.key - Private key with which to sign kernel/grub

 

key generation ...

 

   openssl req -new -x509 -newkey rsa:2048 -keyout $KEY.key -out $KEY.pem -days 3650 

   openssl x509 -in $KEY.pem -out $KEY.crt -outform DER

 

Note: boot.crt should be copied to cgcs-root/build-tools/certificates/TiBoot.crt for inclusion during the  'build-iso' step

 

 

Hope this helps

 

Scott

 

 

On 2022-07-05 03:19, Kumar, Chandan wrote:

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hi Greg,

 

Thanks for acknowledgement.

 

I have raised starlingx launchpad  for document update. Meanwhile it would be really great if you can share the steps which has to be done to integrate signing of images as part of StarlingX build infrastructure.

 

Regards,

Chandan Kumar.

 

From: Waines, Greg <Greg.Waines@windriver.com>
Sent: Monday, July 4, 2022 6:00 PM
To: starlingx-discuss@lists.starlingx.io
Cc: Little, Scott <Scott.Little@windriver.com>
Subject: Re: [Starlingx-discuss] Incorrect public key for signed starlingX 5.0 iso .

 

 

Hey Chandan,

 

Thanks for bringing this up.

 

I chatted with Scott about this.

 

Currently the StarlingX public builds on CENGN are not building a secure boot capable load … i.e. signing the appropriate items to enable secure boot.  Although the StarlingX build infrastructure allows it to be added.

Neither of these points are properly documented in docs.starlingx.io  

 

I can’t remember the details of why we are not doing this.

I am guessing that the thinking was that a user of StarlingX that wanted to use UEFI Secure Boot, would want to sign with his own private key.

 

Can you raise a starlingx launchpad ( https://launchpad.net/starlingx ) to address the docs.starlingx.io documentation issue, i.e. to indicate that the StarlingX CENGN builds are not signed to support uefi secure boot, and describe how a starlingx user could add signing to their StarlingX build environment in order to sign for uefi secure boot with their own private key ?

 

Greg.

 

 

From: Scott Little <scott.little@windriver.com>
Sent: Wednesday, June 29, 2022 10:42 AM
To: starlingx-discuss@lists.starlingx.io
Subject: Re: [Starlingx-discuss] Incorrect public key for signed starlingX 5.0 iso .

 

On 2022-06-02 13:12, Kumar, Chandan wrote:

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hi,

 

I am trying to validate signed starlingX 5.0 iso on a secureboot enabled setup against public key(TiBoot.crt) embedded inside iso. After rebooting , operating system is not coming up with error screen saying “Verification failed: (0X1A) Security Violation”.

 

However, when I signed images with self-generated private key and validated against corresponding public key, system is able to boot up successfully. Signing is done after flashing the iso on a server. Please find attached procedure for signing images inside iso.

I believe, the public key provided with iso is not correct. Can you please confirm ?

 

Regards,

Chandan Kumar.    

 

_______________________________________________
Starlingx-discuss mailing list
Starlingx-discuss@lists.starlingx.io
http://lists.starlingx.io/cgi-bin/mailman/listinfo/starlingx-discuss

Thanks for the report.   I'll look into it

Scott Little