Commit Graph

66 Commits

Author SHA1 Message Date
Serhey Popovych
8d88455509 [baseimage]: Improve password hashing for default user account (#1748)
* [slave.mk]: Fix displaying username and password in build summary

We display contents of DEFAULT_USERNAME and DEFAULT_PASSWORD, while
image can be build with USERNAME and/or PASSWORD given on make(1)
command line. For example:

  $ make USERNAME=adm PASSWORD=mypass target/sonic-broadcom.bin

Fix by displaying USERNAME and PASSWORD variables in build summary.

Signed-off-by: Sergey Popovich <sergey.popovich@ordnance.co>

* [baseimage]: Improve default user account handling

There are couple of issues with current implementation of default
user account management in baseimage:

  1) It uses DES to encrypt accounts password. Furthermore this
     effectively limits password length to 8 symbols, even if more
     provided with PASSWORD or DEFAULT_PASSWORD from rules/config.

  2) Salt value for password is same on all builds even with different
     password increasing attack surface.

  3) During the build process password passed as command line parameter
     either as plain text (if given to make(1) as "make PASSWORD=...")
     or DES encrypted (if given to build_debian.sh) can be seen by
     non-build users using /proc/<pid>/cmdline file that has group and
     world readable permissions.

Both 1) and 2) come from:

  perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')"

that by defalt uses DES if salt does not have format $<id>$<salt>$,
where <id> is hashing function id. See crypt(3) for more details on
valid <id> values.

To address issues above we propose following changes:

  1) Do not create password by hands (e.g. using perl snippet above):
     put this job to chpasswd(8) which is aware about system wide
     password hashing policy specified in /etc/login.defs with
     ENCRYPT_METHOD (by default it is SHA512 for Debian 8).

  2) Now chpasswd(8) will take care about proper salt value.

  3) This has two steps:

    3.1) For compatibility reasons accept USERNAME and PASSWORD as
         make(1) parameters, but warn user that this is unsafe.

    3.2) Use process environment to pass USERNAME and PASSWORD variables
         from Makefile to build_debian.sh as more secure alternative to
         passing via command line parameters: /proc/<pid>/environ
         readable only by user running process or privileged users like
         root.

Before change:
--------------

  hash1
  -----
  # u='admin'
  # p="$(LANG=C perl -e 'print crypt("YourPaSs", "salt"),"\n"')"
                                      ^^^^^^^^
                                      8 symbols
  # echo "$u:$p" | chpasswd -e

  # getent shadow admin
  admin:sazQDkwgZPfSk:17680:0:99999:7:::
        ^^^^^^^^^^^^^
        Note the hash (DES encrypted password)

  hash2
  -----
  # u='admin'
  # p="$(LANG=C perl -e 'print crypt("YourPaSsWoRd", "salt"),"\n"')"
                                      ^^^^^^^^^^^^
                                      12 symbols
  # echo "$u:$p" | chpasswd -e

  # getent shadow admin
  admin:sazQDkwgZPfSk:17680:0:99999:7:::
        ^^^^^^^^^^^^^
        Hash is the same as for "YourPaSs"

After change:
-------------

  hash1
  -----
  # echo "admin:YourPaSs" | chpasswd
  # getent shadow admin
  admin:$6$1Nho1jHC$T8YwK58FYToXMFuetQta7/XouAAN2q1IzWC3bdIg86woAs6WuTg\
           ^^^^^^^^
           Note salt here
  ksLO3oyQInax/wNVq.N4de6dyWZDsCAvsZ1:17681:0:99999:7:::

  hash2
  -----
  # echo "admin:YourPaSs" | chpasswd
  # getent shadow admin
  admin:$6$yKU5g7BO$kdT02Z1wHXhr1VCniKkZbLaMPZXK0WSSVGhSLGrNhsrsVxCJ.D9\
           ^^^^^^^^
           Here salt completely different from case above
  plFpd8ksGNpw/Vb92hvgYyCL2i5cfI8QEY/:17681:0:99999:7:::

Since salt is different hashes for same password different too.

  hash1
  -----
  # LANG=C perl -e 'print crypt("YourPaSs", "\$6\$salt\$"),"\n"'
                                             ^^^^^
                                             We want SHA512 hash
  $6$salt$qkwPvXqUeGpexO1vatnIQFAreOTXs6rnDX.OI.Sz2rcy51JrO8dFc9aGv82bB\
  yd2ELrIMJ.FQLNjgSD0nNha7/

  hash2
  -----
  # LANG=C perl -e 'print crypt("YourPaSsWoRd", "\$6\$salt\$"),"\n"'
  $6$salt$1JVndGzyy/dj7PaXo6hNcttlQoZe23ob8GWYWxVGEiGOlh6sofbaIvwl6Ho7N\
  kYDI8zwRumRwga/A29nHm4mZ1

Now with same "salt" and $<id>$, and same 8 symbol prefix in password, but
different password length we have different hashes.

Signed-off-by: Sergey Popovich <sergey.popovich@ordnance.co>
2018-06-09 11:29:16 -07:00
Qi Luo
d54a7ae566
[baseimage] Adding setuid permissions to ping binaries, so sudo is no longer needed (#1765) 2018-06-04 21:01:53 -07:00
Prince Sunny
5e64310a56 [baseimage]: Disable DAD for eth0 explicitly (#1701) 2018-05-12 01:31:17 -07:00
lguohan
d269263938
[baseimage]: add screen package (#1644) 2018-04-26 13:53:54 -07:00
padmanarayana
dda00292f3 Sonic fstrim (#1520)
* Update Dell submodule for fstrim support

* Revert PR 1500 since fstrim files are now part of submodule
2018-03-21 13:15:05 -07:00
Shuotian Cheng
871161e868
[build_debian]: Add quote to specify values as string (#1503) 2018-03-16 01:09:33 -07:00
padmanarayana
3bb24a975d [debian]: Add fstrim service files to systemd (#1500) 2018-03-15 13:16:00 -07:00
AndriiS
9065e09bee [baseimage] Added net.core.wmem_max value required by Copp test (#1489) 2018-03-14 09:20:47 -07:00
padmanarayana
02b62ac9bb [fast-reboot]: Support OS9 -> SONiC fast-reboot migration (#1414)
* Support OS9 -> SONiC fast-reboot migration

* Address review comments. Update NOS mac in EEPROM and net.rules for eth0

* Address review comments. Update sonic-platform-modules-dell to fac81d...

* Fix script for POSIX compliance
2018-03-08 16:42:41 -08:00
byu343
ecf5c8d311 ssh and snmp allow list (#1363)
- Service ACL framework for Arista platforms
2018-02-08 17:43:52 -08:00
padmanarayana
0d0752e099 Reduce SONiC migration partition from 8G to 1G. (#1343)
* Reduce SONiC migration partition from 8G to 1G.

* Changes to create 1G partition with ability to resize post migration.

* Remove redundant changes in varlog

* Use findfs to interpret root. Move resize in case cmdline params are reordered
2018-02-07 22:07:01 +08:00
Qi Luo
358949b4e5
Upgrade linux-image version (#1294)
* Upgrade linux-image version
* Add missing dependency of igb
* Fix mft build rule
* Add missing dependency of ixgbe
* [Broadcom]: Update OpenNSL modules to be compatible with kernel 3.16.0-5 (#3)
* [Nephos] Update SDK version to support new kernel module 3.16.0-5 (#4)
* [mellanox]: Update URL for SDK (#5)
2018-01-31 11:39:48 -08:00
pavel-shirshov
9e2facbdc9 [baseimage]: Install sysfsutils package into SONiC host system (#1290) 2018-01-10 03:04:32 -08:00
Joe LeVeque
0fffa6c63b
Add caclmgrd and related files to translate and install control plane ACL rules (#1240) 2018-01-09 17:55:10 -08:00
Qi Luo
f077f41ce9
Let debootstrap uses the same sources link as apt (#1279) 2018-01-03 22:22:58 -08:00
Taoyu Li
39a99e1a07 [image]: Explicitly specify kernel_version as string (#1280) 2018-01-03 21:43:06 -08:00
lguohan
15d433d975
[build]: allow to use http(s) proxy in the build (#1265)
* allow to use http(s) proxy in the build

To enable this, use following command
http_proxy=[your_proxy] https_proxy=[your_proxy] make
2017-12-23 23:34:15 -08:00
kaiyu22
63de341dd6 [Platform] Add Ingrasys S9130-32X and S9230-64X with Nephos Switch ASIC (#1245)
* Add switch ASIC vendor and platforms for Nephos

- What I did
Add switch ASIC vendor: Nephos
Add Nephos platforms: Ingrasys S9130-32X, Ingrasys S9230-64X

- How I did it
Add platform/nephos files
Add platform/nephos/sonic-platform-modules-ingrasys submodule
Add device/ingrasys/x86_64-ingrasys_s9130_32x-r0 files
Add device/ingrasys/x86_64-ingrasys_s9230_64x-r0 files
Add SONiC to support Nephos platform

- How to verify it
To build SONiC installer image and docker images, run the following commands:
make configure PLATFORM=nephos
make target/sonic-nephos.bin
Check system and network feature is worked as well

- Description for the changelog
Add switch ASIC vendor and platforms for Nephos

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Sam Yang <yang.kaiyu@gmail.com>

* Advance sonic-sairedis submodule to include #271 (Add Nephos ASIC)
2017-12-22 10:04:29 -08:00
Samuel Angebault
7f25b94378 [aboot]: Add setfacl in the initramfs (#1185)
Arista platforms need the filesystem ACLs to be removed on boot to
prevent invalid permission to be set for new files.
2017-11-24 17:30:11 -08:00
Shuotian Cheng
b07886ec3c [build_debian]: Install grub-common in the base image (#1014) 2017-10-05 21:43:25 -07:00
ravijo2
458093fee5 Framework to plugin Organization specific scripts during ONIE Image build (#951)
* Framework to plugin Organization specific scripts

* Framework to plugin Organization specific scripts

* Framework to plugin Organization specific scripts

* add getopt option to organization script
2017-09-19 16:23:31 -07:00
padmanarayana
6935e00909 [build/onie installer] Install grub for SONiC post migration from another NOS (#949)
* Install grub for SONiC post migration from another NOS

* Install grub from bundled debian package instead of using ONIE's. Address review comments
2017-09-17 11:41:29 -07:00
lguohan
116ba4b180 [baseimage]: allocate varlog disk in the initramfs stage (#936)
moving to initramfs unifies disk allocate on different platforms.
use fallocate instead of dd to speed up the disk allocation.

By default, mkfs.ext4 has -E discard option which discards the blocks
at the mkfs time, also speed up the initialization time.
2017-09-06 20:07:32 -07:00
Ying Xie
1a4f039f55 [quagga] enable core dump for bgpd and zebra (#927)
* [core dump] pass unix time to coredump-compress script

Currently we only have program name (e.g. bgpd) and PID in the core file
name. PID could collide especially after docker restart or recreate.

Passing the unix time to coredump-compress so it could also add time to
the core file name.

* [utilities] include the change to coredump_compress script

* [quagga] enable core dump for bgpd and zebra

bgpd and zebra downgrade their privilege shortly after started. For that
sysctrl kernel.suid_dumpable needs to be set to 2, so that they can dump
core.

Note that fs.suid_dumpable SHOULD NOT be set to 1. Which will bypass all
system security.
2017-08-30 09:41:47 -07:00
byu343
a92f5a9ffe Add arista-net initramfs hook (#899) 2017-08-19 21:32:10 -07:00
Qi Luo
9925aab2e6 Ignore return value of umount (#801)
* Ignore return value of umount

* Refine the umount process, more diagnostic info output
2017-07-12 01:28:36 -07:00
pavel-shirshov
3ac724ecb0 [baseimage]: Increase net.core.rmem_max to 2097152 (#767)
* Increase net.core.rmem_max to 2097152
2017-06-29 01:40:22 -07:00
Haiyang Zheng
9041288359 [build_debian]: Add dbus package to update timezone (#702)
Signed-off-by: Hiayang Zheng haiyang.z@alibaba.inc
2017-06-15 10:31:13 -07:00
Qi Luo
8ebf0b0832 Add monit for disk>85% into pmon docker (#582)
* Add monit for disk>85% into pmon docker

* Revert "Add monit for disk>85% into pmon docker"

This reverts commit 9cbbf591c08bce4b52a0f68cbbddae102d7fc614.

* Install monit in base image
2017-05-18 10:57:19 -07:00
Shuotian Cheng
8af03fd0f9 [orchagent]: Add ARP update script to maintain VLAN neighbors (#401)
- Extend ARP reachable time to 30min
- Add arping to docker-swss
- Add arp_update script to routinely probe neighbors

Signed-off-by: Shuotian Cheng <shuche@microsoft.com>
2017-05-15 17:06:19 -07:00
Qi Luo
2cfa289d3e Image version safely treats slash in branch name (#596) 2017-05-12 10:56:50 -07:00
pavel-shirshov
a5088ae9ec [debian]: Add kernel configuration to reboot on kernel soft lockup (#594) 2017-05-11 18:57:00 -07:00
pavel-shirshov
b26ec863e8 [docker-base]: Add less, strace, and configuration for vim (#591)
* Add less in docker-base. Add strace in docker_base_dbg.
* Make link vim to vim.tiny and have vim config file
2017-05-11 18:46:11 -07:00
pavel-shirshov
3af7c3a132 [debian]: Disable receiving default routes for ipv6 on mgmt interface (#588)
* Disable net.ipv6.conf.eth0.accept_ra_defrtr.
It will remain IPv6 working on mgmt interface, but it will disable receiving default routes
2017-05-10 17:39:51 -07:00
Andriy Moroz
b549adc36c [image]: SONiC-to-SONiC update (#464) 2017-04-21 17:23:36 -07:00
lguohan
fae53f7ea2 [build]: add commit id and build number in sonic_version (#508) 2017-04-16 01:17:22 -07:00
Marian Pritsak
6dbe979e5f [build]: Include SONiC version into installer. (#472)
* [build]: Include SONiC version into installer.

Signed-off-by: marian-pritsak <marianp@mellanox.com>

* Append dirty if contains local changes

Signed-off-by: marian-pritsak <marianp@mellanox.com>

* Update config

* Use correct name for kernel version field

* Update sysDescription.j2
2017-04-05 16:14:41 -07:00
Shuotian Cheng
e2cc409f8a [database]: Mount /var/run/redis/ folder from host for all dockers (#418)
- Create /var/run/redis/ folder on the host
- Install Python client for Redis on the host
- Mount /var/run/redis/ as read/write from host for all dockers
- Enable accessing the database everywhere including on the host and from remote

Signed-off-by: Shuotian Cheng <shuche@microsoft.com>
2017-03-23 12:18:52 -07:00
Shuotian Cheng
6a6bc88dcb [interfaces]: Remove bridge-utils from swss docker and add it to base image (#417)
The reason is that /etc/network/interfaces file is in base image. After booting,
docker-swss is not ready and thus the empty VLAN interfaces cannot be created
when the brctl is pointing to the binary inside the swss docker.

Add the bridge-utils into the base image and add bridge_ports none to the
/etc/network/interfaces file so that after boot-up the empty VLAN interfaces
will be created to let the members to join later.

Signed-off-by: Shuotian Cheng <shuche@microsoft.com>
2017-03-20 21:39:09 -07:00
pavel-shirshov
d7c70665de [baseimage]: Add kexec-tools package into the baseimage (#397)
* Include kexec-tools package which could be used for fast reboot

* Use sudo for sed
2017-03-15 18:38:55 -07:00
Qi Luo
d3891a2a42 Keep pip in the debian image (#356) 2017-03-02 16:04:18 -08:00
lguohan
b9b7d7a295 [installer]: support platform driver lazy installation (#340)
allow one image to support multiple switch devices, install
corresponding platform driver during the first boot time.
2017-02-27 13:08:41 -08:00
Taoyu Li
ea372cc7c1 Add get_graph service to fetch minigraph automatically (#288)
- Add a functionality to get SNMP community from DHCP (option 224)
- Add a functionality to get minigraph from http service instead of using default minigraph
  - The url for graph service is passed through DHCP option 225
  - This feature is by default disabled. Modify rule/config to enable it on build time, or modify /etc/sonic/graph_service_url on run time.
- Fix a bug that getting hostname from DHCP is not working correctly
2017-02-17 13:47:01 -08:00
lguohan
6119a58e4a [build_debian]: install deps in rootfs instead of just extracting the packages (#280)
packages contains post-install that needs to be performed
2017-02-10 07:39:05 -08:00
lguohan
8826beb597 [docker]: change hardcoded value to DOCKERFS_DIR for docker directory on the disk (#269) 2017-02-06 08:17:16 -08:00
Oleksandr Ivantsiv
793b842d60 Add DHCP client hook to update hostname. (#235)
* Add DHCP client hook to update hostname.

* Remove interface checking

* Update hostname in /etc/hosts file
2017-02-02 11:19:48 -08:00
lguohan
c2b4c870c6 remove fsroot after build (#228) 2017-01-31 22:05:24 -08:00
Oleksandr Ivantsiv
34ea91349c one image implementation (#215)
* Single image

* Fix review comments

* Update syncd service. Add HW mgmt to Mellanox single image.

* Add single image template for Broadcom platform.

SKU should be provided during configure:
make configure PLATFORM=broadcom SKU=Force10-S6000

* Add single image template for Cavium platform.

SKU should be provided during configure:
make configure PLATFORM=cavium SKU=AS7512

* Add description to sonic_debian_extension.j2 file.
2017-01-29 11:33:33 -08:00
byu343
6d8f57631b [Arista]: Add support to convert vfat file system to ext4 (#201)
This commit will convert the existing file system of flash drive on Arista switches from VFAT to EXT4 in the booting of SONiC. It will take the whole flash and therefore remove the recovery partition. There is a check in the script making sure that the conversion operation will not happen on a non-Arista switch or if the existing file system is not VFAT.
2017-01-23 22:25:47 -08:00
Qi Luo
930ee3f89d [baseimage] Install package without starting service (#171)
* Install package without starting service

* No need to mount /sys in chroot

* (comment)
2016-12-30 10:40:40 -08:00