General Linux Items / Commands II

##How Create a Boot ISO##

isolinux is used for booting the Red Hat Enterprise Linux installation CD. To create your own CD-ROM to boot the installation program, use the following instructions:

Copy the isolinux/ directory from the Red Hat Enterprise Linux CD #1 into a temporary directory (referred to here as <path-to-workspace>) using the following command:

cp -r <path-to-cd>/isolinux/<path-to-workspace>

Change directories to the <path-to-workspace> directory you have created:

cd <path-to-workspace>

Make sure the files you have copied have appropriate permissions:

chmod u+w isolinux/*

Finally, issue the following command to create the ISO image file:

mkisofs -o file.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T isolinux/

 

The above command was split into two lines for printing purposes only. When you execute this command, be sure to type it as a single command, all on the same line.

Burn the resulting ISO image (named file.iso and located in <path-to-workspace>) to a CD-ROM as you normally would.

Burn the iso image you just created to a CD any way you like.

Drop the CD into the computer you want to install, and reboot the machine. When the boot prompt comes up type linux ks=cdrom:filename.cfg

Watch your machine install!

##How Create a Repo##

To install the RPM, you’ll need to type this command:

# yum install createrepo

Create a directory on a web server.

#  mkdir /var/www/html/repo/5/x86_64/

Copy your rpm’s to the directory you just created and run this command to create all the metadata required:

# createrepo /var/www/html/repo/5/x86_64/

Your local YUM repository has been created. Whenever you put in any new RPMs, you’ll have to run the above command, so that the new repository metadata gets updated.

Creating gpg keys for your new repo

# mkdir ~/.gnupg

You might get the error ‘mkdir: cannot create directory `/root/.gnupg’: File exists’

No problem, just means it is already there

# gpg --gen-key

gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.

This program comes with ABSOLUTELY NO WARRANTY.

This is free software, and you are welcome to redistribute it

under certain conditions. See the file COPYING for details.

Please select what kind of key you want:

(1) DSA and Elgamal (default)

(2) DSA (sign only)

(5) RSA (sign only)

Your selection?

Select 1

Your selection? 1

DSA keypair will have 1024 bits.

ELG-E keys may be between 1024 and 4096 bits long.

What keysize do you want? (2048)

Press Enter

Requested keysize is 2048 bits

Please specify how long the key should be valid.

0 = key does not expire

<n> = key expires in n days

<n>w = key expires in n weeks

<n>m = key expires in n months

<n>y = key expires in n years

Key is valid for? (0)

Press Enter

Key does not expire at all

Is this correct? (y/N)

Press y and enter

You need a user ID to identify your key; the software constructs the user ID

from the Real Name, Comment and Email Address in this form:

“Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>”

Real name:

As an example I used John Doe

Press Enter

Real name: John Doe

Email address:

Enter the maintainers email address. Example: john.doe@hq38.hohenfels.com

Real name: John Doe

Email address: John.doe@hq38.hohenfels.com

Comment:

Enter “Signing Key for Project Name” replace Project Name with the name of your project.
Press enter

You selected this USER-ID:

John Doe (Signing Key for Project Name) <john.doe@hq38.hohenfels.com>

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?

If it is all OK, Press O
Press Enter
Enter passphrase:
Enter your passphrase, you will need to remember this!
Press Enter
Repeat passphrase:
Enter the same passphrase again
Press Enter

We need to generate a lot of random bytes. It is a good idea to perform

some other action (type on the keyboard, move the mouse, utilize the

disks) during the prime generation; this gives the random number

generator a better chance to gain enough entropy.

++++++++++.+++++++++++++++++++++++++..+++++++++++++++..+++++.++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++….+++++.+++++++++++++++>+++++……>+++++……………………………………………………….+++++

Not enough random bytes available. Please do some other work to give

the OS a chance to collect more entropy! (Need 284 more bytes)

gpg: key 10D9424E marked as ultimately trusted

public and secret key created and signed.

gpg: checking the trustdb

gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model

gpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u

pub 1024D/10D9424E 2011-05-12

Key fingerprint = A5CD 97A1 6EA6 DC01 CCC3 0A7B DEA6 CD67 10D9 424E

uid Enoch Root <root@vaausmul1.aac.va.gov>

sub 2048g/93C388B3 2011-05-12

# gpg --export --armor 10D9424E > /tmp/RPM-GPG-KEY-(Project abbreviation)
Example Project Abbreviations: PRE or SLC

Copy your new key to your new repo

# cp /tmp/ RPM-GPG-KEY-(Project abbreviation) /var/www/html/repo/5/x86_64/
# vi /root/.rpmmacros
and insert this at the top %_signature gpg

It should look like this:

%_signature gpg

%_gpg_name John Doe <john.doe.va.gov> (This will be your maintainers name and email address)

If it is not there, create a new file with the above info.

Then you can start resigning your custom channel rpm’s

#rpm –resign /var/www/html/repo/5/x86_64/putty-0.60-6.20100910svn.el5.1.x86_64.rpm

Enter pass phrase:

Done!

To Sync with the Nat Sat we will need the Pub ID marked in red above and the Key fingerprint marked in purple above as well as the URL to your key.

http://spacewalk.hohenfels.com/repo/5/x86_64/

10D9424E

A5CD 97A1 6EA6 DC01 CCC3 0A7B DEA6 CD67 10D9 424E

 

#Resizing images

mogrify -resize 800x600 *.jpg

General Linux Items / Commands

##How to remount the file system read write (rw) In maintenance mode##

mount -o remount, rw /

##How to unencrypt PDF documents##

http://www.cyberciti.biz/faq/removing-password-from-pdf-on-linux/

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=/home/erik/Destination.pdf -c .setpdfwrite -f /home/erik/source.pdf

##How to reindex spacewalk postgres database##

I was getting all kinds of weird spacewalk errors that all seemed to point to the database.

$sudo  su postgres
$reindexdb --all

At the end I got the following eror:

NOTICE:  table "rhnpackagedeltaelement" was reindexed
reindexdb: reindexing of database "rhnschema" failed: ERROR:  could not create unique index "rhnchecksum_chsum_uq"
DETAIL:  Table contains duplicated values.

I ended up restoring a backed up VM

##To Find directories and sizes##

du -sch .[!.]* * |sort -h

 ##Removing Old Kernels##

$ sudo yum install yum-utils
$ sudo package-cleanup --oldkernels --count=2

Edit /etc/yum.conf and set installonly_limit:

installonly_limit=2

##Piping a command through mail##

| mail -s "Clam Scan %D" erik@hq38.hohenfels.com

 ##Get a list of rpm’s off a web page for a script##

http://linux.dell.com/repo/hardware/Linux_Repository_14.12.00/platform_independent/rh60_64/srvadmin-x86_64/ | egrep -o "http:.*rpm" |cut -d "/" -f10

##To delete a server from using Spacewalk

##Delete the server from the WebGUI

##On the Client:

sudo vi /etc/yum/pluginconf.d/rhnplugin.conf

##And change:

[main]
enabled = 1

#to

[main]
enabled = 0

##Then

sudo rm -rf /etc/sysconfig/rhn/systemid

##Remove the spacewalk repos if they are there:

sudo rm /etc/yum.repos.d/spacewalk-client*

##SELinux Love

##First install the trouble shooter

sudo yum install setroubleshoot-server setroubleshoot setools

##Then Search the logs:

sudo cat /var/log/messages | grep sealert (CentOS 6)

or

sudo sealert -a /var/log/audit/audit.log (CentOS 7)

You are going to see something like this:

docker setroubleshoot: SELinux is preventing /usr/bin/bash from ioctl access on the file /usr/bin/distro. For complete SELinux messages. run sealert -l f4eed2fe-d681-412f-ab31-55f704a7cf46

##Do what it says, Bolded above

sudo sealert -l f4eed2fe-d681-412f-ab31-55f704a7cf46

##At the top of the output you will see:

If you believe that bash should be allowed ioctl access on the distro file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep distro /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

##Again, do what it says

sudo grep distro /var/log/audit/audit.log | audit2allow -M mypol

##Then

sudo semodule -i mypol.pp

## Grub Edit ##

 

Make the modifications you want:

$ sudo vi /etc/default/grub

After you edit the above file you need to run:

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

 

##Installing RootKit Hunter

 

http://lintut.com/install-rkhunter-in-centos/

Here is the conf file location.

sudo vi /etc/rkhunter.conf

Add:

##RootKit Check
/usr/bin/rkhunter --update
/usr/bin/rkhunter --checkall

##Firewall Commands

 

##Add Port:

sudo firewall-cmd --zone=public --add-port=161/udp --permanent

##Add Know Service

sudo firewall-cmd --permanent --zone public --add-service samba

##Restart

sudo systemctl restart firewalld.service

 

##Install Logwatch

 

##Install the package

sudo yum install logwatch

##Edit the conf file:

sudo vi /usr/share/logwatch/default.conf/logwatch.conf

##Change to High

Detail = High

##Set to send an email

Output = mail

##ClamAV

1 – Install EPEL 7

After you’ve successfully installed your operating system and applied all the updates. You can install the EPEL 7 repository by running this command:

sudo yum install epel-release

2 – Install and configure the ClamAV packages

sudo yum install clamav clamav-scanner-systemd

Yes, it’s enough. When installing these packages all needed packages will be installed by dependency.

Correct a “bad” file path probably written during the compilation by creating a link to the correct file:

sudo ln -s /etc/clamd.d/scan.conf /etc/clamd.conf

Edit the configuration installed by the clamd-scanner package:

sudo vi /etc/clamd.d/scan.conf

Comment the example line:

#Example

Uncomment the LocalSocket config line to enable it:

LocalSocket /var/run/clamd.scan/clamd.sock

Save and quit the text editor.

3 – Turn on the SELinux boolean for antivirus

sudo setsebool -P antivirus_can_scan_system 1

4 – Start the service and enable it at boot

sudo systemctl start clamd@scan
sudo systemctl enable clamd@scan

5 – Install and configure the ClamAV updater

To automatically get the latest virus updates, you need to install the binary used for this task:

sudo yum install clamav-update

Edit the configuration file:

sudo vi /etc/freshclam.conf

Comment the example line:

#Example

Save and quit the text editor and run the command “freshclam” to update the virus database. If needed you can add a crontab to execute it regularly.

6 – Test your installation

sudo clamdscan --fdpass /var/log/*

Always use the –fdpass to give the correct permission to scan the files with clamdscan binary. In some case the first check mays fail after the installation, a simple reboot can solve this issue.

REF: https://www.adminsys.ch/2015/08/21/installing-clamav-epel-centosred-hat-7-nightmare/ 

##

Pistol vs Steel

Published on Jul 30, 2017

 

We got our steel targets from MOA targets . Man is shooting steel fun! We got 1 – 1/4 inch AR400 and 1 – 3/8 AR500 targets. I threw one of the targets I cut into the mix as well. All 8 inch. By the way, the AR400 I thought I had is mild steel, you will see as the video series progresses.

In a nut shell all 3 handled pistol up to .45 at 10 to 15 Yards without penetration. The Mild had some dents, AR 400 and AR 500 nada.

Here is the Color Code:

Black = Mild Steel, We cut
Yellow = MOA Targets AR500
Orange = MOA Targets AR400

 

Federal Firearms License (FFL) Guide – Intro

In the processes of getting my FFL I found lots of good material on line. It got me prepared for my interview with out a doubt. I realized though that the info on line was dated, so I decided to give back and update the info.

“Acknowledgement of Federal Firearms Regulations

Page references are in Federal Firearms Regulations Reference Guide (ATF P 5300.4 – December 2014)”

Everything I have seen referenced the 2005 version. I will reference the newer 2014 version located HERE

Continue reading “Federal Firearms License (FFL) Guide – Intro”

Federal Firearms License (FFL) Guide – Part 1

1. REQUIRED RECORDS AND REPORTS

Acquisition and Disposition Record 478.125(e) ATF P 5300.4 Federal Firearms Regulations Reference Guide 2014 Page 65.

(e) Firearms receipt and disposition by dealers. Each licensed dealer shall enter into a record each receipt and disposition of firearms. In addition, before commencing or continuing a firearms business, each licensed dealer shall inventory the firearms possessed for such business and shall record same in the record required by this paragraph. The record required by this paragraph shall be maintained in bound form under the format prescribed below. The purchase or other acquisition of a firearm shall, except as provided in paragraph (g) of this section, be recorded not later than the close of the next business day following the date of such purchase or acquisition. The record shall show the date of receipt, the name and address or the name and license number of the person from whom received, the name of the manufacturer and importer (if any), the model, serial number, type, and the caliber or gauge of the firearm. The sale or other disposition of a firearm shall be recorded by the licensed dealer not later than 7 days following the date of such transaction. When such disposition is made to a nonlicensee, the firearms transaction record, Form 4473, obtained by the licensed dealer shall be retained, until the transaction is recorded, separate from the licensee’s Form 4473 file and be readily available for inspection. When such disposition is made to a licensee, the commercial record of the transaction shall be retained, until the transaction is recorded, separate from other commercial documents maintained by the licensed dealer, and be readily available for inspection. The record shall show the date of the sale or other disposition of each firearm, the name and address of the person to whom the firearm is transferred, or the name and license number of the person to whom transferred if such person is a licensee, or the firearms transaction record, Form 4473, serial number if the licensed dealer transferring the firearm serially numbers the Forms 4473 and files them numerically. The format required for the record of receipt and disposition of firearms is as follows: (See Table 4)

Continue reading “Federal Firearms License (FFL) Guide – Part 1”

Federal Firearms License (FFL) Guide – Part 2

2. CONDUCT OF BUSINESS

Firearm Frame or Receiver,478.11, Federal Firearms Regulations Reference Guide 2014 Page 37

Firearm frame or receiver. That part of a firearm which provides housing for the hammer, bolt or breechblock, and firing mechanism, and which is usually threaded at its forward portion to receive the barrel.

NICS Requirements, 478.102 & 478.131 Federal Firearms Regulations Reference Guide 2014 Page 53-54 & 68

§ 478.102 Sales or deliveries of firearms on and after November 30, 1998.

Continue reading “Federal Firearms License (FFL) Guide – Part 2”

Federal Firearms License (FFL) Guide – Part 3

3. LICENSES

Engaged in the Business,478.11, Federal Firearms Regulations Reference Guide 2014 Page 36

§ 478.11 Meaning of terms.

Engaged in the business—

(a) Manufacturer of firearms. A person who devotes time, attention, and labor to manufacturing firearms as a regular course of trade or business with the principalobjective of livelihood and profit through the sale or distribution of the firearms manufactured;

(b) Manufacturer of ammunition. A person who devotes time, attention, and labor to manufacturing ammunition as a regular course of trade or business with the principal objective of livelihood and profit through the sale or distribution of the ammunition manufactured;

(c) Dealer in firearms other than a gunsmith or a pawnbroker. A person who devotes time, attention, and labor to dealing in firearms as a regular course of trade or business with the principal objective of livelihood and profit through the repetitive purchase and resale of firearms, but such a term shall not include a person who makes occasional sales, exchanges, or purchases of firearms for the enhancement of a personal collection or for a hobby, or who sells all or part of his personal collection of firearms;

(d) Gunsmith. A person who devotes time, attention, and labor to engaging in such activity as a regular course of trade or business with the principal objective of livelihood and profit, but such a term shall not include a person who makes occasional repairs of firearms or who occasionally fits special barrels, stocks, or trigger mechanisms to firearms;

(e) Importer of firearms. A person who devotes time, attention, and labor to importing firearms as a regular course of trade or business with the principal objective of livelihood and profit through the sale or distribution of the firearms imported; and,

(f) Importer of ammunition. A person who devotes time, attention, and labor to importing ammunition as a regular course of trade or business with the principal objective of livelihood and profit through the sale or distribution of the ammunition imported.

Continue reading “Federal Firearms License (FFL) Guide – Part 3”

Federal Firearms License (FFL) Guide – Part 4

4. MISCELLANEOUS PROVISIONS

Right of Entry and Examination, 478.23, Federal Firearms Regulations Reference Guide 2014 Page 40

§ 478.23 Right of entry and examination.

(a) Except as provided in paragraph (b), any ATF officer, when there is reasonable cause to believe a violation of the Act has occurred and that evidence of the violation may be found on the premises of any licensed manufacturer, licensed importer, licensed dealer, or licensed collector, may, upon demonstrating such cause before a Federal magistrate and obtaining from the magistrate a warrant authorizing entry, enter during business hours (or, in the case of a licensed collector, the hours of operation) the premises, including places of storage, of any such licensee for the purpose of inspecting or examining:

(1) Any records or documents required to be kept by such licensee under this part and

(2) Any inventory of firearms or ammunition kept or stored by any licensed manufacturer, licensed importer, or licensed dealer at such premises or any firearms curios or relics or ammunition kept or stored by any licensed collector at such premises.

(b) Any ATF officer, without having reasonable cause to believe a violation of the Act has occurred or that evidence of the violation may be found and without demonstrating such cause before a Federal magistrate or obtaining from the magistrate a warrant authorizing entry, may enter during business hours the premises, including places of storage, of any licensed manufacturer, licensed importer, or licensed dealer for the purpose of inspecting or examining the records, documents, ammunition and firearms referred to in paragraph (a) of this section:

Continue reading “Federal Firearms License (FFL) Guide – Part 4”

Federal Firearms License (FFL) Guide – Part 5

5. STATE LAWS AND LOCAL ORDINANCES

Compliance with State Law Pub / ATF P 5300.5, 478.24, Federal Firearms Regulations Reference Guide 2014 Page 40-41

§ 478.24 Compilation of State laws and published ordinances.

(a) The Director shall annually revise and furnish Federal firearms licensees with a compilation of State laws and published ordinances which are relevant to the enforcement of this part. The Director annually revises the compilation and publishes it as “State Laws and Published Ordinances–Fire-arms” which is furnished free of charge to licensees under this part. Where the compilation has previously been furnished to licensees, the Director need only furnish amendments of the relevant laws and ordinances to such licensees.

(b) “State Laws and Published Ordinances–Firearms” is incorporated by reference in this part. It is ATF Publication 5300.5, revised yearly. The current edition is available from the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402. It is also available for inspection at the National Archives and Records Administration (NARA). For information on the availability of this material at NARA, call 202–741–6030, or go to: http://www.archives.gov/federal_register/code_of_federal_reg-ulations/ibr_locations.html. This incorporation by reference was approved by the Director of the Federal Register.

Federal Firearms License (FFL) Guide – Part 6

6. GUNSMITH ACTIVITIES

Gunsmithing Definition 478.11- Engaged in the bussiness (d), Federal Firearms Regulations Reference Guide 2014 Page 36

(d) Gunsmith. A person who devotes time, attention, and labor to engaging in such activity as a regular course of trade or business with the principal objective of livelihood and profit, but such a term shall not include a person who makes occasional repairs of firearms or who occasionally fits special barrels, stocks, or trigger mechanisms to firearms;

Gunsmith Recordkeeping, 478.124(a) & .125(e), ATF Ruling 77-1, Federal Firearms Regulations Reference Guide 2014 Page 63,66 & 124-125

§ 478.124(a) Firearms transactionrecord. Pg 63

Continue reading “Federal Firearms License (FFL) Guide – Part 6”

Copy Protected by Chetan's WP-Copyprotect.