Command Line Common Structures

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:11 PM on 8/10/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

21 Terms

1
New cards

What command structure generates a 2048-bit RSA private key?

openssl genpkey -algorithm RSA -out <private_key_file> -pkeyopt rsa_keygen_bits:2048

2
New cards

What command extracts the public key from a private key?

openssl rsa -pubout -in <private_key_file> -out <public_key_file>

3
New cards

What command signs a file with a private key using SHA-256?

openssl dgst -sha256 -sign <private_key_file> -out <signature_file> <data_file>

4
New cards

What command verifies a file against its signature using the public key?

penssl dgst -sha256 -verify <public_key_file> -signature <signature_file> <data_file>

5
New cards

What command encrypts a file so only the private key holder can read it?

openssl pkeyutl -encrypt -pubin -inkey <public_key_file> -in <input_file> -out <encrypted_file>

6
New cards

What command decrypts a file using the private key?

openssl pkeyutl -decrypt -inkey <private_key_file> -in <encrypted_file> -out <decrypted_file>

7
New cards

What command creates a CSR to send to a Certificate Authority?

openssl req -new -key <private_key_file> -out <csr_file>

8
New cards

What command signs a CSR using a root CA certificate to issue a new cert?

openssl x509 -req -in <csr_file> -CA <ca_certificate> -CAkey <ca_private_key> -CAcreateserial -out <issued_cert> -days <days> -sha256

9
New cards

What command creates a self-signed root certificate (no CSR needed)?

openssl req -new -x509 -key <private_key> -out <root_certificate> -days <days>

10
New cards

How do you drop all packets coming from IP x?

iptables -A INPUT -s <x> -j DROP

11
New cards

How do you block all incoming SSH (port 22) traffic?

iptables -A INPUT -p tcp --dport 22 -j DROP

12
New cards

How do you accept all forwarded traffic coming in from eth0?

iptables -A FORWARD -i eth0 -j ACCEPT

13
New cards

How do you enable NAT so a private subnet can access the internet via eth0?

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

14
New cards

How do you forward all incoming traffic from eth0 to an internal server at 192.168.3.8?

iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination 192.168.3.8

15
New cards

What does -i mean in iptables?

Input interface. It matches packets that are entering the machine through the specified network interface (e.g., eth0).

16
New cards

What does -o mean in iptables?

Output interface. It matches packets that are leaving the machine through the specified network interface.

17
New cards

What does -j mean in iptables?

It specifies the target action to take on a matching packet (e.g., ACCEPT, DROP, REJECT, LOG, MASQUERADE).

18
New cards

In iptables, what does the -s flag specify?

Source. It matches packets based on their source IP address or subnet.

19
New cards

In iptables, what does the -p flag specify?

Protocol. It matches packets based on the transport protocol (e.g., tcp, udp, icmp). Required before using --dport or --sport.

20
New cards

In iptables, what does the -t flag specify?

Table. It specifies which table to operate on (filter [default], nat, mangle). Without it, commands default to the filter table.

21
New cards

In iptables, what does the -d flag specify?

The -d option in iptables stands for Destination.