Saturday, February 5, 2022

Exploring temp senors in fortigates

Various fortigate models have sensor details. These are also pollable via snmp. 

Sample outputs





Depending on models type you may or may not  have fan speeds. 








NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=

         o
      /      \ 


SNMPv3 options fortios 6.4.8

 This is a quick and simple how to setup SNMPv3 in a fortigate. 1st off the fortios is very powerful and has numerous options.


We should set up passphrase for encryption and authenticaion



Make sure to research the hash type that is support for authentication.

fortios has a wide supported options, more than other security vendors md5 SHA1 SHA256 SHA512





The final configuration would look similar to the below




To test ensure the interface that your accessing has snmp enabled





NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o

        /  \

Tuesday, February 1, 2022

Playing around with junos rpc and to make rpc calls to gatherdata

 In my day job we trigger alerts for various alarms but by the time we get around to investigating it might  be 10m 1hours or 1 days later. We need some type of hooks to gather systems state of the device


Here's a playbook I crafted around around that us junos_rpc

(ans1) root@kfelix-HP-Slim-Desktop-S01-pF1xxx:~/ansible/ans1# ansible --version

ansible [core 2.12.2]

  config file = None

  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']

  ansible python module location = /root/ansible/ans1/lib/python3.8/site-packages/ansible

  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections

  executable location = /root/ansible/ans1/bin/ansible

  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]

  jinja version = 3.0.3

  libyaml = True


inventory file details 


[all:vars]

ansible_connection=netconf

ansible_netconf_user=ansible_nms

ansible_netconf_pass=NmStest1234

ansible_ssh_user=ansible_nms

ansible_ssh_pass=NmStest1234

ansible_network_os=junos


[sw]


192.0.2.1


Now to the playbook it runs a series os rpc commands that's dump into file. Later we can call up a task to email or copy the file to a "dest"


---

- name: RPC_callouts

  hosts: all

  connection: local

  gather_facts: no

  roles:

  - Juniper.junos

  

  vars: 

    output: text

  tasks:

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-bgp-summary-information"

      register: result1

    - name: GrabCollectDetails1

      junos_rpc: 

        rpc="get-interface-information"

      register: result2

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-route-engine-information"

      register: result3

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-arp-table-information"

      register: result4

    - name: GrabCollectDetails2

      junos_rpc:

        rpc="get-software-information"

      register: result5

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-route-summary-information"

      register: result6

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-ospf-interface-information"

      register: result7

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-ethernet-switching-table-information"

      register: result8 

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-alarm-information"

      register: result9

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-system-uptime-information"

      register: result10

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-commit-information"

      register: result11

    - name: GrabCollectDetails1

      junos_rpc:

        rpc="get-virtual-chassis-status-information"

      register: result12


    - name: Set to File that we Email and convert

      lineinfile:

        create: yes

        line: "{{item}}"

        path: /solariswind/alarmEvent/{{ inventory_hostname }}.txt

      with_items: "{{ result1.output, result2.output, result3.output, result4.output, result5.output, result6.output, result7.output, result8.output, result9.output, result10.output, result11.output, result12.output  }}"




So the file at /solariswind/alarmEvent/{{ inventory_hostname }}.txt would look similar to the below



-rw-r--r-- 1 ansible1 ansible1 230237 Nov 10 02:25 192.0.2.1.txt



Items I've been exploring has been to see other outputs formats or xml2text converter and haven't had time to fully investigate options










NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=

         o
      /      \