Check RAM Speed and type in Linux

To see what RAM speed and type you have run this command:

 sudo dmidecode --type 17 

The output will look something like this:


# dmidecode 2.11
SMBIOS 2.8 present.
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.

Handle 0x003F, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x003E
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 8192 MB
Form Factor: SODIMM
Set: None
Locator: DIMM 1
Bank Locator: Channel A Slot 0
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MHz
Manufacturer: Kingston
Serial Number: 097054251107
Asset Tag: 9876543210
Part Number: 9905428-087.A00G
Rank: 2
Configured Clock Speed: 1600 MHz

Obviously you should or would be only running this on a physical box.

The detox utility

The detox utility renames files to make them easier to work with. It removes spaces and other such annoyances. It’ll also translate or cleanup Latin-1 (ISO 8859-1) characters encoded in 8-bit ASCII, Unicode characters encoded in UTF-8, and CGI escaped characters.

Sequences:
detox is driven by a configurable series of filters, called a sequence. Sequences are covered in more detail in detoxrc(5) and are discoverable with the -L option. Some examples of default sequences are iso8859_1 and utf_8.

Options:

The main options:

-f configfile
Use configfile instead of the default configuration files for loading translation sequences. No other config file will be parsed.
-h –help
Display helpful information.

-L’ List the currently available sequences. When paired with -v this option shows what filters are used in each sequence and any properties applied to the filters.

-n –dry-run
Doesn’t actually change anything. This implies the -v option.

-r’ Recurse into subdirectories.

-s sequence
Use sequence instead of default.

–special
Works on special files (including links). Normally detox ignores these files.

-v’ Be verbose about which files are being renamed.

-V’ Show the current version of detox.

Reference:
http://detox.sourceforge.net/

 

Find any E-Mail Address or Proxy Address In Active Directory

Who has this e-mail address? The address could be one of many different types of objects. A user mailbox, shared mailbox, distribution list, public folder, contact or resource could all contain that specific e-mail address. The problem with the Exchange Management Console in Exchange 2010 does not allow you to find any e-mail address only the primary.

Exchange Commandlets:

1: The following Exchange commandlet is the easiest method to find a specific e-mail address
or portion of an e-mail address. This will find any object within Exchange that has an exact
match to the e-mail address you place in the filter with -eq or email portion when using -like.

Get-Recipient [email protected]

Get-Recipient -Filter {EmailAddresses -like "*emailportion*"}

2: The following examples highlight the individual commandlets that target and return the
specific Exchange object types. You can substitute -eq with -like to include wild cards.

Get-Mailbox -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Get-MailboxContact -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Get-DistributionGroup -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Get-MailUser -Filter {EmailAddresses -eq "[email protected]" -or WindowsEmailAddress -eq "[email protected]"}

Reference:
http://powershellblogger.com/2015/10/find-any-e-mail-address-or-proxy-address-in-active-directory/

 

Reset Juniper SSG firewall password

If you are faced with not knowing the admin password for a Juniper SSG based firewall, you can reset to factory defaults. Ideally you should have been backing up the configuration and keeping your password safe with a password manager – if not and/or you have been provided with  an SSG or purchased from Ebay etc read on….

Console Cable Option:

  1. Connect via Console cable.
  2. Login with the serial number of the SSG as the username and password.
  3. You can reset the firewall to factory defaults.

Connect a network cable to Ethernet 0/0 and login via your browser to:

http://192.168.1.1
Username: netscreen
Password: netscreen

Reset the unit with reset pin:

Push and hold the pinhole on the Juniper. The status LED will turn to a blinking amber so KEEP holding, and when it turns to blinking green, release the pinhole. After 1 second, push and HOLD the pinhole again. The LED will turn to blinking red so KEEP holding until the status LED turns to solid amber or solid green, release right away and wait for the device to reset and come back – give it five minutes.
Then connect to it as described above http://192.168.1.1

LSOF Utility and Commands

The lsof command is very handy and all Linux/Unix sysadmins should know abouyt it and make more use of it, here are some further details and examples.

(From Wikipedia) – lsof is a command meaning “list open files”, which is used in many Unix-like systems to report a list of all open files and the processes that opened them. This open source utility was developed and supported by Victor A. Abell, the retired Associate Director of the Purdue University Computing Center. It works in and supports several Unix flavors.

Useful Commands:

List all network connections:

 sudo lsof -i 

SSH:

sudo lsof -i:22
sudo lsof -c ssh

List all network files in use by a specific process:

 sudo lsof -i -a -p 1278 

List processes which are listening on a particular port:

 sudo lsof -i :25 

List all TCP or UDP connections:

 sudo lsof -i tcp; lsof -i udp; 

List processes which opened a specific file:

 lsof /var/log/syslog 

List opened files under a directory:

 lsof +D /var/log/ 

List opened files based on process names starting with:

 lsof -c ssh -c init 

List processes using a mount point:

 sudo lsof /home 

List files opened by a specific user:

 lsof -u keith 

What commands is user Keith using:

 sudo lsof -i -u keith 

List all open files by a specific process:

 lsof -p 1278 

Kill all process that belongs to a particular user:

 kill -9 `lsof -t -u keith` 

 

SSL Server Test

Qualys SSL Server Test is free online service that performs a deep analysis of the configuration of any SSL web server on the public Internet.

https://www.ssllabs.com/ssltest/

To configure Apache and Nginx with acceptable protocols TLS settings follow these guides, they will provide a better score on the above Qualys rating and make your SSL site more secure.

 

Penetration Testing Tools Cheat Sheet

Penetration testing tools cheat sheet, a quick reference high level overview for typical penetration testing engagements. Designed as a quick reference cheat sheet providing a high level overview of the typical commands you would run when performing a penetration test. For more in depth information I’d recommend the man file for the tool or a more specific pen testing cheat sheet.

Site and other tools from: https://highon.coffee/blog/penetration-testing-tools-cheat-sheet/

Snapcraft

Package any app for any Linux desktop, server, cloud or device.

A ‘snap’ is a universal Linux package

Snaps work on any distribution or device. Snaps are faster to install, easier to create, safer to run, and they update automatically and transactionally so your app is always fresh and never broken.

The public collection of snaps includes the latest and best apps from GitHub and beyond, so you have the whole world of Linux apps at your fingertips. Take the tour below to experience ‘hello world’ as a snap, or jump to the developer guide to create your own snaps.

Reference: http://snapcraft.io/

netdata real-time performance monitoring for Linux

Netdata is a real-time performance monitoring solution.

Unlike other solutions that are only capable of presenting statistics of past performance, netdata is designed to be perfect for real-time performance troubleshooting.

Netdata is a linux daemon you run, which collects data in realtime (per second) and presents a web site to view and analyze them. The presentation is also real-time and full of interactive charts that precisely render all collected values.

Netdata has been designed to be installed on every system, without disrupting the applications running on it:

  • It will just use some spare CPU cycles (check Performance).
  • It will use the memory you want it have (check Memory Requirements).
  • Once started and while running, it does not use any disk I/O, apart its logging (check Log Files). Of course it saves its DB to disk when it exits and loads it back when it starts.
  • You can use it to monitor all your systems and applications. It will run on Linux PCs, servers or embedded devices.

Out of the box, it comes with plugins that collect key system metrics and metrics of popular applications.

Available here: https://github.com/firehol/netdata

Midnight Commander file size format

When dealing with large files in MC, I have difficulties counting the digits to get the order of magnitude of the file size (hundreds of MB, or tens of GB, etc.). Sometimes, I use the trick to press insert key, which highlights the file and shows the file size in a nicely formatted way (i.e. 123,456,789), which makes it a thousand times more readable.

You can modify the configuration:

You can adjust the displayed digits with the column size option, see the “Listing mode” section in the manual. The file to edit is ~/.config/mc/panels.ini.

To list the file sizes as K, M or G use a narrow size column using the user_format key:

[New Left Panel]
user_format=half type name mark size:4 space mtime