Skip to content

Instantly share code, notes, and snippets.

View calmh's full-sized avatar
:bowtie:
I may be slow to respond.

Jakob Borg calmh

:bowtie:
I may be slow to respond.
View GitHub Profile

SSO Refresh

Keycloak vs Authentik

Existing user import

I wrote a custom LDAP server that returns the current set of users from Azure AD B2C. This works for both Authentik and Keycloak to ingest the current user base (minus passwords).

In Authentik we can run the import once, then disable user syncing and retain the users in the database. On first login Authentik does a bind towards the LDAP server to verify the password, then writes the password back to the local user, thus completing their migration.

SSO Refresh
Keycloak vs Authentik
### Existing user import
I wrote a custom LDAP server that returns the current set of users from Azure AD B2C. This works for both Authentik and Keycloak to ingest the current user base (minus passwords).
In Authentik we can run the import once, then disable user syncing and retain the users in the database. On first login Authentik does a bind towards the LDAP server to verify the password, then writes the password back to the local user, thus completing their migration.
10:49:10.009429 vxlan48 Out IP 100.64.51.239.50148 > 216.153.53.63.443: Flags [S], seq 63849243, win 65535, options [mss 9176,sackOK,TS val 3336816561 ecr 0,nop,wscale 14], length 0
10:49:12.029420 vxlan48 Out IP 100.64.51.239.50148 > 216.153.53.63.443: Flags [S], seq 63849243, win 65535, options [mss 9176,sackOK,TS val 3336818581 ecr 0,nop,wscale 14], length 0
10:49:16.185431 vxlan48 Out IP 100.64.51.239.50148 > 216.153.53.63.443: Flags [S], seq 63849243, win 65535, options [mss 9176,sackOK,TS val 3336822737 ecr 0,nop,wscale 14], length 0
10:49:24.377417 vxlan48 Out IP 100.64.51.239.50148 > 216.153.53.63.443: Flags [S], seq 63849243, win 65535, options [mss 9176,sackOK,TS val 3336830929 ecr 0,nop,wscale 14], length 0
10:49:24.399562 vxlan48 P IP 216.153.53.63.443 > 100.64.51.239.50148: Flags [S.], seq 4279993438, ack 63849244, win 65535, options [mss 1460,sackOK,TS val 1390655000 ecr 3336815551,nop,wscale 14], length 0
10:49:24.399700 vxlan48 Out IP 100.64.51.239.50148 > 216.153.53.63.443: Flags [.], ack 1
commit da03f982379373774ce86c7242aacb56d054ea46
Author: Jakob Borg <[email protected]>
Date: Wed Oct 9 20:16:24 2024 +0200
wip
diff --git a/server.go b/server.go
index c68c1c2..e919211 100644
--- a/server.go
+++ b/server.go
@calmh
calmh / versions.txt
Created May 14, 2020 06:33
Syncthing versions
syncthing v0.7.2 (go1.2.1 freebsd-amd64)
syncthing v0.7.3 (go1.2.1 freebsd-amd64)
syncthing v0.8.0 (go1.2.1 freebsd-amd64)
syncthing v0.8.1 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-04-19T20:37:11Z
syncthing v0.8.2 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-04-27T06:35:23Z
syncthing v0.8.3 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-05-02T18:20:06Z
syncthing v0.8.4 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-05-04T06:18:20Z
syncthing v0.8.5 (go1.2.2 freebsd-amd64) jb@jborg-mbp 2014-05-11T18:46:09Z
syncthing v0.8.7 (go1.2.2 freebsd-amd64) jb@jborg-mbp 2014-05-16 14:28:52 UTC
syncthing v0.8.8 (go1.2.2 freebsd-amd64) jb@jborg-mbp 2014-05-21 13:37:28 UTC
@calmh
calmh / rwlisten.go
Last active June 12, 2018 20:29
Toy HTTP-over-stdio thing
package main
import (
"fmt"
"io"
"net"
"net/http"
"os"
"time"
)
jb@unu:~/t/build $ VERBOSE=1 make
/usr/local/Cellar/cmake/3.8.2/bin/cmake -H/Users/jb/tmp/tray/subdirs/syncthingtray -B/Users/jb/tmp/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.8.2/bin/cmake -E cmake_progress_start /Users/jb/tmp/build/CMakeFiles /Users/jb/tmp/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f c++utilities/CMakeFiles/c++utilities.dir/build.make c++utilities/CMakeFiles/c++utilities.dir/depend
cd /Users/jb/tmp/build && /usr/local/Cellar/cmake/3.8.2/bin/cmake -E cmake_depends "Unix Makefiles" /Users/jb/tmp/tray/subdirs/syncthingtray /Users/jb/tmp/tray/c++utilities /Users/jb/tmp/build /Users/jb/tmp/build/c++utilities /Users/jb/tmp/build/c++utilities/CMakeFiles/c++utilities.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f c++utilities/CMakeFiles/c++utilities.dir/build.make c++utilities/CMakeFiles/c++u

Starting from an Ubuntu installation or similar Docker image, install the NDK.

curl -s -o /tmp/android-ndk.zip https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip
cd /usr/local
unzip /tmp/android-ndk.zip
rm -f /tmp/android-ndk.zip

Create the standalone stuff, whatever that is. Arm and arm64.

package flatten
import (
"reflect"
"testing"
)
// This implements a flatten function for arbitrarily nested integer lists.
// I've chosen Go as the implementation language as it's the one I'm most
// comfortable in right now, but in a way this problem is a bad fit for the
@calmh
calmh / -
Created January 30, 2017 16:49
func TestTimeoutCond(t *testing.T) {
const (
// Low values to avoid being intrusive in continous testing. Can be
// increased significantly for stress testing.
iterations = 100
routines = 10
timeMult = 2
)