Skip to content

Commit

Permalink
terminal and ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
maldevel committed Aug 28, 2017
1 parent 346fe9b commit acee206
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
27 changes: 25 additions & 2 deletions encryption/openssl.md
@@ -1,56 +1,73 @@
### Generate a New CSR and Key
### Generate self-signed Certificate and Key

```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.crt
```

### Generate a New Key

```bash
openssl genrsa -out server.key 2048
```

### Generate Certificate Signing Request in PKCS#10 format

```bash
openssl req -new -key server.key -out server.req
```

### Convert CER to ascii(crt)

```bash
openssl x509 -inform DER -in subdomain.twelvesec.int.cer -out subdomain.twelvesec.int.crt
```

### Generate a New CSR and Key

```bash
openssl req -nodes -new -newkey rsa:<number of bits> -out <filename-csr> -keyout <filename-key>
```

e.g.
e.g.

```bash
openssl req -nodes -new -newkey rsa:2048 -out subdomain.example.com.csr -keyout subdomain.example.com.key
```

### Generate a New CSR from Existing Key

```bash
openssl req -nodes -new -key <filename-key> -out <filename-csr>
```

e.g.

```bash
openssl req -nodes -new -key subdomain.example.com.old.key -out subdomain.example.com.new.csr
```

### Generate a New CSR from Existing CRT and Key

```bash
openssl x509 -x509toreq -in <filename-crt> -signkey <filename-key> -out <filename-csr>
```

e.g.

```bash
openssl x509 -x509toreq -in subdomain.example.com.old.crt -signkey subdomain.example.com.key -out subdomain.example.com.csr
```

### Remove RSA private key PEM password

```bash
openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_2
mv ~/.ssh/id_rsa_2 ~/.ssh/id_rsa
chmod 0400 ~/.ssh/id_rsa
```

### Create a CSR with SANs

```bash
openssl req -new -key subdomain.example.com.key -out subdomain.example.com.req -config myssl.cnf
```
Expand All @@ -62,11 +79,13 @@ openssl req -config myssl.cnf -nodes -new -newkey rsa:<number of bits> -out <fil
```

e.g.

```bash
openssl req -config myssl.conf -nodes -new -newkey rsa:4096 -out subdomain.example.com.csr -keyout subdomain.example.com.key
```

#### myssl.cnf Contents

```
[req]
default_bits = 2048
Expand Down Expand Up @@ -104,21 +123,25 @@ DNS.1 = subdomain.example.com
```

### Read a CSR

```bash
openssl req -text -noout -in <filename-csr>
```

### Read a CRT

```bash
openssl x509 -text -noout -in <filename-crt>
```

### Verify a CRT Matches a Private Key

```bash
openssl x509 -noout -modulus -in <filename-crt>
```

### Client-side SSL

```bash
openssl genrsa -out <user-name>.key 2048
openssl req -new -key <user-name>.key -out <user-name>.req
Expand Down
2 changes: 2 additions & 0 deletions misc/rdesktop.md
@@ -1,9 +1,11 @@
### Remote desktop with shared folder

```bash
rdesktop -r disk:share=/home/username/share -u <username> -p <password> x.x.x.x
```

### Change the screen resolution

```bash
rdesktop -g 60% -u <username> -p <password> x.x.x.x
```
Expand Down
6 changes: 6 additions & 0 deletions misc/terminal.md
@@ -0,0 +1,6 @@
### Append end of every line within the line itself

```bash
paste -d ' ' file.txt file.txt
```

0 comments on commit acee206

Please sign in to comment.