Spring Boot protetto da Let's Encrypt

Installazione, configurazione e uso di Ubuntu come server: web, ftp, mail, news, proxy, dns e altro.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Codice: Seleziona tutto

ubuntu@webserver:~$ sudo certbot certonly --standalone
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Please enter the domain name(s) you would like on your certificate (comma and/or space separated) (Enter 'c' to cancel): nomeadominio.tk
Requesting a certificate for nomeadominio.tk

Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
  Domain: nomeadominio.tk
  Type:   dns
  Detail: no valid A records found for nomeadominio.tk; no valid AAAA records found for nomeadominio.tk

Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
ubuntu@webserver:~$
Ottengo lo stesso problema.
L'installazione di questo programma è molto semplice, sono pochissime le righe di codice ma se non funzionano sono punto e a capo.
Ho provato a rimuovere, per sicuerezza, tutti i container e tutte le immagini di Docker ma non c'è nulla da fare.
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Dai dig +short nomedominio.qualcosa e vedi se risulta l'indirizzo IP del server (se non hai dig installa il pacchetto dnsutils).
Ho provato a rimuovere, per sicuerezza, tutti i container e tutte le immagini di Docker ma non c'è nulla da fare.

Questo è ininfluente ai fini della creazione del certificato con certbot.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Non risolvo, non ottengo l'IP del server:

Codice: Seleziona tutto

ubuntu@webserver:~$ sudo apt install -y dnsutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  dnsutils
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 3916 B of archives.
After this operation, 56.3 kB of additional disk space will be used.
Get:1 http://eu-milan-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 dnsutils all 1:9.18.1-1ubuntu1.1 [3916 B]
Fetched 3916 B in 0s (28.7 kB/s)
Selecting previously unselected package dnsutils.
(Reading database ... 127908 files and directories currently installed.)
Preparing to unpack .../dnsutils_1%3a9.18.1-1ubuntu1.1_all.deb ...
Unpacking dnsutils (1:9.18.1-1ubuntu1.1) ...
Setting up dnsutils (1:9.18.1-1ubuntu1.1) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
ubuntu@webserver:~$ dig +short nomeadominio.tk
ubuntu@webserver:~$
Se digito

Codice: Seleziona tutto

dig www.nomeadominio.tk
ottengo l'IP del server. Non so dirti se prima di lanciare

Codice: Seleziona tutto

sudo apt install -y dnsutils
ottenessi già l'IP con il comando breve 'dig www.nomeadominio.tk'.
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Hai aggiunto il record A a www.nomeadominio.tk ma non a nomeadominio.tk quindi non puoi creare un certificato con certbot per nomeadominio.tk. Aggiungi l'IP anche a nomeadominio.tk e genera il certificato valido per entrambi i domini con sudo certbot certonly --standalone -d nomeadominio.tk -d www.nomeadominio.tk.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Sempre grazie per il tuo prezziosissimo supporto.

Codice: Seleziona tutto

ubuntu@webserver:~$ sudo certbot certonly --standalone -d ------------------------------.tk -d www.------------------------------.tk
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for ------------------------------.tk and www.------------------------------.tk

Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
  Domain: www.------------------------------.tk
  Type:   connection
  Detail: ###.###.###.###: Fetching http://www.------------------------------.tk/.well-known/acme-challenge/Mafty3DI...WZBYihEMk: Error getting validation data

  Domain: ------------------------------.tk
  Type:   dns
  Detail: no valid A records found for ------------------------------.tk; no valid AAAA records found for ------------------------------.tk

Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
ubuntu@webserver:~$ sudo certbot certonly --standalone -d ------------------------------.tk -d www.------------------------------.tk
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for ------------------------------.tk and www.------------------------------.tk

Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
  Domain: www.------------------------------.tk
  Type:   connection
  Detail: ###.###.###.###: Fetching http://www.------------------------------.tk/.well-known/acme-challenge/dDuXQx6ueIBs0b_4tYsF95U6d7GGvkR-O9FZ3r35SXs: Error getting validation data

  Domain: ------------------------------.tk
  Type:   dns
  Detail: no valid A records found for ------------------------------.tk; no valid AAAA records found for ------------------------------.tk

Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
ubuntu@webserver:~$ sudo certbot certonly --standalone -d ------------------------------.tk -d www.------------------------------.tk
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for ------------------------------.tk and www.------------------------------.tk
An unexpected error occurred:
Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
ubuntu@webserver:~$
Immagine
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Il primo errore è il medesimo, probabilmente il DNS non si è ancora propagato a livello globale, il secondo errore è dovuto ai troppi tentativi di richiesta del certificato. Attendi 12-24 ore, dai dig sui domini per verificare l’IP, quindi riprova certbot.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Ho rieseguito:

Codice: Seleziona tutto

sudo certbot certonly --standalone -d oooooooooo.tk -d www.oooooooooo.tk
Avevi ragione, dovevo attendere ancora qualche istante la propagazione ma a mio avviso resta ancora qualche problema.

Codice: Seleziona tutto

ubuntu@webserver:~$ sudo certbot certonly --standalone -d oooooooooo.tk -d www.                                                                                             oooooooooo.tk
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for oooooooooo.tk and www.oooooooooo.tk

Certbot failed to authenticate some domains (authenticator: standalone). The Cer                                                                                             tificate Authority reported these problems:
  Domain: oooooooooo.tk
  Type:   connection
  Detail: ###.###.###.###: Fetching http://oooooooooo.tk/.well-known/acme-challen                                                                                             ge/mtirrSMvK...npGV_rseYlsEQ: Error getting validation data

  Domain: www.oooooooooo.tk
  Type:   connection
  Detail: ###.###.###.###: Fetching http://www.oooooooooo.tk/.well-known/acme-cha                                                                                             llenge/PZmUhwR...0z5OiGY: Error getting validation data

Hint: The Certificate Authority failed to download the challenge files from the                                                                                              temporary standalone webserver started by Certbot on port 80. Ensure that the li                                                                                             sted domains point to this machine and that it can accept inbound connections fr                                                                                             om the internet.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See t                                                                                             he logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for mo                                                                                             re details.

Codice: Seleziona tutto

ubuntu@webserver:~$ dig www.oooooooo.tk

; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> www.oooooooo.tk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36898
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;www.oooooooo.tk.            IN      A

;; ANSWER SECTION:
www.oooooooo.tk.     3568    IN      A       ###.###.###.###

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Tue Jun 21 21:23:39 UTC 2022
;; MSG SIZE  rcvd: 63

ubuntu@webserver:~$

Codice: Seleziona tutto

dig +short oooooooo.tk

Codice: Seleziona tutto

ubuntu@webserver:~$ dig +short oooooooo.tk
###.###.###.###
ubuntu@webserver:~$ dig +short www.oooooooo.tk
###.###.###.###
ubuntu@webserver:~$
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Codice: Seleziona tutto

Hint: The Certificate Authority failed to download the challenge files from the
temporary standalone webserver started by Certbot on port 80. Ensure that the li
sted domains point to this machine and that it can accept inbound connections fr
om the internet.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Si ho letto, direi proprio di si! Quando avvio il progetto Docker riesco a visualizzare il sito sia su http che su https.
Il firewall è configurato correttamente:
Immagine
Il file .log è infinito e a mio avviso non dice molto, ti riporto l'ultima parte poi se vuoi te lo mando tutto:

Codice: Seleziona tutto

HTTP 200
Server: nginx
Date: Wed, 22 Jun 2022 11:48:29 GMT
Content-Type: application/json
Content-Length: 1051
Connection: keep-alive
Boulder-Requester: 59...6
Cache-Control: public, max-age=0, no-cache
Link: <https://acme-v02.api.letsencrypt.org/directory>;rel="index"
Replay-Nonce: 01020L...Ybww4
X-Frame-Options: DENY
Strict-Transport-Security: max-age=604800

{
  "identifier": {
    "type": "dns",
    "value": "www.$$$$$$$$$.tk"
  },
  "status": "invalid",
  "expires": "2022-06-29T11:48:27Z",
  "challenges": [
    {
      "type": "http-01",
      "status": "invalid",
      "error": {
        "type": "urn:ietf:params:acme:error:connection",
        "detail": "###.###.###.###: Fetching http://www.$$$$$$$$$.tk/.well-known/acme-challenge/i5Y7...YTg0: Error getting validation data",
        "status": 400
      },
      "url": "https://acme-v02.api.letsencrypt.org/acme/chall-v3/122425252866/h1i7Vg",
      "token": "i5Y7...GYTg0",
      "validationRecord": [
        {
          "url": "http://www.$$$$$$$$$.tk/.well-known/acme-challenge/i5Y7...d5gGYTg0",
          "hostname": "www.$$$$$$$$$.tk",
          "port": "80",
          "addressesResolved": [
            "###.###.###.###"
          ],
          "addressUsed": "###.###.###.###"
        }
      ],
      "validated": "2022-06-22T11:48:28Z"
    }
  ]
}
2022-06-22 11:48:29,907:DEBUG:acme.client:Storing nonce: 01020...1Ybww4
2022-06-22 11:48:29,907:INFO:certbot._internal.auth_handler:Challenge failed for domain $$$$$$$$$.tk
2022-06-22 11:48:29,907:INFO:certbot._internal.auth_handler:Challenge failed for domain www.$$$$$$$$$.tk
2022-06-22 11:48:29,907:INFO:certbot._internal.auth_handler:http-01 challenge for $$$$$$$$$.tk
2022-06-22 11:48:29,907:INFO:certbot._internal.auth_handler:http-01 challenge for www.$$$$$$$$$.tk
2022-06-22 11:48:29,907:DEBUG:certbot._internal.display.obj:Notifying user: 
Certbot failed to authenticate some domains (authenticator: standalone). The Certificate Authority reported these problems:
  Domain: $$$$$$$$$.tk
  Type:   connection
  Detail: ###.###.###.###: Fetching http://$$$$$$$$$.tk/.well-known/acme-challenge/PfyqCe...9jdWgE: Error getting validation data

  Domain: www.$$$$$$$$$.tk
  Type:   connection
  Detail: ###.###.###.###: Fetching http://www.$$$$$$$$$.tk/.well-known/acme-challenge/i5Y...Qld5gGYTg0: Error getting validation data

Hint: The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.

2022-06-22 11:48:29,908:DEBUG:certbot._internal.error_handler:Encountered exception:
Traceback (most recent call last):
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/auth_handler.py", line 106, in handle_authorizations
    self._poll_authorizations(authzrs, max_retries, best_effort)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/auth_handler.py", line 206, in _poll_authorizations
    raise errors.AuthorizationError('Some challenges have failed.')
certbot.errors.AuthorizationError: Some challenges have failed.

2022-06-22 11:48:29,908:DEBUG:certbot._internal.error_handler:Calling registered functions
2022-06-22 11:48:29,908:INFO:certbot._internal.auth_handler:Cleaning up challenges
2022-06-22 11:48:29,908:DEBUG:certbot._internal.plugins.standalone:Stopping server at :::80...
2022-06-22 11:48:30,158:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
  File "/snap/certbot/2134/bin/certbot", line 8, in <module>
    sys.exit(main())
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/main.py", line 19, in main
    return internal_main.main(cli_args)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/main.py", line 1744, in main
    return config.func(config, plugins)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/main.py", line 1591, in certonly
    lineage = _get_and_save_cert(le_client, config, domains, certname, lineage)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/main.py", line 141, in _get_and_save_cert
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/client.py", line 513, in obtain_and_enroll_certificate
    cert, chain, key, _ = self.obtain_certificate(domains)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/client.py", line 441, in obtain_certificate
    orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/client.py", line 493, in _get_order_and_authorizations
    authzr = self.auth_handler.handle_authorizations(orderr, self.config, best_effort)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/auth_handler.py", line 106, in handle_authorizations
    self._poll_authorizations(authzrs, max_retries, best_effort)
  File "/snap/certbot/2134/lib/python3.8/site-packages/certbot/_internal/auth_handler.py", line 206, in _poll_authorizations
    raise errors.AuthorizationError('Some challenges have failed.')
certbot.errors.AuthorizationError: Some challenges have failed.
2022-06-22 11:48:30,159:ERROR:certbot._internal.log:Some challenges have failed.
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Prova questo test https://letsdebug.net/
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Codice: Seleziona tutto

Test result for ------------.tk using http-01 
ANotWorking
ERROR
------------.tk has an A (IPv4) record (#.#.#.#) but a request to this address over port 80 did not succeed. Your web server must have at least one working IPv4 or IPv6 address.
Get "http://------------.tk/.well-known/acme-challenge/letsdebug-test": dial tcp #.#.#.#:80: connect: no route to host
Trace:
@0ms: Making a request to http://------------.tk/.well-known/acme-challenge/letsdebug-test (using initial IP #.#.#.#)
@0ms: Dialing #.#.#.#
@90ms: Experienced error: dial tcp #.#.#.#:80: connect: no route to host
IssueFromLetsEncrypt
ERROR
A test authorization for ------------.tk to the Let's Encrypt staging service has revealed issues that may prevent any certificate for this domain being issued.
#.#.#.#: Fetching http://------------.tk/.well-known/acme-challenge/-M...4: Error getting validation data
E' la stessa cosa che pensavo anche io, questo Cloud ha qualche problema... non sapevo dell'esistenza di questa pagina...

Volevo provare ad editare /etc/iptables/rules.v4 perché ho visto che manca la porta 80 ma non ci riesco neppure come root. Quando apro il file Ubuntu mi chiede come voglio aprirlo, io scelgo l'opzione di modifica ma quando provo ad editare il file non ci riesco. Ma root non è l'utente principale del sitema!?!?! Ho provato vim e vi come comandi...
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

federicogalimberti ha scritto:
mercoledì 22 giugno 2022, 22:56
Leggi qui:
https://blog.meinside.dev/When-Oracle-C ... r-than-22/

Ah sì? Oracle imposta un firewall di default? Posta sudo cat /etc/iptables/rules.v4. P.S. perché hai aperto all’esterno la porta del database?
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Codice: Seleziona tutto

ubuntu@webserver2:~$ sudo cat /etc/iptables/rules.v4
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
# iptables configuration for Oracle Cloud Infrastructure
# See the Oracle-Provided Images section in the Oracle Cloud Infrastructure
# documentation for security impact of modifying or removing these rule
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [463:49013]
:InstanceServices - [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p udp --sport 123 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -d ###.###.###.###/16 -j InstanceServices
-A InstanceServices -d ###.###.###.###/32 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p udp -m udp --dport 53 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p tcp -m tcp --dport 53 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p tcp -m owner --uid-owner 0 -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p udp -m udp --dport 67 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###4/32 -p udp -m udp --dport 69 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/32 -p udp --dport 123 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
-A InstanceServices -d ###.###.###.###/16 -p tcp -m tcp -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j REJECT --reject-with tcp-reset
-A InstanceServices -d ###.###.###.###/16 -p udp -m udp -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j REJECT --reject-with icmp-port-unreachable
COMMIT
ubuntu@webserver2:~$
Ho aperto la porta del DB così se voglio collegarmi dal mio PC al database del server posso farlo. Mi consigli di rimuovere questa impostazione?
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Secondo quella configurazione le porte 80 e 443 sono chiuse, ma sostenevi di riuscire a visualizzare il sito. Aperta solo la porta 22 per SSH e la porta 123, sebbene quest'ultima sia inutile a meno che il tuo server non faccia da server NTP. Per aprire le porte 80 e 443 è sufficiente aggiungere le regole alla catena INPUT prima di -A INPUT -j REJECT --reject-with icmp-host-prohibited, quindi posizione circa 5.

Codice: Seleziona tutto

sudo iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
Ho aperto la porta del DB così se voglio collegarmi dal mio PC al database del server posso farlo. Mi consigli di rimuovere questa impostazione?

Al più per dei test.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Evviva! Filoteo sei il numero 1!!! The best!!!
Comunque, a livello di configurazione, questo Cloud non mi piace. Gli altri Cloud non richiedono questa configurazione.
Ora posso proseguire questa guida ma noto a malincuore che è tutta da riscrivere:

Codice: Seleziona tutto

ubuntu@webserver2:~$ openssl pkcs12 -export -in fullchain.pem \
                 -inkey privkey.pem \
                 -out keystore.p12
                 -name letsencrypt \
                 -CAfile chain.pem \
                 -caname root
pkcs12: Use -help for summary.
-inkey: command not found
Command '-out' not found, did you mean:
  command 'gout' from deb scotch (6.1.3-1)
Try: sudo apt install <deb name>
Command '-name' not found, did you mean:
  command 'uname' from deb coreutils (8.32-4.1ubuntu1)
Try: sudo apt install <deb name>
Avatar utente
Filoteo
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1318
Iscrizione: venerdì 28 agosto 2015, 9:38
Desktop: Gnome
Distribuzione: Arch Linux

Re: Spring Boot protetto da Let's Encrypt

Messaggio da Filoteo »

Hai copiato un comando su più righe ma la shell pensa che ogni riga sia in comando a sé, prendi ogni riga e aggiungila alla fine della riga precedente, escludendo il \, in modo da avere al termine una sola riga che inizia per openssl.
federicogalimberti
Prode Principiante
Messaggi: 108
Iscrizione: martedì 3 maggio 2022, 23:34

Re: Spring Boot protetto da Let's Encrypt

Messaggio da federicogalimberti »

Ho ricreato una nuova istanza per rifare tutti i passaggi è questi comandi:

Codice: Seleziona tutto

sudo iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
sudo iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
che prima funzionavano ora non funzionano più.
Sulla vecchia istanza ho anche notato che qualcuno ha tolto le righe che ho aggiunto.
Come cavolo modifico questo file rules.v4?
Scrivi risposta

Ritorna a “Ubuntu su server”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 12 ospiti