madwulf

Rancid commands

Jan 22nd, 2022 (edited)
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #Adding router
  2. vi /usr/local/rancid/var
  3. 10.64.128.130;cisco;up
  4. vi /home/rancid/.cloginrc
  5.  
  6. #Credentials
  7. add user * william
  8. add password * william
  9. add method * ssh
  10. add autoenable * 1
  11.  
  12. #Force rancid to check device config
  13. /usr/local/rancid/bin/rancid-run
  14.  
  15. #Rancid Error Logs
  16. /usr/local/rancid/var/logs/
  17.  
  18. #Automation
  19. crontab -e
  20. 0 * * * * /usr/local/rancid/bin/rancid-run /* Hourly
  21. 0 0 * * * /usr/local/rancid/bin/rancid-run /* Daily
  22. 0 0 * * 0 /usr/local/rancid/bin/rancid-run /* Weekly
  23. 0 0 1 * * /usr/local/rancid/bin/rancid-run /* Monthly
  24. 0 0 1 1 * /usr/local/rancid/bin/rancid-run /* Year
  25.  
  26. #Test cerds
  27. /usr/local/rancid/bin/clogin -f /home/rancid/.cloginrc myrouter
  28.  
  29. #Setup mail server
  30. vi /usr/local/rancid/bin/control_rancid
  31.  
  32. SENDMAIL=${SENDMAIL:=/sbin/sendmail};
  33. postconf -e 'relayhost = smtp-relay.sendinblue.com:587'
  34. relayhost = [smtp-relay.XXXXX.com]:587
  35.  
  36. smtp-relay.XXXXX.com [email protected]:XXXXXX
  37. vi /etc/postfix/sasl_passwd
  38. postmap /etc/postfix/sasl_passwd
  39.  
  40. chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
  41. chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
  42.  
  43. #Outbound relay settings
  44. /etc/postfix/main.cf
  45.  
  46. relayhost = smtp-relay.XXXXX.com:587
  47. smtp_sasl_auth_enable = yes
  48. smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
  49. smtp_sasl_security_options = noanonymous
  50. smtp_tls_security_level = may
  51. header_size_limit = 4096000
  52.  
  53. #Adding aliases
  54. vi /etc/aliases
  55.  
  56. rancid-Switches: [email protected]
  57. rancid-admin-Switches: [email protected]
  58.  
  59. newaliases
  60. systemctl enable postfix && systemctl start postfix
  61.  
  62. #Sending Test Emails
  63. echo "Test Postfix system" | sendmail -v "Postfix Email setup" [email protected]
  64. echo "this is a test email." | mailx -r [email protected] -s hello [email protected]
  65.  
  66. #Flush mailq
  67. postqueue -f
  68.  
  69. #Cleaning Sendmail Configuration File
  70. grep -vE '^$|#' /etc/postfix/main.cf
  71. install this package: cyrus-sasl-plain
  72.  
  73. #Logs
  74. /var/log/mail.log
Add Comment
Please, Sign In to add comment