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

Sync Source and Authenticate Listener #132

Merged
merged 1 commit into from
Dec 4, 2023
Merged

Sync Source and Authenticate Listener #132

merged 1 commit into from
Dec 4, 2023

Conversation

oxzi
Copy link
Member

@oxzi oxzi commented Nov 22, 2023

The source table was extended to hold a hashed password, listener_password_hash, which is now synchronized into a new Source type, being hold in the RuntimeConfig.

This value is now being used in the Listener to enforce authenticated API requests.

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Nov 22, 2023
@yhabteab yhabteab mentioned this pull request Nov 22, 2023
Copy link
Collaborator

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, this was my first idea for a somewhat common source configuration considering the options needed in #112. However, on second thought, syncing sources from the config file to the database is exactly the opposite of how most other config works. So the consistent way would probably be to the source table in the database with all the options needed and load them from there. But then, the web module should probably provide proper config forms, including a special one for Icinga 2 with #112, so we should probably discuss this with @nilmerg next week. (Below are the things I noticed so far, but I'd postpone this PR until we know how we actually want to do it.)

internal/daemon/config.go Outdated Show resolved Hide resolved
internal/daemon/config.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
@oxzi oxzi changed the title Multiple Source in Conf, Listener authentication, Populate source table on startup Load sources configuration from database Nov 27, 2023
@oxzi
Copy link
Member Author

oxzi commented Nov 27, 2023

@julianbrost: According to your feedback and our off-band communication about this feature, I have reversed this PR's logic to store all required data in the SQL database and load it into the RuntimeConfig. Please take another look.

internal/config/source.go Outdated Show resolved Hide resolved
schema/pgsql/schema.sql Outdated Show resolved Hide resolved
internal/config/runtime.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
@oxzi oxzi force-pushed the config-sources branch 3 times, most recently from 1371670 to f12eaa4 Compare November 28, 2023 14:32
@oxzi oxzi changed the title Load sources configuration from database Sync Source and Authenticate Listener Nov 28, 2023
schema/pgsql/schema.sql Outdated Show resolved Hide resolved
internal/config/runtime.go Outdated Show resolved Hide resolved
internal/listener/listener.go Outdated Show resolved Hide resolved
@oxzi
Copy link
Member Author

oxzi commented Nov 29, 2023

Bumped the schema/pgsql/upgrades/ file number, as #136 just got approved.

Copy link
Collaborator

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped the schema/pgsql/upgrades/ file number, as #136 just got approved.

Which is now the next number with #105 merged. Please just keep that number as I'd wait with merging #136 as commented there, so this PR here is a prime candidate for being merged soon.

internal/event/event.go Outdated Show resolved Hide resolved
The source table was extended to hold a hashed password,
listener_password_hash, which is now synchronized into a new Source
type, being hold in the RuntimeConfig.

This value is now being used in the Listener to enforce authenticated
API requests.
@julianbrost julianbrost merged commit 087d9b5 into main Dec 4, 2023
3 checks passed
@julianbrost julianbrost deleted the config-sources branch December 4, 2023 11:42
oxzi added a commit that referenced this pull request Dec 6, 2023
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Dec 7, 2023
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Dec 11, 2023
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Dec 11, 2023
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 2, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 3, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 5, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 9, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
sukhwinder33445 pushed a commit that referenced this pull request Jan 9, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 9, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 10, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
oxzi added a commit that referenced this pull request Jan 12, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
julianbrost pushed a commit that referenced this pull request Apr 12, 2024
After #132 got merged and each Source's state is now within the
database, the Event Stream's configuration could go there, too.

This resulted in some level of refactoring as the data flow logic was
now reversed at some points. Especially Golang's non-cyclic imports and
the omnipresence of the RuntimeConfig made the "hack" of the
eventstream.Launcher necessary to not have an importing edge from config
to eventstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants