Skip to content

Instantly share code, notes, and snippets.

@teridon
teridon / nic_parameters.yml
Last active January 26, 2024 14:52
ansible windows change NIC advanced parameters that break the network connection
---
- name: disable some NUC NIC driver features
hosts: windows,!gs483-actb-daq*
gather_facts: yes
become: yes
tasks:
- name: Get Hardware Model
win_shell: (Get-CimInstance -ClassName Win32_ComputerSystem).Model
register: model
@teridon
teridon / check_ssh_cert.sh
Last active December 12, 2022 22:03
tests the validity period of your CA-signed SSH host keys (nagios plugin output)
#!/bin/bash
# If $host has a certificate, `ssh -v` will output something like:
# debug1: Server host certificate: ssh-ed25519-cert-v01@openssh.com SHA256:QD2N2jIKh14Ef3A9yfu9Jw2NOpPtDT01aFRP9/rNI+E, serial 0 ID "gs483-fwdev01 host key" CA ssh-rsa SHA256:ws/24503Ukwp2mVwxe18LRKz63A2elSm5a1FeLqAV70 valid from 2019-12-19T10:05:16 to 2020-12-24T10:10:16
# StrictHostKeyChecking=no so that ssh doesn't hang prompting to accept keys
# but UserKnownHostsFile=/tmp/check_ssh_cert_known_hosts to prevent adding keys to the user's known_hosts file
check_exe="ssh -v -o PreferredAuthentications=none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/tmp/check_ssh_cert_known_hosts"
# If you have multiple certs (one for each algorithm) you need to connect multiple times to see them all
# for ESXi hosts, you only want to check RSA keys; i.e. "-a ssh-rsa-cert-v01@openssh.com"
algolist="ecdsa-sha2-nistp256-cert-v01@openssh.com ssh-ed25519-cert-v01@openssh.com ssh-rsa-cert-v01@openssh.com"
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class DigitalConcertHallIE(InfoExtractor):
IE_DESC = 'DigitalConcertHall extractor'
# originally from http://www.peetersonline.nl/wp-content/get-nicsettings.txt
$serverName = Read-Host "Enter server name"
$NicConfig = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $serverName
$myCol = @()
ForEach ($Nic in $NicConfig)
{
If ($Nic.IPAddress -ne $null)
{
$myObj = "" | Select-Object Description, DHCPEnabled, IPAddress, IPSubnet, DefaultIPGateway, DNSServers, WINSServers, NICModel, SpeedDuplex
$myObj.Description = $Nic.Description