1. Enable serial console with command :
systemctl enable --now serial-getty@ttyS0.service 2. Connecting to guest OS from KVM with command:
virsh console [VM_NAME]
ref: ostechnix.com
1. Enable serial console with command :
systemctl enable --now serial-getty@ttyS0.service 2. Connecting to guest OS from KVM with command:
virsh console [VM_NAME]
ref: ostechnix.com
Problem :
1. Can't start RADIUS Systemd service.
2. Log show like this.
Oct 9 00:00:49 radius1 sh[1114]: C = FR, ST = Radius, L = Somewhere, O = Example Inc., emailAddress = admin@example.org, CN = Example Certificate Authority
Oct 9 00:00:49 radius1 sh[1114]: error 10 at 1 depth lookup: certificate has expired
Oct 9 00:00:49 radius1 sh[1114]: C = FR, ST = Radius, O = Example Inc., CN = Example Server Certificate, emailAddress = admin@example.org
Oct 9 00:00:49 radius1 sh[1114]: error 10 at 0 depth lookup: certificate has expired
Oct 9 00:00:49 radius1 sh[1114]: error server.pem: verification failed
Oct 9 00:00:49 radius1 sh[1114]: make: *** [Makefile:107: server.vrfy] Error 2
Oct 9 00:00:49 radius1 rsyslogd[1098]: imjournal: journal files changed, reloading... [v8.1911.0-6.el8 try https://www.rsyslog.com/e/0 ]
Oct 9 00:00:49 radius1 systemd[1]: radiusd.service: Control process exited, code=exited status=2
Oct 9 00:00:49 radius1 systemd[1]: radiusd.service: Failed with result 'exit-code'.
Oct 9 00:00:49 radius1 systemd[1]: Failed to start FreeRADIUS high performance RADIUS server..
Cause :
Certificate file in `/etc/raddb/certs/` have any expired certificates.
Resolution 1 (If you do not user certificate in /Certs ) :
Delete all certificate files in `/raddb/certs` with this command.
rm -f *.pem *.der *.csr *.crt *.key *.p12 serial* index.txt* Resolution 2 :
Create new certificate new certificate instead expired certs.
1. Show all zone name and information about those zone.
firewall-cmd --list-all-zones
2. Create new zone.
firewall-cmd --new-zone=dmz2 --permanent
3. Add source network or source IP to firewall zone to allow those network access allow services or port number in specific zone. firewall-cmd --zone=dmz2 --add-source=192.168.0.0/24 --permanent
firewall-cmd --reload #Apply
4. Add service port to allow sources network in a zone to access those port.
firewall-cmd --zone=dmz2 --add-port=80/tcp --add-port=443 --permanent
firewall-cmd --reload #apply
tar -C /usr/local -xzf go-xx.tar
ln -s /usr/bin/go/ /usr/local/go/bin
mkdir /go
export GOPATH=/go
This topic talking about alternative way to "Detect and Prevent ssh brute force"
for Linux Server with logstash ipset and iptables on CentOS7
First Step: Create Preventive Mechanism
Create a preventive mechanism with iptable and ipset for blocking an attack source
with brute force's source ip.
install and config ipset:
yum -y install ipset
ipset create block hash:ip
config iptables rule:
iptables -A INPUT -p tcp -m set --match-set block src -j DROP
Second Step: Create Detection Mechanism
Install and config Logstash for analyze sshd log (/var/log/secure) to identify
source ip address of ssh brute force
enable logstash on boot:
systemctl enable logstash
config logstash: copy this configuration and replace in to file "/etc/logstash/conf.d/logstash"
input{
file{
path => ["/var/log/secure"]
}
}
output{
#push output to file
file {path => "/var/log/blacklist"}
# stdout { codec => json_lines }
}
filter{
grok {
match => ["message","%{MONTH:month}(?: | )%{MONTHDAY:day} %{TIME:time} %{WORD} %
{WORD:prog}\[%{DATA}: %{DATA:detail}(?: logname=(?:%{WORD:logname}|)|)(?: uid=(?:%{WORD:uid}|)|)(?: euid=(?:%{WORD:euid}|)|)(?: tty=(?:%{WORD:tty}|)|)(?: ruser=(?:%{WORD:ruser}|)|) rhost=%{IP:remoteIP}(?: user=%{DATA:remoteUser}|)"]
remove_field => ["message"]
}
#drop event if remoteIP is missing.
if ![remoteIP] {
drop { }
}
# block remoteIP when authentication fail 3 time.
throttle {
before_count => 0
after_count => 3
period => 30
key => "%{remoteIP}"
add_field => { "block" => "true"}
}
if [remoteIP] and [block] == "true"{
ruby {
code => "
`/usr/sbin/ipset add block #{event['remoteIP']} timeout 86400 `
"
}
}
}
restart logstash service:
systemctl restart logstash
optional : You can send event data form logstash to elasticsearch for long-term analyze
Introduction: This guide will walk you through the process of importing your SSH private key to a Yubikey (PIV) for SSH authentication on y...