Syslog: Log Levels

0 -> emerg —-> System is unusable.
1 -> alert ——> Should be corrected immediately.
2 -> crit ——–> Failure in the system’s primary application.
3 -> err ———> An application has exceeded storage.
4 -> warning -> An error will occur if action is not taken.
5 -> notice —–> Events that are unusual.
6 -> info ——–> Normal operational messages.
7 -> debug —–> Debug level logging.

Hits: 537


Updated script to scan linux servers for viruses.

 Test log with Infected files
 LOGFILE="/var/log/clamav/clamav-$(/bin/date +'%Y-%m-%d').log";
 Need to build an email header to know which system is scanned.
 Gmail gateway is overwriting from line when it forwards the email.
 HEADER_OS_LEVEL="$(/bin/uname -a)";
 > /var/log/clamav/freshclam.log
Test clamscan
 /usr/bin/clamscan -ri /root/* > "$LOGFILE";
 /usr/bin/clamscan -ri --exclude-dir=/sys/* / > "$LOGFILE";
 get the value of "Infected lines"
 MALWARE=$(/bin/cat "$LOGFILE" | /bin/grep Infected | /usr/bin/cut -d" " -f3);
 if the value is not equal to zero, send an email with the log file attached
 if [ "$MALWARE" -ne "0" ];then
 /bin/echo " " > /var/log/clamav/EMAIL.MSG;
 /bin/echo "OS: $HEADER_OS_LEVEL" >> /var/log/clamav/EMAIL.MSG;
 /bin/echo "Date: $HEADER_DATE" >> /var/log/clamav/EMAIL.MSG;
 /bin/echo " " >> /var/log/clamav/EMAIL.MSG;
 /bin/echo "Freshclam Status:" >> /var/log/clamav/EMAIL.MSG;
 /bin/cat /var/log/clamav/freshclam.log >> /var/log/clamav/EMAIL.MSG;
 /bin/echo " " >> /var/log/clamav/EMAIL.MSG;
 /bin/echo "Log File: $LOGFILE" >> /var/log/clamav/EMAIL.MSG;
 /bin/cat "$LOGFILE" >> /var/log/clamav/EMAIL.MSG;
 /bin/cat /var/log/clamav/EMAIL.MSG | /usr/bin/mail -s "ClamAV Alert" "$EMAIL_TO";
 exit 0

Hits: 1

FreeNAS Debian UPS Specs

Initially the UPS was being monitored by a FreeNAS installation, this was changed due to performance issues unrelated to the UPS monitoring software. Details on the migration are still being compiled, meanwhile, read this.

How come I feel there was a lot of time wasted?!

Here are the readings from the UPS. I am disappointed that it is not reporting battery voltage, but at least I am getting % charged.

battery.charge: 100                     Battery charge (percent of full)
battery.charge.low: 28			Remaining battery level when UPS switches to LB (%) powerpanel			Driver name
driver.parameter.pollinterval: 2	
driver.parameter.port: /dev/ttyS0	Serial or USB port
driver.version: 2.2.2			Driver version - NUT release		
driver.version.internal: 0.23		Internal driver version
input.frequency: 60.3			Input line frequency (Hz)		
input.frequency.nominal: 60		Nominal input line frequency (Hz)
input.transfer.high: 145		High voltage transfer point (V)
input.transfer.low: 90			Low voltage transfer point (V)
input.voltage: 123			Input voltage (V)
input.voltage.nominal: 120		Nominal input voltage (V)
output.voltage: 0			Output voltage (V)
output.voltage.nominal: 120		Nominal output voltage (V)
ups.beeper.status: enabled		UPS beeper status
ups.delay.shutdown: 0			Shutdown with delay command (seconds)
ups.delay.start: 45			Wait before (re)starting (seconds)
ups.firmware: 5.100			UPS firmware
ups.load: 46				Load on UPS (percent of full)
ups.mfr: CyberPower			UPS manufacturer
ups.model: OP1500			UPS model
ups.serial: [unknown]			UPS serial number
ups.status: OL				UPS status
ups.temperature: 35.3			UPS temperature (degrees C)

Hits: 2

Raw FTP Commands

I retrieved it from here:

List of raw FTP commands
(Warning: this is a technical document, not necessary for most FTP use.)

Note that commands marked with a * are not implemented in a number of FTP servers.

Common commands

* ABOR – abort a file transfer
* CWD – change working directory
* DELE – delete a remote file
* LIST – list remote files
* MDTM – return the modification time of a file
* MKD – make a remote directory
* NLST – name list of remote directory
* PASS – send password
* PASV – enter passive mode
* PORT – open a data port
* PWD – print working directory
* QUIT – terminate the connection
* RETR – retrieve a remote file
* RMD – remove a remote directory
* RNFR – rename from
* RNTO – rename to
* SITE – site-specific commands
* SIZE – return the size of a file
* STOR – store a file on the remote host
* TYPE – set transfer type
* USER – send username

Less common commands

* ACCT* – send account information
* APPE – append to a remote file
* CDUP – CWD to the parent of the current directory
* HELP – return help on using the server
* MODE – set transfer mode
* NOOP – do nothing
* REIN* – reinitialize the connection
* STAT – return server status
* STOU – store a file uniquely
* STRU – set file transfer structure
* SYST – return system type

Syntax: ABOR

Aborts a file transfer currently in progress.

Syntax: ACCT account-info

This command is used to send account information on systems that require it. Typically sent after a PASS command.

Syntax: ALLO size [R max-record-size]

Allocates sufficient storage space to receive a file. If the maximum size of a record also needs to be known, that is sent as a second numeric parameter following a space, the capital letter “R”, and another space.

Syntax: APPE remote-filename

Append data to the end of a file on the remote host. If the file does not already exist, it is created. This command must be preceded by a PORT or PASV command so that the server knows where to receive data from.

Syntax: CDUP

Makes the parent of the current directory be the current directory.

Syntax: CWD remote-directory

Makes the given directory be the current directory on the remote host.

Syntax: DELE remote-filename

Deletes the given file on the remote host.

Syntax: HELP [command]

If a command is given, returns help on that command; otherwise, returns general help for the FTP server (usually a list of supported commands).

Syntax: LIST [remote-filespec]

If remote-filespec refers to a file, sends information about that file. If remote-filespec refers to a directory, sends information about each file in that directory. remote-filespec defaults to the current directory. This command must be preceded by a PORT or PASV command.

Syntax: MDTM remote-filename

Returns the last-modified time of the given file on the remote host in the format “YYYYMMDDhhmmss”: YYYY is the four-digit year, MM is the month from 01 to 12, DD is the day of the month from 01 to 31, hh is the hour from 00 to 23, mm is the minute from 00 to 59, and ss is the second from 00 to 59.

Syntax: MKD remote-directory

Creates the named directory on the remote host.

Syntax: MODE mode-character

Sets the transfer mode to one of:

* S – Stream
* B – Block
* C – Compressed

The default mode is Stream.

Syntax: NLST [remote-directory]

Returns a list of filenames in the given directory (defaulting to the current directory), with no other information. Must be preceded by a PORT or PASV command.

Syntax: NOOP

Does nothing except return a response.

Syntax: PASS password

After sending the USER command, send this command to complete the login process. (Note, however, that an ACCT command may have to be used on some systems.)

Syntax: PASV

Tells the server to enter “passive mode”. In passive mode, the server will wait for the client to establish a connection with it rather than attempting to connect to a client-specified port. The server will respond with the address of the port it is listening on, with a message like:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
where a1.a2.a3.a4 is the IP address and p1*256+p2 is the port number.

Syntax: PORT a1,a2,a3,a4,p1,p2

Specifies the host and port to which the server should connect for the next file transfer. This is interpreted as IP address a1.a2.a3.a4, port p1*256+p2.

Syntax: PWD

Returns the name of the current directory on the remote host.

Syntax: QUIT

Terminates the command connection.

Syntax: REIN

Reinitializes the command connection – cancels the current user/password/account information. Should be followed by a USER command for another login.

Syntax: REST position

Sets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR only); i.e. it must come after any PORT or PASV command.

Syntax: RETR remote-filename

Begins transmission of a file from the remote host. Must be preceded by either a PORT command or a PASV command to indicate where the server should send data.

Syntax: RMD remote-directory

Deletes the named directory on the remote host.

Syntax: RNFR from-filename

Used when renaming a file. Use this command to specify the file to be renamed; follow it with an RNTO command to specify the new name for the file.

Syntax: RNTO to-filename

Used when renaming a file. After sending an RNFR command to specify the file to rename, send this command to specify the new name for the file.

Syntax: SITE site-specific-command

Executes a site-specific command.

Syntax: SIZE remote-filename

Returns the size of the remote file as a decimal number.

Syntax: STAT [remote-filespec]

If invoked without parameters, returns general status information about the FTP server process. If a parameter is given, acts like the LIST command, except that data is sent over the control connection (no PORT or PASV command is required).

Syntax: STOR remote-filename

Begins transmission of a file to the remote site. Must be preceded by either a PORT command or a PASV command so the server knows where to accept data from.

Syntax: STOU

Begins transmission of a file to the remote site; the remote filename will be unique in the current directory. The response from the server will include the filename.

Syntax: STRU structure-character

Sets the file structure for transfer to one of:

* F – File (no structure)
* R – Record structure
* P – Page structure

The default structure is File.

Syntax: SYST

Returns a word identifying the system, the word “Type:”, and the default transfer type (as would be set by the TYPE command). For example: UNIX Type: L8

Syntax: TYPE type-character [second-type-character]

Sets the type of file to be transferred. type-character can be any of:

* A – ASCII text
* E – EBCDIC text
* I – image (binary data)
* L – local format

For A and E, the second-type-character specifies how the text should be interpreted. It can be:

* N – Non-print (not destined for printing). This is the default if second-type-character is omitted.
* T – Telnet format control (, , etc.)
* C – ASA Carriage Control

For L, the second-type-character specifies the number of bits per byte on the local system, and may not be omitted.

Syntax: USER username

Send this command to begin the login process. username should be a valid username on the system, or “anonymous” to initiate an anonymous login.

Hits: 68