Commit Graph

229 Commits

Author SHA1 Message Date
xumia
d291f19a75
[Build][201811] Fix the stretch mirror removed issue (#15082)
* [Build][201811] Fix the stretch mirror removed issue

* Remove default mirrors

* Fix mirror reference issue
2023-05-16 08:19:09 -07:00
Hua Liu
273ca3555a
[201811]: Improve sudo cat command for RO user. (#14428) (#14438)
Improve sudo cat command for RO user.

RO user can use sudo command show none syslog files.
2023-04-12 09:12:02 -07:00
Devesh Pathak
fa609b80f1 Fix to improve hostname handling (#12064)
* Fix to improve hostname handling
If config_db.json is missing hostname entry, hostname-config.sh ends
up deleting existing entry too and hostname changes to default 'localhost'

* default hostname to 'sonic` if missing in config file
2022-10-25 21:51:28 +00:00
Prince George
e9737814f8 Close console session due to user inactivity (#9890)
Signed-off-by: Prince George <prgeor@microsoft.com>
2022-10-25 21:28:25 +00:00
xumia
ee87a107cf
[201811] Change submodule path from Azure to sonic-net (#12314)
Why I did it
Change the path of sonic submodules that point to "Azure" to point to "sonic-net"

How I did it
Replace "Azure" with "sonic-net" on all relevant paths of sonic submodules
2022-10-12 21:07:04 +08:00
Sujin Kang
0bd40857d1
[201811] Add the hw reboot cause if it happened during software reboot (#11752)
Why I did it
Add the hardware reboot cause when the previous software reboot failed

How I did it
Check both hardware reboot cause and software reboot cause.
Add the hardware reboot as actual reboot cause
if any hardware reboot cause is available for any software reboot.

How to verify it
Perform reboots and verify the reboot-cause
2022-08-24 08:36:09 -07:00
liuh-80
bb65791060
Add j2 template for enable pam_limit and limit SSH session (#10298)
#### Why I did it
    When too many user login concurrently and run commands, SONiC may kernel panic on some device which has very limited memory.

#### How I did it
    Add j2 template for setup pam_limit plugin for limit SSH session per-user.

#### How to verify it
    Manually validate the j2 template can generate correct config file.

#### Which release branch to backport (provide reason below if selected)

- [x] 201811
- [ ] 201911
- [ ] 202006
- [x] 202012
- [x] 202106
- [x] 202111

#### Description for the changelog
    Add j2 template for setup pam_limit plugin for limit SSH session per-user.

#### A picture of a cute animal (not mandatory but encouraged)
2022-03-23 16:52:09 +08:00
Ying Xie
af6ad545a3
Revert "[201811] Check platform reboot cause to see if any reset happened during fast/warm-reboot (#8912)" (#10076)
This reverts commit a80319e2d0.
2022-02-24 07:27:30 -08:00
Renuka Manavalan
7910108fd8
porting PR #8223, which uses one shot timer to reaload tacacs config (#9987)
Why I did it
There is a small window between load & listen to config-DB. If TACACS config got updated during that gap, the listen will not show it, hence hostcfgd would miss it, until another update.

How I did it
porting PR #8223, which uses one shot timer to reload tacacs config.
2022-02-17 08:16:03 -08:00
Sujin Kang
a80319e2d0
[201811] Check platform reboot cause to see if any reset happened during fast/warm-reboot (#8912)
[201811] Check platform reboot cause to see if any reset happened during fast/warm-reboot

Why I did it
To recover syncd and swss from any cold reset during fast/warm-reboot

How I did it
Check platform reboot-cause to see if any cold reset happens for fast-reboot power up

How to verify it
Manual test
2021-12-01 10:50:55 -08:00
Renuka Manavalan
2a41e0f96b
[201811] disk_check.py: Change path to /usr/bin (#9074)
The scripts from sonic-utilities are installed into /usr/bin in 201811.
Hence correct path for disk_check.py to /usr/bin/
2021-10-26 18:22:10 -07:00
Ying Xie
6483bf48f6
[warmboot finalizer] load dhcpv6 copp rules when missing (#9048)
Why I did it
Need to enable DHCPv6 COPP rules.

How I did it
Load the separate DHCPv6 COPP rules after warm reboot if the rules are missing.

How to verify it
Warm reboot from an image doesn't have DHCPv6 COPP rules installed.
Warm reboot from an image have DHCPv6 COPP rules already installed.
In either case, the script did the right thing and only install the COPP rules if it is missing.

Signed-off-by: Ying Xie ying.xie@microsoft.com
2021-10-25 08:05:55 -07:00
Renuka Manavalan
52366b099d
[201811] Invoke disk check periodically (#8951)
* Invoke disk check periodically. (#7374)

Why I did it
Helps with periodic scan of disk for RO state.
If found, this script makes transient fix and raise error message.
2021-10-15 19:43:05 -07:00
Renuka Manavalan
77892832b7
Add service to restore TACACS from old config (#7560) (#8233)
Why I did it
In upgrade scenarios, where config_db.json is not carry forwarded to new image, it could be left w/o TACACS credentials.
Added a service to trigger 5 minutes after boot and restore TACACS, if /etc/sonic/old_config/tacacs.json is present.

How I did it
By adding a service, that would fire 5 mins after boot.
This service apply tacacs if available.

How to verify it
Upgrade and watch status of tacacs.timer & tacacs.service
You may create /etc/sonic/old_config/tacacs.json, with updated credentials
(before 5mins after boot) and see that appears in config & persisted too.
2021-08-02 10:33:55 -07:00
Blueve
22b5ebd792
[port_config] Introduce ad-hoc mport_config.json file (#8275)
Signed-off-by: Jing Kan jika@microsoft.com
2021-07-29 10:41:31 +08:00
xumia
a7725e6480
Fix vtysh shell-ingestion security issue (#7991)
Fix vtysh shell-ingestion security issue
Only expose the limited parameters of the command vtysh show.
2021-06-30 19:32:21 +08:00
xumia
78f90ac7a9
Support readonly vtysh for sudoers (#7383) (#7573)
* Support readonly vtysh for sudoers (#7383)

Why I did it
Support readonly version of the command vtysh

How I did it
Check if the command starting with "show", and verify only contains single command in script.

* Fix the type issue in rvtysh
2021-05-19 09:02:33 +08:00
Sumukha Tumkur Vani
b6ca3bd5bb
add EPMS devicetype (#7255) 2021-04-09 12:44:31 -07:00
rkdevi27
6c2fd18f51
Fixed S6000 abrupt reboot in 201811 (#6923)
Why I did it
The S6000 devices, the cold reboot is abrupt and it is likely to cause issues which will cause the device to land into EFI shell. Hence the platform reboot will happen after graceful unmount of all the filesystems as in S6100.

How I did it
Moved the platform_reboot to platform_reboot_override and hooked it to the systemd shutdown services as in S6100.
Fixed the "/host unmount failed" issue as well in 201811.

How to verify it
Issue "reboot" command to verify if the reboot is happening gracefully.
2021-03-12 11:09:54 -08:00
arlakshm
ddbfe0631d [baseimage]: add docker ps to the sudoer file (#6604)
fixes Azure/sonic-utilities#1389

With the recent changes in sudoer files. The  show commands fails for the read-only users.
The problem here is the 'docker ps' is failing in the function [get_routing_stack()](8a1109ed30/show/main.py (L54)) therefore all the CLI commands are failing.

Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <arlakshm@microsoft.com>
2021-01-29 08:38:47 -08:00
Qi Luo
a6295f82be
Cleanup sudoers file (#6523)
Same as https://github.com/Azure/sonic-buildimage/pull/6518
For 201811 branch
2021-01-21 14:42:10 -08:00
Renuka Manavalan
b2e3ba800e
[tacacs]: Restore from TACACS backup if present, upon load-minigraph during update-graph action. (#6407)
Why I did it
During upgrade, if config is loaded from minigraph, it would miss TACACS credentials. This leads to device losing remote user accessibility

- How I did it
During update graph, when config is loaded from minigraph, look for TACACS credentials back-up and load that if available

- How to verify it
Remove /etc/sonic/config-db.json, save TACACS credentials in /etc/sonic/tacacs.json and do a Image upgrade. Do image upgrade and boot into new image. Verify remote user access is available.

NOTE: This change is available in master via PR #6285
2021-01-11 13:57:20 -08:00
Ying Xie
9ea38c417c [rc.local] separate configuration migration and grub installation logic (#5528)
To address issue #5525

Explicitly control the grub installation requirement when it is needed.
We have scenario where configuration migration happened but grub
installation is not required.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
2020-10-05 15:11:35 +00:00
Blueve
55d2d15e4e [conf] append nos-config-part for s6100 (#5234)
* [conf] append nos-config-part for s6100

* modify rc.local

Signed-off-by: Guohan Lu <lguohan@gmail.com>

* Update rc.local

Co-authored-by: Blueve <jika@microsoft.com>
Co-authored-by: Guohan Lu <lguohan@gmail.com>
Co-authored-by: Ying Xie <yxieca@users.noreply.github.com>
2020-09-08 19:30:33 +00:00
Joe LeVeque
c909422abc [caclmgrd] Always restart service upon process termination (#5065) 2020-08-31 20:31:13 +00:00
Joe LeVeque
4547ea022d [caclmgrd] Improve code reuse (#4931)
Improve code reuse in `generate_block_ip2me_traffic_iptables_commands()` function.
2020-08-31 20:30:54 +00:00
Joe LeVeque
6120145bf1 [caclmgrd] remove default DROP rule on FORWARD chain (#5034) 2020-07-24 19:09:32 +00:00
Joe LeVeque
cf142e7e6c [caclmgrd] Filter DHCP packets based on dest port only (#4995) 2020-07-17 18:17:27 +00:00
padmanarayana
062fd849b3 [DELL]: FTOS to SONiC fast conversion fixes (#4807)
While migrating to SONiC 20181130, identified a couple of issues:
1. union-mount needs /host/machine.conf parameters for vendor specific checks : however, in case of migration, the /host/machine.conf is extracted from ONIE only in https://github.com/Azure/sonic-buildimage/blob/master/files/image_config/platform/rc.local#L127.
2. Since grub.cfg is updated to have net.ifnames=0 biosdevname=0, 70-persistent-net.rules changes are no longer required.
2020-06-19 22:35:29 +00:00
Joe LeVeque
d9b8bed916 [caclmgrd] Don't limit connection tracking to TCP (#4796)
Don't limit iptables connection tracking to TCP protocol; allow connection tracking for all protocols. This allows services like NTP, which is UDP-based, to receive replies from an NTP server even if the port is blocked, as long as it is in reply to a request sent from the device itself.
2020-06-19 04:33:50 +00:00
Ying Xie
4cd54ed58c [ntp] disable ntp long jump (#4748)
Found another syncd timing issue related to clock going backwards.
To be safe disable the ntp long jump.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
2020-06-11 22:03:22 +00:00
Joe LeVeque
7ae30d7898 [caclmgrd] Get first VLAN host IP address via next() (#4685)
I found that with IPv4Network types, calling list(ip_ntwrk.hosts()) is reliable. However, when doing the same with an IPv6Network, I found that the conversion to a list can hang indefinitely. This appears to me to be a bug in the ipaddress.IPv6Network implementation. However, I could not find any other reports on the web.

This patch changes the behavior to call next() on the ip_ntwrk.hosts() generator instead, which returns the IP address of the first host.
2020-06-09 16:30:45 +00:00
Joe LeVeque
494701a0ee [caclmgrd] Allow more ICMP types (#4625) 2020-06-09 16:07:51 +00:00
Joe LeVeque
7da0c15af5 [caclmgrd] Ignore keys in interface-related tables if no IP prefix is present (#4581)
Since the introduction of VRF, interface-related tables in ConfigDB will have multiple entries, one of which only contains the interface name and no IP prefix. Thus, when iterating over the keys in the tables, we need to ignore the entries which do not contain IP prefixes.
2020-06-09 16:05:40 +00:00
Joe LeVeque
3ee9c5d1e3 [caclmgrd] Add some default ACCEPT rules and lastly drop all incoming packets (#4412)
Modified caclmgrd behavior to enhance control plane security as follows:

Upon starting or receiving notification of ACL table/rule changes in Config DB:
1. Add iptables/ip6tables commands to allow all incoming packets from established TCP sessions or new TCP sessions which are related to established TCP sessions
2. Add iptables/ip6tables commands to allow bidirectional ICMPv4 ping and traceroute
3. Add iptables/ip6tables commands to allow bidirectional ICMPv6 ping and traceroute
4. Add iptables/ip6tables commands to allow all incoming Neighbor Discovery Protocol (NDP) NS/NA/RS/RA messages
5. Add iptables/ip6tables commands to allow all incoming IPv4 DHCP packets
6. Add iptables/ip6tables commands to allow all incoming IPv6 DHCP packets
7. Add iptables/ip6tables commands to allow all incoming BGP traffic
8. Add iptables/ip6tables commands for all ACL rules for recognized services (currently SSH, SNMP, NTP)
9. For all services which we did not find configured ACL rules, add iptables/ip6tables commands to allow all incoming packets for those services (allows the device to accept SSH connections before the device is configured)
10. Add iptables rules to drop all packets destined for loopback interface IP addresses
11. Add iptables rules to drop all packets destined for management interface IP addresses
12. Add iptables rules to drop all packets destined for point-to-point interface IP addresses
13. Add iptables rules to drop all packets destined for our VLAN interface gateway IP addresses
14. Add iptables/ip6tables commands to allow all incoming packets with TTL of 0 or 1 (This allows the device to respond to tools like tcptraceroute)
15. If we found control plane ACLs in the configuration and applied them, we lastly add iptables/ip6tables commands to drop all other incoming packets
2020-06-09 04:21:27 +00:00
Ying Xie
f52e59a032
[ntp] enable/disable NTP long jump according to reboot type (#4582)
- Enable NTP long jump after cold reboot.
- Disable NTP long jump after warrm/fast reboot.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
2020-05-12 12:23:47 -07:00
Joe LeVeque
ceb878414d [process-reboot-cause] If software reboot cause is unknown add note if first boot into new image (#4538) 2020-05-08 20:37:22 +00:00
SuvarnaMeenakshi
fba321ae6c [ntp]: Add "tinker panic 0" in ntp.conf to avoid ntpd from panic (#4263)
- What I did
Add configuration to avoid ntpd from panic and exit if the drift between new time and current system time is large.

- How I did it
Added "tinker panic 0" in ntp.conf file.

- How to verify it
[this assumes that there is a valid NTP server IP in config_db/ntp.conf]

Change the current system time to a bad time with a large drift from time in ntp server; drift should be greater than 1000s.
Reboot the device.
Before the fix:
3. upon reboot, ntp-config service comes up fine, ntp service goes to active(exited) state without any error message. This is because the offset between new time (from ntp server) and the current system time is very large, ntpd goes to panic mode and exits. The system continues to show the bad time.

After the fix:
3. Upon reboot, ntp-config comes up fine, ntp services comes up from and stays in active (running) state. The system clock gets synced with the ntp server time.
2020-04-03 19:42:17 +00:00
Joe LeVeque
cbf7c7d80d [rsyslog] Suppress duplicate messages from base image and all Docker containers (#2497) 2020-04-02 21:42:01 +00:00
yozhao101
1cc6141a93 [Monit] Delay start of monitoring for 5 minutes (#4281) 2020-03-19 22:49:04 +00:00
zhenggen-xu
19c1ad36a5
[201811] [interfaces-config.sh] Flush the loopback interface addresses (#4234)
* [interfaces-config.sh] Flush the loopback interface before configure it

Without this, you may end up with more and more ip addresses
on loopback interface after you change the loopback ip and do config reload

Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
2020-03-09 16:14:59 -07:00
Stephen Sun
726fecaf8b [process-reboot-cause]Clean up the process-reboot-cause as reqired in issue 3927 (#4128) 2020-02-14 19:37:30 +00:00
Joe LeVeque
4af3e5066d
[interfaces-config.sh] Force lo interface down (#4149)
Force "lo" interface down in interfaces-config.sh to prevent interface-config.service from failing with the following error:

```
-- The result is failed.
systemd[1]: networking.service: Unit entered failed state.
systemd[1]: networking.service: Failed with result 'exit-code'.
interfaces-config.sh[29232]: Job for networking.service failed because the control process exited with error code.
interfaces-config.sh[29232]: See "systemctl status networking.service" and "journalctl -xe" for details.
interfaces-config.sh[29232]: ifdown: interface lo not configured
interfaces-config.sh[29232]: RTNETLINK answers: File exists
interfaces-config.sh[29232]: ifup: failed to bring up lo
systemd[1]: interfaces-config.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: Failed to start Update interfaces configuration.
-- Subject: Unit interfaces-config.service has failed
```

Failure to bring down the interface will result in a failure to subsequently bring the interface back up.
2020-02-13 22:38:21 -08:00
Joe LeVeque
2e43e6bc6c [caclmgrd] Fix application of IPv6 service ACL rules (part 2) (#4036) 2020-01-18 01:44:42 +00:00
Sujin Kang
956b8fd7c7 [reboot cause]: Delay process-reboot-cause service until network connection is stable (#4003) 2020-01-11 01:09:08 +00:00
yozhao101
27a2e0692b [Monit] Change the monitoring period from 120 seconds to 60 seconds. (#3974)
* [Monit] Change the monitoring period of monit from 120 seconds to 60
seconds and also at the same time double the interval for existing sonic monit config file in
host.

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
2020-01-11 01:01:34 +00:00
Joe LeVeque
640023ec57 [caclmgrd] Fix application of IPv6 service ACL rules (#3917) 2020-01-06 21:04:52 +00:00
Renuka Manavalan
da7db51259 corefile uploader: Updates per review comments offline (#3915)
* Updates per review comments
1) core_uploader service waits for syslog.service
2) core_uploader service enabled for restart on failure
3) Use mtime instead of file size + ample time to be robust.

* Avoid reloading already uploaded file, by marking the names with a prefix.

* Updated failing path.
1) If rc file is missing or required data missing, it periodically logs error in forever loop.
2) If upload fails, retry every hour with a error log, forever.

* Fix few bugs

* The binary update_json.py will come from sonic-utilities.
2020-01-06 21:03:40 +00:00
Renuka Manavalan
6db0c76a06 Corefile uploader service (#3887)
* Corefile uploader service

1) A service is added to watch /var/core and upload to Azure storage
2) The service is disabled on boot. One may enable explicitly.
3) The .rc file to be updated with acct credentials and http proxy to use.
4) If service is enabled with no credentials, it would sleep, with periodic log messages
5) For any update in .rc, the service has to be restarted to take effect.

* Remove rw permission for .rc file for group & others.

* Changes per review comments.
Re-ordered .rc file per JSON.dump order.
Added a script to enable partial update of .rc, which HWProxy would use to add acct key.

* Azure storage upload requires python module futures, hence added it to install list.

* Removed trailing spaces.

* A mistake in name corrected.
Copy the .rc updater script to /usr/bin.
2020-01-06 21:02:14 +00:00
Joe LeVeque
9ee8eba77c [monit] Build from source and patch to use MemAvailable value if available on system (#3875) 2020-01-06 20:59:32 +00:00