<div dir="ltr">Hello,<div><br></div><div>I m facing a problem when I am trying to use dropbear with PAM support.</div><div><br></div><div>My requirement is to restrict certain users to do ssh only through certain interfaces.</div><div>for ex: my board has 2 ip&#39;s <a href="http://10.207.18.101/24">10.207.18.101/24</a> on eth0 and <a href="http://10.207.118.101/24">10.207.118.101/24</a> on eth1.</div><div>dropbear server listens on port 22 on both of these interfaces. Given this scenario, I want to restrict a particular user say &quot;abc&quot; to be able to do ssh only through eth1 network.  </div><div>like &quot;abc&quot; should be able to login from ip&#39;s like <a href="http://10.207.118.102/24">10.207.118.102/24</a>, <a href="http://10.207.118.103/24">10.207.118.103/24</a> etc.,</div><div><br></div><div>I didnt find a way to do using only dropbear. So had to integrate dropbear with PAM.</div><div><br></div><div>I applied this patch to dropbear-2016.74.tar.bz2</div><div><div>--- a/options.h</div><div>+++ b/options.h</div><div>@@ -213,10 +213,10 @@ If you test it please contact the Dropbear author */</div><div><br></div><div> /* This requires crypt() */</div><div> #ifdef HAVE_CRYPT</div><div>-#define ENABLE_SVR_PASSWORD_AUTH</div><div>+/*#define ENABLE_SVR_PASSWORD_AUTH*/</div><div> #endif</div><div> /* PAM requires ./configure --enable-pam */</div><div>-/*#define ENABLE_SVR_PAM_AUTH */</div><div>+#define ENABLE_SVR_PAM_AUTH</div><div> #define ENABLE_SVR_PUBKEY_AUTH</div><div><br></div></div><div><br></div><div>Configured and compiled dropbear with PAM support. </div><div>I added below configuration files.</div><div><br></div><div>a. cat /etc/pam.d/sshd</div><div>     </div><div>     auth required pam_unix.so</div><div>     account required pam_access.so</div><div><br></div><div>b. cat /etc/security/access.conf </div><div><br></div><div>    + : root : ALL</div><div>    + : abc : <a href="http://10.207.118.0/24">10.207.118.0/24</a></div><div>    - :  abc : <a href="http://10.207.18.0/24">10.207.18.0/24</a></div><div>    - : ALL : ALL</div><div><br></div><div>But with this configuration, abc is unable to login to the machine via <a href="http://10.207.118.0/24">10.207.118.0/24</a> also.</div><div>Any idea on how to fix this one ?</div><div><br></div><div>Apologies if its not the right forum to ask this question. </div><div><br></div><div>Regards,</div><div>Sriram.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>