Naveen Ramanathan (@msgtonaveen) profile picture

Founder https://teapawt.net/t.co/T9hIJb0yME @bot_golang Building https://teapawt.net/t.co/F61G8WjWR1

India
Joined June 2009
Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)Photo by Naveen Ramanathan (@msgtonaveen)
Naveen Ramanathan retweeted
I have written an article about using the principle of least privilege to write secure Go code. It covers *Over privileged DB handles *Inadvertently logging sensitive data * Unmarshalling user input using over privileged structs Tutorial URL: golangbot.com/secure-go-code… #golang
3
7
1,149
Naveen Ramanathan retweeted
The preconnect keyword for the rel attribute of the <link> element is a hint to browsers that the user is likely to need resources from the target resource's origin, and therefore the browser can likely improve the user experience by preemptively initiating a connection to that origin. Preconnecting speeds up future loads from a given origin by preemptively performing part or all of the handshake. Example code <link rel="preconnect" href="example.com" /> Read more: developer.mozilla.org/en-US/…
1
2
680
Naveen Ramanathan retweeted
Bulk inserts for Postgres in sqlc without batch queries is possible using Postgres' unnest() function. For example, unnest(ARRAY[1,2]) is expanded to the rows 1 2 The following is an example of multiple insert query using unnest INSERT INTO domain (id, domain, port_no, customer_id) VALUES ( unnest(@id_array::uuid[]), unnest(@domain_array::text[]), unnest(@port_array::text[]), unnest(@customer_id_array::uuid[]) ) RETURNING *; #golang #sqlc
1
6
849
Naveen Ramanathan retweeted
I have been hosting my SAAS apps in baremetal servers/virtual machines for quite sometime. Here are some of the basic security measures that should be implemented to secure the server 1. Disable ssh login via password. Enforce ssh using only public/private key authentication. 2. Disable root user login and create a new user with sudo privileges. 3. Setup a jump host and allow ssh access to the baremetal server only from the jump host using IP allow listing. 4. Configure IP tables and only expose ports required by the application. 5. Run applications with the least privileges required. Avoid running services as root. #linux #security #tips
1
2
625
Naveen Ramanathan retweeted
I have started working on the ssl monitoring and alerting feature for sslnotify.com This is one of the mockups I came up with for the page that lists all the domains being monitored. The front end is built using Bootstrap, jQuery and Go templates with most of the pages rendered on the server using Go templates. No fancy SPA, no React, no fancy JavaScript libraries. I like creating frontends the way they used to be done in the good old days!
1
3
578
Naveen Ramanathan retweeted
#golang #tip The go mod why command can be used to find out why a particular package is needed. For example, let's stay there is a indirect dependency on a particular package in go.mod. You need to find out the import graph of this particular dependency. This is possible using `go mod why`.
1
7
538
RT @bot_golang: Postgres 19 Beta 1 has a new ON CONFLICT DO SELECT statement. This statement returns rows that conflict during an upsert…
Naveen Ramanathan retweeted
I am using sqlc for coding sslnotify.com and found it quite useful. Writing queries and getting sqlc to generate the Go code is impressive. It does have a few features missing like 1. Inability to rename the functions sqlc generates 2. Limited support for /lib/pq when compared to jackc/pgx. These are the types I have overridden in my sqlc.yaml overrides: - db_type: "uuid" go_type: import: "github.com/google/uuid" type: "UUID" - db_type: "timestamptz" nullable: true go_type: type: "*time.Time" sqlc also has the ability to understand the DB migration format of golang-migrate. Overall I am impressed! #golang #sqlc
1
4
733
Naveen Ramanathan retweeted
I have started creating the data model for sslnotify.com to support SSL expiry reminder notifications. If you have not heard about dbdiagram.io, I recommend you try it. It's a great tool for data model diagrams as code.
1
1
2
487
Naveen Ramanathan retweeted
I usually read books during my commute in TfL. Some of the gems that I have read in the past few months "The last house in the street" by Diane Chamberlain "Hunted" by Roberta Kray "Richest Man In Babylon" by George S. Clason "Just After Sunset" by Stephen King "Stolen focus: why you can't pay attention" by Johann Hari
1
2
463
Naveen Ramanathan retweeted
The new widgets in Firefox are amazing!
2
2
690
Naveen Ramanathan retweeted
I wrote a tutorial about deploying a Go binary using systemd in Ubuntu. The tutorial is available at golangbot.com/golang-systemd… I hope it helps. Feedback is appreciated! #golang #ubuntu #systemd
1
5
697
Naveen Ramanathan retweeted
The kubectl command has a `-v` flag to control the logging verbosity. This is useful for debugging when kubectl fails. For example, log level 8 display the http request contents. `kubectl get po -A -v=8` prints the following output #kubernetes #kubectl
1
3
500
Naveen Ramanathan retweeted
#golang #tip If a web service needs to be accessible only from the local machine, bind it to 127.0.0.1:<port> instead of 0.0.0.0:<port>. 127.0.0.1 accepts connections only from the host itself, while 0.0.0.0 listens on all network interfaces.
2
10
785
Naveen Ramanathan retweeted
The tool also verifies whether the SSL cert is revoked by validating against Certification Revocation Lists (CRLs) and also using Online Certificate Status Protocol(OCSP). Tech stack: #golang Bootstrap jQuery Hosted in Hetzner.
1
1
246
Naveen Ramanathan retweeted
Launching sslnotify.com/, a tool to track SSL cert expiry and also to validate the entire cert chain for all resolved IP addresses. Cert expiry notifications will be added soon.
1
1
5
570
Naveen Ramanathan retweeted
I have been inactive in twitter for sometime. Reason being, I was hacking yet another side project. I have leased a Hetzner cloud server and installed caddy ready to go at http://62.238.18.22/ Expecting to launch my project in a day or two! Exciting times.
1
6
1,267
Naveen Ramanathan retweeted
Go's ctx `WithoutCancel` function propagates values from the parent context and is not cancelled when the parent is cancelled. This is useful when a new goroutine wants the parent's values but should not be cancelled with the parent. Playground go.dev/play/p/mGqFKDaOCIl #golang
1
4
718
Naveen Ramanathan retweeted
#golang #tip You Go micro service can listen on multiple ports. One port can be for the public API and the other can be for internal APIs like metrics.
2
6
1
62
2,844