Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove LDAP password set feature #52

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 7 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Backend build and integration tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
Expand All @@ -28,41 +28,16 @@ jobs:
# Launch and prepare MySQL server
sudo systemctl start mysql.service
dotnet run -c Release --no-build --project server/src/Korga.Server -- database create --populate

# Install and configure OpenLDAP server
sudo apt-get update -yq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends slapd
cat <<EOF | sudo debconf-set-selections
slapd slapd/internal/generated_adminpw password admin
slapd slapd/internal/adminpw password admin
slapd slapd/password2 password admin
slapd slapd/password1 password admin
slapd slapd/dump_database_destdir string /var/backups/slapd-VERSION
slapd slapd/domain string example.com
slapd shared/organization string Example Church
slapd slapd/purge_database boolean true
slapd slapd/move_old_database boolean true
slapd slapd/allow_ldap_v2 boolean false
slapd slapd/no_configuration boolean false
EOF
sudo dpkg-reconfigure -f noninteractive slapd

# .NET attempts to load a specific version of libldap: https://github.com/dotnet/runtime/issues/69456
sudo ln -s /usr/lib/x86_64-linux-gnu/libldap-2.5.so.0 /usr/lib/x86_64-linux-gnu/libldap-2.4.so.2

# Launch and prepare OpenLDAP server
sudo systemctl start slapd.service
dotnet run -c Release --no-build --project server/src/Korga.Server -- ldap create --organizational-unit
- name: Test
run: dotnet test -c Release --no-build --verbosity normal

webapp:
name: Frontend build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Restore NPM packages
Expand All @@ -76,10 +51,10 @@ jobs:
name: Docker build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/daniel-lerch/korga
Expand All @@ -88,13 +63,13 @@ jobs:
type=ref,event=pr
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: Docker build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
daniellerch/korga
Expand All @@ -24,12 +24,12 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ RUN dotnet publish -c Release -o /app/out Korga.Server
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app

RUN set -x \
&& apt-get update -yq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends libldap-2.4-2 \
&& rm -rf /var/lib/apt/list/*

COPY --from=server /app/out .
COPY --from=webapp /app/dist wwwroot/
ENTRYPOINT ["dotnet", "Korga.Server.dll"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ The following instructions are written for Windows but generally also apply to L
- .NET SDK 7.0
- EF Core CLI Tools _(e.g. `dotnet tool install -g dotnet-ef`)_
- MySQL or MariaDB _(e.g. from [PSModules](https://github.com/daniel-lerch/psmodules))_
- OpenLDAP server

### Frontend
- Visual Studio Code
Expand All @@ -179,4 +178,4 @@ That means the backend can be running in Visual Studio with Debugger attached.

If you just want to work on the frontend you can also use a public test server by creating a file `webapp/.env.development.local`
to override the defaults with `VUE_APP_API_URL=https://lerchen.net/korga`.
Then you don't have to setup a database server, LDAP server and the ASP.NET Core backend.
Then you don't have to setup a database server and the ASP.NET Core backend.
11 changes: 0 additions & 11 deletions server/src/Korga.Core/DatabaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Korga.EmailDelivery.Entities;
using Korga.EmailRelay.Entities;
using Korga.EventRegistration.Entities;
using Korga.Ldap.Entities;
using Microsoft.EntityFrameworkCore;

namespace Korga;
Expand Down Expand Up @@ -37,8 +36,6 @@ public sealed class DatabaseContext : DbContext
public DbSet<OutboxEmail> OutboxEmails => Set<OutboxEmail>();
public DbSet<SentEmail> SentEmails => Set<SentEmail>();

public DbSet<PasswordReset> PasswordResets => Set<PasswordReset>();


public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }

Expand All @@ -53,8 +50,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
CreateEmailRelay(modelBuilder);

CreateEmailDelivery(modelBuilder);

CreateLdap(modelBuilder);
}

private void CreateEvents(ModelBuilder modelBuilder)
Expand Down Expand Up @@ -158,10 +153,4 @@ private void CreateEmailDelivery(ModelBuilder modelBuilder)
sentEmail.HasIndex(e => e.DeliveryTime);
sentEmail.Property(e => e.Id).ValueGeneratedNever();
}

private void CreateLdap(ModelBuilder modelBuilder)
{
var passwordReset = modelBuilder.Entity<PasswordReset>();
passwordReset.HasKey(r => r.Token);
}
}
16 changes: 0 additions & 16 deletions server/src/Korga.Core/Ldap/Entities/PasswordReset.cs

This file was deleted.

2 changes: 1 addition & 1 deletion server/src/Korga.Server/Commands/KorgaCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Korga.Server.Commands;

[Command("korga", Description = "Korga server management console")]
[Subcommand(typeof(DatabaseCommand), typeof(DistributionListCommand), typeof(LdapCommand))]
[Subcommand(typeof(DatabaseCommand), typeof(DistributionListCommand))]
public class KorgaCommand
{
private int OnExecute(CommandLineApplication app)
Expand Down
198 changes: 0 additions & 198 deletions server/src/Korga.Server/Commands/LdapCommand.cs

This file was deleted.

Loading
Loading