openvpn installation from openvpn-install.sh

fallowed https://www.cyberciti.biz/faq/ubuntu-18-04-lts-set-up-openvpn-server-in-5-minutes/

 

 Welcome to this OpenVPN road warrior installer!

This server is behind NAT. What is the public IPv4 address or hostname?
Public IPv4 address / hostname [129.151.67.166]:

Which protocol should OpenVPN use?
   1) UDP (recommended)
   2) TCP
Protocol [1]:

What port should OpenVPN listen to?
Port [1194]:

Select a DNS server for the clients:
   1) Current system resolvers
   2) Google
   3) 1.1.1.1
   4) OpenDNS
   5) Quad9
   6) AdGuard
DNS server [1]: 3

Enter a name for the first client:
Name [client]:

OpenVPN installation is ready to begin.
Press any key to continue…
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://uk-cardiff-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://uk-cardiff-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://uk-cardiff-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Fetched 214 kB in 1s (230 kB/s)
Reading package lists… Done
Reading package lists… Done
Building dependency tree
Reading state information… Done
ca-certificates is already the newest version (20210119~20.04.2).
ca-certificates set to manually installed.
openssl is already the newest version (1.1.1f-1ubuntu2.9).
openssl set to manually installed.
The following additional packages will be installed:
  libpkcs11-helper1
Suggested packages:
  resolvconf openvpn-systemd-resolved easy-rsa
The following NEW packages will be installed:
  libpkcs11-helper1 openvpn
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 521 kB of archives.
After this operation, 1343 kB of additional disk space will be used.
Get:1 http://uk-cardiff-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal/main amd64 libpkcs11-helper1 amd64 1.26-1 [44.3 kB]
Get:2 http://uk-cardiff-1-ad-1.clouds.archive.ubuntu.com/ubuntu focal-updates/main amd64 openvpn amd64 2.4.7-1ubuntu2.20.04.3 [477 kB]
Fetched 521 kB in 1s (754 kB/s)
Preconfiguring packages …
Selecting previously unselected package libpkcs11-helper1:amd64.
(Reading database … 109458 files and directories currently installed.)
Preparing to unpack …/libpkcs11-helper1_1.26-1_amd64.deb …
Unpacking libpkcs11-helper1:amd64 (1.26-1) …
Selecting previously unselected package openvpn.
Preparing to unpack …/openvpn_2.4.7-1ubuntu2.20.04.3_amd64.deb …
Unpacking openvpn (2.4.7-1ubuntu2.20.04.3) …
Setting up libpkcs11-helper1:amd64 (1.26-1) …
Setting up openvpn (2.4.7-1ubuntu2.20.04.3) …
 * Restarting virtual private network daemon.                                                                                                                                                               [ OK ]
Created symlink /etc/systemd/system/multi-user.target.wants/openvpn.service → /lib/systemd/system/openvpn.service.
Processing triggers for systemd (245.4-4ubuntu3.13) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for libc-bin (2.31-0ubuntu9.2) …

init-pki complete; you may now create a CA or requests.
Your newly created PKI dir is: /etc/openvpn/server/easy-rsa/pki

Using SSL: openssl OpenSSL 1.1.1f  31 Mar 2020
Generating RSA private key, 2048 bit long modulus (2 primes)
…………………………….+++++
…………………………………………………..+++++
e is 65537 (0x010001)

Using SSL: openssl OpenSSL 1.1.1f  31 Mar 2020
Generating a RSA private key
………+++++
………………………………………………………………………………………………….+++++
writing new private key to ‘/etc/openvpn/server/easy-rsa/pki/easy-rsa-26177.SPTIGN/tmp.5GtBwo’
—–
Using configuration from /etc/openvpn/server/easy-rsa/pki/easy-rsa-26177.SPTIGN/tmp.sr4zkA
Check that the request matches the signature
Signature ok
The Subject’s Distinguished Name is as follows
commonName            :ASN.1 12:’server’
Certificate is to be certified until Nov 14 21:22:43 2031 GMT (3650 days)

Write out database with 1 new entries
Data Base Updated

Using SSL: openssl OpenSSL 1.1.1f  31 Mar 2020
Generating a RSA private key
…+++++
…………………..+++++
writing new private key to ‘/etc/openvpn/server/easy-rsa/pki/easy-rsa-26252.cc46tn/tmp.ab6NsL’
—–
Using configuration from /etc/openvpn/server/easy-rsa/pki/easy-rsa-26252.cc46tn/tmp.XqmxyS
Check that the request matches the signature
Signature ok
The Subject’s Distinguished Name is as follows
commonName            :ASN.1 12:’client’
Certificate is to be certified until Nov 14 21:22:43 2031 GMT (3650 days)

Write out database with 1 new entries
Data Base Updated

Using SSL: openssl OpenSSL 1.1.1f  31 Mar 2020
Using configuration from /etc/openvpn/server/easy-rsa/pki/easy-rsa-26308.ZWa4G1/tmp.efAUfB

An updated CRL has been created.
CRL file: /etc/openvpn/server/easy-rsa/pki/crl.pem

Created symlink /etc/systemd/system/multi-user.target.wants/openvpn-iptables.service → /etc/systemd/system/openvpn-iptables.service.
Created symlink /etc/systemd/system/multi-user.target.wants/openvpn-server@server.service → /lib/systemd/system/openvpn-server@.service.

Finished!

The client configuration is available in: /root/client.ovpn
New clients can be added by running this script again.

download db from heroku

 If you are using heroku with postgres, here is how to download dthe dump

user@pc MINGW64 ~/tmp/jdl2 (main)
$ heroku pg:backups:capture
Starting backup of postgresql-reticulated-07948… done

Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
Use heroku pg:backups:info to check progress.
Stop a running backup with heroku pg:backups:cancel.

Backing up DATABASE to b001… done
user@pc MINGW64 ~/tmp/jdl2 (main)
$ heroku pg:backups:download
Getting backup from hamta… fetching url of #1
Getting backup from hamta… done, #1
user@pc MINGW64 ~/tmp/jdl2 (main)
$ ls -ltrh
total 1.2M
-rwxr-xr-x 1 ozkan 197609 9.9K Oct 12 10:21 mvnw*
-rwxr-xr-x 1 ozkan 197609  509 Oct 12 10:21 npmw*
-rw-r–r– 1 ozkan 197609 1.9K Oct 15 17:34 test.jdl
…………………………

-rw-r–r– 1 ozkan 197609  62K Oct 16 15:12 pom.xml
-rw-r–r– 1 ozkan 197609   24 Oct 19 21:33 system.properties
drwxr-xr-x 1 ozkan 197609    0 Oct 19 21:36 node_modules/
-rw-r–r– 1 ozkan 197609 1.5M Oct 19 21:36 package-lock.json
drwxr-xr-x 1 ozkan 197609    0 Oct 19 21:37 target/
-rw-r–r– 1 ozkan 197609  31K Oct 19 21:43 latest.dump

how to restore

pg_restore –verbose –clean –no-acl –no-owner -h localhost -U myuser -d mydb latest.dump

jhipster create a user

If you are also using jhipster here is how you can create/register user

curl “http://xxx.herokuapp.com/api/register” -X POST -H “Accept: application/json” -H “Content-Type: application/json” -d ‘{“login”:”test6″,”email”:”fakofo1207@otozuz.com”,”password”:”123456″,”langKey”:”en”}’

this is the minimum parameters and after curl you dont get much in bash, after that I can see that user created in management panel. 

now I need to figure out how activation mails work in herokuapp or in jhipster, I gave gmail parameters but did not work

jhipster login and how to call a rest api under

 In order to use jhipster user system I needed to find out how to call jhipster, I am planning to do this with curl because it is easiest way to test and see the results.

  curl -v https://xxx.herokuapp.com/api/authenticate -X POST -d '{"password":"xxxxx","username":"admin"}' -H 'Content-Type: application/json' 

 and result is {"id_token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTYzNDY2MDAwM30.1g_8nXgZfTITCfQgewLm8V6PnGKy5kx41dm9gbpJMltVARK8DJZBbbnI-VzQFFO1kkP-8wzVcsB-bvAaHGMPkA"}  

 now I will use this token to call another rest api 
curl "https://xxx.herokuapp.com/api/categories?page=0&size=20&sort=id,asc" -H 'Accept: application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTYzNDY2MDAwM30.1g_8nXgZfTITCfQgewLm8V6PnGKy5kx41dm9gbpJMltVARK8DJZBbbnI-VzQFFO1kkP-8wzVcsB-bvAaHGMPkA'
 

 and result is [{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":null,"advert":null},{"id":1052,"description":"Kiralik Evler","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE"},"advert":null},{"id":1053,"description":"Satilik Evler","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE"},"advert":null}]

Glasgow IKEA delivery times

I moved to a new place around 1.5 months ago(23.08.2021) and needed to buy all the furniture. Even for renting, finding all furnished flat chances in Scotland is close to zero. Anyways I started searching. First I thought I should buy all second hand went to Gumtree which is a huge website full of second-hand advertisements, I found one bed and mattress ad, Contacted with the owner he said he will deliver and that day I slept on air bed 😀

Then I contacted another ad for bed and mattress, they said they will deliver that Sunday, still sleeping on an air bed, I decided to buy a new bed and mattress, I mean from a real furniture shop a “NEW” one, first hand.

I decided to buy from local in Glasgow, I found some local bed and mattress shops but they were expensive than IKEA, so I decided to go to IKEA and check out the quality, the numbers were around 600 in local and in IKEA was 400 pounds, after I have seen their showroom and quality I decided to go with IKEA, it is cheap and quality is good.

I went online and start adding things to my basket, the first surprise was when I decided to check out some items that were missing from local IKEA so they can not deliver they have to be removed from the list. Then I learn that I can set my postcode on the website and it can show if they are available in my area. Took around 2-3 days for me to decide and finish all, then I come to checkout, it took around 1200 pounds, I have a couch and some tables(TV/coffee) and other things other than the bed.

When I check out at 04.09.2021, IKEA cut my order delivery into two, one delivery at 06.09.2021 and the next one at 02.10.2021 there is almost a month difference. So thanks to Tesco I have an air bed and until Oct 2 I will sleep on it, and last Tuesday airbed started to lose air 😊I think the universe is trying to tell me something.

download zipped/gz file and unzip and use in java

 Example code for downloading a zipped file and unzipping in java

public static void main(String[] args) throws Exception {
String mmdb = "https://someaddress/somefile.gz";
String zipFilename = "somefile.gz";
if (!Files.exists(Path.of(zipFilename))) {
System.out.println(mmdb);
Files.copy(
new URL(mmdb).openStream(),
Paths.get(zipFilename));
try (GZIPInputStream gis = new GZIPInputStream(new FileInputStream(Path.of(zipFilename).toFile()))) {
Files.copy(gis, Path.of(dbFileName));
}
}

SpringApplication.run(Application.class, args);
}