Thursday, April 29, 2021

forward authentication log on freeradius to syslog server

enable: authen log on radius.log

edit /etc/freeradius/radiusd.conf


#  Log authentication requests to the log file.

#

#  allowed values: {no, yes}

#

auth = yes 

#  Log passwords with the authentication requests.

#  auth_badpass  - logs password if it's rejected

#  auth_goodpass - logs password if it's correct

#

#  allowed values: {no, yes}

#

auth_badpass = yes

auth_goodpass = yes


restart services freeradius:

/etc/init.d/freeradius restart


create file rc.capture


#!/bin/bash

tail -F /var/log/freeradius/radius.log | logger -t freeradius -p local3.info &


chmod a+x /etc/init.d/rc.capture


add line in /etc/rc.local file

/etc/init.d/rc.capture


set remote syslog server

local3.* @10.10.31.71:514

# @ udp

# @@ tcp

Sunday, April 18, 2021

Python Random Function

import math

import random

import string



def generate_random_digit(length):

    digits = "0123456789"

    otp = ""


    for i in range(length):

        otp += digits[math.floor(random.random() * 10)]


    print(otp)



def generate_random(length):

    print(string.ascii_uppercase)

    print(string.ascii_lowercase)

    print(string.ascii_letters)

    print(string.digits)

    print(''.join(random.choices(string.digits, k=length)))

    print(''.join(random.choices(string.ascii_letters+string.digits, k=length)))

    print(''.join(random.choices(string.ascii_uppercase+string.digits, k=length)))



generate_random_digit(8)

generate_random(10)

Tuesday, February 9, 2021

Error getting keypair for CA issuer: certificate is not a CA

edit file /etc/ssl/openssl.cnf


[ v3_ca ]

basicConstraints = critical,CA:TRUE

subjectKeyIdentifier = hash

authorityKeyIdentifier = keyid:always,issuer:always


generate csr with option  -extensions v3_ca 

ex. 


openssl req  \

    -x509 \

    -new \

    -nodes \

    -key private/univ-ca.key.pem \

    -sha256 \

    -days 1825 \

    -out certs/univ-ca.cert.pem \

    -subj '/C=TH/O=YOU-ORG-NAME/emailAddress=YOU_EMAIL' \

    -passin pass:$CA_PASS \

    -extensions v3_c

Monday, December 21, 2020

How to access from local network in WSL2

add port: 

netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=172.20.216.249


delete port:

netsh interface portproxy delete v4tov4 listenport=3000 listenaddress=0.0.0.0


show port:

netsh interface portproxy show all


ex.

PS C:\Windows\system32> netsh interface portproxy show all

Listen on ipv4:             Connect to ipv4:


Address         Port        Address         Port

--------------- ----------  --------------- ----------

0.0.0.0         3000        172.20.216.249  3000

0.0.0.0         8080        172.20.216.249  8080


Monday, December 7, 2020

PowerShell Connections for Office365 Administrators

Office 365/Azure AD

Microsoft Online Services Sign-in Assistant for IT Professionals 

PS C:\>Install-Module MSOnline

PS C:\>$credential = Get-Credential

PS C:\>Connect-MsolService -Credential $Credential


Azure AD

PS C:\>Install-Module AzureAD

PS C:\>Connect-AzureAD


Exchange Online

PS C:\>$credential = Get-Credential

PS C:\>$exosession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid -Credential $credential -Authentication Basic –AllowRedirection

PS C:\>Import-PSSession $exosession


Microsoft Teams

PS C:\>Install-Module -Name MicrosoftTeams

PS C:\>Install-Module -Name MicrosoftTeams -AllowClobber

PS C:\>Connect-MicrosoftTeams


Skype for Business Online

Skype for Business Online PowerShell Module 

PS C:\>$credential = Get-Credential

PS C:\>$skypesession = New-CsOnlineSession -Credential $credential

PS C:\>Import-PSSession $skypesession


SharePoint Online

SharePoint Online Management Shell

PS C:\>$Credential = Get-Credential

PS C:\>Connect-SPOService -url https://yourtenantname-admin.sharepoint.com -Credential $credential

ex. Connect-SPOService -url https://my365-admin.sharepoint.com -Credential $credential

PS C:\>Get-Command -Noun SPO*


Security and Compliance Center

PS C:\>$credential = Get-Credential

PS C:\>$ccsession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $Credential -Authentication Basic -AllowRedirection

PS C:\>Import-PSSession $ccsession


ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout