<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>8365</bug_id>
          
          <creation_ts>2015-09-21 12:18:38 +0000</creation_ts>
          <short_desc>sshd key generation fails when both systemd and read-only-rootfs are enabled</short_desc>
          <delta_ts>2015-11-16 14:32:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>connectivity</component>
          <version>1.8</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.0</target_milestone>
          <dependson>8680</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Winfried">winfried_mb2</reporter>
          <assigned_to name="Alexander Kanavin">alex.kanavin</assigned_to>
          <cc>bogdanx.a.voiculescu</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ross.burton</cc>
    
    <cc>yp.bsp.watcher</cc>
    
    <cc>yp.watcher</cc>
          
          <qa_contact name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54369</commentid>
    <comment_count>0</comment_count>
    <who name="Winfried">winfried_mb2</who>
    <bug_when>2015-09-21 12:18:38 +0000</bug_when>
    <thetext>When read-only-rootfs is added to (EXTRA_)IMAGE_FEATURES, directory /etc/ssh in the target rootfs becomes readonly and as a consequence ssh key generation in that directory fails. This has been fixed for SysV init, but not for systemd.

There is already a sshd config file /etc/ssh/sshd_config_readonly that relocates the ssh keys to /var/run/ssh (which is mounted on a tmpfs). Probably sshd should be started with this config file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54412</commentid>
    <comment_count>1</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-09-22 01:49:47 +0000</bug_when>
    <thetext>Ross: I&apos;m not the right person for this .. do you know who is ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54675</commentid>
    <comment_count>2</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2015-09-25 14:23:04 +0000</bug_when>
    <thetext>I think it&apos;s better to move this ssh key location tweaking out of image.bbclass altogether, and have it in init.d/sshd where it&apos;ll be together with the rest of ssh stuff. Dropbear already does it.

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/image.bbclass#n238

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-core/dropbear/dropbear/init#n30

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-connectivity/openssh/openssh/init</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54744</commentid>
    <comment_count>3</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2015-09-28 16:12:46 +0000</bug_when>
    <thetext>Okay, I misunderstood how sysvinit/systemd works. Those init scripts aren&apos;t used at all, systemd actually runs sshd only when someone connects to port 22:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-connectivity/openssh/openssh/sshd.socket

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-connectivity/openssh/openssh/sshd@.service

http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service

The last file hardcodes the keys location to /etc/ssh/. Dropbear has a similar problem and needs to be fixed too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54821</commentid>
    <comment_count>4</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2015-09-30 12:53:51 +0000</bug_when>
    <thetext>Patches submitted to oe-core mailing list. I&apos;ve also included a bonus fix for dropbear :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54863</commentid>
    <comment_count>5</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2015-10-01 11:43:48 +0000</bug_when>
    <thetext>Patches are now in master.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56491</commentid>
    <comment_count>6</comment_count>
    <who name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</who>
    <bug_when>2015-11-16 14:31:30 +0000</bug_when>
    <thetext>Verified on master: fc45deac89ef63ca1c44e763c38ced7dfd72cbe1&quot;

I used a core-image-sato with 
EXTRA_IMAGE_FEATURES += &quot;ssh-server-openssh&quot;
EXTRA_IMAGE_INSTALL += &quot;ssh-server-openssh&quot;
DISTRO_FEATURES_append = &quot; systemd&quot;
IMAGE_FEATURES_REPLACES_ssh-server-openssh = &quot; ssh-server-dropbear&quot;
VIRTUAL-RUNTIME_init_manager = &quot;systemd&quot;
DISTRO_FEATURES_BACKFILL_CONSIDERED = &quot;sysvinit&quot;
VIRTUAL-RUNTIME_initscripts = &quot;&quot;
IMAGE_FEATURES[validitems] += &quot; read-only-rootfs empty-root-password allow-empty-password post-install-logging&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56492</commentid>
    <comment_count>7</comment_count>
    <who name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</who>
    <bug_when>2015-11-16 14:32:35 +0000</bug_when>
    <thetext>using empty-root-password allow-empty-password you can work around the dependency of Bug 8680</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>