Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kilimnik committed Feb 7, 2023
0 parents commit 14b9136
Show file tree
Hide file tree
Showing 107 changed files with 7,232 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
keys/
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Vepiot

This is a authentication plugin for [Hashicorp Vault](https://github.com/hashicorp/vault).

The idea of this plugin is to add a manual human step into the authentication process. This works by registering the app with the vault and every time the vault tries to authenticate via this service. The service makes a push notification via firebase. The user can accept the authentication or deny it.

```mermaid
sequenceDiagram
loop
Vault->>+Proxy: Did someone respond to Vault_X?
Proxy-->>-Vault: No
end
Vault->>Firebase: Accept or Deny Vault_X login?
Firebase->>Mobile Devices: Accept or Deny Vault_X login?
Mobile Devices->>Proxy: Accept login to Vault_X!
Vault->>+Proxy: Did someone respond to Vault_X?
Proxy-->>-Vault: Accept login to Vault_X!
Vault->>Firebase: Login to Vault_X accepted.
Firebase->>Mobile Devices: Login to Vault_X accepted.
Note right of Vault: Login Accepted
```

## TODO:
* CI/CD
* More secure device registration
* Testcases
* ...
51 changes: 51 additions & 0 deletions api/api/v1/api.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
syntax = "proto3";

package api.v1;

enum TOTPResponseType {
TOTP_RESPONSE_TYPE_UNSPECIFIED = 0;
TOTP_RESPONSE_TYPE_ALLOW = 1;
TOTP_RESPONSE_TYPE_DENY = 2;
}

message TOTPResponse {
TOTPResponseType type = 1;
string id = 2;
string totp_code = 3;
string device_id = 4;
string name = 5;
}

message SendTOTPRequest {
TOTPResponse response = 1;
}

message SendTOTPResponse {}

message GetTOTPRequest {
string id = 1;
}

message GetTOTPResponse {
TOTPResponse response = 1;
}

service Service {
rpc SendTOTP(SendTOTPRequest) returns (SendTOTPResponse) {}
rpc GetTOTP(GetTOTPRequest) returns (GetTOTPResponse) {}
}


enum TOTPRequestType {
TOTP_REQUEST_TYPE_UNSPECIFIED = 0;
TOTP_REQUEST_TYPE_REQUEST = 1;
TOTP_REQUEST_TYPE_RESPONSE = 2;
TOTP_REQUEST_TYPE_CANCEL= 3;
}

message TOTPRequest {
TOTPRequestType type = 1;
string id = 2;
string name = 3;
TOTPResponseType response_type = 4;
}
24 changes: 24 additions & 0 deletions api/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: v1
plugins:
- name: go
out: ../auth_proxy/gen
opt:
- paths=source_relative
- Mapi/v1/api.proto=github.com/kilimnik/vepiot/auth_proxy/gen/api/v1
- name: connect-go
out: ../auth_proxy/gen
opt:
- paths=source_relative
- Mapi/v1/api.proto=github.com/kilimnik/vepiot/auth_proxy/gen/api/v1
- name: go
out: ../vault_plugin/gen
opt:
- paths=source_relative
- Mapi/v1/api.proto=github.com/kilimnik/vepiot/vault_plugin/gen/api/v1
- name: connect-go
out: ../vault_plugin/gen
opt:
- paths=source_relative
- Mapi/v1/api.proto=github.com/kilimnik/vepiot/vault_plugin/gen/api/v1
- plugin: buf.build/protocolbuffers/dart
out: ../app/lib/gen
7 changes: 7 additions & 0 deletions api/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
44 changes: 44 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
33 changes: 33 additions & 0 deletions app/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
- platform: android
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
- platform: ios
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# app

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
29 changes: 29 additions & 0 deletions app/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions app/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
79 changes: 79 additions & 0 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
ndkVersion flutter.ndkVersion

compileOptions {
coreLibraryDesugaringEnabled true

sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.vepiot.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.gms:play-services-base:18.1.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
Loading

0 comments on commit 14b9136

Please sign in to comment.