Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (2) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (31) javascript (3) Linux (167) Mac (19) Machine Learning (1) mySQL (48) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (47) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Tuesday, 27 November 2018

Removing LVM



# df -hP | grep -i data01
/dev/mapper/datavg-testlv  976M  2.6M  907M   1% /data01

# lvs
  LV     VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   centos -wi-ao---- 17.47g
  swap   centos -wi-ao----  2.00g
  testlv datavg -wi-ao----  1.00g
1. Delete the entry of the mount point from the /etc/fstab :
# cat /etc/fstab
...
/dev/mapper/datavg-testlv            /data01              ext4    defaults        0 0
...
2. Unmount the mount point :
# umount /data01
3. Disable lvm :
# lvchange -an /dev/datavg/testlv
4. Delete lvm volume :
# lvremove /dev/datavg/testlv
5. Disable volume group :
# vgchange -an datavg
6. Delete volume group :
# vgremove datavg
7. Delete physical Volumes being used for the volume group “datavg” :
# pvremove /dev/sdb  /dev/sdc

Tuesday, 20 November 2018

Slackbuilds

A note on Slackbuilds.

I noticed during some issues with fail2ban that as I had run my build script while anaconda2 was installed, this meant that the installation package when run would put binaries in the /opt/anaconds2/bin directory as opposed to /usr/bin

Even after removing anaconda2 directory and also entries from root and user .bashrc files, running the installation package, still put the fail2ban-client file in /opt/anaconds2/bin as opposed to /usr/bin

This I'm guessing was down to the fact that the python location was in my PATH when the build script was run and of course after this was removed, I rebuilt the installation package and installed and all was as expected.

I need to verify this as I thought you could run a build script and then use the installation package on a different machine, obviously with the same version of slackware but this may not be the case. Perhaps I was thinking about regular compiling into binaries?

rc.local_shutdown

#!/bin/sh
#
# /etc/rc.d/rc.local_shutdown:  Local system shutdown script.
#
# Put any local shutdown commands in here.

# by H Nisbet 02 Nov 2018

if [ -x /etc/rc.d/rc.tm351vm ]
then
        /etc/rc.d/rc.tm351vm suspend # attempt suspend first
#       /etc/rc.d/rc.tm351vm stop
fi

# Stop fail2ban:
if [ -x /etc/rc.d/rc.fail2ban ]; then
        echo "Stopping fail2ban: /etc/rc.d/rc.fail2ban stop"
        /etc/rc.d/rc.fail2ban stop
fi


# Stop Webminin:
if [ -x /etc/rc.d/rc.webmin ]; then
        echo "Stopping Webmin:   /etc/rc.d/rc.webmin stop"
        /etc/rc.d/rc.webmin stop

fi

rc.local

#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
if [ -x /etc/rc.d/rc.tm351vm ]
then
        /etc/rc.d/rc.tm351vm start

fi

# Start fail2ban
if [ -x /etc/rc.d/rc.fail2ban ]; then
        echo "Starting fail2ban:   /etc/rc.d/rc.fail2ban"
        /etc/rc.d/rc.fail2ban start
fi

# Log boot time...
/bin/date >> /var/log/boot.log

jail.conf

# Fail2Ban jail specifications file
#
# Comments: use '#' for comment lines and ';' (following a space) for inline comments
#
# Changes:  in most of the cases you should not modify this
#           file, but provide customizations in jail.local file, e.g.:
#
# [DEFAULT]
# bantime = 3600
#
# [ssh-iptables]
# enabled = true
#

fail2ban.conf

# Fail2Ban main configuration file
#
# Comments: use '#' for comment lines and ';' (following a space) for inline comments
#
# Changes:  in most of the cases you should not modify this
#           file, but provide customizations in fail2ban.local file, e.g.:
#
# [Definition]
# loglevel = 4
#

[Definition]

# Option:  loglevel
# Notes.:  Set the log level output.
#          1 = ERROR
#          2 = WARN
#          3 = INFO
#          4 = DEBUG
# Values:  NUM  Default:  3
#
loglevel = 3

# Option:  logtarget
# Notes.:  Set the log target. This could be a file, SYSLOG, STDERR or STDOUT.
#          Only one log target can be specified.
#          If you change logtarget from the default value and you are
#          using logrotate -- also adjust or disable rotation in the
#          corresponding configuration file
#          (e.g. /etc/logrotate.d/fail2ban on Debian systems)
# Values:  STDOUT STDERR SYSLOG file  Default:  /var/log/fail2ban.log
#
logtarget = /var/log/fail2ban.log

# Option: socket
# Notes.: Set the socket file. This is used to communicate with the daemon. Do
#         not remove this file when Fail2ban runs. It will not be possible to
#         communicate with the server afterwards.
# Values: FILE  Default:  /var/run/fail2ban/fail2ban.sock
#
socket = /var/run/fail2ban/fail2ban.sock

# Option: pidfile
# Notes.: Set the PID file. This is used to store the process ID of the
#         fail2ban server.
# Values: FILE  Default:  /var/run/fail2ban/fail2ban.pid
#
pidfile = /var/run/fail2ban/fail2ban.pid

Monday, 19 November 2018

Slackware Configuration

Network/Host name
netconfig
/etc/rc.d/rc.inet1.conf
/etc/hosts
/etc/hosts.deny
/etc/hosts.allow
/etc/resolve

Runlevel

rc.d 
/etc/rc.d/rc.local
/etc/rc.d/rc.local_shutdown

SSHD
/etc/ssh

Samba
/etc/rc.d/rc.samba
/etc/samba/smb.conf

SendMail
/etc/rc.d/rc.sendmail

Spamassassin

Apache
/etc/rc.d/rc.httpd
/etc/httpd/httpd.conf
/etc/httpd/extras/

ProFTPd
/etc/inetd.conf
users allow file?
/etc/proftpd.conf

awstats
/etc/awstats/
/var/run/awstats/
/var/lib/swstats/
Cron job: TBA
Update data: perl awstats.pl -config=mysite -update

Fail2ban
/etc/fail2ban/
/etc/rc.d/rc.fail2ban

awstats

Location of files for awstats in Slackware.

Site configuration files:
/etc/awstats/

Binaries or such:
/var/run/awstats/

Data:
/var/lib/swstats/

Cron job:
TBA

Update data:
perl awstats.pl -config=mysite -update