Skip to content

Commit

Permalink
Certbot
Browse files Browse the repository at this point in the history
  • Loading branch information
m-thirumal authored Jan 17, 2024
1 parent 44310d7 commit 4c4c492
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Nginx/nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

11. [To access website log](Nginx/log.md)

12. [Add Godaddy SSL certificate](Nginx/Generate%20and%20install%20godaddy%20ssl%20certificate.md)
12. [Add Godaddy SSL certificate](Nginx/Generate%20and%20install%20godaddy%20ssl%20certificate.md)
28 changes: 19 additions & 9 deletions TLS/certbot.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
sudo apt install python3 python3-venv libaugeas0
```

### Set up a virtual environment:
### Set up a virtual environment

```bash
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
```

### Install Certbot on Apache or NGINX:
### Install Certbot on Apache or NGINX

```bash
sudo /opt/certbot/bin/pip install certbot certbot-apache
Expand All @@ -25,15 +25,15 @@ OR
sudo /opt/certbot/bin/pip install certbot certbot-nginx
```

### Create a symlink to ensure Certbot runs:
### Create a symlink to ensure Certbot runs

```bash
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
```

## Create an SSL Certificate with Certbot

### Create SSL certs for all domains and configure redirects in the web server:
### Create SSL certs for all domains and configure redirects in the web server

!> This will modify `/etc/nginx/sites-enabled/default` file for SSL. No manual chage is requrired

Expand All @@ -49,14 +49,13 @@ For Nginx
sudo certbot --nginx
```

### Create SSL certs for a specified domain (recommended if you’re using your system hostname):

### Create SSL certs for a specified domain (recommended if you’re using your system hostname)

```bash
sudo certbot --apache -d example.com -d www.example.com
```

### Only install SSL certs:
### Only install SSL certs

?> TODO Manually change `/etc/nginx/sites-enabled/default` file for SSL

Expand All @@ -74,16 +73,27 @@ sudo certbot certonly --nginx
sudo certbot renew
```

##### Force renew
### Force renew

```bash
sudo certbot --force-renewal

sudo certbot certonly --force-renewal
```

## Troubleshooting
### Auto Renew

```bash
sudo crontab -e
```

select `nano` editor, then add the following line to renew certificate using cron job

```bash
0 7 * * * certbot renew
```

## Troubleshooting

The certificate files for each domain is stored in:

Expand Down
51 changes: 29 additions & 22 deletions encrypt/encrypt.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
1. Generating the encrypted value:
# Encrypting properties file in Spring boot

Download and extract from http://www.jasypt.org/download.html
1.Generating the encrypted value:

Download and extract from <http://www.jasypt.org/download.html>

Run the below from the bin of the extracted download:

WINDOWS :- encrypt.bat input="testuser" password=MY_PASS
LINUX :- ./encrypt.sh input="postgres" password=INDsolv
```bash
WINDOWS :- encrypt.bat input="testuser" password=MY_PASS
LINUX :- ./encrypt.sh input="postgres" password=INDsolv
```

2.Added dependency to the project:

2. Added dependency to the project:
```bash
<dependency>
   <groupId>com.github.ulisesbocchio</groupId>
   <artifactId>jasypt-spring-boot-starter</artifactId>
   <version>1.14</version>
</dependency>
```

<dependency>
   <groupId>com.github.ulisesbocchio</groupId>
   <artifactId>jasypt-spring-boot-starter</artifactId>
   <version>1.14</version>
</dependency>
3.Using encrypted username/password in properties.yml:

3. Using encrypted username/password in properties.yml:
Place the generated text between `“ENC(” and “)”`
Build the project.

Place the generated text between “ENC(” and “)”
Build the project.
4.Running your project using spring-boot:run: Run the below from project directory:

4. Running your project using spring-boot:run: Run the below from project directory:

mvn spring-boot:run -Djasypt.encryptor.password=MY_PASS
./gradlew bootRun -Djasypt.encryptor.password=MY_PASS

5. Running project’s jar:
Run the below from project target directory:
```bash
mvn spring-boot:run -Djasypt.encryptor.password=MY_PASS
./gradlew bootRun -Djasypt.encryptor.password=MY_PASS
```

java -jar target\jasypt-test-0.0.1-SNAPSHOT.jar --jasypt.encryptor.password=MY_PASS

5.Running project’s jar: Run the below from project target directory:

```bash
java -jar target\jasypt-test-0.0.1-SNAPSHOT.jar --jasypt.encryptor.password=MY_PASS
```

0 comments on commit 4c4c492

Please sign in to comment.