How to enable Linux-PAM on uClinux

By default the uClinux  uses the tools provided by busybox firstly.
So the init login and passwd are all linked to busybox by default.
Although busybox supports PAM too. But the above three tools are only simplified versions.
For example, the init doesn't support run level and always run in single user mode;
so login from serial need not any authentication.
Busybox's login dosn't use shadow file, and then there is no way to age password
and ensure to change password on first login from all consoles.
The more important is that the login and passwd can't utilize PAM-framwork to practice
more complicated checking and authentications.
So one possible way to meet the security requirments for password
is to enable Linux-PAM on uClinux too.

Refering to yocto's platform, we migrated the sysvinit, shadow utils(4.2.1), Linux-PAM-1.2.1 and all its standard modules to uClinux.
Details are:
1. sysvinit-2.88dsf takes place of busybox's init
2. login of shadow takes place of busybox's login
3. passwd of shadow takes place of buysbox's passwd.
Shadow utils include many other tools which can be imported when needed.
4. imported Linux-PAM-1.2.1 to uClinux.
5. imported all standard modules of Linux-PAM
6. imported libcrack depended by pam_cracklib.so
7. added several configure files, such as /etc/{environment, login.defs, securetty, shadow} and
all in /etc/pam.d directory.
8. modify the /etc/inittab as follow:

id:2:initdefault:
si::sysinit:/etc/init.d/rcS
~~:S:wait:/sbin/sulogin
l2:2:respawn:/sbin/getty -L 921600 ttyS0
l6:6:wait:/sbin/reboot

After these modifications, authentication is ensured for any login from all terminals, such as serial port and telnet.
Process login and passwd command can certificate with PAM-framwork and configured modules.
Third, the shadow utils make it possible to age the password and change password on first login from all possibilities.

posted @ 2018-05-29 11:22  耕读编码  阅读(436)  评论(0编辑  收藏  举报